From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Wed, 18 Nov 2009 08:30:36 +0100 Subject: [U-Boot] [PATCH] OMAP3EVM: Added NAND support In-Reply-To: <1258527494-14330-1-git-send-email-hvaibhav@ti.com> References: <1258527494-14330-1-git-send-email-hvaibhav@ti.com> Message-ID: <4B03A29C.8020404@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de hvaibhav at ti.com wrote: > From: Vaibhav Hiremath > > User can now choose between NAND and ONENAND support in omap3_evm.h > > Signed-off-by: Vaibhav Hiremath > --- > include/configs/omap3_evm.h | 27 ++++++++++++++++++++++++++- > 1 files changed, 26 insertions(+), 1 deletions(-) > > diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h > index a5514ae..3434306 100644 > --- a/include/configs/omap3_evm.h > +++ b/include/configs/omap3_evm.h > @@ -110,7 +110,8 @@ > > #define CONFIG_CMD_I2C /* I2C serial bus support */ > #define CONFIG_CMD_MMC /* MMC support */ > -#define CONFIG_CMD_ONENAND /* ONENAND support */ > +/*#define CONFIG_CMD_ONENAND*/ /* ONENAND support */ > +#define CONFIG_CMD_NAND /* NAND support */ Is it okay to switch the default from ONENAND to NAND here? > #define CONFIG_CMD_DHCP > #define CONFIG_CMD_PING > > @@ -141,6 +142,7 @@ > /* to access */ > /* nand at CS0 */ > > + ? > #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of */ > /* NAND devices */ > #define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ > @@ -268,7 +270,13 @@ > #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE > #define CONFIG_SYS_ONENAND_BASE ONENAND_MAP > > +#if defined(CONFIG_CMD_NAND) > +#define CONFIG_NAND_OMAP_GPMC > +#define GPMC_NAND_ECC_LP_x16_LAYOUT 1 > +#define CONFIG_ENV_IS_IN_NAND 1 > +#elif defined(CONFIG_CMD_ONENAND) > #define CONFIG_ENV_IS_IN_ONENAND 1 > +#endif > #define ONENAND_ENV_OFFSET 0x260000 /* environment starts here */ > #define SMNAND_ENV_OFFSET 0x260000 /* environment starts here */ > > @@ -300,6 +308,23 @@ extern unsigned int boot_flash_sec; > extern unsigned int boot_flash_type; > #endif > > + > +#define WRITE_NAND_COMMAND(d, adr)\ > + writel(d, &nand_cs_base->nand_cmd) > +#define WRITE_NAND_ADDRESS(d, adr)\ > + writel(d, &nand_cs_base->nand_adr) > +#define WRITE_NAND(d, adr) writew(d, &nand_cs_base->nand_dat) > +#define READ_NAND(adr) readl(&nand_cs_base->nand_dat) > + > +/* Other NAND Access APIs */ > +#define NAND_WP_OFF() do {readl(&gpmc_cfg_base->config) |= GPMC_CONFIG_WP; } \ > + while (0) > +#define NAND_WP_ON() do {readl(&gpmc_cfg_base->config) &= ~GPMC_CONFIG_WP; } \ > + while (0) > +#define NAND_DISABLE_CE(nand) > +#define NAND_ENABLE_CE(nand) > +#define NAND_WAIT_READY(nand) udelay(10) Would encapsulating this with #if defined(CONFIG_CMD_NAND) #endif make sense here? Best regards Dirk