Skip to contentSkip to conversation

ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

PATCH New Tom Rini 3 participants 6 messages Mar 19, 2019 – Mar 21, 2019 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

Enable support for SPL_OF_CONTROL on this platform. That means doing a few things:
- Add u-boot,dm-pre-reloc to a number of nodes
- Drop static platdata in the board file.
- A lot of tweaks to the defconfig. We remove some things such as SPL_USE_ARCH_MEMCPY/SET for space. Increase our malloc len.
- Drop, for now at least, USB SPL support as it's causing a hang.

Cc Faiz Abbas <[email protected]>
Cc Lokesh Vutla <[email protected]>
---
 arch/arm/dts/am335x-evm-u-boot.dtsi | 45 +++++++++++++++++++++++++++++++++++--
 board/ti/am335x/board.c             | 30 -------------------------
 configs/am335x_evm_defconfig        | 14 ++++++++----
 3 files changed, 53 insertions(+), 36 deletions(-)
arch/arm/dts/am335x-evm-u-boot.dtsi +43 -2
index b6b97ed16d91..16a9f855ad1f 100644
@@ -3,11 +3,52 @@
  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  */
 
+#include "am33xx-u-boot.dtsi"
 
-&mmc3 {
-	status = "disabled";
+&l4_wkup {
+	u-boot,dm-pre-reloc;
+};
+
+&scm {
+	u-boot,dm-pre-reloc;
+};
+
+&am33xx_pinmux {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0_pins {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio0 {
+	u-boot,dm-pre-reloc;
+};
+
+&i2c0 {
+	u-boot,dm-pre-reloc;
+};
+
+&i2c0_pins {
+	u-boot,dm-pre-reloc;
 };
 
 &usb0 {
 	dr_mode = "peripheral";
 };
+
+&mmc1 {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc1_pins {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc3 {
+	status = "disabled";
+};
board/ti/am335x/board.c +0 -30
index d67f94ad47ba..bfad1a75a456 100644
@@ -1054,33 +1054,3 @@ void board_fit_image_post_process(void **p_image, size_t *p_size)
 	secure_boot_verify_image(p_image, p_size);
 }
 #endif
-
-#if !CONFIG_IS_ENABLED(OF_CONTROL)
-static const struct omap_hsmmc_plat am335x_mmc0_platdata = {
-	.base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE,
-	.cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_4BIT,
-	.cfg.f_min = 400000,
-	.cfg.f_max = 52000000,
-	.cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
-	.cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
-U_BOOT_DEVICE(am335x_mmc0) = {
-	.name = "omap_hsmmc",
-	.platdata = &am335x_mmc0_platdata,
-};
-
-static const struct omap_hsmmc_plat am335x_mmc1_platdata = {
-	.base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE,
-	.cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT,
-	.cfg.f_min = 400000,
-	.cfg.f_max = 52000000,
-	.cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
-	.cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
-U_BOOT_DEVICE(am335x_mmc1) = {
-	.name = "omap_hsmmc",
-	.platdata = &am335x_mmc1_platdata,
-};
-#endif
configs/am335x_evm_defconfig +10 -4
index 924116835251..dd690dcb495c 100644
@@ -1,23 +1,26 @@
 CONFIG_ARM=y
+# CONFIG_SPL_USE_ARCH_MEMCPY is not set
+# CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_TI_COMMON_CMD_OPTIONS=y
+CONFIG_SYS_MALLOC_F_LEN=0x4000
 CONFIG_AM33XX=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
 CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
+CONFIG_TPL_SYS_MALLOC_F_LEN=0x1000
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd"
+CONFIG_LOGLEVEL=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_ARCH_MISC_INIT=y
 # CONFIG_SPL_FS_EXT4 is not set
 CONFIG_SPL_MTD_SUPPORT=y
-CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_NET_SUPPORT=y
 CONFIG_SPL_NET_VCI_STRING="AM33xx U-Boot SPL"
 CONFIG_SPL_OS_BOOT=y
-CONFIG_SPL_USB_GADGET=y
-CONFIG_SPL_USB_ETHER=y
 CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x00080000
 # CONFIG_CMD_FLASH is not set
@@ -28,10 +31,12 @@ CONFIG_MTDIDS_DEFAULT="nand0=nand.0"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)"
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
 CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2"
+CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
-# CONFIG_BLK is not set
+CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_NAND=y
@@ -68,5 +73,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0451
 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
 CONFIG_USB_ETHER=y
 CONFIG_DYNAMIC_CRC_TABLE=y
+CONFIG_SPL_TINY_MEMSET=y
 CONFIG_RSA=y
 CONFIG_LZO=y
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

Hi Tom,

Quoted 104 lines · Tom Rini

Enable support for SPL_OF_CONTROL on this platform. That means doing a few things:
- Add u-boot,dm-pre-reloc to a number of nodes
- Drop static platdata in the board file.
- A lot of tweaks to the defconfig. We remove some things such as SPL_USE_ARCH_MEMCPY/SET for space. Increase our malloc len.
- Drop, for now at least, USB SPL support as it's causing a hang.

Cc Faiz Abbas <[email protected]>
Cc Lokesh Vutla <[email protected]>
---
 arch/arm/dts/am335x-evm-u-boot.dtsi | 45 +++++++++++++++++++++++++++++++++++--
 board/ti/am335x/board.c             | 30 -------------------------
 configs/am335x_evm_defconfig        | 14 ++++++++----
 3 files changed, 53 insertions(+), 36 deletions(-)
arch/arm/dts/am335x-evm-u-boot.dtsi +43 -2
index b6b97ed16d91..16a9f855ad1f 100644
@@ -3,11 +3,52 @@
  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  */
 
+#include "am33xx-u-boot.dtsi"
 
-&mmc3 {
-	status = "disabled";
+&l4_wkup {
+	u-boot,dm-pre-reloc;
+};
+
+&scm {
+	u-boot,dm-pre-reloc;
+};
+
+&am33xx_pinmux {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0_pins {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio0 {
+	u-boot,dm-pre-reloc;
+};
+
+&i2c0 {
+	u-boot,dm-pre-reloc;
+};
+
+&i2c0_pins {
+	u-boot,dm-pre-reloc;
 };
 
 &usb0 {
 	dr_mode = "peripheral";
 };
+
+&mmc1 {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc1_pins {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc3 {
+	status = "disabled";
+};
board/ti/am335x/board.c +0 -20
index d67f94ad47ba..bfad1a75a456 100644
@@ -1054,33 +1054,3 @@ void board_fit_image_post_process(void **p_image, size_t *p_size)
 	secure_boot_verify_image(p_image, p_size);
 }
 #endif
-
-#if !CONFIG_IS_ENABLED(OF_CONTROL)
-static const struct omap_hsmmc_plat am335x_mmc0_platdata = {
-	.base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE,
-	.cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_4BIT,
-	.cfg.f_min = 400000,
-	.cfg.f_max = 52000000,
-	.cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
-	.cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
-U_BOOT_DEVICE(am335x_mmc0) = {
-	.name = "omap_hsmmc",
-	.platdata = &am335x_mmc0_platdata,
-};
-
-static const struct omap_hsmmc_plat am335x_mmc1_platdata = {
-	.base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE,
-	.cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT,
-	.cfg.f_min = 400000,

board/ti/am335x/board.c void board_fit_image_post_process(void **p_image, size_t *p_size) · line 1086

Quoted 10 lines
board/ti/am335x/board.c +0 -10
-	.cfg.f_max = 52000000,
-	.cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
-	.cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
-U_BOOT_DEVICE(am335x_mmc1) = {
-	.name = "omap_hsmmc",
-	.platdata = &am335x_mmc1_platdata,
-};
-#endif

We also need to look at arch/arm/mach-omap2/board.c. Bunch of GPIO and I2C platdata there.

In general, if we are not able to fit all bootmodes with SPL_OF_CONTROL enabled, should we remove it and add back platdata or do something else?

Thanks,
Faiz

author
#2 lore raw

PATCH 1/1 ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

Quoted 112 lines · Faiz Abbas

Hi Tom,

Quoted 109 lines · Tom Rini

Enable support for SPL_OF_CONTROL on this platform. That means doing a few things:
- Add u-boot,dm-pre-reloc to a number of nodes
- Drop static platdata in the board file.
- A lot of tweaks to the defconfig. We remove some things such as SPL_USE_ARCH_MEMCPY/SET for space. Increase our malloc len.
- Drop, for now at least, USB SPL support as it's causing a hang.

Cc Faiz Abbas <[email protected]>
Cc Lokesh Vutla <[email protected]>
---
 arch/arm/dts/am335x-evm-u-boot.dtsi | 45 +++++++++++++++++++++++++++++++++++--
 board/ti/am335x/board.c             | 30 -------------------------
 configs/am335x_evm_defconfig        | 14 ++++++++----
 3 files changed, 53 insertions(+), 36 deletions(-)
arch/arm/dts/am335x-evm-u-boot.dtsi +43 -2
index b6b97ed16d91..16a9f855ad1f 100644
@@ -3,11 +3,52 @@
  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  */
 
+#include "am33xx-u-boot.dtsi"
 
-&mmc3 {
-	status = "disabled";
+&l4_wkup {
+	u-boot,dm-pre-reloc;
+};
+
+&scm {
+	u-boot,dm-pre-reloc;
+};
+
+&am33xx_pinmux {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0_pins {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio0 {
+	u-boot,dm-pre-reloc;
+};
+
+&i2c0 {
+	u-boot,dm-pre-reloc;
+};
+
+&i2c0_pins {
+	u-boot,dm-pre-reloc;
 };
 
 &usb0 {
 	dr_mode = "peripheral";
 };
+
+&mmc1 {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc1_pins {
+	u-boot,dm-pre-reloc;
+};
+
+&mmc3 {
+	status = "disabled";
+};
board/ti/am335x/board.c +0 -25
index d67f94ad47ba..bfad1a75a456 100644
@@ -1054,33 +1054,3 @@ void board_fit_image_post_process(void **p_image, size_t *p_size)
 	secure_boot_verify_image(p_image, p_size);
 }
 #endif
-
-#if !CONFIG_IS_ENABLED(OF_CONTROL)
-static const struct omap_hsmmc_plat am335x_mmc0_platdata = {
-	.base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE,
-	.cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_4BIT,
-	.cfg.f_min = 400000,
-	.cfg.f_max = 52000000,
-	.cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
-	.cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
-U_BOOT_DEVICE(am335x_mmc0) = {
-	.name = "omap_hsmmc",
-	.platdata = &am335x_mmc0_platdata,
-};
-
-static const struct omap_hsmmc_plat am335x_mmc1_platdata = {
-	.base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE,
-	.cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT,
-	.cfg.f_min = 400000,
-	.cfg.f_max = 52000000,
-	.cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195,
-	.cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
-
Quoted 8 lines

board/ti/am335x/board.c void board_fit_image_post_process(void **p_image, size_t *p_size) · line 1086

Quoted 5 lines
board/ti/am335x/board.c +0 -5
-U_BOOT_DEVICE(am335x_mmc1) = {
-	.name = "omap_hsmmc",
-	.platdata = &am335x_mmc1_platdata,
-};
-#endif

We also need to look at arch/arm/mach-omap2/board.c. Bunch of GPIO and I2C platdata there.

Yes, but that's all also guarded under a check for SPL_OF_CONTROL being enabled. The above is the board-specific part and why I dropped it.

Quoted 2 lines

In general, if we are not able to fit all bootmodes with SPL_OF_CONTROL enabled, should we remove it and add back platdata or do something else?

I'm not sure we can fit all the boot modes with platdata either, nor am I convinced that's the best thing to do. Checking the TRM again, you can only have 4 choices at most in a single hardware config, and we already don't support some options such as SPI with everything else.

But I'd like to start with seeing everything working with SPL_OF_CONTROL, even if it's not all enabled in the same binary and then we can see what options are available to us to fit the most into a single binary.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190319/cdf20a94/attachment.sig>
#3 lore raw

PATCH 1/1 ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

In reply to Tom Rini
Quoted 11 lines · Tom Rini

Enable support for SPL_OF_CONTROL on this platform. That means doing a few things:
- Add u-boot,dm-pre-reloc to a number of nodes
- Drop static platdata in the board file.
- A lot of tweaks to the defconfig. We remove some things such as SPL_USE_ARCH_MEMCPY/SET for space. Increase our malloc len.
- Drop, for now at least, USB SPL support as it's causing a hang.

Cc Faiz Abbas <[email protected]>
Cc Lokesh Vutla <[email protected]>

Any stats on the binary size changes and the remaining space left? I have been trying to not add SPL_OF_CONTROL so that more features can fit in the same binary :) We will soon reach that stage if few other boot modes are added in.

Thanks and regards,
Lokesh

author
#4 lore raw

PATCH 1/1 ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

Quoted 11 lines · Lokesh Vutla
Quoted 8 lines · Tom Rini

Enable support for SPL_OF_CONTROL on this platform. That means doing a few things:
- Add u-boot,dm-pre-reloc to a number of nodes
- Drop static platdata in the board file.
- A lot of tweaks to the defconfig. We remove some things such as SPL_USE_ARCH_MEMCPY/SET for space. Increase our malloc len.
- Drop, for now at least, USB SPL support as it's causing a hang.

Quoted 7 lines
Quoted 3 lines
Cc Faiz Abbas <[email protected]>
Cc Lokesh Vutla <[email protected]>

Any stats on the binary size changes and the remaining space left? I have been trying to not add SPL_OF_CONTROL so that more features can fit in the same binary :) We will soon reach that stage if few other boot modes are added in.

Without USB support, we're only at 72KiB. Going for "kitchen sink" on this platform with DM is going to be tricky. If we can drop falcon mode that'll help.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190320/4e9343be/attachment.sig>
#5 lore raw

PATCH 1/1 ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL

Tom, Lokesh,

Quoted 16 lines · Tom Rini
Quoted 15 lines · Lokesh Vutla
Quoted 11 lines · Tom Rini

Enable support for SPL_OF_CONTROL on this platform. That means doing a few things:
- Add u-boot,dm-pre-reloc to a number of nodes
- Drop static platdata in the board file.
- A lot of tweaks to the defconfig. We remove some things such as SPL_USE_ARCH_MEMCPY/SET for space. Increase our malloc len.
- Drop, for now at least, USB SPL support as it's causing a hang.

Cc Faiz Abbas <[email protected]>
Cc Lokesh Vutla <[email protected]>
Quoted 8 lines
Quoted 3 lines

Any stats on the binary size changes and the remaining space left? I have been trying to not add SPL_OF_CONTROL so that more features can fit in the same binary :) We will soon reach that stage if few other boot modes are added in.

Without USB support, we're only at 72KiB. Going for "kitchen sink" on this platform with DM is going to be tricky. If we can drop falcon mode that'll help.

I've got usb working with my patches here:

https://patchwork.ozlabs.org/project/uboot/list/?series=97658

That means we have all the bootmodes for am335x working as shown in this table:
http://processors.wiki.ti.com/index.php/Linux_Core_U-Boot_User%27s_Guide#Compiling_MLO_and_u-boot

The only problem I see is with using environment in falcon boot. Can we live with that?

Thanks,
Faiz