All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
@ 2022-10-22 14:28 Adam Ford
  2022-10-22 14:28 ` [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP Adam Ford
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Adam Ford @ 2022-10-22 14:28 UTC (permalink / raw)
  To: u-boot; +Cc: sbabic, Adam Ford, Fabio Estevam, NXP i.MX U-Boot Team

There are a few functions which are not essential for use in
SPL, but they take up enough space to make other preferred
features not fit.  Remove the extras.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
index a93cc93878..b0e9d918da 100644
--- a/board/beacon/imx8mm/spl.c
+++ b/board/beacon/imx8mm/spl.c
@@ -44,11 +44,6 @@ static void spl_dram_init(void)
 	ddr_init(&dram_timing);
 }
 
-void spl_board_init(void)
-{
-	debug("Normal Boot\n");
-}
-
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
index e37ce01c19..f6a1012d8a 100644
--- a/configs/imx8mm_beacon_defconfig
+++ b/configs/imx8mm_beacon_defconfig
@@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x910000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
-CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK=0x920000
 CONFIG_SYS_SPL_MALLOC=y
@@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_MMC_IO_VOLTAGE=y
-CONFIG_SPL_MMC_IO_VOLTAGE=y
 CONFIG_MMC_UHS_SUPPORT=y
-CONFIG_SPL_MMC_UHS_SUPPORT=y
 CONFIG_MMC_HS400_ES_SUPPORT=y
 CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_SPL_MMC_HS400_SUPPORT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
@@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_IMX8M_POWER_DOMAIN=y
 CONFIG_DM_PMIC=y
+# CONFIG_SPL_PMIC_CHILDREN is not set
 CONFIG_DM_PMIC_BD71837=y
 CONFIG_SPL_DM_PMIC_BD71837=y
 CONFIG_DM_REGULATOR=y
-CONFIG_SPL_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_BD71837=y
-CONFIG_SPL_DM_REGULATOR_BD71837=y
 CONFIG_DM_REGULATOR_FIXED=y
-CONFIG_SPL_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP
  2022-10-22 14:28 [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Adam Ford
@ 2022-10-22 14:28 ` Adam Ford
  2022-10-22 15:12   ` Fabio Estevam
  2022-11-08 16:39   ` sbabic
  2022-10-22 14:28 ` [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2 Adam Ford
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Adam Ford @ 2022-10-22 14:28 UTC (permalink / raw)
  To: u-boot; +Cc: sbabic, Adam Ford, Fabio Estevam, NXP i.MX U-Boot Team

In order to boot over USB, the device tree needs to enable
a few extra nodes in SPL.  Since the USB driver has the
ability to detect host/device, the dr_mode can be removed
from the device tree since it needs to act as a device when
booting and OTG is the default mode.  Add USB boot support
to spl_board_boot_device and enable the corresponding config
options.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
index c94b4ffa4c..00ac413f36 100644
--- a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
@@ -13,6 +13,10 @@
 	};
 };
 
+&aips4 {
+	u-boot,dm-spl;
+};
+
 &reg_usdhc2_vmmc {
 	u-boot,off-on-delay-us = <20000>;
 };
@@ -77,12 +81,24 @@
 	u-boot,dm-spl;
 };
 
+&reg_usbotg1 {
+
+};
+
 &uart2 {
 	u-boot,dm-spl;
 };
 
+&usbmisc1 {
+	u-boot,dm-spl;
+};
+
 &usbotg1 {
-	dr_mode="host";
+	u-boot,dm-spl;
+};
+
+&usbphynop1 {
+	u-boot,dm-spl;
 };
 
 &usdhc2 {
diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
index b0e9d918da..a5f337aa17 100644
--- a/board/beacon/imx8mm/spl.c
+++ b/board/beacon/imx8mm/spl.c
@@ -34,6 +34,8 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
 	case SD3_BOOT:
 	case MMC3_BOOT:
 		return BOOT_DEVICE_MMC2;
+	case USB_BOOT:
+		return BOOT_DEVICE_BOARD;
 	default:
 		return BOOT_DEVICE_NONE;
 	}
diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
index f6a1012d8a..90a623515e 100644
--- a/configs/imx8mm_beacon_defconfig
+++ b/configs/imx8mm_beacon_defconfig
@@ -39,6 +39,9 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
 CONFIG_SPL_POWER=y
+CONFIG_SPL_USB_HOST=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=64
@@ -56,6 +59,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
@@ -103,6 +107,8 @@ CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_GIGE=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_NOP_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
@@ -127,12 +133,13 @@ CONFIG_SYSRESET_PSCI=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
-# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_MXC_USB_OTG_HACTIVE=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
+CONFIG_SDP_LOADADDR=0x40400000
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2
  2022-10-22 14:28 [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Adam Ford
  2022-10-22 14:28 ` [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP Adam Ford
@ 2022-10-22 14:28 ` Adam Ford
  2022-10-22 15:13   ` Fabio Estevam
  2022-11-08 16:37   ` sbabic
  2022-10-22 15:11 ` [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Fabio Estevam
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Adam Ford @ 2022-10-22 14:28 UTC (permalink / raw)
  To: u-boot; +Cc: sbabic, Adam Ford, Fabio Estevam, NXP i.MX U-Boot Team

The downstream U-Boot distributed by Beacon stores the environment
in the eMMC and the end of partition 2.  This allow the environment
to stay on the SOM regardless of the boot source.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
index 90a623515e..4dd87914b8 100644
--- a/configs/imx8mm_beacon_defconfig
+++ b/configs/imx8mm_beacon_defconfig
@@ -5,8 +5,8 @@ CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_ENV_SIZE=0x1000
-CONFIG_ENV_OFFSET=0x400000
+CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_OFFSET=0xFFFFDE00
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mm-beacon-kit"
 CONFIG_SPL_TEXT_BASE=0x7E1000
@@ -76,7 +76,8 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_SYS_MMC_ENV_DEV=2
+CONFIG_SYS_MMC_ENV_PART=2
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_USE_ETHPRIME=y
 CONFIG_ETHPRIME="FEC"
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-22 14:28 [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Adam Ford
  2022-10-22 14:28 ` [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP Adam Ford
  2022-10-22 14:28 ` [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2 Adam Ford
@ 2022-10-22 15:11 ` Fabio Estevam
  2022-10-24 19:57 ` Tim Harvey
  2022-11-08 16:37 ` sbabic
  4 siblings, 0 replies; 16+ messages in thread
From: Fabio Estevam @ 2022-10-22 15:11 UTC (permalink / raw)
  To: Adam Ford; +Cc: u-boot, sbabic, NXP i.MX U-Boot Team

On Sat, Oct 22, 2022 at 11:28 AM Adam Ford <aford173@gmail.com> wrote:
>
> There are a few functions which are not essential for use in
> SPL, but they take up enough space to make other preferred
> features not fit.  Remove the extras.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>

Reviewed-by: Fabio Estevam <festevam@denx.de>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP
  2022-10-22 14:28 ` [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP Adam Ford
@ 2022-10-22 15:12   ` Fabio Estevam
  2022-11-08 16:39   ` sbabic
  1 sibling, 0 replies; 16+ messages in thread
From: Fabio Estevam @ 2022-10-22 15:12 UTC (permalink / raw)
  To: Adam Ford; +Cc: u-boot, sbabic, NXP i.MX U-Boot Team

On Sat, Oct 22, 2022 at 11:28 AM Adam Ford <aford173@gmail.com> wrote:
>
> In order to boot over USB, the device tree needs to enable
> a few extra nodes in SPL.  Since the USB driver has the
> ability to detect host/device, the dr_mode can be removed
> from the device tree since it needs to act as a device when
> booting and OTG is the default mode.  Add USB boot support
> to spl_board_boot_device and enable the corresponding config
> options.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>

Reviewed-by: Fabio Estevam <festevam@denx.de>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2
  2022-10-22 14:28 ` [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2 Adam Ford
@ 2022-10-22 15:13   ` Fabio Estevam
  2022-11-08 16:37   ` sbabic
  1 sibling, 0 replies; 16+ messages in thread
From: Fabio Estevam @ 2022-10-22 15:13 UTC (permalink / raw)
  To: Adam Ford; +Cc: u-boot, sbabic, NXP i.MX U-Boot Team

On Sat, Oct 22, 2022 at 11:28 AM Adam Ford <aford173@gmail.com> wrote:
>
> The downstream U-Boot distributed by Beacon stores the environment
> in the eMMC and the end of partition 2.  This allow the environment
> to stay on the SOM regardless of the boot source.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>

Reviewed-by: Fabio Estevam <festevam@denx.de>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-22 14:28 [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Adam Ford
                   ` (2 preceding siblings ...)
  2022-10-22 15:11 ` [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Fabio Estevam
@ 2022-10-24 19:57 ` Tim Harvey
  2022-10-24 20:26   ` Adam Ford
  2022-11-08 16:37 ` sbabic
  4 siblings, 1 reply; 16+ messages in thread
From: Tim Harvey @ 2022-10-24 19:57 UTC (permalink / raw)
  To: Adam Ford; +Cc: u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team

On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
>
> There are a few functions which are not essential for use in
> SPL, but they take up enough space to make other preferred
> features not fit.  Remove the extras.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> index a93cc93878..b0e9d918da 100644
> --- a/board/beacon/imx8mm/spl.c
> +++ b/board/beacon/imx8mm/spl.c
> @@ -44,11 +44,6 @@ static void spl_dram_init(void)
>         ddr_init(&dram_timing);
>  }
>
> -void spl_board_init(void)
> -{
> -       debug("Normal Boot\n");
> -}
> -
>  #ifdef CONFIG_SPL_LOAD_FIT
>  int board_fit_config_name_match(const char *name)
>  {
> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> index e37ce01c19..f6a1012d8a 100644
> --- a/configs/imx8mm_beacon_defconfig
> +++ b/configs/imx8mm_beacon_defconfig
> @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
>  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
>  CONFIG_SPL_BSS_START_ADDR=0x910000
>  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> -CONFIG_SPL_BOARD_INIT=y
>  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
>  CONFIG_SPL_STACK=0x920000
>  CONFIG_SYS_SPL_MALLOC=y
> @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
>  CONFIG_DM_I2C=y
>  CONFIG_SUPPORT_EMMC_BOOT=y
>  CONFIG_MMC_IO_VOLTAGE=y
> -CONFIG_SPL_MMC_IO_VOLTAGE=y
>  CONFIG_MMC_UHS_SUPPORT=y
> -CONFIG_SPL_MMC_UHS_SUPPORT=y
>  CONFIG_MMC_HS400_ES_SUPPORT=y
>  CONFIG_MMC_HS400_SUPPORT=y
> -CONFIG_SPL_MMC_HS400_SUPPORT=y
>  CONFIG_FSL_USDHC=y
>  CONFIG_MTD=y
>  CONFIG_DM_MTD=y
> @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
>  CONFIG_POWER_DOMAIN=y
>  CONFIG_IMX8M_POWER_DOMAIN=y
>  CONFIG_DM_PMIC=y
> +# CONFIG_SPL_PMIC_CHILDREN is not set
>  CONFIG_DM_PMIC_BD71837=y
>  CONFIG_SPL_DM_PMIC_BD71837=y
>  CONFIG_DM_REGULATOR=y
> -CONFIG_SPL_DM_REGULATOR=y
>  CONFIG_DM_REGULATOR_BD71837=y
> -CONFIG_SPL_DM_REGULATOR_BD71837=y
>  CONFIG_DM_REGULATOR_FIXED=y
> -CONFIG_SPL_DM_REGULATOR_FIXED=y
>  CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_DM_SERIAL=y
>  CONFIG_MXC_UART=y
> --
> 2.34.1
>

Adam,

I'm looking at your patches as I'm also trying to strip down the
imx8mm-venice SPL so that I can fit DM USB support. It seems that
all/most of the imx8m boards have a spl_board_init() which calls
arch_misc_init(). I'm curious why your not calling that function?

Another config that I've found to save a lot of space for imx8m
without any negative impact I can see is CONFIG_SPL_MMC_TINY=y

Best Regards,

Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-24 19:57 ` Tim Harvey
@ 2022-10-24 20:26   ` Adam Ford
  2022-10-24 20:47     ` Tim Harvey
  0 siblings, 1 reply; 16+ messages in thread
From: Adam Ford @ 2022-10-24 20:26 UTC (permalink / raw)
  To: Tim Harvey; +Cc: u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team

On Mon, Oct 24, 2022 at 2:57 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > There are a few functions which are not essential for use in
> > SPL, but they take up enough space to make other preferred
> > features not fit.  Remove the extras.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> > index a93cc93878..b0e9d918da 100644
> > --- a/board/beacon/imx8mm/spl.c
> > +++ b/board/beacon/imx8mm/spl.c
> > @@ -44,11 +44,6 @@ static void spl_dram_init(void)
> >         ddr_init(&dram_timing);
> >  }
> >
> > -void spl_board_init(void)
> > -{
> > -       debug("Normal Boot\n");
> > -}
> > -
> >  #ifdef CONFIG_SPL_LOAD_FIT
> >  int board_fit_config_name_match(const char *name)
> >  {
> > diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> > index e37ce01c19..f6a1012d8a 100644
> > --- a/configs/imx8mm_beacon_defconfig
> > +++ b/configs/imx8mm_beacon_defconfig
> > @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
> >  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> >  CONFIG_SPL_BSS_START_ADDR=0x910000
> >  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> > -CONFIG_SPL_BOARD_INIT=y
> >  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> >  CONFIG_SPL_STACK=0x920000
> >  CONFIG_SYS_SPL_MALLOC=y
> > @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
> >  CONFIG_DM_I2C=y
> >  CONFIG_SUPPORT_EMMC_BOOT=y
> >  CONFIG_MMC_IO_VOLTAGE=y
> > -CONFIG_SPL_MMC_IO_VOLTAGE=y
> >  CONFIG_MMC_UHS_SUPPORT=y
> > -CONFIG_SPL_MMC_UHS_SUPPORT=y
> >  CONFIG_MMC_HS400_ES_SUPPORT=y
> >  CONFIG_MMC_HS400_SUPPORT=y
> > -CONFIG_SPL_MMC_HS400_SUPPORT=y
> >  CONFIG_FSL_USDHC=y
> >  CONFIG_MTD=y
> >  CONFIG_DM_MTD=y
> > @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
> >  CONFIG_POWER_DOMAIN=y
> >  CONFIG_IMX8M_POWER_DOMAIN=y
> >  CONFIG_DM_PMIC=y
> > +# CONFIG_SPL_PMIC_CHILDREN is not set
> >  CONFIG_DM_PMIC_BD71837=y
> >  CONFIG_SPL_DM_PMIC_BD71837=y
> >  CONFIG_DM_REGULATOR=y
> > -CONFIG_SPL_DM_REGULATOR=y
> >  CONFIG_DM_REGULATOR_BD71837=y
> > -CONFIG_SPL_DM_REGULATOR_BD71837=y
> >  CONFIG_DM_REGULATOR_FIXED=y
> > -CONFIG_SPL_DM_REGULATOR_FIXED=y
> >  CONFIG_DM_REGULATOR_GPIO=y
> >  CONFIG_DM_SERIAL=y
> >  CONFIG_MXC_UART=y
> > --
> > 2.34.1
> >
>
> Adam,
>
> I'm looking at your patches as I'm also trying to strip down the
> imx8mm-venice SPL so that I can fit DM USB support. It seems that
> all/most of the imx8m boards have a spl_board_init() which calls
> arch_misc_init(). I'm curious why your not calling that function?

As of right now, we're not using the CAAM which is initialized in
arch_misc_init.  If/When we do, we'll likely have to pull that in.

>
> Another config that I've found to save a lot of space for imx8m
> without any negative impact I can see is CONFIG_SPL_MMC_TINY=y

I experimented a bit with that too, but I hadn't fully tested
switching between booting between MMC1 and MMC2, so I wasn't quite
ready to enable it, but I'll spend some more time with it to see how
much more space I can shave off SPL.
Getting rid of the PMIC children in SPL helped me quite a bit.

thanks!

adam

>
> Best Regards,
>
> Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-24 20:26   ` Adam Ford
@ 2022-10-24 20:47     ` Tim Harvey
  2022-10-24 20:51       ` Adam Ford
  2022-10-25  1:29       ` Peng Fan
  0 siblings, 2 replies; 16+ messages in thread
From: Tim Harvey @ 2022-10-24 20:47 UTC (permalink / raw)
  To: Adam Ford; +Cc: u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team

On Mon, Oct 24, 2022 at 1:26 PM Adam Ford <aford173@gmail.com> wrote:
>
> On Mon, Oct 24, 2022 at 2:57 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > There are a few functions which are not essential for use in
> > > SPL, but they take up enough space to make other preferred
> > > features not fit.  Remove the extras.
> > >
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > >
> > > diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> > > index a93cc93878..b0e9d918da 100644
> > > --- a/board/beacon/imx8mm/spl.c
> > > +++ b/board/beacon/imx8mm/spl.c
> > > @@ -44,11 +44,6 @@ static void spl_dram_init(void)
> > >         ddr_init(&dram_timing);
> > >  }
> > >
> > > -void spl_board_init(void)
> > > -{
> > > -       debug("Normal Boot\n");
> > > -}
> > > -
> > >  #ifdef CONFIG_SPL_LOAD_FIT
> > >  int board_fit_config_name_match(const char *name)
> > >  {
> > > diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> > > index e37ce01c19..f6a1012d8a 100644
> > > --- a/configs/imx8mm_beacon_defconfig
> > > +++ b/configs/imx8mm_beacon_defconfig
> > > @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
> > >  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> > >  CONFIG_SPL_BSS_START_ADDR=0x910000
> > >  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> > > -CONFIG_SPL_BOARD_INIT=y
> > >  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> > >  CONFIG_SPL_STACK=0x920000
> > >  CONFIG_SYS_SPL_MALLOC=y
> > > @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
> > >  CONFIG_DM_I2C=y
> > >  CONFIG_SUPPORT_EMMC_BOOT=y
> > >  CONFIG_MMC_IO_VOLTAGE=y
> > > -CONFIG_SPL_MMC_IO_VOLTAGE=y
> > >  CONFIG_MMC_UHS_SUPPORT=y
> > > -CONFIG_SPL_MMC_UHS_SUPPORT=y
> > >  CONFIG_MMC_HS400_ES_SUPPORT=y
> > >  CONFIG_MMC_HS400_SUPPORT=y
> > > -CONFIG_SPL_MMC_HS400_SUPPORT=y
> > >  CONFIG_FSL_USDHC=y
> > >  CONFIG_MTD=y
> > >  CONFIG_DM_MTD=y
> > > @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
> > >  CONFIG_POWER_DOMAIN=y
> > >  CONFIG_IMX8M_POWER_DOMAIN=y
> > >  CONFIG_DM_PMIC=y
> > > +# CONFIG_SPL_PMIC_CHILDREN is not set
> > >  CONFIG_DM_PMIC_BD71837=y
> > >  CONFIG_SPL_DM_PMIC_BD71837=y
> > >  CONFIG_DM_REGULATOR=y
> > > -CONFIG_SPL_DM_REGULATOR=y
> > >  CONFIG_DM_REGULATOR_BD71837=y
> > > -CONFIG_SPL_DM_REGULATOR_BD71837=y
> > >  CONFIG_DM_REGULATOR_FIXED=y
> > > -CONFIG_SPL_DM_REGULATOR_FIXED=y
> > >  CONFIG_DM_REGULATOR_GPIO=y
> > >  CONFIG_DM_SERIAL=y
> > >  CONFIG_MXC_UART=y
> > > --
> > > 2.34.1
> > >
> >
> > Adam,
> >
> > I'm looking at your patches as I'm also trying to strip down the
> > imx8mm-venice SPL so that I can fit DM USB support. It seems that
> > all/most of the imx8m boards have a spl_board_init() which calls
> > arch_misc_init(). I'm curious why your not calling that function?
>
> As of right now, we're not using the CAAM which is initialized in
> arch_misc_init.  If/When we do, we'll likely have to pull that in.
>

ok - makes sense.

> >
> > Another config that I've found to save a lot of space for imx8m
> > without any negative impact I can see is CONFIG_SPL_MMC_TINY=y
>
> I experimented a bit with that too, but I hadn't fully tested
> switching between booting between MMC1 and MMC2, so I wasn't quite
> ready to enable it, but I'll spend some more time with it to see how
> much more space I can shave off SPL.
> Getting rid of the PMIC children in SPL helped me quite a bit.

I see. It appears to save about 2K and Fabio's imx8mm clk reduction
series that made it in saves another 800 bytes or so.

Regardless I'm still oversize for imx8mm-venice by 2K bytes and
looking for things to prune. My issue is that I have 4 DRAM configs to
support which suck up 3K each I believe.

Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-24 20:47     ` Tim Harvey
@ 2022-10-24 20:51       ` Adam Ford
  2022-10-24 20:56         ` Tim Harvey
  2022-10-25  1:29       ` Peng Fan
  1 sibling, 1 reply; 16+ messages in thread
From: Adam Ford @ 2022-10-24 20:51 UTC (permalink / raw)
  To: Tim Harvey; +Cc: u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team

On Mon, Oct 24, 2022 at 3:47 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> On Mon, Oct 24, 2022 at 1:26 PM Adam Ford <aford173@gmail.com> wrote:
> >
> > On Mon, Oct 24, 2022 at 2:57 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > >
> > > On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
> > > >
> > > > There are a few functions which are not essential for use in
> > > > SPL, but they take up enough space to make other preferred
> > > > features not fit.  Remove the extras.
> > > >
> > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > >
> > > > diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> > > > index a93cc93878..b0e9d918da 100644
> > > > --- a/board/beacon/imx8mm/spl.c
> > > > +++ b/board/beacon/imx8mm/spl.c
> > > > @@ -44,11 +44,6 @@ static void spl_dram_init(void)
> > > >         ddr_init(&dram_timing);
> > > >  }
> > > >
> > > > -void spl_board_init(void)
> > > > -{
> > > > -       debug("Normal Boot\n");
> > > > -}
> > > > -
> > > >  #ifdef CONFIG_SPL_LOAD_FIT
> > > >  int board_fit_config_name_match(const char *name)
> > > >  {
> > > > diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> > > > index e37ce01c19..f6a1012d8a 100644
> > > > --- a/configs/imx8mm_beacon_defconfig
> > > > +++ b/configs/imx8mm_beacon_defconfig
> > > > @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
> > > >  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> > > >  CONFIG_SPL_BSS_START_ADDR=0x910000
> > > >  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> > > > -CONFIG_SPL_BOARD_INIT=y
> > > >  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> > > >  CONFIG_SPL_STACK=0x920000
> > > >  CONFIG_SYS_SPL_MALLOC=y
> > > > @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
> > > >  CONFIG_DM_I2C=y
> > > >  CONFIG_SUPPORT_EMMC_BOOT=y
> > > >  CONFIG_MMC_IO_VOLTAGE=y
> > > > -CONFIG_SPL_MMC_IO_VOLTAGE=y
> > > >  CONFIG_MMC_UHS_SUPPORT=y
> > > > -CONFIG_SPL_MMC_UHS_SUPPORT=y
> > > >  CONFIG_MMC_HS400_ES_SUPPORT=y
> > > >  CONFIG_MMC_HS400_SUPPORT=y
> > > > -CONFIG_SPL_MMC_HS400_SUPPORT=y
> > > >  CONFIG_FSL_USDHC=y
> > > >  CONFIG_MTD=y
> > > >  CONFIG_DM_MTD=y
> > > > @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
> > > >  CONFIG_POWER_DOMAIN=y
> > > >  CONFIG_IMX8M_POWER_DOMAIN=y
> > > >  CONFIG_DM_PMIC=y
> > > > +# CONFIG_SPL_PMIC_CHILDREN is not set
> > > >  CONFIG_DM_PMIC_BD71837=y
> > > >  CONFIG_SPL_DM_PMIC_BD71837=y
> > > >  CONFIG_DM_REGULATOR=y
> > > > -CONFIG_SPL_DM_REGULATOR=y
> > > >  CONFIG_DM_REGULATOR_BD71837=y
> > > > -CONFIG_SPL_DM_REGULATOR_BD71837=y
> > > >  CONFIG_DM_REGULATOR_FIXED=y
> > > > -CONFIG_SPL_DM_REGULATOR_FIXED=y
> > > >  CONFIG_DM_REGULATOR_GPIO=y
> > > >  CONFIG_DM_SERIAL=y
> > > >  CONFIG_MXC_UART=y
> > > > --
> > > > 2.34.1
> > > >
> > >
> > > Adam,
> > >
> > > I'm looking at your patches as I'm also trying to strip down the
> > > imx8mm-venice SPL so that I can fit DM USB support. It seems that
> > > all/most of the imx8m boards have a spl_board_init() which calls
> > > arch_misc_init(). I'm curious why your not calling that function?
> >
> > As of right now, we're not using the CAAM which is initialized in
> > arch_misc_init.  If/When we do, we'll likely have to pull that in.
> >
>
> ok - makes sense.
>
> > >
> > > Another config that I've found to save a lot of space for imx8m
> > > without any negative impact I can see is CONFIG_SPL_MMC_TINY=y
> >
> > I experimented a bit with that too, but I hadn't fully tested
> > switching between booting between MMC1 and MMC2, so I wasn't quite
> > ready to enable it, but I'll spend some more time with it to see how
> > much more space I can shave off SPL.
> > Getting rid of the PMIC children in SPL helped me quite a bit.
>
> I see. It appears to save about 2K and Fabio's imx8mm clk reduction
> series that made it in saves another 800 bytes or so.
>
> Regardless I'm still oversize for imx8mm-venice by 2K bytes and
> looking for things to prune. My issue is that I have 4 DRAM configs to
> support which suck up 3K each I believe.

Can you split the DRAM configs into different _defconfig files so only
the DRAM config you want is built-in?

adam
>
> Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-24 20:51       ` Adam Ford
@ 2022-10-24 20:56         ` Tim Harvey
  0 siblings, 0 replies; 16+ messages in thread
From: Tim Harvey @ 2022-10-24 20:56 UTC (permalink / raw)
  To: Adam Ford; +Cc: u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team

On Mon, Oct 24, 2022 at 1:52 PM Adam Ford <aford173@gmail.com> wrote:
>
> On Mon, Oct 24, 2022 at 3:47 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > On Mon, Oct 24, 2022 at 1:26 PM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > On Mon, Oct 24, 2022 at 2:57 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > > >
> > > > On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
> > > > >
> > > > > There are a few functions which are not essential for use in
> > > > > SPL, but they take up enough space to make other preferred
> > > > > features not fit.  Remove the extras.
> > > > >
> > > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > >
> > > > > diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> > > > > index a93cc93878..b0e9d918da 100644
> > > > > --- a/board/beacon/imx8mm/spl.c
> > > > > +++ b/board/beacon/imx8mm/spl.c
> > > > > @@ -44,11 +44,6 @@ static void spl_dram_init(void)
> > > > >         ddr_init(&dram_timing);
> > > > >  }
> > > > >
> > > > > -void spl_board_init(void)
> > > > > -{
> > > > > -       debug("Normal Boot\n");
> > > > > -}
> > > > > -
> > > > >  #ifdef CONFIG_SPL_LOAD_FIT
> > > > >  int board_fit_config_name_match(const char *name)
> > > > >  {
> > > > > diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> > > > > index e37ce01c19..f6a1012d8a 100644
> > > > > --- a/configs/imx8mm_beacon_defconfig
> > > > > +++ b/configs/imx8mm_beacon_defconfig
> > > > > @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
> > > > >  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> > > > >  CONFIG_SPL_BSS_START_ADDR=0x910000
> > > > >  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> > > > > -CONFIG_SPL_BOARD_INIT=y
> > > > >  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> > > > >  CONFIG_SPL_STACK=0x920000
> > > > >  CONFIG_SYS_SPL_MALLOC=y
> > > > > @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
> > > > >  CONFIG_DM_I2C=y
> > > > >  CONFIG_SUPPORT_EMMC_BOOT=y
> > > > >  CONFIG_MMC_IO_VOLTAGE=y
> > > > > -CONFIG_SPL_MMC_IO_VOLTAGE=y
> > > > >  CONFIG_MMC_UHS_SUPPORT=y
> > > > > -CONFIG_SPL_MMC_UHS_SUPPORT=y
> > > > >  CONFIG_MMC_HS400_ES_SUPPORT=y
> > > > >  CONFIG_MMC_HS400_SUPPORT=y
> > > > > -CONFIG_SPL_MMC_HS400_SUPPORT=y
> > > > >  CONFIG_FSL_USDHC=y
> > > > >  CONFIG_MTD=y
> > > > >  CONFIG_DM_MTD=y
> > > > > @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
> > > > >  CONFIG_POWER_DOMAIN=y
> > > > >  CONFIG_IMX8M_POWER_DOMAIN=y
> > > > >  CONFIG_DM_PMIC=y
> > > > > +# CONFIG_SPL_PMIC_CHILDREN is not set
> > > > >  CONFIG_DM_PMIC_BD71837=y
> > > > >  CONFIG_SPL_DM_PMIC_BD71837=y
> > > > >  CONFIG_DM_REGULATOR=y
> > > > > -CONFIG_SPL_DM_REGULATOR=y
> > > > >  CONFIG_DM_REGULATOR_BD71837=y
> > > > > -CONFIG_SPL_DM_REGULATOR_BD71837=y
> > > > >  CONFIG_DM_REGULATOR_FIXED=y
> > > > > -CONFIG_SPL_DM_REGULATOR_FIXED=y
> > > > >  CONFIG_DM_REGULATOR_GPIO=y
> > > > >  CONFIG_DM_SERIAL=y
> > > > >  CONFIG_MXC_UART=y
> > > > > --
> > > > > 2.34.1
> > > > >
> > > >
> > > > Adam,
> > > >
> > > > I'm looking at your patches as I'm also trying to strip down the
> > > > imx8mm-venice SPL so that I can fit DM USB support. It seems that
> > > > all/most of the imx8m boards have a spl_board_init() which calls
> > > > arch_misc_init(). I'm curious why your not calling that function?
> > >
> > > As of right now, we're not using the CAAM which is initialized in
> > > arch_misc_init.  If/When we do, we'll likely have to pull that in.
> > >
> >
> > ok - makes sense.
> >
> > > >
> > > > Another config that I've found to save a lot of space for imx8m
> > > > without any negative impact I can see is CONFIG_SPL_MMC_TINY=y
> > >
> > > I experimented a bit with that too, but I hadn't fully tested
> > > switching between booting between MMC1 and MMC2, so I wasn't quite
> > > ready to enable it, but I'll spend some more time with it to see how
> > > much more space I can shave off SPL.
> > > Getting rid of the PMIC children in SPL helped me quite a bit.
> >
> > I see. It appears to save about 2K and Fabio's imx8mm clk reduction
> > series that made it in saves another 800 bytes or so.
> >
> > Regardless I'm still oversize for imx8mm-venice by 2K bytes and
> > looking for things to prune. My issue is that I have 4 DRAM configs to
> > support which suck up 3K each I believe.
>
> Can you split the DRAM configs into different _defconfig files so only
> the DRAM config you want is built-in?
>

Yes that would work but I hate adding multiple firmware images. I
already have issues with users selecting the wrong firmware between
imx8mm/n/p as it is.

I'm thinking I should be able to move dram configs to binman blobs
like was recently done with the ddr4 training blobs.

Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-24 20:47     ` Tim Harvey
  2022-10-24 20:51       ` Adam Ford
@ 2022-10-25  1:29       ` Peng Fan
  2022-10-25 15:51         ` Tim Harvey
  1 sibling, 1 reply; 16+ messages in thread
From: Peng Fan @ 2022-10-25  1:29 UTC (permalink / raw)
  To: Tim Harvey, Adam Ford; +Cc: u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team



On 10/25/2022 4:47 AM, Tim Harvey wrote:
> On Mon, Oct 24, 2022 at 1:26 PM Adam Ford <aford173@gmail.com> wrote:
>>
>> On Mon, Oct 24, 2022 at 2:57 PM Tim Harvey <tharvey@gateworks.com> wrote:
>>>
>>> On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
>>>>
>>>> There are a few functions which are not essential for use in
>>>> SPL, but they take up enough space to make other preferred
>>>> features not fit.  Remove the extras.
>>>>
>>>> Signed-off-by: Adam Ford <aford173@gmail.com>
>>>>
>>>> diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
>>>> index a93cc93878..b0e9d918da 100644
>>>> --- a/board/beacon/imx8mm/spl.c
>>>> +++ b/board/beacon/imx8mm/spl.c
>>>> @@ -44,11 +44,6 @@ static void spl_dram_init(void)
>>>>          ddr_init(&dram_timing);
>>>>   }
>>>>
>>>> -void spl_board_init(void)
>>>> -{
>>>> -       debug("Normal Boot\n");
>>>> -}
>>>> -
>>>>   #ifdef CONFIG_SPL_LOAD_FIT
>>>>   int board_fit_config_name_match(const char *name)
>>>>   {
>>>> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
>>>> index e37ce01c19..f6a1012d8a 100644
>>>> --- a/configs/imx8mm_beacon_defconfig
>>>> +++ b/configs/imx8mm_beacon_defconfig
>>>> @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
>>>>   CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
>>>>   CONFIG_SPL_BSS_START_ADDR=0x910000
>>>>   CONFIG_SPL_BSS_MAX_SIZE=0x2000
>>>> -CONFIG_SPL_BOARD_INIT=y
>>>>   # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
>>>>   CONFIG_SPL_STACK=0x920000
>>>>   CONFIG_SYS_SPL_MALLOC=y
>>>> @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
>>>>   CONFIG_DM_I2C=y
>>>>   CONFIG_SUPPORT_EMMC_BOOT=y
>>>>   CONFIG_MMC_IO_VOLTAGE=y
>>>> -CONFIG_SPL_MMC_IO_VOLTAGE=y
>>>>   CONFIG_MMC_UHS_SUPPORT=y
>>>> -CONFIG_SPL_MMC_UHS_SUPPORT=y
>>>>   CONFIG_MMC_HS400_ES_SUPPORT=y
>>>>   CONFIG_MMC_HS400_SUPPORT=y
>>>> -CONFIG_SPL_MMC_HS400_SUPPORT=y
>>>>   CONFIG_FSL_USDHC=y
>>>>   CONFIG_MTD=y
>>>>   CONFIG_DM_MTD=y
>>>> @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
>>>>   CONFIG_POWER_DOMAIN=y
>>>>   CONFIG_IMX8M_POWER_DOMAIN=y
>>>>   CONFIG_DM_PMIC=y
>>>> +# CONFIG_SPL_PMIC_CHILDREN is not set
>>>>   CONFIG_DM_PMIC_BD71837=y
>>>>   CONFIG_SPL_DM_PMIC_BD71837=y
>>>>   CONFIG_DM_REGULATOR=y
>>>> -CONFIG_SPL_DM_REGULATOR=y
>>>>   CONFIG_DM_REGULATOR_BD71837=y
>>>> -CONFIG_SPL_DM_REGULATOR_BD71837=y
>>>>   CONFIG_DM_REGULATOR_FIXED=y
>>>> -CONFIG_SPL_DM_REGULATOR_FIXED=y
>>>>   CONFIG_DM_REGULATOR_GPIO=y
>>>>   CONFIG_DM_SERIAL=y
>>>>   CONFIG_MXC_UART=y
>>>> --
>>>> 2.34.1
>>>>
>>>
>>> Adam,
>>>
>>> I'm looking at your patches as I'm also trying to strip down the
>>> imx8mm-venice SPL so that I can fit DM USB support. It seems that
>>> all/most of the imx8m boards have a spl_board_init() which calls
>>> arch_misc_init(). I'm curious why your not calling that function?
>>
>> As of right now, we're not using the CAAM which is initialized in
>> arch_misc_init.  If/When we do, we'll likely have to pull that in.
>>
> 
> ok - makes sense.
> 
>>>
>>> Another config that I've found to save a lot of space for imx8m
>>> without any negative impact I can see is CONFIG_SPL_MMC_TINY=y
>>
>> I experimented a bit with that too, but I hadn't fully tested
>> switching between booting between MMC1 and MMC2, so I wasn't quite
>> ready to enable it, but I'll spend some more time with it to see how
>> much more space I can shave off SPL.
>> Getting rid of the PMIC children in SPL helped me quite a bit.
> 
> I see. It appears to save about 2K and Fabio's imx8mm clk reduction
> series that made it in saves another 800 bytes or so.
> 
> Regardless I'm still oversize for imx8mm-venice by 2K bytes and
> looking for things to prune. My issue is that I have 4 DRAM configs to
> support which suck up 3K each I believe.

Why has so many DRAM configs? Use one image to support multiple boards?

Regards,
Peng.

> 
> Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-25  1:29       ` Peng Fan
@ 2022-10-25 15:51         ` Tim Harvey
  0 siblings, 0 replies; 16+ messages in thread
From: Tim Harvey @ 2022-10-25 15:51 UTC (permalink / raw)
  To: Peng Fan; +Cc: Adam Ford, u-boot, sbabic, Fabio Estevam, NXP i.MX U-Boot Team

On Mon, Oct 24, 2022 at 6:29 PM Peng Fan <peng.fan@oss.nxp.com> wrote:
>
>
>
> On 10/25/2022 4:47 AM, Tim Harvey wrote:
> > On Mon, Oct 24, 2022 at 1:26 PM Adam Ford <aford173@gmail.com> wrote:
> >>
> >> On Mon, Oct 24, 2022 at 2:57 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >>>
> >>> On Sat, Oct 22, 2022 at 7:28 AM Adam Ford <aford173@gmail.com> wrote:
> >>>>
> >>>> There are a few functions which are not essential for use in
> >>>> SPL, but they take up enough space to make other preferred
> >>>> features not fit.  Remove the extras.
> >>>>
> >>>> Signed-off-by: Adam Ford <aford173@gmail.com>
> >>>>
> >>>> diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> >>>> index a93cc93878..b0e9d918da 100644
> >>>> --- a/board/beacon/imx8mm/spl.c
> >>>> +++ b/board/beacon/imx8mm/spl.c
> >>>> @@ -44,11 +44,6 @@ static void spl_dram_init(void)
> >>>>          ddr_init(&dram_timing);
> >>>>   }
> >>>>
> >>>> -void spl_board_init(void)
> >>>> -{
> >>>> -       debug("Normal Boot\n");
> >>>> -}
> >>>> -
> >>>>   #ifdef CONFIG_SPL_LOAD_FIT
> >>>>   int board_fit_config_name_match(const char *name)
> >>>>   {
> >>>> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> >>>> index e37ce01c19..f6a1012d8a 100644
> >>>> --- a/configs/imx8mm_beacon_defconfig
> >>>> +++ b/configs/imx8mm_beacon_defconfig
> >>>> @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
> >>>>   CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
> >>>>   CONFIG_SPL_BSS_START_ADDR=0x910000
> >>>>   CONFIG_SPL_BSS_MAX_SIZE=0x2000
> >>>> -CONFIG_SPL_BOARD_INIT=y
> >>>>   # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> >>>>   CONFIG_SPL_STACK=0x920000
> >>>>   CONFIG_SYS_SPL_MALLOC=y
> >>>> @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
> >>>>   CONFIG_DM_I2C=y
> >>>>   CONFIG_SUPPORT_EMMC_BOOT=y
> >>>>   CONFIG_MMC_IO_VOLTAGE=y
> >>>> -CONFIG_SPL_MMC_IO_VOLTAGE=y
> >>>>   CONFIG_MMC_UHS_SUPPORT=y
> >>>> -CONFIG_SPL_MMC_UHS_SUPPORT=y
> >>>>   CONFIG_MMC_HS400_ES_SUPPORT=y
> >>>>   CONFIG_MMC_HS400_SUPPORT=y
> >>>> -CONFIG_SPL_MMC_HS400_SUPPORT=y
> >>>>   CONFIG_FSL_USDHC=y
> >>>>   CONFIG_MTD=y
> >>>>   CONFIG_DM_MTD=y
> >>>> @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
> >>>>   CONFIG_POWER_DOMAIN=y
> >>>>   CONFIG_IMX8M_POWER_DOMAIN=y
> >>>>   CONFIG_DM_PMIC=y
> >>>> +# CONFIG_SPL_PMIC_CHILDREN is not set
> >>>>   CONFIG_DM_PMIC_BD71837=y
> >>>>   CONFIG_SPL_DM_PMIC_BD71837=y
> >>>>   CONFIG_DM_REGULATOR=y
> >>>> -CONFIG_SPL_DM_REGULATOR=y
> >>>>   CONFIG_DM_REGULATOR_BD71837=y
> >>>> -CONFIG_SPL_DM_REGULATOR_BD71837=y
> >>>>   CONFIG_DM_REGULATOR_FIXED=y
> >>>> -CONFIG_SPL_DM_REGULATOR_FIXED=y
> >>>>   CONFIG_DM_REGULATOR_GPIO=y
> >>>>   CONFIG_DM_SERIAL=y
> >>>>   CONFIG_MXC_UART=y
> >>>> --
> >>>> 2.34.1
> >>>>
> >>>
> >>> Adam,
> >>>
> >>> I'm looking at your patches as I'm also trying to strip down the
> >>> imx8mm-venice SPL so that I can fit DM USB support. It seems that
> >>> all/most of the imx8m boards have a spl_board_init() which calls
> >>> arch_misc_init(). I'm curious why your not calling that function?
> >>
> >> As of right now, we're not using the CAAM which is initialized in
> >> arch_misc_init.  If/When we do, we'll likely have to pull that in.
> >>
> >
> > ok - makes sense.
> >
> >>>
> >>> Another config that I've found to save a lot of space for imx8m
> >>> without any negative impact I can see is CONFIG_SPL_MMC_TINY=y
> >>
> >> I experimented a bit with that too, but I hadn't fully tested
> >> switching between booting between MMC1 and MMC2, so I wasn't quite
> >> ready to enable it, but I'll spend some more time with it to see how
> >> much more space I can shave off SPL.
> >> Getting rid of the PMIC children in SPL helped me quite a bit.
> >
> > I see. It appears to save about 2K and Fabio's imx8mm clk reduction
> > series that made it in saves another 800 bytes or so.
> >
> > Regardless I'm still oversize for imx8mm-venice by 2K bytes and
> > looking for things to prune. My issue is that I have 4 DRAM configs to
> > support which suck up 3K each I believe.
>
> Why has so many DRAM configs? Use one image to support multiple boards?
>
> Regards,
> Peng.
>

Peng,

Yes, imx8mm_venice_defconfig covers 6 different dtbs and 4 different
DRAM configs (512MiB, 1GiB, 2GiB, 4GiB) which bloats the SPL to the
point that I can't add SDP support... specifically DM USB.

Tim

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  2022-10-22 14:28 [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Adam Ford
                   ` (3 preceding siblings ...)
  2022-10-24 19:57 ` Tim Harvey
@ 2022-11-08 16:37 ` sbabic
  4 siblings, 0 replies; 16+ messages in thread
From: sbabic @ 2022-11-08 16:37 UTC (permalink / raw)
  To: Adam Ford, u-boot

> There are a few functions which are not essential for use in
> SPL, but they take up enough space to make other preferred
> features not fit.  Remove the extras.
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Fabio Estevam <festevam@denx.de>
> diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> index a93cc93878..b0e9d918da 100644
> --- a/board/beacon/imx8mm/spl.c
> +++ b/board/beacon/imx8mm/spl.c
> @@ -44,11 +44,6 @@ static void spl_dram_init(void)
>  	ddr_init(&dram_timing);
>  }
>  
> -void spl_board_init(void)
> -{
> -	debug("Normal Boot\n");
> -}
> -
>  #ifdef CONFIG_SPL_LOAD_FIT
>  int board_fit_config_name_match(const char *name)
>  {
> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> index e37ce01c19..f6a1012d8a 100644
> --- a/configs/imx8mm_beacon_defconfig
> +++ b/configs/imx8mm_beacon_defconfig
> @@ -29,7 +29,6 @@ CONFIG_DEFAULT_FDT_FILE="imx8mm-beacon-kit.dtb"
>  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
>  CONFIG_SPL_BSS_START_ADDR=0x910000
>  CONFIG_SPL_BSS_MAX_SIZE=0x2000
> -CONFIG_SPL_BOARD_INIT=y
>  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
>  CONFIG_SPL_STACK=0x920000
>  CONFIG_SYS_SPL_MALLOC=y
> @@ -88,12 +87,9 @@ CONFIG_DM_PCA953X=y
>  CONFIG_DM_I2C=y
>  CONFIG_SUPPORT_EMMC_BOOT=y
>  CONFIG_MMC_IO_VOLTAGE=y
> -CONFIG_SPL_MMC_IO_VOLTAGE=y
>  CONFIG_MMC_UHS_SUPPORT=y
> -CONFIG_SPL_MMC_UHS_SUPPORT=y
>  CONFIG_MMC_HS400_ES_SUPPORT=y
>  CONFIG_MMC_HS400_SUPPORT=y
> -CONFIG_SPL_MMC_HS400_SUPPORT=y
>  CONFIG_FSL_USDHC=y
>  CONFIG_MTD=y
>  CONFIG_DM_MTD=y
> @@ -113,14 +109,12 @@ CONFIG_PINCTRL_IMX8M=y
>  CONFIG_POWER_DOMAIN=y
>  CONFIG_IMX8M_POWER_DOMAIN=y
>  CONFIG_DM_PMIC=y
> +# CONFIG_SPL_PMIC_CHILDREN is not set
>  CONFIG_DM_PMIC_BD71837=y
>  CONFIG_SPL_DM_PMIC_BD71837=y
>  CONFIG_DM_REGULATOR=y
> -CONFIG_SPL_DM_REGULATOR=y
>  CONFIG_DM_REGULATOR_BD71837=y
> -CONFIG_SPL_DM_REGULATOR_BD71837=y
>  CONFIG_DM_REGULATOR_FIXED=y
> -CONFIG_SPL_DM_REGULATOR_FIXED=y
>  CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_DM_SERIAL=y
>  CONFIG_MXC_UART=y
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2
  2022-10-22 14:28 ` [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2 Adam Ford
  2022-10-22 15:13   ` Fabio Estevam
@ 2022-11-08 16:37   ` sbabic
  1 sibling, 0 replies; 16+ messages in thread
From: sbabic @ 2022-11-08 16:37 UTC (permalink / raw)
  To: Adam Ford, u-boot

> The downstream U-Boot distributed by Beacon stores the environment
> in the eMMC and the end of partition 2.  This allow the environment
> to stay on the SOM regardless of the boot source.
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Fabio Estevam <festevam@denx.de>
> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> index 90a623515e..4dd87914b8 100644
> --- a/configs/imx8mm_beacon_defconfig
> +++ b/configs/imx8mm_beacon_defconfig
> @@ -5,8 +5,8 @@ CONFIG_SYS_MALLOC_LEN=0x2000000
>  CONFIG_SPL_GPIO=y
>  CONFIG_SPL_LIBCOMMON_SUPPORT=y
>  CONFIG_SPL_LIBGENERIC_SUPPORT=y
> -CONFIG_ENV_SIZE=0x1000
> -CONFIG_ENV_OFFSET=0x400000
> +CONFIG_ENV_SIZE=0x2000
> +CONFIG_ENV_OFFSET=0xFFFFDE00
>  CONFIG_DM_GPIO=y
>  CONFIG_DEFAULT_DEVICE_TREE="imx8mm-beacon-kit"
>  CONFIG_SPL_TEXT_BASE=0x7E1000
> @@ -76,7 +76,8 @@ CONFIG_SPL_OF_CONTROL=y
>  CONFIG_ENV_OVERWRITE=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> -CONFIG_SYS_MMC_ENV_DEV=1
> +CONFIG_SYS_MMC_ENV_DEV=2
> +CONFIG_SYS_MMC_ENV_PART=2
>  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
>  CONFIG_USE_ETHPRIME=y
>  CONFIG_ETHPRIME="FEC"
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP
  2022-10-22 14:28 ` [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP Adam Ford
  2022-10-22 15:12   ` Fabio Estevam
@ 2022-11-08 16:39   ` sbabic
  1 sibling, 0 replies; 16+ messages in thread
From: sbabic @ 2022-11-08 16:39 UTC (permalink / raw)
  To: Adam Ford, u-boot

> In order to boot over USB, the device tree needs to enable
> a few extra nodes in SPL.  Since the USB driver has the
> ability to detect host/device, the dr_mode can be removed
> from the device tree since it needs to act as a device when
> booting and OTG is the default mode.  Add USB boot support
> to spl_board_boot_device and enable the corresponding config
> options.
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Fabio Estevam <festevam@denx.de>
> diff --git a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
> index c94b4ffa4c..00ac413f36 100644
> --- a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
> +++ b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
> @@ -13,6 +13,10 @@
>  	};
>  };
>  
> +&aips4 {
> +	u-boot,dm-spl;
> +};
> +
>  &reg_usdhc2_vmmc {
>  	u-boot,off-on-delay-us = <20000>;
>  };
> @@ -77,12 +81,24 @@
>  	u-boot,dm-spl;
>  };
>  
> +&reg_usbotg1 {
> +
> +};
> +
>  &uart2 {
>  	u-boot,dm-spl;
>  };
>  
> +&usbmisc1 {
> +	u-boot,dm-spl;
> +};
> +
>  &usbotg1 {
> -	dr_mode="host";
> +	u-boot,dm-spl;
> +};
> +
> +&usbphynop1 {
> +	u-boot,dm-spl;
>  };
>  
>  &usdhc2 {
> diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> index b0e9d918da..a5f337aa17 100644
> --- a/board/beacon/imx8mm/spl.c
> +++ b/board/beacon/imx8mm/spl.c
> @@ -34,6 +34,8 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
>  	case SD3_BOOT:
>  	case MMC3_BOOT:
>  		return BOOT_DEVICE_MMC2;
> +	case USB_BOOT:
> +		return BOOT_DEVICE_BOARD;
>  	default:
>  		return BOOT_DEVICE_NONE;
>  	}
> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> index f6a1012d8a..90a623515e 100644
> --- a/configs/imx8mm_beacon_defconfig
> +++ b/configs/imx8mm_beacon_defconfig
> @@ -39,6 +39,9 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
>  CONFIG_SPL_I2C=y
>  CONFIG_SPL_POWER=y
> +CONFIG_SPL_USB_HOST=y
> +CONFIG_SPL_USB_GADGET=y
> +CONFIG_SPL_USB_SDP_SUPPORT=y
>  CONFIG_SPL_WATCHDOG=y
>  CONFIG_HUSH_PARSER=y
>  CONFIG_SYS_MAXARGS=64
> @@ -56,6 +59,7 @@ CONFIG_CMD_MMC=y
>  CONFIG_CMD_PART=y
>  CONFIG_CMD_SPI=y
>  CONFIG_CMD_USB=y
> +CONFIG_CMD_USB_SDP=y
>  CONFIG_CMD_USB_MASS_STORAGE=y
>  CONFIG_CMD_DHCP=y
>  CONFIG_CMD_MII=y
> @@ -103,6 +107,8 @@ CONFIG_PHY_ATHEROS=y
>  CONFIG_PHY_GIGE=y
>  CONFIG_FEC_MXC=y
>  CONFIG_MII=y
> +CONFIG_SPL_PHY=y
> +CONFIG_SPL_NOP_PHY=y
>  CONFIG_PINCTRL=y
>  CONFIG_SPL_PINCTRL=y
>  CONFIG_PINCTRL_IMX8M=y
> @@ -127,12 +133,13 @@ CONFIG_SYSRESET_PSCI=y
>  CONFIG_SYSRESET_WATCHDOG=y
>  CONFIG_DM_THERMAL=y
>  CONFIG_USB=y
> -# CONFIG_SPL_DM_USB is not set
>  CONFIG_USB_EHCI_HCD=y
> +CONFIG_MXC_USB_OTG_HACTIVE=y
>  CONFIG_USB_STORAGE=y
>  CONFIG_USB_GADGET=y
>  CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>  CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>  CONFIG_CI_UDC=y
> +CONFIG_SDP_LOADADDR=0x40400000
>  CONFIG_USB_GADGET_DOWNLOAD=y
>  CONFIG_IMX_WATCHDOG=y
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-11-08 16:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22 14:28 [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Adam Ford
2022-10-22 14:28 ` [PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP Adam Ford
2022-10-22 15:12   ` Fabio Estevam
2022-11-08 16:39   ` sbabic
2022-10-22 14:28 ` [PATCH 3/3] imx: imx8mm-beacon: Move Environment to eMMC partition 2 Adam Ford
2022-10-22 15:13   ` Fabio Estevam
2022-11-08 16:37   ` sbabic
2022-10-22 15:11 ` [PATCH 1/3] imx: imx8mm_beacon: Eliminate a few extras to free up SPL space Fabio Estevam
2022-10-24 19:57 ` Tim Harvey
2022-10-24 20:26   ` Adam Ford
2022-10-24 20:47     ` Tim Harvey
2022-10-24 20:51       ` Adam Ford
2022-10-24 20:56         ` Tim Harvey
2022-10-25  1:29       ` Peng Fan
2022-10-25 15:51         ` Tim Harvey
2022-11-08 16:37 ` sbabic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.