[U-Boot] [PATCH 1/1] Changes for single binary image for u-boot for NAND/OneNAND flash.
Pillai, Manikandan
mani.pillai at ti.com
Wed Mar 4 07:35:12 CET 2009
Hi,
Pls find my comments below
> -----Original Message-----
> From: Nishanth Menon [mailto:menon.nishanth at gmail.com]
> Sent: Tuesday, March 03, 2009 2:03 PM
> To: Pillai, Manikandan
> Cc: u-boot at lists.denx.de; dirk.behme at googlemail.com
> Subject: Re: [U-Boot] [PATCH 1/1] Changes for single binary image for u-boot
> for NAND/OneNAND flash.
>
> Manikandan Pillai said the following on 03/03/2009 05:41 AM:
> > Support for single binary image for NAND/OneNAND based OMAP3 EVM
> > boards. The software has to set the flag CONFIG_ENV_IS_RUNTIME_SEL
> > in include/configs/omap3_evm.h. The software is able to detect
> > whether it is NAND or OneNAND flash at runtime. The flash
> > detected is set as the environment store also.
> >
> makes sense for SDP also.. in SDP3430, we have NOR,OneNAND,NAND and MMC
> as possible boot devices. :(
> Could you please split this patch into two:
> a) changes to generic files
> b) changes specific to omap.
> it is easier to review that way..
[Pillai, Manikandan] OK
> > As per the comments received, the change is done only for OMAP3 EVM.
> >
> > Signed-off-by: Manikandan Pillai <mani.pillai at ti.com>
> > ---
> > board/omap3/evm/evm.c | 2 +
> > common/Makefile | 1 +
> > common/cmd_nvedit.c | 5 ++
> > common/env_common.c | 8 +++-
> > common/env_nand.c | 33 +++++++++++-
> > common/env_onenand.c | 26 +++++++++-
> > cpu/arm_cortexa8/omap3/board.c | 13 +++++
> > cpu/arm_cortexa8/omap3/mem.c | 100
> ++++++++++++++++++++++++++++++++++++-
> > cpu/arm_cortexa8/omap3/sys_info.c | 27 +++++++++-
> > include/common.h | 10 +++-
> > include/configs/omap3_evm.h | 6 ++-
> > lib_arm/board.c | 25 +++++++---
> > 12 files changed, 237 insertions(+), 19 deletions(-)
> >
> > diff --git a/board/omap3/evm/evm.c b/board/omap3/evm/evm.c
> > index b406312..9924432 100644
> > --- a/board/omap3/evm/evm.c
> > +++ b/board/omap3/evm/evm.c
> > @@ -44,7 +44,9 @@ int board_init(void)
> > {
> > DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if !defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
> > +#endif
> > /* board id for Linux */
> > gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM;
> > /* boot param addr */
> > diff --git a/common/Makefile b/common/Makefile
> > index f13cd11..a6c55d2 100644
> > --- a/common/Makefile
> > +++ b/common/Makefile
> > @@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
> > COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
> > COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
> > COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
> > +COBJS-$(CONFIG_ENV_IS_RUNTIME_SEL) += env_onenand.o env_nand.o
> >
> > # command
> > COBJS-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o
> > diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
> > index 68c673e..628bcf4 100644
> > --- a/common/cmd_nvedit.c
> > +++ b/common/cmd_nvedit.c
> > @@ -59,6 +59,7 @@ DECLARE_GLOBAL_DATA_PTR;
> > !defined(CONFIG_ENV_IS_IN_NAND) && \
> > !defined(CONFIG_ENV_IS_IN_ONENAND) && \
> > !defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \
> > + !defined(CONFIG_ENV_IS_RUNTIME_SEL) && \
> > !defined(CONFIG_ENV_IS_NOWHERE)
> > # error Define one of
> CONFIG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|SPI_FLASH|NOWHERE}
> > #endif
> > @@ -66,6 +67,10 @@ DECLARE_GLOBAL_DATA_PTR;
> > #define XMK_STR(x) #x
> > #define MK_STR(x) XMK_STR(x)
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +extern saveenv_p saveenv;
> > +#endif
> > +
> > /************************************************************************
> > ************************************************************************/
> >
> > diff --git a/common/env_common.c b/common/env_common.c
> > index 6be3bb0..b692900 100644
> > --- a/common/env_common.c
> > +++ b/common/env_common.c
> > @@ -46,8 +46,13 @@ DECLARE_GLOBAL_DATA_PTR;
> >
> > extern env_t *env_ptr;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +extern env_get_char_spec_p env_get_char_spec;
> > +extern env_relocate_spec_p env_relocate_spec;
> > +#else
> > extern void env_relocate_spec (void);
> > extern uchar env_get_char_spec(int);
> > +#endif
> >
> > static uchar env_get_char_init (int index);
> >
> > @@ -140,7 +145,8 @@ uchar default_environment[] = {
> > };
> >
> > #if defined(CONFIG_ENV_IS_IN_NAND) /* Environment is in Nand
> Flash */ \
> > - || defined(CONFIG_ENV_IS_IN_SPI_FLASH)
> > + || defined(CONFIG_ENV_IS_IN_SPI_FLASH) \
> > + || (defined(CONFIG_CMD_NAND) && defined(CONFIG_ENV_IS_RUNTIME_SEL))
> >
> Errr.... ENV_IS_IN_NAND Vs ENV_IS_RUNTIME_SEL is not clear.
[Pillai, Manikandan] I am not clear with the query
>
> > int default_environment_size = sizeof(default_environment);
> > #endif
> >
> > diff --git a/common/env_nand.c b/common/env_nand.c
> > index 76569da..add74c2 100644
> > --- a/common/env_nand.c
> > +++ b/common/env_nand.c
> > @@ -65,17 +65,22 @@ int nand_legacy_rw (struct nand_chip* nand, int cmd,
> > extern uchar default_environment[];
> > extern int default_environment_size;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +char *nand_env_name_spec = "NAND";
> >
> I suppose we might want a README.runtime_env to understand it's usage..
[Pillai, Manikandan] OK
> > +#else
> > char * env_name_spec = "NAND";
> > -
> > +#endif
> >
> > #ifdef ENV_IS_EMBEDDED
> > extern uchar environment[];
> > env_t *env_ptr = (env_t *)(&environment[0]);
> > +#elif defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +env_t *nand_env_ptr;
> > +env_t *env_ptr;
> > #else /* ! ENV_IS_EMBEDDED */
> > env_t *env_ptr = 0;
> > #endif /* ENV_IS_EMBEDDED */
> >
> > -
> > /* local functions */
> > #if !defined(ENV_IS_EMBEDDED)
> > static void use_default(void);
> > @@ -83,7 +88,11 @@ static void use_default(void);
> >
> > DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +uchar nand_env_get_char_spec(int index)
> > +#else
> > uchar env_get_char_spec (int index)
> > +#endif
> > {
> > return ( *((uchar *)(gd->env_addr + index)) );
> > }
> > @@ -100,7 +109,11 @@ uchar env_get_char_spec (int index)
> > * the SPL loads not only the U-Boot image from NAND but also the
> > * environment.
> > */
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +int nand_env_init(void)
> > +#else
> > int env_init(void)
> > +#endif
> > {
> > #if defined(ENV_IS_EMBEDDED)
> > size_t total;
> > @@ -181,7 +194,11 @@ int writeenv(size_t offset, u_char *buf)
> > return 0;
> > }
> > #ifdef CONFIG_ENV_OFFSET_REDUND
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +int nand_saveenv(void)
> > +#else
> > int saveenv(void)
> > +#endif
> > {
> > size_t total;
> > int ret = 0;
> > @@ -224,7 +241,11 @@ int saveenv(void)
> > return ret;
> > }
> > #else /* ! CONFIG_ENV_OFFSET_REDUND */
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +int nand_saveenv(void)
> > +#else
> > int saveenv(void)
> > +#endif
> > {
> > size_t total;
> > int ret = 0;
> > @@ -284,7 +305,11 @@ int readenv (size_t offset, u_char * buf)
> > }
> >
> > #ifdef CONFIG_ENV_OFFSET_REDUND
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +void nand_env_relocate_spec(void)
> > +#else
> > void env_relocate_spec (void)
> > +#endif
> > {
> > #if !defined(ENV_IS_EMBEDDED)
> > size_t total;
> > @@ -343,7 +368,11 @@ void env_relocate_spec (void)
> > * The legacy NAND code saved the environment in the first NAND device
> i.e.,
> > * nand_dev_desc + 0. This is also the behaviour using the new NAND code.
> > */
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +void nand_env_relocate_spec(void)
> > +#else
> > void env_relocate_spec (void)
> > +#endif
> > {
> > #if !defined(ENV_IS_EMBEDDED)
> > int ret;
> > diff --git a/common/env_onenand.c b/common/env_onenand.c
> > index dbccc79..7aaa83c 100644
> > --- a/common/env_onenand.c
> > +++ b/common/env_onenand.c
> > @@ -39,11 +39,19 @@ extern uchar default_environment[];
> >
> > #define ONENAND_ENV_SIZE(mtd) (mtd.writesize - ENV_HEADER_SIZE)
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +char *onenand_env_name_spec = "OneNAND";
> > +#else
> > char *env_name_spec = "OneNAND";
> > +#endif
> >
> > #ifdef ENV_IS_EMBEDDED
> > extern uchar environment[];
> > env_t *env_ptr = (env_t *) (&environment[0]);
> > +#elif defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +static unsigned char onenand_env[MAX_ONENAND_PAGESIZE];
> > +env_t *onenand_env_ptr = (env_t *)&onenand_env[0];
> > +extern env_t *env_ptr;
> > #else /* ! ENV_IS_EMBEDDED */
> >
> and NOT CONFIG_ENV_IS_RUNTIME_SEL...
[Pillai, Manikandan] OK
> > static unsigned char onenand_env[MAX_ONENAND_PAGESIZE];
> > env_t *env_ptr = (env_t *) onenand_env;
> > @@ -51,12 +59,20 @@ env_t *env_ptr = (env_t *) onenand_env;
> >
> > DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +uchar onenand_env_get_char_spec(int index)
> > +#else
> > uchar env_get_char_spec(int index)
> > +#endif
> > {
> > return (*((uchar *) (gd->env_addr + index)));
> > }
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> >
> how about #ifdef :).... many places we do have #if defined... ;).. saves
> a few bytes here and there.. :D
[Pillai, Manikandan] OK
> > +void onenand_env_relocate_spec(void)
> > +#else
> > void env_relocate_spec(void)
> > +#endif
> > {
> > unsigned long env_addr;
> > int use_default = 0;
> > @@ -87,7 +103,11 @@ void env_relocate_spec(void)
> > gd->env_valid = 1;
> > }
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +int onenand_saveenv(void)
> > +#else
> > int saveenv(void)
> > +#endif
> > {
> > unsigned long env_addr = CONFIG_ENV_ADDR;
> > struct erase_info instr = {
> > @@ -102,7 +122,6 @@ int saveenv(void)
> > printf("OneNAND: erase failed at 0x%08lx\n", env_addr);
> > return 1;
> > }
> > -
> >
> some one did not like empty lines? ;)
> > /* update crc */
> > env_ptr->crc =
> > crc32(0, env_ptr->data, ONENAND_ENV_SIZE(onenand_mtd));
> > @@ -112,11 +131,14 @@ int saveenv(void)
> > printf("OneNAND: write failed at 0x%08x\n", instr.addr);
> > return 2;
> > }
> > -
> >
> some one did not like empty lines? ;)
> > return 0;
> > }
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +int onenand_env_init(void)
> > +#else
> > int env_init(void)
> > +#endif
> > {
> > /* use default */
> > gd->env_addr = (ulong) & default_environment[0];
> > diff --git a/cpu/arm_cortexa8/omap3/board.c b/cpu/arm_cortexa8/omap3/board.c
> > index 7bb3e28..ba0eec6 100644
> > --- a/cpu/arm_cortexa8/omap3/board.c
> > +++ b/cpu/arm_cortexa8/omap3/board.c
> > @@ -313,6 +313,19 @@ void abort(void)
> > {
> > }
> >
> >
> +/****************************************************************************
> **
> > + * Routine: print_board_info
> > + * Description: Displays cpu and memory information for the board
> > +
> *****************************************************************************/
> > +void print_board_info(void)
> > +{
> > + u32 btype;
> > +
> > + btype = get_board_type();
> > +
> > + display_board_info(btype);
> > +}
> > +
> >
> I dont think this is related to this...
[Pillai, Manikandan] The default EVM support does not have NAND. To build only
For NAND, you need to enable this. I can put this in a separate patch in a series.
> > #ifdef CONFIG_NAND_OMAP_GPMC
> >
> /*****************************************************************************
> *
> > * OMAP3 specific command to switch between NAND HW and SW ecc
> > diff --git a/cpu/arm_cortexa8/omap3/mem.c b/cpu/arm_cortexa8/omap3/mem.c
> > index 3cc22c4..159ed87 100644
> > --- a/cpu/arm_cortexa8/omap3/mem.c
> > +++ b/cpu/arm_cortexa8/omap3/mem.c
> > @@ -26,10 +26,12 @@
> > */
> >
> > #include <common.h>
> > +#include <environment.h>
> > #include <asm/io.h>
> > #include <asm/arch/mem.h>
> > #include <asm/arch/sys_proto.h>
> > #include <command.h>
> > +#include <nand.h>
> >
> > /*
> > * Only One NAND allowed on board at a time.
> > @@ -41,7 +43,21 @@ unsigned int boot_flash_sec;
> > unsigned int boot_flash_type;
> > volatile unsigned int boot_flash_env_addr;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +extern env_t *env_ptr;
> > +extern char *nand_env_name_spec;
> > +extern char *onenand_env_name_spec;
> > +extern env_t *nand_env_ptr;
> > +extern env_t *onenand_env_ptr;
> > +
> > +extern void onenand_init(void);
> > +extern int nand_scan_ident(struct mtd_info *mtd, int maxchips);
> > +#endif
> > +
> > #if defined(CONFIG_CMD_NAND)
> > +u8 is_nand;
> > +extern nand_info_t nand_info[2];
> > +
> > static u32 gpmc_m_nand[GPMC_MAX_REG] = {
> > M_NAND_GPMC_CONFIG1,
> > M_NAND_GPMC_CONFIG2,
> > @@ -63,6 +79,8 @@ gpmc_t *gpmc_cfg_base;
> > #endif
> >
> > #if defined(CONFIG_CMD_ONENAND)
> > +u8 is_onenand;
> > +extern struct mtd_info onenand_mtd;
> > static u32 gpmc_onenand[GPMC_MAX_REG] = {
> > ONENAND_GPMC_CONFIG1,
> > ONENAND_GPMC_CONFIG2,
> > @@ -84,6 +102,24 @@ gpmc_csx_t *onenand_cs_base;
> >
> > static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +char *env_name_spec;
> > +env_get_char_spec_p env_get_char_spec;
> > +env_init_p env_init;
> > +saveenv_p saveenv;
> > +env_relocate_spec_p env_relocate_spec;
> > +
> > +extern uchar nand_env_get_char_spec(int index);
> > +extern int nand_env_init(void);
> > +extern int nand_saveenv(void);
> > +extern void nand_env_relocate_spec(void);
> > +
> > +extern uchar onenand_env_get_char_spec(int index);
> > +extern int onenand_env_init(void);
> > +extern int onenand_saveenv(void);
> > +extern void onenand_env_relocate_spec(void);
> > +#endif /* CONFIG_ENV_IS_RUNTIME_SEL */
> > +
> > /**************************************************************************
> > * make_cs1_contiguous() - for es2 and above remap cs1 behind cs0 to allow
> > * command line mem=xyz use all memory with out discontinuous support
> > @@ -229,6 +265,7 @@ void gpmc_init(void)
> > u32 f_off = CONFIG_SYS_MONITOR_LEN;
> > u32 f_sec = 0;
> > u32 config = 0;
> > + u32 gpmc_index = 0;
> >
> > /* global settings */
> > writel(0, &gpmc_base->irqenable); /* isr's sources masked */
> > @@ -245,7 +282,7 @@ void gpmc_init(void)
> > writel(0, &gpmc_cs_base->config7);
> > sdelay(1000);
> >
> > -#if defined(CONFIG_CMD_NAND) /* CS 0 */
> > +#if defined(CONFIG_CMD_NAND) && !defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > gpmc_config = gpmc_m_nand;
> > gpmc_cfg_base = gpmc_base;
> > nand_cs_base = (gpmc_csx_t *)(GPMC_CONFIG_CS0_BASE +
> > @@ -264,7 +301,37 @@ void gpmc_init(void)
> > #endif
> > #endif
> >
> > -#if defined(CONFIG_CMD_ONENAND)
> > +#if defined(CONFIG_CMD_NAND) && defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > + gpmc_config = gpmc_m_nand;
> > + nand_cs_base = (gpmc_csx_t *)(GPMC_CONFIG_CS0_BASE +
> > + (gpmc_index * GPMC_CONFIG_WIDTH));
> > + base = PISMO1_NAND_BASE;
> > + size = PISMO1_NAND_SIZE;
> > + enable_gpmc_config(gpmc_config, nand_cs_base, base, size);
> > + /* NAND and/or ONENAND is to be scanned */
> > + is_nand = 0;
> > + nand_init();
> > + if (nand_info[0].size) {
> > + is_nand = 1;
> > + f_off = SMNAND_ENV_OFFSET;
> > + f_sec = SZ_128K;
> > + /* env setup */
> > + boot_flash_base = base;
> > + boot_flash_off = f_off;
> > + boot_flash_sec = f_sec;
> > + boot_flash_env_addr = f_off;
> > +
> > + env_name_spec = nand_env_name_spec;
> > + env_ptr = nand_env_ptr;
> > + env_get_char_spec = nand_env_get_char_spec;
> > + env_init = nand_env_init;
> > + saveenv = nand_saveenv;
> > + env_relocate_spec = nand_env_relocate_spec;
> > + gpmc_index++;
> > + }
> >
> with a change like above in a common omap3 file, you are essentially
> bottlenecking scalability to other OMAP3 platforms which use different
> NAND. Eg. we assume SZ_128K ;) kinda wrong rt? sector size is dependent
> on the nand device we plug in..
[Pillai, Manikandan] I can plug out the initialization stuff and put it in
a board dependent file and invoke the same from the common omap3 locations
for the type of board.
> > +#endif
> > +
> > +#if defined(CONFIG_CMD_ONENAND) && !defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > gpmc_config = gpmc_onenand;
> > onenand_cs_base = (gpmc_csx_t *)(GPMC_CONFIG_CS0_BASE +
> > (GPMC_CS * GPMC_CONFIG_WIDTH));
> > @@ -281,4 +348,33 @@ void gpmc_init(void)
> > boot_flash_env_addr = f_off;
> > #endif
> > #endif
> > +
> > +#if defined(CONFIG_CMD_ONENAND) && defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > + gpmc_config = gpmc_onenand;
> > + onenand_cs_base = (gpmc_csx_t *)(GPMC_CONFIG_CS0_BASE +
> > + (gpmc_index * GPMC_CONFIG_WIDTH));
> > + base = PISMO1_ONEN_BASE;
> > + size = PISMO1_ONEN_SIZE;
> >
> here.. PISMO? PISMO is a plugin Board on SDP and possibly EVM, but not
> true for other platforms.. :(
> > + enable_gpmc_config(gpmc_config, onenand_cs_base, base, size);
> > + /* NAND and/or ONENAND is to be scanned */
> > + is_onenand = 0;
> > + onenand_init();
> > + if (onenand_mtd.size) {
> > + is_onenand = 1;
> > + f_off = ONENAND_ENV_OFFSET;
> > + f_sec = SZ_128K;
> > + /* env setup */
> > + boot_flash_base = base;
> > + boot_flash_off = f_off;
> > + boot_flash_sec = f_sec;
> > + boot_flash_env_addr = f_off;
> > + env_name_spec = onenand_env_name_spec;
> > + env_ptr = onenand_env_ptr;
> > + env_get_char_spec = onenand_env_get_char_spec;
> > + env_init = onenand_env_init;
> > + saveenv = onenand_saveenv;
> > + env_relocate_spec = onenand_env_relocate_spec;
> > + gpmc_index++;
> > + }
> > +#endif
> > }
> > diff --git a/cpu/arm_cortexa8/omap3/sys_info.c
> b/cpu/arm_cortexa8/omap3/sys_info.c
> > index 28a1020..86cc95f 100644
> > --- a/cpu/arm_cortexa8/omap3/sys_info.c
> > +++ b/cpu/arm_cortexa8/omap3/sys_info.c
> > @@ -36,6 +36,14 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_csx_t
> *)GPMC_CONFIG_CS0_BASE;
> > static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
> > static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
> >
> > +#if defined(CONFIG_CMD_NAND)
> > +extern u8 is_nand;
> > +#endif
> > +
> > +#if defined(CONFIG_CMD_ONENAND)
> > +extern u8 is_onenand;
> > +#endif
> > +
> > /******************************************
> > * get_cpu_type(void) - extract cpu info
> > ******************************************/
> > @@ -208,9 +216,22 @@ void display_board_info(u32 btype)
> >
> >
> > printf("OMAP%s-%s rev %d, CPU-OPP2 L3-165MHz\n", cpu_s,
> > - sec_s, get_cpu_rev());
> > - printf("%s + %s/%s\n", sysinfo.board_string,
> > - mem_s, sysinfo.nand_string);
> > + sec_s, get_cpu_rev());
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > + printf("%s + %s/", sysinfo.board_string,
> > + mem_s);
> > +#if defined(CONFIG_CMD_NAND)
> > + if (is_nand)
> > + printf("%s\n", "NAND");
> > +#endif
> > +#if defined(CONFIG_CMD_ONENAND)
> > + if (is_onenand)
> > + printf("%s\n", "ONENAND");
> > +#endif
> > +#else
> > + printf("%s + %s/%s\n", sysinfo.board_string,
> > + mem_s, sysinfo.nand_string);
> > +#endif
> >
> I have this feel that we could improve this #ifdef mess.. using
> variables maybe?
[Pillai, Manikandan] other suggestions welcome Personally, I felt
here the #ifdef is not so dirty.
> >
> > }
> >
> > diff --git a/include/common.h b/include/common.h
> > index b75ea60..fd3da2c 100644
> > --- a/include/common.h
> > +++ b/include/common.h
> > @@ -243,12 +243,20 @@ extern ulong load_addr; /* Default Load Address
> */
> > void doc_probe(unsigned long physadr);
> >
> > /* common/cmd_nvedit.c */
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +typedef uchar (*env_get_char_spec_p)(int index);
> > +typedef int (*env_init_p)(void);
> > +typedef int (*saveenv_p)(void);
> > +typedef void (*env_relocate_spec_p)(void);
> > +#else
> > int env_init (void);
> > +int saveenv(void);
> > +#endif
> > void env_relocate (void);
> > int envmatch (uchar *, int);
> > char *getenv (char *);
> > int getenv_r (char *name, char *buf, unsigned len);
> > -int saveenv (void);
> > +
> > #ifdef CONFIG_PPC /* ARM version to be fixed! */
> > int inline setenv (char *, char *);
> > #else
> > diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
> > index f4498a9..bf5614e 100644
> > --- a/include/configs/omap3_evm.h
> > +++ b/include/configs/omap3_evm.h
> > @@ -107,6 +107,7 @@
> > #define CONFIG_CMD_I2C /* I2C serial bus support */
> > #define CONFIG_CMD_MMC /* MMC support */
> > #define CONFIG_CMD_ONENAND /* ONENAND support */
> > +#define CONFIG_CMD_NAND /* NAND support */
> >
> please move this to some other patch.. not relevant here..
> > #define CONFIG_CMD_DHCP
> > #define CONFIG_CMD_PING
> >
> > @@ -125,12 +126,15 @@
> > /*
> > * Board NAND Info.
> > */
> > +#define CONFIG_NAND_OMAP_GPMC
> > #define CONFIG_SYS_NAND_ADDR NAND_BASE /* physical address */
> > /* to access nand */
> > #define CONFIG_SYS_NAND_BASE NAND_BASE /* physical address */
> > /* to access */
> > /* nand at CS0 */
> >
> > +#define GPMC_NAND_ECC_LP_x16_LAYOUT 1
> > +
> > #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of */
> > /* NAND devices */
> > #define SECTORSIZE 512
> > @@ -271,7 +275,7 @@
> > #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
> > #define CONFIG_SYS_ONENAND_BASE ONENAND_MAP
> >
> > -#define CONFIG_ENV_IS_IN_ONENAND 1
> > +#define CONFIG_ENV_IS_RUNTIME_SEL 1
> > #define ONENAND_ENV_OFFSET 0x260000 /* environment starts here */
> > #define SMNAND_ENV_OFFSET 0x260000 /* environment starts here */
> >
> > diff --git a/lib_arm/board.c b/lib_arm/board.c
> > index 09eaaf2..9a0c285 100644
> > --- a/lib_arm/board.c
> > +++ b/lib_arm/board.c
> > @@ -60,6 +60,11 @@ DECLARE_GLOBAL_DATA_PTR;
> >
> > ulong monitor_flash_len;
> >
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > +extern void gpmc_init(void);
> > +extern void print_board_info(void);
> > +#endif
> > +
> > #ifdef CONFIG_HAS_DATAFLASH
> > extern int AT91F_DataflashInit(void);
> > extern void dataflash_print_info(void);
> > @@ -259,12 +264,17 @@ static int arm_pci_init(void)
> > typedef int (init_fnc_t) (void);
> >
> > int print_cpuinfo (void); /* test-only */
> > +extern env_init_p env_init;
> >
> > init_fnc_t *init_sequence[] = {
> > cpu_init, /* basic cpu dependent setup */
> > board_init, /* basic board dependent setup */
> > interrupt_init, /* set up exceptions */
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > + NULL, /* initialize environment */
> > +#else
> > env_init, /* initialize environment */
> > +#endif
> > init_baudrate, /* initialze baudrate settings */
> > serial_init, /* serial communications setup */
> > console_init_f, /* stage 1 init of console */
> > @@ -350,13 +360,14 @@ void start_armboot (void)
> > /* armboot_start is defined in the board-specific linker script */
> > mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN);
> >
> > -#if defined(CONFIG_CMD_NAND)
> > - puts ("NAND: ");
> > - nand_init(); /* go init the NAND */
> > -#endif
> > -
> > -#if defined(CONFIG_CMD_ONENAND)
> > - onenand_init();
> >
> well.. my nand and onenand init dissapeared... :( not the way to di it I
> guess..
[Pillai, Manikandan] OK agreed. It was a miss.
> > +#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
> > + gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
> >
> Wooooaaah.. gpmc is TI OMAP2 or OMAP3 only.... NOT in other ARM or PPC
> or other platforms.. NAK on this.
[Pillai, Manikandan] Got your point. But I don't have a solution to this
Since I EVM is doing a scan, it requires the gpmc_init to be called late.
An option is to have another function board_init_late() which can be used to
called gpmc_init_late().
> > + env_init();
> > + init_baudrate(); /* initialze baudrate settings */
> > + serial_init(); /* serial communications setup */
> > + console_init_f(); /* stage 1 init of console */
> > + display_banner();
> > + print_board_info();
> > #endif
> >
> > #ifdef CONFIG_HAS_DATAFLASH
> >
>
> Regards,
> Nishanth Menon
More information about the U-Boot
mailing list