From bb085b87e587b5ea98519d95c8b24f603d91360a Mon Sep 17 00:00:00 2001 From: Simon Schwarz Date: Wed, 14 Sep 2011 15:29:26 -0400 Subject: omap-common: add nand spl support Add NAND support for the new SPL structure. Signed-off-by: Simon Schwarz Signed-off-by: Sandeep Paulraj --- arch/arm/cpu/armv7/omap-common/spl.c | 46 +++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'arch/arm/cpu/armv7/omap-common') diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index 1d301f4..53d10bf 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -173,7 +174,7 @@ end: hang(); } } - +static void mmc_load_image(void) __attribute__((unused)); static void mmc_load_image(void) { struct mmc *mmc; @@ -207,12 +208,48 @@ static void mmc_load_image(void) } } +#ifdef CONFIG_SPL_NAND_SUPPORT +static void nand_load_image(void) __attribute__ ((unused)); +static void nand_load_image(void) +{ + struct image_header *header; + + gpmc_init(); + nand_init(); + + /*use CONFIG_SYS_TEXT_BASE as temporary storage area */ + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); + +#ifdef CONFIG_NAND_ENV_DST + nand_spl_load_image(CONFIG_ENV_OFFSET, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + parse_image_header(header); + nand_spl_load_image(CONFIG_ENV_OFFSET, image_size, + (void *)image_load_addr); +#ifdef CONFIG_ENV_OFFSET_REDUND + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + parse_image_header(header); + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, image_size, + (void *)image_load_addr); +#endif +#endif + /* Load u-boot */ + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + CONFIG_SYS_NAND_PAGE_SIZE, (void *)header); + parse_image_header(header); + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + image_size, (void *)image_load_addr); + nand_deselect(); +} +#endif /* CONFIG_SPL_NAND_SUPPORT */ void jump_to_image_no_args(void) { typedef void (*image_entry_noargs_t)(void)__attribute__ ((noreturn)); image_entry_noargs_t image_entry = (image_entry_noargs_t) image_entry_point; + debug("image entry point: 0x%X\n", image_entry_point); image_entry(); } @@ -228,10 +265,17 @@ void board_init_r(gd_t *id, ulong dummy) boot_device = omap_boot_device(); debug("boot device - %d\n", boot_device); switch (boot_device) { +#ifdef CONFIG_SPL_MMC_SUPPORT case BOOT_DEVICE_MMC1: case BOOT_DEVICE_MMC2: mmc_load_image(); break; +#endif +#ifdef CONFIG_SPL_NAND_SUPPORT + case BOOT_DEVICE_NAND: + nand_load_image(); + break; +#endif default: printf("SPL: Un-supported Boot Device - %d!!!\n", boot_device); hang(); -- cgit v1.1