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

Jagan Teki
2015-12-06T13:10:10Z

Hi Thomas,

On 6 December 2015 at 17:07, Thomas Chou <thomas@wytron.com.tw> wrote:
> Hi Jagan,
>
> On 2015?12?06? 16:23, Jagan Teki wrote:
>>>
>>> +#ifdef CONFIG_CFI_FLASH /* for driver model */
>>> +static void cfi_flash_init_dm(void)
>>> +{
>>> + struct udevice *dev;
>>> +
>>> + cfi_flash_num_flash_banks = 0;
>>> + /*
>>> + * The uclass_first_device() will probe the first device and
>>> + * uclass_next_device() will probe the rest if they exist. So
>>> + * that cfi_flash_probe() will get called assigning the base
>>> + * addresses that are available.
>>> + */
>>> + for (uclass_first_device(UCLASS_MTD, &dev);
>>> + dev;
>>> + uclass_next_device(&dev)) {
>>> + }
>>> +}
>>
>>
>> I think this is for probing MTD_UCLASS drivers is it? for my
>> understanding MTD should be generic to all the flash variants if so
>> this probing shouldn't be CFI specific or If MTD uclass is specific to
>> CFI this implementation is correct. Can you comment which one is true.
>
>
> This probing is not specific to CFI flash. It will probe all flash variants
> of MTD uclass.

This is something I'm unclear, suppose if I need to use MTD uclass in
spi-flash drivers shall I enable CONFIG_CFI_FLASH? If so that depends
on CONFIG_CFI_FLASH_DRIVER as well right? then it is not correct to
enable CFI_FLASH_DRIVER for other flash variants like spi-flash right?

thanks!
--
Jagan.