Dear Simon, Andreas, On Tuesday 26 July 2011 02:12 PM, Simon Schwarz wrote: > Dear Andreas, > > On 07/26/2011 08:07 AM, Andreas Bießmann wrote: >> Dear Simon, >> >> Am 25.07.2011 um 20:05 schrieb Simon Schwarz: >> >>> Add NAND support for the new SPL structure. >>> >>> --- >>> This patch didn't exist before V2! >>> >>> V2 changes: >>> ADD Some define-barriers for OMAP3 to only use NAND >>> ADD nand_load_image() - inits the OMAP gpmc, loads the images - parses the >>> header >>> CHG cosmetic >>> ADD do_reset() implementation for omap-common spl >>> ADD nand_copy_image to nand.h >>> ADD CPP barriers for mmc and nand support. The parts depending on library >>> support are only compiled if the respective library is included. >>> >>> Transition from V1 to V2 also includes that this patch is now based on >>> - the new SPL layout by Aneesh V and Daniel Schwierzeck >>> - the OMAP4 SPL patches by Aneesh V >>> >>> Signed-off-by: Simon Schwarz<simonschwarz...@gmail.com> >>> --- >>> arch/arm/cpu/armv7/omap-common/spl.c | 43 >>> ++++++++++++++++++++++++++++++++++ >>> arch/arm/include/asm/omap_common.h | 2 + >>> include/nand.h | 3 ++ >>> 3 files changed, 48 insertions(+), 0 deletions(-) >>> >>> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c >>> b/arch/arm/cpu/armv7/omap-common/spl.c >>> index d177652..3a0093d 100644 >>> --- a/arch/arm/cpu/armv7/omap-common/spl.c >>> +++ b/arch/arm/cpu/armv7/omap-common/spl.c >>> @@ -26,6 +26,7 @@ >>> #include<asm/u-boot.h> >>> #include<asm/utils.h> >>> #include<asm/arch/sys_proto.h> >>> +#include<nand.h> >>> #include<mmc.h> >>> #include<fat.h> >>> #include<timestamp_autogenerated.h> >>> @@ -107,6 +108,7 @@ static void parse_image_header(const struct >>> image_header *header) >>> } >>> } >>> >>> +#ifdef CONFIG_SPL_MMC_SUPPORT >>> static void mmc_load_image_raw(struct mmc *mmc) >>> { >>> u32 image_size_sectors, err; >>> @@ -140,7 +142,9 @@ end: >>> hang(); >>> } >>> } >>> +#endif /* CONFIG_SPL_MMC_SUPPORT */ >>> >>> +#ifdef CONFIG_SPL_MMC_SUPPORT >>> static void mmc_load_image_fat(struct mmc *mmc) >>> { >>> s32 err; >>> @@ -173,7 +177,9 @@ end: >>> hang(); >>> } >>> } >>> +#endif /* CONFIG_SPL_MMC_SUPPORT */ >>> >>> +#ifdef CONFIG_SPL_MMC_SUPPORT >>> static void mmc_load_image(void) >>> { >>> struct mmc *mmc; >>> @@ -206,6 +212,26 @@ static void mmc_load_image(void) >>> hang(); >>> } >>> } >>> +#endif /* CONFIG_SPL_MMC_SUPPORT */ >>> + >>> +#ifdef CONFIG_SPL_NAND_SUPPORT >>> +static void nand_load_image(void) >>> +{ >>> + gpmc_init(); >>> + nand_init(); >>> + nand_copy_image(CONFIG_SYS_NAND_U_BOOT_OFFS, >>> CONFIG_SYS_NAND_U_BOOT_SIZE, >>> + (uchar *)CONFIG_SYS_NAND_U_BOOT_DST); >>> +#ifdef CONFIG_NAND_ENV_DST >>> + nand_copy_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, >>> + (uchar *)CONFIG_NAND_ENV_DST); >>> +#ifdef CONFIG_ENV_OFFSET_REDUND >>> + nand_copy_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, >>> + (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); >>> +#endif >>> +#endif >>> + parse_image_header((struct image_header *)CONFIG_SYS_NAND_U_BOOT_DST); >>> +} >>> +#endif /* CONFIG_SPL_NAND_SUPPORT */ >>> >>> void jump_to_image_no_args(void) >>> { >>> @@ -228,10 +254,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(); >>> @@ -259,7 +292,9 @@ void preloader_console_init(void) >>> gd->flags |= GD_FLG_RELOC; >>> gd->baudrate = CONFIG_BAUDRATE; >>> >>> +#ifndef CONFIG_OMAP34XX >> >> Well .. that was discussed with Aneesh in another mail. I prefer Aneesh >> decides how the interface should be: >> a) OMAP3 provides setup_clocks_for_console() and remove the UART stuff >> from per_clocks_enable() >> b) remove setup_clocks_for_console() here and require >> preloader_console_init() to have the clocks enabled before >> > Totally agree. I just wait for a reply by Aneesh and will change it.
I am fine with either. (a) will allow us to have a debug traces in prcm_init()(only for SPL) and also print SPL banner a little earlier. I leave it to active OMAP3 users to decide this. If you want to go with (b) please do it as below (my patches are already in u-boot-arm, it will be good if you could do this in your patch). --- diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index d177652..d380b3e 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -259,7 +259,6 @@ void preloader_console_init(void) gd->flags |= GD_FLG_RELOC; gd->baudrate = CONFIG_BAUDRATE; - setup_clocks_for_console(); serial_init(); /* serial communications setup */ /* Avoid a second "U-Boot" coming from this string */ diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c index 5943d61..a9e90de 100644 --- a/arch/arm/cpu/armv7/omap4/board.c +++ b/arch/arm/cpu/armv7/omap4/board.c @@ -196,6 +196,7 @@ void s_init(void) watchdog_init(); set_mux_conf_regs(); #ifdef CONFIG_SPL_BUILD + setup_clocks_for_console(); preloader_console_init(); #endif prcm_init(); --- br, Aneesh _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot