common: board_r: Drop initr_pci wrapper

Add a return value to pci_init and use it directly in the post-relocation
init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Ovidiu Panait 2020-11-28 10:43:12 +02:00 committed by Tom Rini
parent c343e8c0bf
commit b9f6d0f7db
4 changed files with 23 additions and 18 deletions

View file

@ -214,16 +214,6 @@ static int initr_unlock_ram_in_cache(void)
} }
#endif #endif
#ifdef CONFIG_PCI
static int initr_pci(void)
{
if (IS_ENABLED(CONFIG_PCI_INIT_R))
pci_init();
return 0;
}
#endif
static int initr_barrier(void) static int initr_barrier(void)
{ {
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
@ -732,12 +722,12 @@ static init_fnc_t init_sequence_r[] = {
post_output_backlog, post_output_backlog,
#endif #endif
INIT_FUNC_WATCHDOG_RESET INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT) #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT)
/* /*
* Do early PCI configuration _before_ the flash gets initialised, * Do early PCI configuration _before_ the flash gets initialised,
* because PCU resources are crucial for flash access on some boards. * because PCU resources are crucial for flash access on some boards.
*/ */
initr_pci, pci_init,
#endif #endif
#ifdef CONFIG_ARCH_EARLY_INIT_R #ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r, arch_early_init_r,
@ -776,11 +766,11 @@ static init_fnc_t init_sequence_r[] = {
mac_read_from_eeprom, mac_read_from_eeprom,
#endif #endif
INIT_FUNC_WATCHDOG_RESET INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT) #if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
/* /*
* Do pci configuration * Do pci configuration
*/ */
initr_pci, pci_init,
#endif #endif
stdio_add_devices, stdio_add_devices,
initr_jumptable, initr_jumptable,

View file

@ -1842,7 +1842,7 @@ U_BOOT_DRIVER(pci_generic_drv) = {
.of_match = pci_generic_ids, .of_match = pci_generic_ids,
}; };
void pci_init(void) int pci_init(void)
{ {
struct udevice *bus; struct udevice *bus;
@ -1855,4 +1855,6 @@ void pci_init(void)
uclass_next_device_check(&bus)) { uclass_next_device_check(&bus)) {
; ;
} }
return 0;
} }

View file

@ -454,16 +454,18 @@ int pci_hose_scan(struct pci_controller *hose)
return pci_hose_scan_bus(hose, hose->current_busno); return pci_hose_scan_bus(hose, hose->current_busno);
} }
void pci_init(void) int pci_init(void)
{ {
hose_head = NULL; hose_head = NULL;
/* allow env to disable pci init/enum */ /* allow env to disable pci init/enum */
if (env_get("pcidisable") != NULL) if (env_get("pcidisable") != NULL)
return; return 0;
/* now call board specific pci_init()... */ /* now call board specific pci_init()... */
pci_init_board(); pci_init_board();
return 0;
} }
/* Returns the address of the requested capability structure within the /* Returns the address of the requested capability structure within the

View file

@ -186,6 +186,18 @@ int cpu_secondary_init_r(void);
*/ */
int pci_ep_init(void); int pci_ep_init(void);
/**
* pci_init() - Enumerate pci devices
*
* It is called during the generic post-relocation init sequence to enumerate
* pci buses. This is needed, for instance, in the case of DM PCI-based
* Ethernet devices, which will not be detected without having the enumeration
* performed earlier.
*
* Return: 0 if OK
*/
int pci_init(void);
/** /**
* init_cache_f_r() - Turn on the cache in preparation for relocation * init_cache_f_r() - Turn on the cache in preparation for relocation
* *
@ -257,7 +269,6 @@ int mac_read_from_eeprom(void);
int set_cpu_clk_info(void); int set_cpu_clk_info(void);
int update_flash_size(int flash_size); int update_flash_size(int flash_size);
int arch_early_init_r(void); int arch_early_init_r(void);
void pci_init(void);
int misc_init_r(void); int misc_init_r(void);
#if defined(CONFIG_VID) #if defined(CONFIG_VID)
int init_func_vid(void); int init_func_vid(void);