[U-Boot] [PATCH v3 0/5] ARM: DRA7: AM57xx: Enable SPL_DM

- Enable SPL_DM on all DRA7 and AM57xx based platforms. - SPL uses a generic dts on all platforms with same defconfig. - After this series SPL size is increased by ~8KB.
Verified MMC, eMMC boot on DRA74-evm, DRA72-evm. MMC boot on AM57xx-evm.
Changes since v2: - Increased SYS_MALLOC_F_LEN.
Lokesh Vutla (5): tools: omapimage: Fix size in header ARM: OMAP2+: define _image_binary_end to fix SPL_OF_CONTROL ARM: dts: OMAP5+: Add u-boot specific dtsi configs: am57xx_evm: Enable SPL_DM configs: dra7xx_evm: Enable SPL_DM
arch/arm/dts/omap5-u-boot.dtsi | 50 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/u-boot-spl.lds | 2 ++ configs/am57xx_evm_defconfig | 8 ++++-- configs/am57xx_hs_evm_defconfig | 6 ++++- configs/dra7xx_evm_defconfig | 6 ++++- configs/dra7xx_hs_evm_defconfig | 5 +++- include/configs/am57xx_evm.h | 5 ---- include/configs/dra7xx_evm.h | 5 ---- include/configs/ti_omap5_common.h | 8 +----- tools/gpimage.c | 2 +- tools/omapimage.c | 2 +- 11 files changed, 75 insertions(+), 24 deletions(-) create mode 100644 arch/arm/dts/omap5-u-boot.dtsi

The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- tools/gpimage.c | 2 +- tools/omapimage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/gpimage.c b/tools/gpimage.c index 1adc55c5fc..3ae511d33e 100644 --- a/tools/gpimage.c +++ b/tools/gpimage.c @@ -54,7 +54,7 @@ static void gpimage_set_header(void *ptr, struct stat *sbuf, int ifd, { struct gp_header *gph = (struct gp_header *)ptr;
- gph_set_header(gph, sbuf->st_size - GPIMAGE_HDR_SIZE, params->addr, 1); + gph_set_header(gph, sbuf->st_size, params->addr, 1); }
/* diff --git a/tools/omapimage.c b/tools/omapimage.c index 7198b3330d..4fe62c5b31 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -143,7 +143,7 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, toc++; memset(toc, 0xff, sizeof(*toc));
- gph_set_header(gph, sbuf->st_size - OMAP_FILE_HDR_SIZE, + gph_set_header(gph, sbuf->st_size - OMAP_CH_HDR_SIZE, params->addr, 0);
if (strncmp(params->imagename, "byteswap", 8) == 0) {

Hi Tom,
On Friday 10 February 2017 08:37 PM, Lokesh Vutla wrote:
The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Unfortunately this is not ture for Keystone2. K2 rom still expects only the image size but the $subject patch effects K2 as well. Can you please take the below patch instead? Let me know if you want me to resend the series.
From 3cb059cca5af5cb7538a411b2386ee4c5f753f2e Mon Sep 17 00:00:00 2001
From: Lokesh Vutla lokeshvutla@ti.com Date: Wed, 15 Feb 2017 16:06:00 +0530 Subject: [PATCH v4] tools: omapimage: Fix size in header
The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- tools/omapimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/omapimage.c b/tools/omapimage.c index 7198b3330d..e31b94ae4f 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -143,7 +143,7 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, toc++; memset(toc, 0xff, sizeof(*toc));
- gph_set_header(gph, sbuf->st_size - OMAP_FILE_HDR_SIZE, + gph_set_header(gph, sbuf->st_size - OMAP_CH_HDR_SIZE + GPIMAGE_HDR_SIZE, params->addr, 0);
if (strncmp(params->imagename, "byteswap", 8) == 0) {

On Wed, Feb 15, 2017 at 06:02:37PM +0530, Lokesh Vutla wrote:
Hi Tom,
On Friday 10 February 2017 08:37 PM, Lokesh Vutla wrote:
The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Unfortunately this is not ture for Keystone2. K2 rom still expects only the image size but the $subject patch effects K2 as well. Can you please take the below patch instead? Let me know if you want me to resend the series.
Please just re-send the v4 of 1/5 so patchwork will pick it up correctly, thanks!
From 3cb059cca5af5cb7538a411b2386ee4c5f753f2e Mon Sep 17 00:00:00 2001 From: Lokesh Vutla lokeshvutla@ti.com Date: Wed, 15 Feb 2017 16:06:00 +0530 Subject: [PATCH v4] tools: omapimage: Fix size in header
The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
tools/omapimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/omapimage.c b/tools/omapimage.c index 7198b3330d..e31b94ae4f 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -143,7 +143,7 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, toc++; memset(toc, 0xff, sizeof(*toc));
- gph_set_header(gph, sbuf->st_size - OMAP_FILE_HDR_SIZE,
gph_set_header(gph, sbuf->st_size - OMAP_CH_HDR_SIZE + GPIMAGE_HDR_SIZE, params->addr, 0);
if (strncmp(params->imagename, "byteswap", 8) == 0) {
-- 2.11.0

To make SPL_OF_CONTROL work on OMAP2+ SoCs, _image_binary_end must be defined in the linker script along with CONFIG_SPL_SEPARATE_BSS.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- arch/arm/mach-omap2/u-boot-spl.lds | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-omap2/u-boot-spl.lds b/arch/arm/mach-omap2/u-boot-spl.lds index 8fec715ca5..e9da2a9dd1 100644 --- a/arch/arm/mach-omap2/u-boot-spl.lds +++ b/arch/arm/mach-omap2/u-boot-spl.lds @@ -46,6 +46,8 @@ SECTIONS *(.__end) }
+ _image_binary_end = .; + .bss : { . = ALIGN(4);

On Fri, Feb 10, 2017 at 08:37:17PM +0530, Lokesh Vutla wrote:
To make SPL_OF_CONTROL work on OMAP2+ SoCs, _image_binary_end must be defined in the linker script along with CONFIG_SPL_SEPARATE_BSS.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

Add u-boot specific dtsi so that this will be included automatically while building dts.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- arch/arm/dts/omap5-u-boot.dtsi | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 arch/arm/dts/omap5-u-boot.dtsi
diff --git a/arch/arm/dts/omap5-u-boot.dtsi b/arch/arm/dts/omap5-u-boot.dtsi new file mode 100644 index 0000000000..6305f570c5 --- /dev/null +++ b/arch/arm/dts/omap5-u-boot.dtsi @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * Based on "dra7.dtsi" + */ + +/{ + ocp { + u-boot,dm-pre-reloc; + }; +}; + +&uart1 { + u-boot,dm-pre-reloc; +}; + +&uart3 { + u-boot,dm-pre-reloc; +}; + +&mmc1 { + u-boot,dm-pre-reloc; +}; + +&mmc2 { + u-boot,dm-pre-reloc; +}; + +&l4_cfg { + u-boot,dm-pre-reloc; +}; + +&scm { + u-boot,dm-pre-reloc; +}; + +&scm_conf { + u-boot,dm-pre-reloc; +}; + +&qspi { + u-boot,dm-pre-reloc; + + m25p80@0 { + u-boot,dm-pre-reloc; + }; +};

On Fri, Feb 10, 2017 at 08:37:18PM +0530, Lokesh Vutla wrote:
Add u-boot specific dtsi so that this will be included automatically while building dts.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

Enable SPL_DM on all AM57xx based platforms.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- configs/am57xx_evm_defconfig | 8 ++++++-- configs/am57xx_hs_evm_defconfig | 6 +++++- include/configs/am57xx_evm.h | 5 ----- 3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index e804b02c1e..d9648d8270 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -1,12 +1,13 @@ CONFIG_ARM=y CONFIG_OMAP54XX=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_TARGET_AM57XX_EVM=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_ARMV7_LPAE=y CONFIG_SPL_STACK_R_ADDR=0x82000000 -CONFIG_DEFAULT_DEVICE_TREE="am57xx-beagle-x15" +CONFIG_DEFAULT_DEVICE_TREE="am572x-idk" CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_OF_BOARD_SETUP=y @@ -14,7 +15,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_HUSH_PARSER=y @@ -52,8 +55,10 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIST="am57xx-beagle-x15 am57xx-beagle-x15-revb1 am572x-idk am571x-idk" CONFIG_DM=y +CONFIG_SPL_DM=y # CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y @@ -87,4 +92,3 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Texas Instruments" CONFIG_G_DNL_VENDOR_NUM=0x0451 CONFIG_G_DNL_PRODUCT_NUM=0xd022 -CONFIG_SPL_OF_LIBFDT=y diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index 7e84ccddf3..a0abf34ff6 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_OMAP54XX=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TI_SECURE_DEVICE=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_TARGET_AM57XX_EVM=y @@ -19,7 +20,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_FASTBOOT=y @@ -55,7 +58,9 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y CONFIG_DM=y +CONFIG_SPL_DM=y # CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y @@ -85,4 +90,3 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Texas Instruments" CONFIG_G_DNL_VENDOR_NUM=0x0451 CONFIG_G_DNL_PRODUCT_NUM=0xd022 -CONFIG_SPL_OF_LIBFDT=y diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index 3d8b996054..9883c9545a 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -121,11 +121,6 @@ #define CONFIG_SYS_SPI_ARGS_OFFS 0x140000 #define CONFIG_SYS_SPI_ARGS_SIZE 0x80000
-#ifdef CONFIG_SPL_BUILD -#undef CONFIG_DM_SPI -#undef CONFIG_DM_SPI_FLASH -#endif - /* SPI SPL */ #define CONFIG_TI_EDMA3 #define CONFIG_SPL_SPI_LOAD

On Fri, Feb 10, 2017 at 08:37:19PM +0530, Lokesh Vutla wrote:
Enable SPL_DM on all AM57xx based platforms.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

Enable SPL_DM on all DRA7 based platforms.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- configs/dra7xx_evm_defconfig | 6 +++++- configs/dra7xx_hs_evm_defconfig | 5 ++++- include/configs/dra7xx_evm.h | 5 ----- include/configs/ti_omap5_common.h | 8 +------- 4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig index 26b26cc4cd..42f87b34db 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_OMAP54XX=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_TARGET_DRA7XX_EVM=y CONFIG_SPL_SPI_FLASH_SUPPORT=y @@ -14,7 +15,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_HUSH_PARSER=y @@ -52,8 +55,10 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm" CONFIG_DM=y +CONFIG_SPL_DM=y # CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y @@ -96,4 +101,3 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Texas Instruments" CONFIG_G_DNL_VENDOR_NUM=0x0451 CONFIG_G_DNL_PRODUCT_NUM=0xd022 -CONFIG_SPL_OF_LIBFDT=y diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig index 244940cd6c..12f2c3a786 100644 --- a/configs/dra7xx_hs_evm_defconfig +++ b/configs/dra7xx_hs_evm_defconfig @@ -20,7 +20,9 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_STACK_R=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_FASTBOOT=y @@ -57,8 +59,10 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm" CONFIG_DM=y +CONFIG_SPL_DM=y # CONFIG_BLK is not set CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y @@ -101,4 +105,3 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Texas Instruments" CONFIG_G_DNL_VENDOR_NUM=0x0451 CONFIG_G_DNL_PRODUCT_NUM=0xd022 -CONFIG_SPL_OF_LIBFDT=y diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index bf8c041fb7..827d076e76 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -123,11 +123,6 @@ #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 #define CONFIG_QSPI_QUAD_SUPPORT
-#ifdef CONFIG_SPL_BUILD -#undef CONFIG_DM_SPI -#undef CONFIG_DM_SPI_FLASH -#endif - /* * Default to using SPI for environment, etc. * 0x000000 - 0x040000 : QSPI.SPL (256KiB) diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index 37d65653a5..8f65c2242f 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -45,7 +45,7 @@ * Hardware drivers */ #define CONFIG_SYS_NS16550_CLK 48000000 -#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL) +#if !defined(CONFIG_DM_SERIAL) #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE (-4) #endif @@ -163,14 +163,8 @@ #define CONFIG_SPL_NAND_AM33XX_BCH /* ELM support */ #endif
-/* - * Disable MMC DM for SPL build and can be re-enabled after adding - * DM support in SPL - */ #ifdef CONFIG_SPL_BUILD -#undef CONFIG_DM_MMC #undef CONFIG_TIMER -#undef CONFIG_DM_ETH #endif
#endif /* __CONFIG_TI_OMAP5_COMMON_H */

On Fri, Feb 10, 2017 at 08:37:20PM +0530, Lokesh Vutla wrote:
Enable SPL_DM on all DRA7 based platforms.
Reviewed-by: Tom Rini trini@konsulko.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- tools/omapimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/omapimage.c b/tools/omapimage.c index 7198b3330d..e31b94ae4f 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -143,7 +143,7 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, toc++; memset(toc, 0xff, sizeof(*toc));
- gph_set_header(gph, sbuf->st_size - OMAP_FILE_HDR_SIZE, + gph_set_header(gph, sbuf->st_size - OMAP_CH_HDR_SIZE + GPIMAGE_HDR_SIZE, params->addr, 0);
if (strncmp(params->imagename, "byteswap", 8) == 0) {

On Wed, Feb 15, 2017 at 06:42:54PM +0530, Lokesh Vutla wrote:
The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage generates a gp header only with size of the image as size field. Fix it
Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!
participants (2)
-
Lokesh Vutla
-
Tom Rini