From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jagan Teki Date: Sun, 6 Dec 2015 18:40:10 +0530 Subject: [U-Boot] [PATCH v5 2/3] cfi_flash: convert to driver model In-Reply-To: <56641DFD.1080004@wytron.com.tw> References: <1444289667-23775-1-git-send-email-thomas@wytron.com.tw> <1446883058-8321-1-git-send-email-thomas@wytron.com.tw> <1446883058-8321-2-git-send-email-thomas@wytron.com.tw> <56641DFD.1080004@wytron.com.tw> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Thomas, On 6 December 2015 at 17:07, Thomas Chou 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.