[U-Boot] [PATCH] dm: implement a cfi flash uclass

Bin Meng
2015-10-11T05:41:58Z

Hi Thomas,

On Sun, Oct 11, 2015 at 1:16 PM, Thomas Chou <thomas@wytron.com.tw> wrote:
> Hi Simon,
>
> On 10/09/2015 09:31 PM, Thomas Chou wrote:
>>>>
>>>> + ret = uclass_get_device(UCLASS_CFI_FLASH, i, &dev);
>>>> + if (ret)
>>>> + return ret;
>>>> + if (!dev)
>>>> + return -ENODEV;
>>>
>>>
>>> That function will never return a NULL dev, unless it returns an
>>> error. It is different from uclass_first_device(). Also are you sure
>>> you want uclass_get_device() and not uclass_get_device_by_seq()?
>>
>>
>> Yes, I should use by_seq. Thanks for reminding.
>
>
> I tried uclass_get_device_by_seq(), but it failed without proper seq
> assignment. So I reverted uclass_get_device(), as we didn't assign seq for a
> single cfi-flash.
>
> cfi_flash_64m: flash at 0x0 {
> compatible = "cfi-flash";
> reg = <0x00000000 0x04000000>;
>
>
> I have a problem on device tree decoding. Would you please give me some
> light on decoding with multiple "reg" tuples, like this,
>
> reg = <0 0x00000000 0x02000000
> 0 0x02000000 0x02000000>;
> or,
>
> tse_mac: ethernet at 0x4000 {
> compatible = "altr,tse-1.0";
> reg = <0x00004000 0x00000400>,
> <0x00004400 0x00000040>,
> <0x00004800 0x00000040>,
> <0x00002000 0x00002000>;
> reg-names = "control_port", "rx_csr", "tx_csr", "s1";
>
> Thank you in advance.

You can check fdtdec_get_pci_addr() to see how multiple "reg" tuples
are decoded.

Regards,
Bin