[U-Boot] ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL
diff mbox series

Message ID 1552994361-32058-1-git-send-email-trini@konsulko.com
State Deferred
Delegated to: Tom Rini
Headers show
Series
  • [U-Boot] ti: am335x_evm: Enable CONFIG_SPL_OF_CONTROL
Related show

Commit Message

Tom Rini March 19, 2019, 11:19 a.m. UTC
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 <faiz_abbas@ti.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 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(-)

Comments

Faiz Abbas March 19, 2019, 11:31 a.m. UTC | #1
Hi Tom,

On 19/03/19 4:49 PM, Tom Rini wrote:
> 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 <faiz_abbas@ti.com>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  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(-)
> 
> diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi b/arch/arm/dts/am335x-evm-u-boot.dtsi
> index b6b97ed16d91..16a9f855ad1f 100644
> --- a/arch/arm/dts/am335x-evm-u-boot.dtsi
> +++ b/arch/arm/dts/am335x-evm-u-boot.dtsi
> @@ -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";
> +};
> diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
> index d67f94ad47ba..bfad1a75a456 100644
> --- a/board/ti/am335x/board.c
> +++ b/board/ti/am335x/board.c
> @@ -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

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
Tom Rini March 19, 2019, 2:40 p.m. UTC | #2
On Tue, Mar 19, 2019 at 05:01:42PM +0530, Faiz Abbas wrote:
> Hi Tom,
> 
> On 19/03/19 4:49 PM, Tom Rini wrote:
> > 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 <faiz_abbas@ti.com>
> > Cc: Lokesh Vutla <lokeshvutla@ti.com>
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> >  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(-)
> > 
> > diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi b/arch/arm/dts/am335x-evm-u-boot.dtsi
> > index b6b97ed16d91..16a9f855ad1f 100644
> > --- a/arch/arm/dts/am335x-evm-u-boot.dtsi
> > +++ b/arch/arm/dts/am335x-evm-u-boot.dtsi
> > @@ -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";
> > +};
> > diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
> > index d67f94ad47ba..bfad1a75a456 100644
> > --- a/board/ti/am335x/board.c
> > +++ b/board/ti/am335x/board.c
> > @@ -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
> 
> 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.

> 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.
Lokesh Vutla March 20, 2019, 1:37 p.m. UTC | #3
On 19/03/19 4:49 PM, Tom Rini wrote:
> 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 <faiz_abbas@ti.com>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>

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
Tom Rini March 20, 2019, 2:36 p.m. UTC | #4
On Wed, Mar 20, 2019 at 07:07:06PM +0530, Lokesh Vutla wrote:
> 
> 
> On 19/03/19 4:49 PM, Tom Rini wrote:
> > 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 <faiz_abbas@ti.com>
> > Cc: Lokesh Vutla <lokeshvutla@ti.com>
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> 
> 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.
Faiz Abbas March 21, 2019, 7:05 a.m. UTC | #5
Tom, Lokesh,

On 20/03/19 8:06 PM, Tom Rini wrote:
> On Wed, Mar 20, 2019 at 07:07:06PM +0530, Lokesh Vutla wrote:
>>
>>
>> On 19/03/19 4:49 PM, Tom Rini wrote:
>>> 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 <faiz_abbas@ti.com>
>>> Cc: Lokesh Vutla <lokeshvutla@ti.com>
>>> Signed-off-by: Tom Rini <trini@konsulko.com>
>>
>> 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

Patch
diff mbox series

diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi b/arch/arm/dts/am335x-evm-u-boot.dtsi
index b6b97ed16d91..16a9f855ad1f 100644
--- a/arch/arm/dts/am335x-evm-u-boot.dtsi
+++ b/arch/arm/dts/am335x-evm-u-boot.dtsi
@@ -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";
+};
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index d67f94ad47ba..bfad1a75a456 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -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
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index 924116835251..dd690dcb495c 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -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