From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Sun, 11 Oct 2015 13:16:35 +0800 Subject: [U-Boot] [PATCH] dm: implement a cfi flash uclass In-Reply-To: <5617C1CF.4020408@wytron.com.tw> References: <1444289667-23775-1-git-send-email-thomas@wytron.com.tw> <5617C1CF.4020408@wytron.com.tw> Message-ID: <5619F0B3.3090704@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. Best regards, Thomas