Hello Scott, Scott Wood wrote: > 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.
Oh, Ok. How could/should this then be solved? (Some weak function, maybe: int nand_available(void)?, that board specific code can overwrite, and this function is checked before a nand command is executed?) In the First step, I don;t call nand_init() again, there is also a warning message, that NAND is disabled, so the user should know, that he don;t have longer access to it, is this Okay for you? > Even as a hack, it looks like these boards use the kirkwood nand controller, > and its board_nand_init() will unconditionally return 0, telling Yep, but ... > nand_init_chip that it does indeed have NAND available. Or is there a patch > somewhere changing that? ... nand_get_flash_type() returns -ENODEV, if no manufacturer or/and id could be read from nand (And if using this u-boot command, the nand is not longer visible, because the nand is disabled, and the pins are used to access a SPI Flash) -> nand_scan_ident returns this error, and so nand_scan ... Actually, I get this message, when running this code: No NAND device found!!! Thanks for your comment. bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot