From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Wed, 3 Feb 2010 16:32:17 -0600 Subject: [U-Boot] [PATCH 2/2 v3] arm: suen3, suen3_v1, mgcoge2_arm_p1a support In-Reply-To: <4B699BA5.6090001@denx.de> References: <73173D32E9439E4ABB5151606C3E19E2030A5663DB@SC-VEXCH1.marvell.com> <4B699BA5.6090001@denx.de> Message-ID: <20100203223217.GA9158@loki.buserror.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Feb 03, 2010 at 04:52:05PM +0100, Heiko Schocher wrote: > >> + if ((strcmp(argv[1], "off") == 0)) { > >> + printf("SPI FLASH disabled, NAND enabled\n"); > >> + /* Multi-Purpose Pins Functionality configuration */ > >> + kwmpp_config[0] = MPP0_NF_IO2; > >> + kwmpp_config[1] = MPP1_NF_IO3; > >> + kwmpp_config[2] = MPP2_NF_IO4; > >> + kwmpp_config[3] = MPP3_NF_IO5; > >> + > >> + kirkwood_mpp_conf(kwmpp_config); > >> + tmp = readl(KW_GPIO0_BASE); > >> + writel(tmp | FLASH_GPIO_PIN , KW_GPIO0_BASE); > >> + > >> + nand_init(); > >> + } else if ((strcmp(argv[1], "on") == 0)) { > >> + printf("SPI FLASH enabled, NAND disabled\n"); > >> + /* Multi-Purpose Pins Functionality configuration */ > >> + kwmpp_config[0] = MPP0_SPI_SCn; > >> + kwmpp_config[1] = MPP1_SPI_MOSI; > >> + kwmpp_config[2] = MPP2_SPI_SCK; > >> + kwmpp_config[3] = MPP3_SPI_MISO; > >> + > >> + kirkwood_mpp_conf(kwmpp_config); > >> + tmp = readl(KW_GPIO0_BASE); > >> + writel(tmp & (~FLASH_GPIO_PIN) , KW_GPIO0_BASE); > >> + > >> + nand_init(); > > > > What do you need nand_init for disabled nand operation? > > With it, the nand subsystem knows, that there is no longer > the nand availiable. That's not how nand_init() is meant to be used. It is meant to be called once on system init. There is probably at least a memory leak here, e.g. chip->buffers. Even as a hack, it looks like these boards use the kirkwood nand controller, and its board_nand_init() will unconditionally return 0, telling nand_init_chip that it does indeed have NAND available. Or is there a patch somewhere changing that? -Scott