From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Grandegger Date: Tue, 20 Jan 2009 09:36:44 +0100 Subject: [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer In-Reply-To: <200901200840.04367.sr@denx.de> References: <4964FA39.3010902@grandegger.com> <200901191821.15116.sr@denx.de> <4974D97F.3060907@grandegger.com> <200901200840.04367.sr@denx.de> Message-ID: <49758D1C.30802@grandegger.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Stefan Roese wrote: > Hi Wolfgang, > > On Monday 19 January 2009, Wolfgang Grandegger wrote: >>>> Are they accessed as 2 NAND controllers, or 2 chips on one controller? >>> 2 chips on one controller. >>> >>>> We can make it "#define NAND_MAX_CHIPS 2" if that's appropriate, but >>>> defining it to CONFIG_SYS_MAX_NAND_DEVICE doesn't seem to make sense. >>> OK with me. >> NAND_MAX_CHIPS should be set to 1! >> >> NAND_MAX_CHIPS defines the number of NAND chips (or dies) *per* NAND >> device (or bank) meaning two or more identical NAND chips can be mapped >> to one device. So far this was not supported, because nand_scan() was >> always called with maxchips=1 in nand_init_chip: >> >> $ cat drivers/mtd/nand/nand.c: >> ... >> static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, >> ulong base_addr) >> { >> mtd->priv = nand; >> >> nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr; >> if (board_nand_init(nand) == 0) { >> if (nand_scan(mtd, 1) == 0) { >> ^^^^^^^^^^^^^^^^^ >> if (!mtd->name) >> mtd->name = (char *)default_nand_name; >> } else >> mtd->name = NULL; >> } else { >> mtd->name = NULL; >> mtd->size = 0; >> } >> } >> >> Furthermore, the callback chip->select_chip() must be provided by the >> NAND driver to select the chips properly. It's seems not to be >> implemented for NDFC and therefore you do not have this choice. >> Therefore NAND_MAX_CHIPS should be set to 1 for the Bamboo. > > The 4xx NDFC driver uses the board_nand_select_device() function to select the > NAND chip (other platforms do it this way as well). IIRC, this function was > already introduced with old legacy NAND driver. Could be that it is > deprecated now and should be replaced with the ->select_device() function. NAND device selection is a different issue. The NAND FLASHes are presented to the user as separate devices. I don't think it's deprecated, it's just an option, the only one so far. Wolfgang.