[U-Boot] [PATCH v3 2/3] cfi_flash: convert to driver model

Stefan Roese sr at denx.de
Tue Nov 3 06:56:44 CET 2015


Hi Thomas,

On 03.11.2015 01:23, Thomas Chou wrote:
>>>    #ifdef CONFIG_SYS_FLASH_PROTECTION
>>>        /* read environment from EEPROM */
>>> @@ -2322,6 +2337,14 @@ unsigned long flash_init (void)
>>>        getenv_f("unlock", s, sizeof(s));
>>>    #endif
>>>
>>> +#ifdef CONFIG_CFI_FLASH /* for driver model */
>>> +    cfi_flash_num_flash_banks = 0;
>>> +    /* probe every MTD device */
>>> +    for (uclass_first_device(UCLASS_MTD, &dev);
>>> +         dev;
>>> +         uclass_next_device(&dev)) {
>>> +    }
>>> +#endif
>>
>> What is this loop above exactly doing?
>
> I want to get the cfi-flash device probed and flash_info[] got
> initialized. So I look in every mtd uclass device.
>
> I will use CONFIG_IS_ENABLED to remove the warning above.

Thats good, thanks.

> if (CONFIG_IS_ENABLED(CFI_FLASH)) {
>      struct udevice *dev;
>      cfi_flash_num_flash_banks = 0;
>      /* probe every MTD device to find cfi-flash device */
>      for (uclass_first_device(UCLASS_MTD, &dev);
>           dev;
>           uclass_next_device(&dev)) {
>      }
> }

I'm still not an expert in the DM internals. I fail to see, where
the actual probing is happening in the loop. Is it buried in the
uclass_first_device() call?

Thanks,
Stefan



More information about the U-Boot mailing list