Skip to content
Snippets Groups Projects
Commit 96d61603 authored by John Schmoller's avatar John Schmoller Committed by Kumar Gala
Browse files

pci: Add ability to re-enumerate PCI buses


Add a new 'pci enum' command which re-enumerates the PCI buses.  This
command is enabled via the CONFIG_CMD_PCI_ENUM define and can be useful
in boards with FPGAs connected via PCI/PCIe, boards that support PCI
hot-plugging, or during PCI debug.

Also enable the 'pci enum' command for X-ES's Freescale-based boards.

Signed-off-by: default avatarJohn Schmoller <jschmoller@xes-inc.com>
Signed-off-by: default avatarPeter Tyser <ptyser@xes-inc.com>
Acked-by: default avatarKumar Gala <galak@kernel.crashing.org>
Acked-by: default avatarWolfgang Denk <wd@denx.de>
parent 9660c5de
No related branches found
No related tags found
No related merge requests found
...@@ -497,6 +497,10 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ...@@ -497,6 +497,10 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if ((bdf = get_pci_dev(argv[2])) == -1) if ((bdf = get_pci_dev(argv[2])) == -1)
return 1; return 1;
break; break;
#ifdef CONFIG_CMD_PCI_ENUM
case 'e':
break;
#endif
default: /* scan bus */ default: /* scan bus */
value = 1; /* short listing */ value = 1; /* short listing */
bdf = 0; /* bus number */ bdf = 0; /* bus number */
...@@ -518,6 +522,11 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ...@@ -518,6 +522,11 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0; return 0;
case 'd': /* display */ case 'd': /* display */
return pci_cfg_display(bdf, addr, size, value); return pci_cfg_display(bdf, addr, size, value);
#ifdef CONFIG_CMD_PCI_ENUM
case 'e':
pci_init();
return 0;
#endif
case 'n': /* next */ case 'n': /* next */
if (argc < 4) if (argc < 4)
goto usage; goto usage;
...@@ -545,6 +554,10 @@ U_BOOT_CMD( ...@@ -545,6 +554,10 @@ U_BOOT_CMD(
"list and access PCI Configuration Space", "list and access PCI Configuration Space",
"[bus] [long]\n" "[bus] [long]\n"
" - short or long list of PCI devices on bus 'bus'\n" " - short or long list of PCI devices on bus 'bus'\n"
#ifdef CONFIG_CMD_PCI_ENUM
"pci enum\n"
" - re-enumerate PCI buses\n"
#endif
"pci header b.d.f\n" "pci header b.d.f\n"
" - show header of PCI device 'bus.device.function'\n" " - show header of PCI device 'bus.device.function'\n"
"pci display[.b, .w, .l] b.d.f [address] [# of objects]\n" "pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
......
...@@ -91,6 +91,9 @@ int fsl_setup_hose(struct pci_controller *hose, unsigned long addr) ...@@ -91,6 +91,9 @@ int fsl_setup_hose(struct pci_controller *hose, unsigned long addr)
{ {
volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) addr; volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) addr;
/* Reset hose to make sure its in a clean state */
memset(hose, 0, sizeof(struct pci_controller));
pci_setup_indirect(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data); pci_setup_indirect(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
return fsl_is_pci_agent(hose); return fsl_is_pci_agent(hose);
......
...@@ -139,7 +139,7 @@ void *pci_map_bar(pci_dev_t pdev, int bar, int flags) ...@@ -139,7 +139,7 @@ void *pci_map_bar(pci_dev_t pdev, int bar, int flags)
* *
*/ */
static struct pci_controller* hose_head = NULL; static struct pci_controller* hose_head;
void pci_register_hose(struct pci_controller* hose) void pci_register_hose(struct pci_controller* hose)
{ {
...@@ -640,6 +640,8 @@ void pci_init(void) ...@@ -640,6 +640,8 @@ void pci_init(void)
} }
#endif /* CONFIG_PCI_BOOTDELAY */ #endif /* CONFIG_PCI_BOOTDELAY */
hose_head = NULL;
/* now call board specific pci_init()... */ /* now call board specific pci_init()... */
pci_init_board(); pci_init_board();
} }
...@@ -545,6 +545,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); ...@@ -545,6 +545,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
#define CONFIG_CMD_PCA953X #define CONFIG_CMD_PCA953X
#define CONFIG_CMD_PCA953X_INFO #define CONFIG_CMD_PCA953X_INFO
#define CONFIG_CMD_PCI #define CONFIG_CMD_PCI
#define CONFIG_CMD_PCI_ENUM
#define CONFIG_CMD_PING #define CONFIG_CMD_PING
#define CONFIG_CMD_REGINFO #define CONFIG_CMD_REGINFO
#define CONFIG_CMD_SNTP #define CONFIG_CMD_SNTP
......
...@@ -339,6 +339,7 @@ ...@@ -339,6 +339,7 @@
#define CONFIG_CMD_PCA953X #define CONFIG_CMD_PCA953X
#define CONFIG_CMD_PCA953X_INFO #define CONFIG_CMD_PCA953X_INFO
#define CONFIG_CMD_PCI #define CONFIG_CMD_PCI
#define CONFIG_CMD_PCI_ENUM
#define CONFIG_CMD_PING #define CONFIG_CMD_PING
#define CONFIG_CMD_SNTP #define CONFIG_CMD_SNTP
#define CONFIG_CMD_REGINFO #define CONFIG_CMD_REGINFO
......
...@@ -396,6 +396,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy); ...@@ -396,6 +396,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
#define CONFIG_CMD_PCA953X #define CONFIG_CMD_PCA953X
#define CONFIG_CMD_PCA953X_INFO #define CONFIG_CMD_PCA953X_INFO
#define CONFIG_CMD_PCI #define CONFIG_CMD_PCI
#define CONFIG_CMD_PCI_ENUM
#define CONFIG_CMD_PING #define CONFIG_CMD_PING
#define CONFIG_CMD_SAVEENV #define CONFIG_CMD_SAVEENV
#define CONFIG_CMD_SNTP #define CONFIG_CMD_SNTP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment