[U-Boot] [U-boot] use of CONFIG_SYS_EARLY_PCI_INIT with DM PCI

Simon Glass sjg at chromium.org
Tue May 2 11:27:44 UTC 2017


Hi Suneel,

On 27 April 2017 at 05:29, Suneel Garapati <suneelglinux at gmail.com> wrote:
> Hi Tom/Simon,
>
> Request to help on below query.
>
> Regards,
> Suneel
>
> On Tue, Apr 25, 2017 at 16:25 Suneel Garapati <suneelglinux at gmail.com>
> wrote:
>>
>> Hi Simon,
>>
>> Request your inputs on below query -
>>
>> Boards I work on have most of the devices on PCI bus, driver model
>> support enabled, would like to use CONFIG_SYS_EARLY_PCI_INIT to call
>> pci_init but the below snippet would hinder.
>>
>>  #ifdef CONFIG_PCI
>>  static int initr_pci(void)
>>  {
>> -#ifndef CONFIG_DM_PCI
>>         pci_init();
>> -#endif
>> ....
>>
>> Is this change valid or should create another config item for driver
>> model based early pci init?

Here are my ideas:

1. Create a new DM_FLAG_OF_AUTO_INIT flag to dm/device.h which can be
used in a uclass, i.e.:

UCLASS_DRIVER(pci_generic) = {
   .id = UCLASS_PCI_GENERIC,
   .name = "pci_generic",
   .flags = DM_FLAG_OF_AUTO_INIT,
};

2. Update dm_init_and_scan() to add a new call to dm_auto_init() at
the end of it

3. Implement dm_auto_init() to scan all the uclasses (see
uclass_find() for an example) and for any that have the flag set,
probe all their devices

That way, PCI will be auto-probed on machines which have it.

Later we could come up with a way to allow boards to turn this on/off,
but for now, maybe just always doing it is good enough.

Regards,
Simon


More information about the U-Boot mailing list