Re: [U-Boot] [PATCH] spl: exynos: make spl_boot common for all exynos based platforms
Dear Minkyu Kang, Thanks for the review. On 4 June 2013 12:56, Minkyu Kang mk7.k...@samsung.com wrote: Dear Inderpal Singh, On 27/03/13 17:48, Inderpal Singh wrote: Dear Minkyu, Please let me know if you have any comments for this patch. With Regards, Inder On 16 March 2013 14:16, Inderpal Singh inderpal.si...@linaro.org wrote: The spl_boot.c which copies the u-boot from the booting device to ram is made common for all the exynos based platforms. To do so: 1. Moved smdk5250/spl_boot.c to common armv7/exynos folder and updated to make it common for exynos4 and exynos5 2. Introduced a CONFIG_SPL_BOOTING option as only exynos5250 supports booting from SPI device 3. Renamed some config options to make them common between exynos5250, origen and smdkv310. SD/MMC booting: tested on exynos4210 based origen, exynos5250 based Arndale and SMDK5250 boards. SPI booting: tested on SMDK5250 board Signed-off-by: Inderpal Singh inderpal.si...@linaro.org --- It depends on the patchset at [1] as it provides the infrastructure to detect the SOC type and revision in spl at runtime. [1] http://www.mail-archive.com/u-boot@lists.denx.de/msg108301.html arch/arm/cpu/armv7/exynos/Makefile |4 ++ .../arm/cpu/armv7/exynos}/spl_boot.c | 33 +++ board/samsung/origen/Makefile |4 -- board/samsung/origen/mmc_boot.c| 58 --- board/samsung/smdk5250/Makefile|4 -- board/samsung/smdkv310/Makefile|4 -- board/samsung/smdkv310/mmc_boot.c | 60 include/configs/exynos5250-dt.h| 10 ++-- include/configs/origen.h | 21 +++ include/configs/smdkv310.h | 21 +++ 10 files changed, 54 insertions(+), 165 deletions(-) rename {board/samsung/smdk5250 = arch/arm/cpu/armv7/exynos}/spl_boot.c (73%) delete mode 100644 board/samsung/origen/mmc_boot.c delete mode 100644 board/samsung/smdkv310/mmc_boot.c Since this patch had wait too long on queue, need to rebase. I'm sorry to late review. diff --git a/arch/arm/cpu/armv7/exynos/Makefile b/arch/arm/cpu/armv7/exynos/Makefile index b9cf921..c507608 100644 --- a/arch/arm/cpu/armv7/exynos/Makefile +++ b/arch/arm/cpu/armv7/exynos/Makefile @@ -24,6 +24,10 @@ LIB = $(obj)lib$(SOC).o COBJS += clock.o power.o soc.o system.o pinmux.o tzpc_init.o +ifdef CONFIG_SPL_BUILD +COBJS += spl_boot.o +endif + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/board/samsung/smdk5250/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c similarity index 73% rename from board/samsung/smdk5250/spl_boot.c rename to arch/arm/cpu/armv7/exynos/spl_boot.c index d8f3c1e..e970ff6 100644 --- a/board/samsung/smdk5250/spl_boot.c +++ b/arch/arm/cpu/armv7/exynos/spl_boot.c @@ -23,6 +23,8 @@ #includecommon.h #includeconfig.h +#define OM_STAT(0x1f 1) + enum boot_mode { BOOT_MODE_MMC = 4, BOOT_MODE_SERIAL = 20, @@ -31,8 +33,6 @@ enum boot_mode { BOOT_MODE_USB, /* Boot using USB download */ }; - typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst); - /* * Copy U-boot from mmc to RAM: * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains @@ -40,26 +40,37 @@ enum boot_mode { */ void copy_uboot_to_ram(void) { - spi_copy_func_t spi_copy; enum boot_mode bootmode; - u32 (*copy_bl2)(u32, u32, u32); + u32 (*copy_bl2)(u32, u32, u32) = NULL; + u32 offset = 0, size = 0; - bootmode = readl(EXYNOS5_POWER_BASE) OM_STAT; + bootmode = readl(samsung_get_base_power()) OM_STAT; switch (bootmode) { +#ifdef CONFIG_SPI_BOOTING Is this ifdef needs? I introduced this ifdef because only exynos5250 has EXYNOS_COPY_SPI_FNPTR_ADDR defined. If i don't use this ifdef, It won't compile for origen, smdkv310 etc. case BOOT_MODE_SERIAL: - spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR; - spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_OFFSET - CONFIG_RES_BLOCK_SIZE; + size = CONFIG_BL2_SIZE; + copy_bl2 = (void *) *(u32 *)EXYNOS_COPY_SPI_FNPTR_ADDR; break; +#endif case BOOT_MODE_MMC: - copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; - copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_BLOCK_OFFSET; + size = CONFIG_BL2_SIZE_BLOCK_COUNT; + +
Re: [U-Boot] [PATCH] spl: exynos: make spl_boot common for all exynos based platforms
Dear Inderpal Singh, On 27/03/13 17:48, Inderpal Singh wrote: Dear Minkyu, Please let me know if you have any comments for this patch. With Regards, Inder On 16 March 2013 14:16, Inderpal Singh inderpal.si...@linaro.org wrote: The spl_boot.c which copies the u-boot from the booting device to ram is made common for all the exynos based platforms. To do so: 1. Moved smdk5250/spl_boot.c to common armv7/exynos folder and updated to make it common for exynos4 and exynos5 2. Introduced a CONFIG_SPL_BOOTING option as only exynos5250 supports booting from SPI device 3. Renamed some config options to make them common between exynos5250, origen and smdkv310. SD/MMC booting: tested on exynos4210 based origen, exynos5250 based Arndale and SMDK5250 boards. SPI booting: tested on SMDK5250 board Signed-off-by: Inderpal Singh inderpal.si...@linaro.org --- It depends on the patchset at [1] as it provides the infrastructure to detect the SOC type and revision in spl at runtime. [1] http://www.mail-archive.com/u-boot@lists.denx.de/msg108301.html arch/arm/cpu/armv7/exynos/Makefile |4 ++ .../arm/cpu/armv7/exynos}/spl_boot.c | 33 +++ board/samsung/origen/Makefile |4 -- board/samsung/origen/mmc_boot.c| 58 --- board/samsung/smdk5250/Makefile|4 -- board/samsung/smdkv310/Makefile|4 -- board/samsung/smdkv310/mmc_boot.c | 60 include/configs/exynos5250-dt.h| 10 ++-- include/configs/origen.h | 21 +++ include/configs/smdkv310.h | 21 +++ 10 files changed, 54 insertions(+), 165 deletions(-) rename {board/samsung/smdk5250 = arch/arm/cpu/armv7/exynos}/spl_boot.c (73%) delete mode 100644 board/samsung/origen/mmc_boot.c delete mode 100644 board/samsung/smdkv310/mmc_boot.c Since this patch had wait too long on queue, need to rebase. I'm sorry to late review. diff --git a/arch/arm/cpu/armv7/exynos/Makefile b/arch/arm/cpu/armv7/exynos/Makefile index b9cf921..c507608 100644 --- a/arch/arm/cpu/armv7/exynos/Makefile +++ b/arch/arm/cpu/armv7/exynos/Makefile @@ -24,6 +24,10 @@ LIB = $(obj)lib$(SOC).o COBJS += clock.o power.o soc.o system.o pinmux.o tzpc_init.o +ifdef CONFIG_SPL_BUILD +COBJS += spl_boot.o +endif + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/board/samsung/smdk5250/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c similarity index 73% rename from board/samsung/smdk5250/spl_boot.c rename to arch/arm/cpu/armv7/exynos/spl_boot.c index d8f3c1e..e970ff6 100644 --- a/board/samsung/smdk5250/spl_boot.c +++ b/arch/arm/cpu/armv7/exynos/spl_boot.c @@ -23,6 +23,8 @@ #includecommon.h #includeconfig.h +#define OM_STAT(0x1f 1) + enum boot_mode { BOOT_MODE_MMC = 4, BOOT_MODE_SERIAL = 20, @@ -31,8 +33,6 @@ enum boot_mode { BOOT_MODE_USB, /* Boot using USB download */ }; - typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst); - /* * Copy U-boot from mmc to RAM: * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains @@ -40,26 +40,37 @@ enum boot_mode { */ void copy_uboot_to_ram(void) { - spi_copy_func_t spi_copy; enum boot_mode bootmode; - u32 (*copy_bl2)(u32, u32, u32); + u32 (*copy_bl2)(u32, u32, u32) = NULL; + u32 offset = 0, size = 0; - bootmode = readl(EXYNOS5_POWER_BASE) OM_STAT; + bootmode = readl(samsung_get_base_power()) OM_STAT; switch (bootmode) { +#ifdef CONFIG_SPI_BOOTING Is this ifdef needs? case BOOT_MODE_SERIAL: - spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR; - spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_OFFSET - CONFIG_RES_BLOCK_SIZE; + size = CONFIG_BL2_SIZE; + copy_bl2 = (void *) *(u32 *)EXYNOS_COPY_SPI_FNPTR_ADDR; break; +#endif case BOOT_MODE_MMC: - copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; - copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_BLOCK_OFFSET; + size = CONFIG_BL2_SIZE_BLOCK_COUNT; + + /* Only SMDKv310 EVT0 directly jumps to BootROM copy function */ + if (s5p_get_cpu_rev()) According to your comment, you should check cpu_ids. + copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; + else + copy_bl2 = (void *) COPY_BL2_FNPTR_ADDR; + break; default:
Re: [U-Boot] [PATCH] spl: exynos: make spl_boot common for all exynos based platforms
[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg108301.html This gives 404 not found... ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] spl: exynos: make spl_boot common for all exynos based platforms
Dear Minkyu, Please let me know if you have any comments for this patch. With Regards, Inder On 16 March 2013 14:16, Inderpal Singh inderpal.si...@linaro.org wrote: The spl_boot.c which copies the u-boot from the booting device to ram is made common for all the exynos based platforms. To do so: 1. Moved smdk5250/spl_boot.c to common armv7/exynos folder and updated to make it common for exynos4 and exynos5 2. Introduced a CONFIG_SPL_BOOTING option as only exynos5250 supports booting from SPI device 3. Renamed some config options to make them common between exynos5250, origen and smdkv310. SD/MMC booting: tested on exynos4210 based origen, exynos5250 based Arndale and SMDK5250 boards. SPI booting: tested on SMDK5250 board Signed-off-by: Inderpal Singh inderpal.si...@linaro.org --- It depends on the patchset at [1] as it provides the infrastructure to detect the SOC type and revision in spl at runtime. [1] http://www.mail-archive.com/u-boot@lists.denx.de/msg108301.html arch/arm/cpu/armv7/exynos/Makefile |4 ++ .../arm/cpu/armv7/exynos}/spl_boot.c | 33 +++ board/samsung/origen/Makefile |4 -- board/samsung/origen/mmc_boot.c| 58 --- board/samsung/smdk5250/Makefile|4 -- board/samsung/smdkv310/Makefile|4 -- board/samsung/smdkv310/mmc_boot.c | 60 include/configs/exynos5250-dt.h| 10 ++-- include/configs/origen.h | 21 +++ include/configs/smdkv310.h | 21 +++ 10 files changed, 54 insertions(+), 165 deletions(-) rename {board/samsung/smdk5250 = arch/arm/cpu/armv7/exynos}/spl_boot.c (73%) delete mode 100644 board/samsung/origen/mmc_boot.c delete mode 100644 board/samsung/smdkv310/mmc_boot.c diff --git a/arch/arm/cpu/armv7/exynos/Makefile b/arch/arm/cpu/armv7/exynos/Makefile index b9cf921..c507608 100644 --- a/arch/arm/cpu/armv7/exynos/Makefile +++ b/arch/arm/cpu/armv7/exynos/Makefile @@ -24,6 +24,10 @@ LIB = $(obj)lib$(SOC).o COBJS += clock.o power.o soc.o system.o pinmux.o tzpc_init.o +ifdef CONFIG_SPL_BUILD +COBJS += spl_boot.o +endif + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/board/samsung/smdk5250/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c similarity index 73% rename from board/samsung/smdk5250/spl_boot.c rename to arch/arm/cpu/armv7/exynos/spl_boot.c index d8f3c1e..e970ff6 100644 --- a/board/samsung/smdk5250/spl_boot.c +++ b/arch/arm/cpu/armv7/exynos/spl_boot.c @@ -23,6 +23,8 @@ #includecommon.h #includeconfig.h +#define OM_STAT(0x1f 1) + enum boot_mode { BOOT_MODE_MMC = 4, BOOT_MODE_SERIAL = 20, @@ -31,8 +33,6 @@ enum boot_mode { BOOT_MODE_USB, /* Boot using USB download */ }; - typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst); - /* * Copy U-boot from mmc to RAM: * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains @@ -40,26 +40,37 @@ enum boot_mode { */ void copy_uboot_to_ram(void) { - spi_copy_func_t spi_copy; enum boot_mode bootmode; - u32 (*copy_bl2)(u32, u32, u32); + u32 (*copy_bl2)(u32, u32, u32) = NULL; + u32 offset = 0, size = 0; - bootmode = readl(EXYNOS5_POWER_BASE) OM_STAT; + bootmode = readl(samsung_get_base_power()) OM_STAT; switch (bootmode) { +#ifdef CONFIG_SPI_BOOTING case BOOT_MODE_SERIAL: - spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR; - spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_OFFSET - CONFIG_RES_BLOCK_SIZE; + size = CONFIG_BL2_SIZE; + copy_bl2 = (void *) *(u32 *)EXYNOS_COPY_SPI_FNPTR_ADDR; break; +#endif case BOOT_MODE_MMC: - copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; - copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_BLOCK_OFFSET; + size = CONFIG_BL2_SIZE_BLOCK_COUNT; + + /* Only SMDKv310 EVT0 directly jumps to BootROM copy function */ + if (s5p_get_cpu_rev()) + copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; + else + copy_bl2 = (void *) COPY_BL2_FNPTR_ADDR; + break; default: break; } + + if (copy_bl2) + copy_bl2(offset, size, CONFIG_SYS_TEXT_BASE); } void board_init_f(unsigned long bootflag) diff --git a/board/samsung/origen/Makefile
[U-Boot] [PATCH] spl: exynos: make spl_boot common for all exynos based platforms
The spl_boot.c which copies the u-boot from the booting device to ram is made common for all the exynos based platforms. To do so: 1. Moved smdk5250/spl_boot.c to common armv7/exynos folder and updated to make it common for exynos4 and exynos5 2. Introduced a CONFIG_SPL_BOOTING option as only exynos5250 supports booting from SPI device 3. Renamed some config options to make them common between exynos5250, origen and smdkv310. SD/MMC booting: tested on exynos4210 based origen, exynos5250 based Arndale and SMDK5250 boards. SPI booting: tested on SMDK5250 board Signed-off-by: Inderpal Singh inderpal.si...@linaro.org --- It depends on the patchset at [1] as it provides the infrastructure to detect the SOC type and revision in spl at runtime. [1] http://www.mail-archive.com/u-boot@lists.denx.de/msg108301.html arch/arm/cpu/armv7/exynos/Makefile |4 ++ .../arm/cpu/armv7/exynos}/spl_boot.c | 33 +++ board/samsung/origen/Makefile |4 -- board/samsung/origen/mmc_boot.c| 58 --- board/samsung/smdk5250/Makefile|4 -- board/samsung/smdkv310/Makefile|4 -- board/samsung/smdkv310/mmc_boot.c | 60 include/configs/exynos5250-dt.h| 10 ++-- include/configs/origen.h | 21 +++ include/configs/smdkv310.h | 21 +++ 10 files changed, 54 insertions(+), 165 deletions(-) rename {board/samsung/smdk5250 = arch/arm/cpu/armv7/exynos}/spl_boot.c (73%) delete mode 100644 board/samsung/origen/mmc_boot.c delete mode 100644 board/samsung/smdkv310/mmc_boot.c diff --git a/arch/arm/cpu/armv7/exynos/Makefile b/arch/arm/cpu/armv7/exynos/Makefile index b9cf921..c507608 100644 --- a/arch/arm/cpu/armv7/exynos/Makefile +++ b/arch/arm/cpu/armv7/exynos/Makefile @@ -24,6 +24,10 @@ LIB = $(obj)lib$(SOC).o COBJS += clock.o power.o soc.o system.o pinmux.o tzpc_init.o +ifdef CONFIG_SPL_BUILD +COBJS += spl_boot.o +endif + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/board/samsung/smdk5250/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c similarity index 73% rename from board/samsung/smdk5250/spl_boot.c rename to arch/arm/cpu/armv7/exynos/spl_boot.c index d8f3c1e..e970ff6 100644 --- a/board/samsung/smdk5250/spl_boot.c +++ b/arch/arm/cpu/armv7/exynos/spl_boot.c @@ -23,6 +23,8 @@ #includecommon.h #includeconfig.h +#define OM_STAT(0x1f 1) + enum boot_mode { BOOT_MODE_MMC = 4, BOOT_MODE_SERIAL = 20, @@ -31,8 +33,6 @@ enum boot_mode { BOOT_MODE_USB, /* Boot using USB download */ }; - typedef u32 (*spi_copy_func_t)(u32 offset, u32 nblock, u32 dst); - /* * Copy U-boot from mmc to RAM: * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains @@ -40,26 +40,37 @@ enum boot_mode { */ void copy_uboot_to_ram(void) { - spi_copy_func_t spi_copy; enum boot_mode bootmode; - u32 (*copy_bl2)(u32, u32, u32); + u32 (*copy_bl2)(u32, u32, u32) = NULL; + u32 offset = 0, size = 0; - bootmode = readl(EXYNOS5_POWER_BASE) OM_STAT; + bootmode = readl(samsung_get_base_power()) OM_STAT; switch (bootmode) { +#ifdef CONFIG_SPI_BOOTING case BOOT_MODE_SERIAL: - spi_copy = *(spi_copy_func_t *)EXYNOS_COPY_SPI_FNPTR_ADDR; - spi_copy(SPI_FLASH_UBOOT_POS, CONFIG_BL2_SIZE, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_OFFSET - CONFIG_RES_BLOCK_SIZE; + size = CONFIG_BL2_SIZE; + copy_bl2 = (void *) *(u32 *)EXYNOS_COPY_SPI_FNPTR_ADDR; break; +#endif case BOOT_MODE_MMC: - copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; - copy_bl2(BL2_START_OFFSET, BL2_SIZE_BLOC_COUNT, - CONFIG_SYS_TEXT_BASE); + offset = CONFIG_BL2_BLOCK_OFFSET; + size = CONFIG_BL2_SIZE_BLOCK_COUNT; + + /* Only SMDKv310 EVT0 directly jumps to BootROM copy function */ + if (s5p_get_cpu_rev()) + copy_bl2 = (void *) *(u32 *)COPY_BL2_FNPTR_ADDR; + else + copy_bl2 = (void *) COPY_BL2_FNPTR_ADDR; + break; default: break; } + + if (copy_bl2) + copy_bl2(offset, size, CONFIG_SYS_TEXT_BASE); } void board_init_f(unsigned long bootflag) diff --git a/board/samsung/origen/Makefile b/board/samsung/origen/Makefile index 3a885a5..6133b26 100644 --- a/board/samsung/origen/Makefile +++ b/board/samsung/origen/Makefile @@ -31,10 +31,6 @@ ifndef CONFIG_SPL_BUILD COBJS += origen.o endif -ifdef CONFIG_SPL_BUILD -COBJS += mmc_boot.o -endif - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)