From 0e226b20497768b6af40ace2bb1fa5d14c090566 Mon Sep 17 00:00:00 2001 From: "H. Nikolaus Schaller" Date: Thu, 19 Apr 2012 23:22:02 +0200 Subject: added option to enable/disable NAND booting so that we can compile a serial-loader from the same sources --- x-loader/board/omap3530gta04/omap3530gta04.c | 11 ++++++++++- x-loader/include/configs/omap3530gta04.h | 7 +++++++ x-loader/lib/board.c | 8 ++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/x-loader/board/omap3530gta04/omap3530gta04.c b/x-loader/board/omap3530gta04/omap3530gta04.c index 796c893..04f310d 100644 --- a/x-loader/board/omap3530gta04/omap3530gta04.c +++ b/x-loader/board/omap3530gta04/omap3530gta04.c @@ -481,6 +481,8 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound) int identify_xm_ddr(void) { +#ifdef CONFIG_NAND + int mfr, id; extern int nand_readid(int *mfr, int *id); @@ -504,8 +506,10 @@ int identify_xm_ddr(void) return NUMONYX_MCP; if ((mfr == 0x2c) && (id == 0xbc)) return MICRON_MCP; +#endif return 0; } + /********************************************************************* * config_3430sdram_ddr() - Init DDR on 3430SDP dev board. *********************************************************************/ @@ -1062,7 +1066,7 @@ void per_clocks_enable(void) MUX_VAL(CP(GPMC_nCS3), (IDIS | PTU | EN | M0)) /*GPMC_nCS3*/\ MUX_VAL(CP(GPMC_nCS4), (IDIS | PTU | EN | M0)) /*GPMC_nCS4*/\ MUX_VAL(CP(GPMC_nCS5), (IDIS | PTD | DIS | M0)) /*GPMC_nCS5*/\ -MUX_VAL(CP(GPMC_nCS6), (IEN | PTD | DIS | M4)) /*GPMC_nCS6=gpio_57*/\ +MUX_VAL(CP(GPMC_nCS6), (IEN | PTD | DIS | M4)) /*GPMC_nCS6=gpio_57=gpt11_pwm*/\ MUX_VAL(CP(GPMC_nCS7), (IEN | PTU | EN | M1)) /*GPMC_nCS7*/\ MUX_VAL(CP(GPMC_CLK), (IDIS | PTD | DIS | M0)) /*GPMC_CLK*/\ MUX_VAL(CP(GPMC_nADV_ALE), (IDIS | PTD | DIS | M0)) /*GPMC_nADV_ALE*/\ @@ -1147,6 +1151,9 @@ MUX_VAL(CP(ETK_CTL), (IEN | PTU | DIS | M4)) /*GPIO_13*/\ void set_muxconf_regs(void) { MUX_DEFAULT(); +#if 1 // enable backlight as first boot indication + MUX_VAL(CP(GPMC_nCS6), (IEN | PTU | EN | M4)); /*GPMC_nCS6=gpio_57=gpt11_pwm*/ +#endif } /********************************************************** @@ -1156,6 +1163,7 @@ void set_muxconf_regs(void) int nand_init(void) { +#ifdef CONFIG_NAND /* global settings */ __raw_writel(0x10, GPMC_SYSCONFIG); /* smart idle */ __raw_writel(0x0, GPMC_IRQENABLE); /* isr's sources masked */ @@ -1215,6 +1223,7 @@ int nand_init(void) } } #endif +#endif return 0; } diff --git a/x-loader/include/configs/omap3530gta04.h b/x-loader/include/configs/omap3530gta04.h index 07fa63d..3e6ef21 100644 --- a/x-loader/include/configs/omap3530gta04.h +++ b/x-loader/include/configs/omap3530gta04.h @@ -85,6 +85,9 @@ //#define SDRC_B1_R_B0_C 1 #define SDRC_R_B_C 1 +/* Enable the below macro if NAND boot support is required */ +//#define CONFIG_NAND 1 + #define NAND_BASE_ADR NAND_BASE #define ONENAND_BASE ONENAND_MAP #define ONENAND_ADDR ONENAND_BASE @@ -124,6 +127,8 @@ */ #define CONFIG_STACKSIZE (128*1024) /* regular stack */ +#if defined(CONFIG_NAND) + /*----------------------------------------------------------------------- * Board NAND Info. */ @@ -205,5 +210,7 @@ #define ONENAND_PAGE_SIZE 2048 /* 2KB */ #define ONENAND_BLOCK_SIZE 0x20000 /* 128KB */ +#endif + #endif /* __CONFIG_H */ diff --git a/x-loader/lib/board.c b/x-loader/lib/board.c index 70cd17a..fc6e86b 100644 --- a/x-loader/lib/board.c +++ b/x-loader/lib/board.c @@ -36,7 +36,7 @@ #include const char version_string[] = - "Texas Instruments X-Loader 1.4.4ss (" __DATE__ " - " __TIME__ ")"; + "Texas Instruments X-Loader 1.4.4ss modified for GTA04 (" __DATE__ " - " __TIME__ ")"; int print_info(void) { @@ -99,13 +99,15 @@ void start_armboot (void) size = file_fat_read("u-boot.bin", buf, 0); if (size > 0) { #ifdef CFG_PRINTF - printf("Loading u-boot.bin from mmc\n"); + printf("Loading u-boot.bin (%i bytes) from mmc/sd\n", size); #endif buf += size; } } #endif +#ifdef CONFIG_NAND + if (buf == (uchar *)CFG_LOADADDR) { /* if no u-boot on mmc, try onenand or nand, depending upon sysboot */ if (get_mem_type() == GPMC_ONENAND){ @@ -130,6 +132,7 @@ void start_armboot (void) #endif } } +#endif /* if u-boot not found on mmc or * nand read result is erased data @@ -137,6 +140,7 @@ void start_armboot (void) */ first_instruction = (int *)CFG_LOADADDR; if((buf == (uchar *)CFG_LOADADDR) || (*first_instruction == 0xffffffff)) { + extern int do_load_serial_bin (ulong offset, int baudrate); printf("u-boot.bin not found or blank nand contents - attempting serial boot . . .\n"); do_load_serial_bin(CFG_LOADADDR, 115200); } -- cgit v1.1