Skip to contentSkip to conversation

arm64: binman: use binman symbols for imx

PATCH In review Peng Fan (OSS) 5 participants 35 messages Jun 3, 2022 – Jun 18, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm64: binman: use binman symbols for imx

From: Peng Fan <[email protected]>

V6:
Drop no-u-boot-any introduced in V5
Drop binman symbol replacement with @ to _, which is not needed Update imx8m config to not select RAM IMAGE and RAM DEVICE Update ddr firmware node name
Introduce autoconf.h for binman test

V5:
Introduce no-u-boot-any property to drop the X86 guard patch 1 Add blob-ext type for ddr firmware node
Include a missing dts change

V4:
Fix three boards build failure

V3:
Add R-b/T-b
Fix build warning

V2:
resolve some CI failure
include patch 7

binman symbol is a good feature, but only used on X86 for now. This patchset is to use it for i.MX8M platform.

The current imx8m ddr phy firmware consumes lots of space, because we pad them to the largest 32KB and 16KB for IMEM and DMEM.

With this patchset we use binman symbols to get firmware location and size, we could save near 36KB with i.MX8MP-EVK.

Please help check and test

Peng Fan (8):
spl: Kconfig: not select SPL_RAW_IMAGE_SUPPORT for i.MX8M
configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE
arm: dts: imx8m: update binman ddr firmware node name
armv8: u-boot-spl.lds: mark __image_copy_start as symbol
ddr: imx8m: helper: load ddr firmware according to binman symbols
arm: dts: imx8m: shrink ddr firmware size to actual file size
binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
imx: imx8mm-icore: migrate to use BINMAN

 arch/arm/cpu/armv8/u-boot-spl.lds             |  2 +-
 arch/arm/dts/imx8mm-u-boot.dtsi               | 16 +++---
 arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi    | 20 +++++---
 .../dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi  |  8 +--
 arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi      | 20 +++++---
 arch/arm/dts/imx8mn-evk-u-boot.dtsi           | 20 +++++---
 .../dts/imx8mn-var-som-symphony-u-boot.dtsi   | 16 +++---
 arch/arm/dts/imx8mn-venice-u-boot.dtsi        | 16 +++---
 arch/arm/dts/imx8mp-u-boot.dtsi               | 20 +++++---
 arch/arm/dts/imx8mq-cm-u-boot.dtsi            | 20 +++++---
 arch/arm/dts/imx8mq-u-boot.dtsi               | 16 +++---
 arch/arm/mach-imx/imx8m/Kconfig               |  1 +
 .../mach-imx/imx8m/imximage-8mm-lpddr4.cfg    | 10 +---
 common/spl/Kconfig                            |  1 +
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |  2 +-
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |  2 +-
 configs/imx8mm_data_modul_edm_sbc_defconfig   |  2 -
 drivers/ddr/imx/imx8m/helper.c                | 51 ++++++++++++++++---
 include/binman_sym.h                          |  2 +-
 tools/binman/test/Makefile                    |  2 +-
 tools/binman/test/generated/autoconf.h        |  3 ++
 tools/binman/test/u_boot_binman_syms.c        |  2 +-
 tools/binman/test/u_boot_binman_syms_size.c   |  2 +-
 23 files changed, 152 insertions(+), 102 deletions(-)
 create mode 100644 tools/binman/test/generated/autoconf.h
Signature · 1 line
2.36.0
#1 lore raw

PATCH 1/8 spl: Kconfig: not select SPL_RAW_IMAGE_SUPPORT for i.MX8M

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_IMAGE_SUPPORT

---
 common/spl/Kconfig | 1 +
 1 file changed, 1 insertion(+)
common/spl/Kconfig +1 -0
index 50ff113cab2..63ebc09ee0a 100644
@@ -219,6 +219,7 @@ config SPL_BOOTCOUNT_LIMIT
 config SPL_RAW_IMAGE_SUPPORT
 	bool "Support SPL loading and booting of RAW images"
 	default n if (ARCH_MX6 && (SPL_MMC || SPL_SATA))
+	default n if ARCH_IMX8M
 	default y
 	depends on !TI_SECURE_DEVICE
 	help
Signature · 1 line
2.36.0
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] spl: Kconfig: not select SPL_RAW_IMAGE_SUPPORT for i.MX8M

Quoted 7 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_IMAGE_SUPPORT

Signature · 1 line
Tom
Reviewed-by on v1 1/8
#3 lore raw

Re: [PATCH 1/8] spl: Kconfig: not select SPL_RAW_IMAGE_SUPPORT for i.MX8M

In reply to Peng Fan (OSS)
Quoted 10 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_IMAGE_SUPPORT

---
 common/spl/Kconfig | 1 +
 1 file changed, 1 insertion(+)
#4 lore raw

PATCH 2/8 configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

---
 configs/imx8mm_data_modul_edm_sbc_defconfig | 2 --
 1 file changed, 2 deletions(-)
configs/imx8mm_data_modul_edm_sbc_defconfig +0 -2
index d55efa6d00e..20ee9877539 100644
@@ -48,8 +48,6 @@ 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_RAM_SUPPORT=y
-CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_HUSH_PARSER=y
Signature · 1 line
2.36.0
Reviewed-by on v1 2/8
#5 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 10 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

---
 configs/imx8mm_data_modul_edm_sbc_defconfig | 2 --
 1 file changed, 2 deletions(-)
#6 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

In reply to Peng Fan (OSS)
Quoted 5 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

Is it RAW device/image or RAM device/image ? There seem to be some confusion here. It also seems this might break start of U-Boot by JTAG upload, right ?

#7 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 10 lines · Marek Vasut
Quoted 5 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

Is it RAW device/image or RAM device/image ? There seem to be some confusion here. It also seems this might break start of U-Boot by JTAG upload, right ?

The previous patch disables SPL_RAW_IMAGE_SUPPORT for i.MX8M boards (already disabled for this), this one disables SPL_RAM_DEVICE (was only enabled for this). Both need to be disabled for this series in its current form to avoid a binman symbol-related error, but this commit message suffers from being copy-paste of the previous one.

I don't understand the SPL details much. But I see in spl/spl_ram.c that CONFIG_SPL_RAM_DEVICE associates BOOT_DEVICE_RAM with a function, and running 'git grep' for those doesn't turn up anything related to i.MX or this board. So I guess RAM_DEVICE is actually unused/unusable here and disabling it won't break anything.

#8 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 12 lines · Alper Nebi Yasak
Quoted 10 lines · Marek Vasut
Quoted 5 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

Is it RAW device/image or RAM device/image ? There seem to be some confusion here. It also seems this might break start of U-Boot by JTAG upload, right ?

Quoted 5 lines

The previous patch disables SPL_RAW_IMAGE_SUPPORT for i.MX8M boards (already disabled for this), this one disables SPL_RAM_DEVICE (was only enabled for this). Both need to be disabled for this series in its current form to avoid a binman symbol-related error, but this commit message suffers from being copy-paste of the previous one.

OK, I am really confused now. What binman symbol error ?

Is this some attempt at papering over a bug ?

[...]

#9 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 13 lines · Marek Vasut
Quoted 12 lines · Alper Nebi Yasak
Quoted 10 lines · Marek Vasut
Quoted 5 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

Is it RAW device/image or RAM device/image ? There seem to be some confusion here. It also seems this might break start of U-Boot by JTAG upload, right ?

Quoted 7 lines
Quoted 5 lines

The previous patch disables SPL_RAW_IMAGE_SUPPORT for i.MX8M boards (already disabled for this), this one disables SPL_RAM_DEVICE (was only enabled for this). Both need to be disabled for this series in its current form to avoid a binman symbol-related error, but this commit message suffers from being copy-paste of the previous one.

OK, I am really confused now. What binman symbol error ?

When BINMAN_SYMBOLS is enabled, some binman 'u_boot_any' symbols are declared in common/spl/spl.c. They are marked as 'unused', but if anything actually uses them they survive optimization and show up in the spl/u-boot-spl ELF file. When binman is building an image including a 'u-boot-spl' entry, it sees these symbols and tries to fill them in with appropriate values about 'u-boot'-like entries. If there is no such entry in the same image as the 'u-boot-spl', binman raises an error about this.

In this case, SPL_RAW_IMAGE_SUPPORT and SPL_RAM_DEVICE both enable code that uses the 'u_boot_any' symbols. However, the i.MX8M binman image descriptions try to specify the binman images in a modular way, and one of the images has a 'u-boot-spl' without any 'u-boot'-like entries. Which means enabling the configs ends up triggering the error above.

See my reply to an earlier version [1] (this is actually v6 of this series) about what could be done to solve this properly. Also see previous discussions [2][3] for more info.

[1] Re: [PATCH V4 1/8] spl: guard u_boot_any with X86
https://lore.kernel.org/u-boot/[email protected]/

[2] using binman fails boot
https://lore.kernel.org/u-boot/CAJ+vNU0BZDr2q0ZPQkoQBP1eBhbYmQfJMYraSgOvWXwZ=yFReQ@mail.gmail.com/T/#u

[3] imx8: ls1028a: Drop raw image support
https://lore.kernel.org/u-boot/[email protected]/T/#u

Quoted 1 line

Is this some attempt at papering over a bug ?

Simon recommended disabling SPL_RAW_IMAGE_SUPPORT to resolve this error in the previous discussions [3]. But I'm leaning towards saying yes here, I think it's a workaround to something that should change on the binman side. I'm not exactly sure what or how. Just now I thought maybe we could add a BINMAN_SYMBOLS_FOR_NEXT_PHASE config or so, which would enable the 'u_boot_any' etc. symbols instead of BINMAN_SYMBOLS.

Regardless, I think this version is a good enough step in the right direction and more changes can still be done afterwards, so I'm not asking for a new version.

#10 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 58 lines · Alper Nebi Yasak
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Alper Nebi Yasak
Quoted 10 lines · Marek Vasut
Quoted 5 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

i.MX8M use FIT image, not RAW image. And to support binman symbols, u_boot_any could be optimized if RAW image is not selected, otherwise there will be build failure. So not select SPL_RAW_DEVICE

Is it RAW device/image or RAM device/image ? There seem to be some confusion here. It also seems this might break start of U-Boot by JTAG upload, right ?

Quoted 7 lines
Quoted 5 lines

The previous patch disables SPL_RAW_IMAGE_SUPPORT for i.MX8M boards (already disabled for this), this one disables SPL_RAM_DEVICE (was only enabled for this). Both need to be disabled for this series in its current form to avoid a binman symbol-related error, but this commit message suffers from being copy-paste of the previous one.

OK, I am really confused now. What binman symbol error ?

When BINMAN_SYMBOLS is enabled, some binman 'u_boot_any' symbols are declared in common/spl/spl.c. They are marked as 'unused', but if anything actually uses them they survive optimization and show up in the spl/u-boot-spl ELF file. When binman is building an image including a 'u-boot-spl' entry, it sees these symbols and tries to fill them in with appropriate values about 'u-boot'-like entries. If there is no such entry in the same image as the 'u-boot-spl', binman raises an error about this.

In this case, SPL_RAW_IMAGE_SUPPORT and SPL_RAM_DEVICE both enable code that uses the 'u_boot_any' symbols. However, the i.MX8M binman image descriptions try to specify the binman images in a modular way, and one of the images has a 'u-boot-spl' without any 'u-boot'-like entries. Which means enabling the configs ends up triggering the error above.

See my reply to an earlier version [1] (this is actually v6 of this series) about what could be done to solve this properly. Also see previous discussions [2][3] for more info.

[1] Re: [PATCH V4 1/8] spl: guard u_boot_any with X86
https://lore.kernel.org/u-boot/[email protected]/

[2] using binman fails boot
https://lore.kernel.org/u-boot/CAJ+vNU0BZDr2q0ZPQkoQBP1eBhbYmQfJMYraSgOvWXwZ=yFReQ@mail.gmail.com/T/#u

[3] imx8: ls1028a: Drop raw image support
https://lore.kernel.org/u-boot/[email protected]/T/#u

Quoted 1 line

Is this some attempt at papering over a bug ?

Simon recommended disabling SPL_RAW_IMAGE_SUPPORT to resolve this error in the previous discussions [3]. But I'm leaning towards saying yes here, I think it's a workaround to something that should change on the binman side. I'm not exactly sure what or how. Just now I thought maybe we could add a BINMAN_SYMBOLS_FOR_NEXT_PHASE config or so, which would enable the 'u_boot_any' etc. symbols instead of BINMAN_SYMBOLS.

Quoted 3 lines

Regardless, I think this version is a good enough step in the right direction and more changes can still be done afterwards, so I'm not asking for a new version.

I still don't see why we should randomly damage board configs to work around what looks like a bug in binman -- are we now implementing workarounds instead of trying to fully understand issues and implement proper fixes for those ?

Why can't we fix binman instead ?

#11 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 6 lines · Marek Vasut

I still don't see why we should randomly damage board configs to work around what looks like a bug in binman -- are we now implementing workarounds instead of trying to fully understand issues and implement proper fixes for those ?

Why can't we fix binman instead ?

There aren't many people who understand binman internals enough to fix things properly. Simon is less active recently, I'm not as productive as I'd like (even then I don't know the C parts), and my availability will get way worse in a few weeks. I wanted to prioritize reviews so that others' work don't stall, didn't know when this could be fixed, thus a clean workaround until then (not 'instead of') seemed OK.

Anyway, doesn't matter now that I managed to send a fix, but I didn't want to keep the question unanswered.

#12 lore raw

Re: [PATCH 2/8] configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE

Quoted 15 lines · Alper Nebi Yasak
Quoted 6 lines · Marek Vasut

I still don't see why we should randomly damage board configs to work around what looks like a bug in binman -- are we now implementing workarounds instead of trying to fully understand issues and implement proper fixes for those ?

Why can't we fix binman instead ?

There aren't many people who understand binman internals enough to fix things properly. Simon is less active recently, I'm not as productive as I'd like (even then I don't know the C parts), and my availability will get way worse in a few weeks. I wanted to prioritize reviews so that others' work don't stall, didn't know when this could be fixed, thus a clean workaround until then (not 'instead of') seemed OK.

Quoted 2 lines

Anyway, doesn't matter now that I managed to send a fix, but I didn't want to keep the question unanswered.

Thanks, I appreciate the proper fix.

#13 lore raw

PATCH 3/8 arm: dts: imx8m: update binman ddr firmware node name

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

We are migrating to use BINMAN SYMBOLS, the current name is not a valid binman type, so update to unify them.

Also add type = "blob-ext"; for generating a valid binman symbol

The current names are inconsistent across different boards, so unify them.

Also add type = "blob-ext";, since the new names are not valid binman types.

---
 arch/arm/dts/imx8mm-u-boot.dtsi                   |  8 ++++----
 arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi        | 12 ++++++++----
 arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi |  4 ++--
 arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi          | 12 ++++++++----
 arch/arm/dts/imx8mn-evk-u-boot.dtsi               | 12 ++++++++----
 arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi  |  8 ++++----
 arch/arm/dts/imx8mn-venice-u-boot.dtsi            |  8 ++++----
 arch/arm/dts/imx8mp-u-boot.dtsi                   | 12 ++++++++----
 arch/arm/dts/imx8mq-cm-u-boot.dtsi                | 12 ++++++++----
 arch/arm/dts/imx8mq-u-boot.dtsi                   |  8 ++++----
 10 files changed, 58 insertions(+), 38 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +4 -4
index 9f66cdb65a9..86f8e1a284b 100644
@@ -39,25 +39,25 @@
 			filename = "u-boot-spl.bin";
 		};
 
-		1d-imem {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		1d-dmem {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
 			size = <0x4000>;
 			type = "blob-ext";
 		};
 
-		2d-imem {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		2d-dmem {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
 			size = <0x4000>;
 			type = "blob-ext";
arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi +8 -4
index eb1dd8debba..d28bb2b2ffe 100644
@@ -147,24 +147,28 @@
 			align-end = <4>;
 		};
 
-		blob_1: blob-ext@1 {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_2: blob-ext@2 {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 
-		blob_3: blob-ext@3 {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_4: blob-ext@4 {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 	};
 
arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi +2 -2
index 46a9d7fd78b..dc4cec250ef 100644
@@ -111,13 +111,13 @@
 			filename = "u-boot-spl.bin";
 		};
 
-		1d-imem {
+		ddr-1d-imem-fw {
 			filename = "ddr3_imem_1d.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		1d_dmem {
+		ddr-1d-dmem-fw {
 			filename = "ddr3_dmem_1d.bin";
 			size = <0x4000>;
 			type = "blob-ext";
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +8 -4
index 4d0ecb07d4f..30ef8bc47d9 100644
@@ -155,24 +155,28 @@
 			align-end = <4>;
 		};
 
-		blob_1: blob-ext@1 {
+		ddr-1d-imem-fw {
 			filename = "ddr4_imem_1d_201810.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_2: blob-ext@2 {
+		ddr-1d-dmem-fw {
 			filename = "ddr4_dmem_1d_201810.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 
-		blob_3: blob-ext@3 {
+		ddr-2d-imem-fw {
 			filename = "ddr4_imem_2d_201810.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_4: blob-ext@4 {
+		ddr-2d-dmem-fw {
 			filename = "ddr4_dmem_2d_201810.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 	};
 
arch/arm/dts/imx8mn-evk-u-boot.dtsi +8 -4
index 3db46d4cbcb..f366117f210 100644
@@ -36,24 +36,28 @@
 			align-end = <4>;
 		};
 
-		blob_1: blob-ext@1 {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_2: blob-ext@2 {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 
-		blob_3: blob-ext@3 {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_4: blob-ext@4 {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 	};
 
arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi +4 -4
index 6e37622cca7..b8df6f749b0 100644
@@ -130,25 +130,25 @@
 			filename = "u-boot-spl.bin";
 		};
 
-		1d-imem {
+		ddr-1d-imem-fw {
 			filename = "ddr4_imem_1d.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		1d_dmem {
+		ddr-1d-dmem-fw {
 			filename = "ddr4_dmem_1d.bin";
 			size = <0x4000>;
 			type = "blob-ext";
 		};
 
-		2d_imem {
+		ddr-2d-imem-fw {
 			filename = "ddr4_imem_2d.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		2d_dmem {
+		ddr-2d-dmem-fw {
 			filename = "ddr4_dmem_2d.bin";
 			size = <0x4000>;
 			type = "blob-ext";
arch/arm/dts/imx8mn-venice-u-boot.dtsi +4 -4
index 35819553879..bcf2abd0676 100644
@@ -126,25 +126,25 @@
 			filename = "u-boot-spl.bin";
 		};
 
-		1d-imem {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		1d_dmem {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
 			size = <0x4000>;
 			type = "blob-ext";
 		};
 
-		2d_imem {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		2d_dmem {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
 			size = <0x4000>;
 			type = "blob-ext";
arch/arm/dts/imx8mp-u-boot.dtsi +8 -4
index 20edd90cfad..dc57ee20411 100644
@@ -61,24 +61,28 @@
 			align-end = <4>;
 		};
 
-		blob_1: blob-ext@1 {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem_202006.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_2: blob-ext@2 {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem_202006.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 
-		blob_3: blob-ext@3 {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem_202006.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_4: blob-ext@4 {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem_202006.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 	};
 
arch/arm/dts/imx8mq-cm-u-boot.dtsi +8 -4
index e2f4b0e740d..bc7e9756c23 100644
@@ -28,24 +28,28 @@
 			align-end = <4>;
 		};
 
-		blob_1: blob-ext@1 {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_2: blob-ext@2 {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 
-		blob_3: blob-ext@3 {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
 			size = <0x8000>;
+			type = "blob-ext";
 		};
 
-		blob_4: blob-ext@4 {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
 			size = <0x4000>;
+			type = "blob-ext";
 		};
 	};
 
arch/arm/dts/imx8mq-u-boot.dtsi +4 -4
index 912a3d4a356..462c470091a 100644
@@ -46,25 +46,25 @@
 			filename = "u-boot-spl.bin";
 		};
 
-		1d-imem {
+		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		1d-dmem {
+		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
 			size = <0x4000>;
 			type = "blob-ext";
 		};
 
-		2d-imem {
+		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
 			size = <0x8000>;
 			type = "blob-ext";
 		};
 
-		2d-dmem {
+		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
 			size = <0x4000>;
 			type = "blob-ext";
Signature · 1 line
2.36.0
Reviewed-by on v1 3/8
#14 lore raw

Re: [PATCH 3/8] arm: dts: imx8m: update binman ddr firmware node name

Quoted 6 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

We are migrating to use BINMAN SYMBOLS, the current name is not a valid binman type, so update to unify them.

Also add type = "blob-ext"; for generating a valid binman symbol

(While applying, please remove the lines above.)

Quoted 6 lines

The current names are inconsistent across different boards, so unify them.

Also add type = "blob-ext";, since the new names are not valid binman types.

Quoted 12 lines
---
 arch/arm/dts/imx8mm-u-boot.dtsi                   |  8 ++++----
 arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi        | 12 ++++++++----
 arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi |  4 ++--
 arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi          | 12 ++++++++----
 arch/arm/dts/imx8mn-evk-u-boot.dtsi               | 12 ++++++++----
 arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi  |  8 ++++----
 arch/arm/dts/imx8mn-venice-u-boot.dtsi            |  8 ++++----
 arch/arm/dts/imx8mp-u-boot.dtsi                   | 12 ++++++++----
 arch/arm/dts/imx8mq-cm-u-boot.dtsi                | 12 ++++++++----
 arch/arm/dts/imx8mq-u-boot.dtsi                   |  8 ++++----
 10 files changed, 58 insertions(+), 38 deletions(-)
#15 lore raw

PATCH 4/8 armv8: u-boot-spl.lds: mark __image_copy_start as symbol

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

In arch/arm/lib/sections.c there is below code:
char __image_copy_start[0] __section(".__image_copy_start"); But actually 'objdump -t spl/u-boot-spl' not able to find out symbol '__image_copy_start' for binman update image-pos/size.

So update link file

---
 arch/arm/cpu/armv8/u-boot-spl.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/u-boot-spl.lds +1 -1
index 730eb93dbc3..9b1e7d46287 100644
@@ -23,7 +23,7 @@ SECTIONS
 {
 	.text : {
 		. = ALIGN(8);
-		*(.__image_copy_start)
+		__image_copy_start = .;
 		CPUDIR/start.o (.text*)
 		*(.text*)
 	} >.sram
Signature · 1 line
2.36.0
Reviewed-by on v1 4/8
#16 lore raw

Re: [PATCH 4/8] armv8: u-boot-spl.lds: mark __image_copy_start as symbol

Quoted 7 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

In arch/arm/lib/sections.c there is below code:
char __image_copy_start[0] __section(".__image_copy_start"); But actually 'objdump -t spl/u-boot-spl' not able to find out symbol '__image_copy_start' for binman update image-pos/size.

Quoted 8 lines

So update link file

---
 arch/arm/cpu/armv8/u-boot-spl.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#17 lore raw

PATCH 5/8 ddr: imx8m: helper: load ddr firmware according to binman symbols

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

By reading binman symbols, we no need hard coded IMEM_LEN/DMEM_LEN after we update the binman dtsi to drop 0x8000/0x4000 length for the firmware.

And that could save binary size for many KBs.

---
 drivers/ddr/imx/imx8m/helper.c | 51 ++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 8 deletions(-)
drivers/ddr/imx/imx8m/helper.c +43 -8
index f23904bf712..d9a4ced4462 100644
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <binman_sym.h>
 #include <log.h>
 #include <spl.h>
 #include <asm/global_data.h>
@@ -25,15 +26,30 @@ DECLARE_GLOBAL_DATA_PTR;
 #define DMEM_OFFSET_ADDR 0x00054000
 #define DDR_TRAIN_CODE_BASE_ADDR IP2APB_DDRPHY_IPS_BASE_ADDR(0)
 
+binman_sym_declare(ulong, ddr_1d_imem_fw, image_pos);
+binman_sym_declare(ulong, ddr_1d_imem_fw, size);
+
+binman_sym_declare(ulong, ddr_1d_dmem_fw, image_pos);
+binman_sym_declare(ulong, ddr_1d_dmem_fw, size);
+
+#if !IS_ENABLED(CONFIG_IMX8M_DDR3L)
+binman_sym_declare(ulong, ddr_2d_imem_fw, image_pos);
+binman_sym_declare(ulong, ddr_2d_imem_fw, size);
+
+binman_sym_declare(ulong, ddr_2d_dmem_fw, image_pos);
+binman_sym_declare(ulong, ddr_2d_dmem_fw, size);
+#endif
+
 /* We need PHY iMEM PHY is 32KB padded */
 void ddr_load_train_firmware(enum fw_type type)
 {
 	u32 tmp32, i;
 	u32 error = 0;
 	unsigned long pr_to32, pr_from32;
-	unsigned long fw_offset = type ? IMEM_2D_OFFSET : 0;
-	unsigned long imem_start = (unsigned long)&_end + fw_offset;
-	unsigned long dmem_start;
+	uint32_t fw_offset = type ? IMEM_2D_OFFSET : 0;
+	uint32_t imem_start = (unsigned long)&_end + fw_offset;
+	uint32_t dmem_start;
+	uint32_t imem_len = IMEM_LEN, dmem_len = DMEM_LEN;
 
 #ifdef CONFIG_SPL_OF_CONTROL
 	if (gd->fdt_blob && !fdt_check_header(gd->fdt_blob)) {
@@ -43,11 +59,30 @@ void ddr_load_train_firmware(enum fw_type type)
 	}
 #endif
 
-	dmem_start = imem_start + IMEM_LEN;
+	dmem_start = imem_start + imem_len;
+
+	if (CONFIG_IS_ENABLED(BINMAN_SYMBOLS)) {
+		switch (type) {
+		case FW_1D_IMAGE:
+			imem_start = binman_sym(ulong, ddr_1d_imem_fw, image_pos);
+			imem_len = binman_sym(ulong, ddr_1d_imem_fw, size);
+			dmem_start = binman_sym(ulong, ddr_1d_dmem_fw, image_pos);
+			dmem_len = binman_sym(ulong, ddr_1d_dmem_fw, size);
+			break;
+		case FW_2D_IMAGE:
+#if !IS_ENABLED(CONFIG_IMX8M_DDR3L)
+			imem_start = binman_sym(ulong, ddr_2d_imem_fw, image_pos);
+			imem_len = binman_sym(ulong, ddr_2d_imem_fw, size);
+			dmem_start = binman_sym(ulong, ddr_2d_dmem_fw, image_pos);
+			dmem_len = binman_sym(ulong, ddr_2d_dmem_fw, size);
+#endif
+			break;
+		}
+	}
 
 	pr_from32 = imem_start;
 	pr_to32 = DDR_TRAIN_CODE_BASE_ADDR + 4 * IMEM_OFFSET_ADDR;
-	for (i = 0x0; i < IMEM_LEN; ) {
+	for (i = 0x0; i < imem_len; ) {
 		tmp32 = readl(pr_from32);
 		writew(tmp32 & 0x0000ffff, pr_to32);
 		pr_to32 += 4;
@@ -59,7 +94,7 @@ void ddr_load_train_firmware(enum fw_type type)
 
 	pr_from32 = dmem_start;
 	pr_to32 = DDR_TRAIN_CODE_BASE_ADDR + 4 * DMEM_OFFSET_ADDR;
-	for (i = 0x0; i < DMEM_LEN; ) {
+	for (i = 0x0; i < dmem_len; ) {
 		tmp32 = readl(pr_from32);
 		writew(tmp32 & 0x0000ffff, pr_to32);
 		pr_to32 += 4;
@@ -72,7 +107,7 @@ void ddr_load_train_firmware(enum fw_type type)
 	debug("check ddr_pmu_train_imem code\n");
 	pr_from32 = imem_start;
 	pr_to32 = DDR_TRAIN_CODE_BASE_ADDR + 4 * IMEM_OFFSET_ADDR;
-	for (i = 0x0; i < IMEM_LEN; ) {
+	for (i = 0x0; i < imem_len; ) {
 		tmp32 = (readw(pr_to32) & 0x0000ffff);
 		pr_to32 += 4;
 		tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16);
@@ -93,7 +128,7 @@ void ddr_load_train_firmware(enum fw_type type)
 	debug("check ddr4_pmu_train_dmem code\n");
 	pr_from32 = dmem_start;
 	pr_to32 = DDR_TRAIN_CODE_BASE_ADDR + 4 * DMEM_OFFSET_ADDR;
-	for (i = 0x0; i < DMEM_LEN;) {
+	for (i = 0x0; i < dmem_len;) {
 		tmp32 = (readw(pr_to32) & 0x0000ffff);
 		pr_to32 += 4;
 		tmp32 += ((readw(pr_to32) & 0x0000ffff) << 16);
Signature · 1 line
2.36.0
Reviewed-by on v1 5/8
#18 lore raw

Re: [PATCH 5/8] ddr: imx8m: helper: load ddr firmware according to binman symbols

Quoted 5 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

By reading binman symbols, we no need hard coded IMEM_LEN/DMEM_LEN after we update the binman dtsi to drop 0x8000/0x4000 length for the firmware.

Quoted 7 lines

And that could save binary size for many KBs.

---
 drivers/ddr/imx/imx8m/helper.c | 51 ++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 8 deletions(-)
#19 lore raw

PATCH 6/8 arm: dts: imx8m: shrink ddr firmware size to actual file size

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

After we switch to use BINMAN_SYMBOLS, there is no need to pad the file size to 0x8000 and 0x4000. After we use BINMAN_SYMBOLS, the u-boot-spl-ddr.bin shrink about 36KB with i.MX8MP-EVK.

---
 arch/arm/dts/imx8mm-u-boot.dtsi                   | 8 ++++----
 arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi        | 8 ++++----
 arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 4 ++--
 arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi          | 8 ++++----
 arch/arm/dts/imx8mn-evk-u-boot.dtsi               | 8 ++++----
 arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi  | 8 ++++----
 arch/arm/dts/imx8mn-venice-u-boot.dtsi            | 8 ++++----
 arch/arm/dts/imx8mp-u-boot.dtsi                   | 8 ++++----
 arch/arm/dts/imx8mq-cm-u-boot.dtsi                | 8 ++++----
 arch/arm/dts/imx8mq-u-boot.dtsi                   | 8 ++++----
 10 files changed, 38 insertions(+), 38 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +4 -4
index 86f8e1a284b..8c48678625d 100644
@@ -41,25 +41,25 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 	};
arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi +4 -4
index d28bb2b2ffe..5f839524028 100644
@@ -149,26 +149,26 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 	};
 
arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi +2 -2
index dc4cec250ef..c4ae7ca4f31 100644
@@ -113,13 +113,13 @@
 
 		ddr-1d-imem-fw {
 			filename = "ddr3_imem_1d.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "ddr3_dmem_1d.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 	};
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi +4 -4
index 30ef8bc47d9..78773c198e4 100644
@@ -157,26 +157,26 @@
 
 		ddr-1d-imem-fw {
 			filename = "ddr4_imem_1d_201810.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "ddr4_dmem_1d_201810.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-imem-fw {
 			filename = "ddr4_imem_2d_201810.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "ddr4_dmem_2d_201810.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 	};
 
arch/arm/dts/imx8mn-evk-u-boot.dtsi +4 -4
index f366117f210..c4789488a44 100644
@@ -38,26 +38,26 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 	};
 
arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi +4 -4
index b8df6f749b0..ed1ab10ded3 100644
@@ -132,25 +132,25 @@
 
 		ddr-1d-imem-fw {
 			filename = "ddr4_imem_1d.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "ddr4_dmem_1d.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-imem-fw {
 			filename = "ddr4_imem_2d.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "ddr4_dmem_2d.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 	};
arch/arm/dts/imx8mn-venice-u-boot.dtsi +4 -4
index bcf2abd0676..9fb38714523 100644
@@ -128,25 +128,25 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 	};
arch/arm/dts/imx8mp-u-boot.dtsi +4 -4
index dc57ee20411..adb24cccc3b 100644
@@ -63,26 +63,26 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem_202006.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem_202006.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem_202006.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem_202006.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 	};
 
arch/arm/dts/imx8mq-cm-u-boot.dtsi +4 -4
index bc7e9756c23..cb4e36c387d 100644
@@ -30,26 +30,26 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
-			size = <0x8000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			size = <0x4000>;
 			type = "blob-ext";
+			align-end = <4>;
 		};
 	};
 
arch/arm/dts/imx8mq-u-boot.dtsi +4 -4
index 462c470091a..e8b5f83706e 100644
@@ -48,25 +48,25 @@
 
 		ddr-1d-imem-fw {
 			filename = "lpddr4_pmu_train_1d_imem.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-1d-dmem-fw {
 			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-imem-fw {
 			filename = "lpddr4_pmu_train_2d_imem.bin";
-			size = <0x8000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 
 		ddr-2d-dmem-fw {
 			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			size = <0x4000>;
+			align-end = <4>;
 			type = "blob-ext";
 		};
 	};
Signature · 1 line
2.36.0
Reviewed-by on v1 6/8
#20 lore raw

Re: [PATCH 6/8] arm: dts: imx8m: shrink ddr firmware size to actual file size

Quoted 8 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

After we switch to use BINMAN_SYMBOLS, there is no need to pad the file size to 0x8000 and 0x4000. After we use BINMAN_SYMBOLS, the u-boot-spl-ddr.bin shrink about 36KB with i.MX8MP-EVK.

Quoted 12 lines
---
 arch/arm/dts/imx8mm-u-boot.dtsi                   | 8 ++++----
 arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi        | 8 ++++----
 arch/arm/dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi | 4 ++--
 arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi          | 8 ++++----
 arch/arm/dts/imx8mn-evk-u-boot.dtsi               | 8 ++++----
 arch/arm/dts/imx8mn-var-som-symphony-u-boot.dtsi  | 8 ++++----
 arch/arm/dts/imx8mn-venice-u-boot.dtsi            | 8 ++++----
 arch/arm/dts/imx8mp-u-boot.dtsi                   | 8 ++++----
 arch/arm/dts/imx8mq-cm-u-boot.dtsi                | 8 ++++----
 arch/arm/dts/imx8mq-u-boot.dtsi                   | 8 ++++----
 10 files changed, 38 insertions(+), 38 deletions(-)
#21 lore raw

PATCH 7/8 binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

There is case that CONFIG_BINMAN is defined, but CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

---
 include/binman_sym.h                        | 2 +-
 tools/binman/test/Makefile                  | 2 +-
 tools/binman/test/generated/autoconf.h      | 3 +++
 tools/binman/test/u_boot_binman_syms.c      | 2 +-
 tools/binman/test/u_boot_binman_syms_size.c | 2 +-
 5 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/generated/autoconf.h
include/binman_sym.h +1 -1
index 72e6765fe52..b76b3293516 100644
@@ -13,7 +13,7 @@
 
 #define BINMAN_SYM_MISSING	(-1UL)
 
-#ifdef CONFIG_BINMAN
+#if CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
 
 /**
  * binman_symname() - Internal function to get a binman symbol name
tools/binman/test/Makefile +1 -1
index 57057e2d588..45c67f43561 100644
@@ -21,7 +21,7 @@ CC		= $(CROSS_COMPILE)gcc
 OBJCOPY		= $(CROSS_COMPILE)objcopy
 
 VPATH := $(SRC)
-CFLAGS := -march=i386 -m32 -nostdlib -I $(SRC)../../../include \
+CFLAGS := -march=i386 -m32 -nostdlib -I $(SRC)../../../include -I $(SRC)\
 	-Wl,--no-dynamic-linker
 
 LDS_UCODE := -T $(SRC)u_boot_ucode_ptr.lds
tools/binman/test/generated/autoconf.h new file +3 -0
new file mode 100644
index 00000000000..6a23039f469
@@ -0,0 +1,3 @@
+#define CONFIG_BINMAN 1
+#define CONFIG_SPL_BUILD 1
+#define CONFIG_SPL_BINMAN_SYMBOLS 1
tools/binman/test/u_boot_binman_syms.c +1 -1
index 37fc339ce84..89fee5567e1 100644
@@ -5,7 +5,7 @@
  * Simple program to create some binman symbols. This is used by binman tests.
  */
 
-#define CONFIG_BINMAN
+#include <linux/kconfig.h>
 #include <binman_sym.h>
 
 binman_sym_declare(unsigned long, u_boot_spl_any, offset);
tools/binman/test/u_boot_binman_syms_size.c +1 -1
index 7224bc1863c..c4a053f96f1 100644
@@ -5,7 +5,7 @@
  * Simple program to create some binman symbols. This is used by binman tests.
  */
 
-#define CONFIG_BINMAN
+#include <linux/kconfig.h>
 #include <binman_sym.h>
 
 binman_sym_declare(char, u_boot_spl, pos);
Signature · 1 line
2.36.0
Reviewed-by on v1 7/8
#22 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 9 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

There is case that CONFIG_BINMAN is defined, but CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

Quoted 8 lines
---
 include/binman_sym.h                        | 2 +-
 tools/binman/test/Makefile                  | 2 +-
 tools/binman/test/generated/autoconf.h      | 3 +++
 tools/binman/test/u_boot_binman_syms.c      | 2 +-
 tools/binman/test/u_boot_binman_syms_size.c | 2 +-
 5 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/generated/autoconf.h
#23 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 19 lines · Alper Nebi Yasak
Quoted 9 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

There is case that CONFIG_BINMAN is defined, but CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

Quoted 8 lines
---
 include/binman_sym.h                        | 2 +-
 tools/binman/test/Makefile                  | 2 +-
 tools/binman/test/generated/autoconf.h      | 3 +++
 tools/binman/test/u_boot_binman_syms.c      | 2 +-
 tools/binman/test/u_boot_binman_syms_size.c | 2 +-
 5 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/generated/autoconf.h
Quoted 1 line

Looks like I have misunderstood things here a bit. CONFIG_BINMAN enables you to declare and use symbols. CONFIG_SPL/TPL_BINMAN_SYMBOLS declares certain symbols ('u_boot_any'). The name is a bit misleading, as if it enables support for using symbols, and that confused me.

I have sent a patch [1] that fixes the build error mentioned here, which should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8
- Drop this patch 7/8

Sorry for the confusion.

[1] spl: binman: Fix use of undeclared u_boot_any symbols
https://lore.kernel.org/u-boot/[email protected]/

#24 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 19 lines · Alper Nebi Yasak
Quoted 18 lines · Alper Nebi Yasak
Quoted 17 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

There is case that CONFIG_BINMAN is defined, but CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

---
  include/binman_sym.h                        | 2 +-
  tools/binman/test/Makefile                  | 2 +-
  tools/binman/test/generated/autoconf.h      | 3 +++
  tools/binman/test/u_boot_binman_syms.c      | 2 +-
  tools/binman/test/u_boot_binman_syms_size.c | 2 +-
  5 files changed, 7 insertions(+), 4 deletions(-)

create mode 100644 tools/binman/test/generated/autoconf.h

Quoted 5 lines
Quoted 1 line

Looks like I have misunderstood things here a bit. CONFIG_BINMAN enables you to declare and use symbols. CONFIG_SPL/TPL_BINMAN_SYMBOLS declares certain symbols ('u_boot_any'). The name is a bit misleading, as if it enables support for using symbols, and that confused me.

I am not sure, but I think CONFIG_SPL/TPL_BINMAN_SYMBOLS are only for certain symbols saying u_boot_any.

Maybe Simon could comment?

Quoted 8 lines

I have sent a patch [1] that fixes the build error mentioned here, which should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8

This not work, BINMAN has been enabled for packing images, but we have not generated some i.MX binman symbols for getting exact blob size. So I use binman symbols to get exact blob size in this patchset.

Thanks,
Peng.

Quoted 6 lines

- Drop this patch 7/8

Sorry for the confusion.

[1] spl: binman: Fix use of undeclared u_boot_any symbols
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F20220610105806.27177-2-alpernebiyasak%40gmail.com%2F&amp;data=05%7C01%7Cpeng.fan%40nxp.com%7C4e7220d3cf724ca71a8e08da4b00e7fa%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637904764505471459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=L9jmVdbr1RUL8gKZa8QWwxFnPhmxjW5bYZKwq8eDsH4%3D&amp;reserved=0

#25 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 9 lines · Peng Fan (OSS)
Quoted 7 lines · Alper Nebi Yasak

I have sent a patch [1] that fixes the build error mentioned here, which should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8

Quoted 4 lines

This not work, BINMAN has been enabled for packing images, but we have not generated some i.MX binman symbols
for getting exact blob size. So I use binman symbols to get exact blob size in this patchset.

CONFIG_IS_ENABLED(BINMAN) doesn't work, but IS_ENABLED(CONFIG_BINMAN) worked for me. I see all 8 symbols in spl/u-boot-spl.sym. I can send you a git branch if you want?

Quoted 4 lines

Thanks,
Peng.

Quoted 1 line

- Drop this patch 7/8

#26 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 9 lines · Alper Nebi Yasak
Quoted 8 lines · Peng Fan (OSS)
Quoted 7 lines · Alper Nebi Yasak

I have sent a patch [1] that fixes the build error mentioned here, which should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8

Quoted 7 lines
Quoted 4 lines

This not work, BINMAN has been enabled for packing images, but we have not generated some i.MX binman symbols
for getting exact blob size. So I use binman symbols to get exact blob size in this patchset.

CONFIG_IS_ENABLED(BINMAN) doesn't work, but IS_ENABLED(CONFIG_BINMAN) worked for me. I see all 8 symbols in spl/u-boot-spl.sym. I can send you a git branch if you want?

But now with your suggestion, that means all i.MX8M boards should use the i.MX binman symbols, that is not expected. The i.MX driver code is expected to support w/o i.MX binman symbols.

Thanks,
Peng

Quoted 5 lines
Quoted 5 lines

Thanks,
Peng.

Quoted 1 line

- Drop this patch 7/8

#27 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 9 lines · Peng Fan (OSS)
Quoted 3 lines · Alper Nebi Yasak

CONFIG_IS_ENABLED(BINMAN) doesn't work, but IS_ENABLED(CONFIG_BINMAN) worked for me. I see all 8 symbols in spl/u-boot-spl.sym. I can send you a git branch if you want?

But now with your suggestion, that means all i.MX8M boards should use the i.MX binman symbols, that is not
expected. The i.MX driver code is expected to support w/o i.MX binman symbols.

In my series I'll add a macro like BINMAN_SYMS_OK that is true if binman wrote the declared symbols, and false if it didn't. Then you can check 'if (BINMAN_SYMS_OK)' to decide if the driver should use the symbols. It'll take a day or two for me to test and send. If the macro isn't good enough, maybe you can add a new config for the driver's binman symbols.

(Is there any i.MX8M board that won't have working symbols for ddr_fw files after this series?)

#28 lore raw

RE: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 14 lines

Subject: Re: [PATCH 7/8] binman_sym: guard with
CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 2 lines · Peng Fan (OSS)
Quoted 1 line · Alper Nebi Yasak

CONFIG_IS_ENABLED(BINMAN) doesn't work, but

IS_ENABLED(CONFIG_BINMAN)

Quoted 6 lines
Quoted 2 lines

worked for me. I see all 8 symbols in spl/u-boot-spl.sym. I can send you a git branch if you want?

But now with your suggestion, that means all i.MX8M boards should use the i.MX binman symbols, that is not expected. The i.MX driver code is expected to support w/o i.MX binman symbols.

Quoted 5 lines

In my series I'll add a macro like BINMAN_SYMS_OK that is true if binman wrote the declared symbols, and false if it didn't. Then you can check 'if (BINMAN_SYMS_OK)' to decide if the driver should use the symbols. It'll take a day or two for me to test and send. If the macro isn't good enough, maybe you can add a new config for the driver's binman symbols.

Thanks for helping, please also share me a git repo.

Quoted 3 lines

(Is there any i.MX8M board that won't have working symbols for ddr_fw files after this series?)

I think NO, but I still prefer symbols could be disabled on demand, some NXP downstream validation boards not have symbols enabled.

Thanks,
Peng.

#29 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 14 lines · Peng Fan
Quoted 14 lines

Subject: Re: [PATCH 7/8] binman_sym: guard with
CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 2 lines · Peng Fan (OSS)
Quoted 1 line · Alper Nebi Yasak

CONFIG_IS_ENABLED(BINMAN) doesn't work, but

IS_ENABLED(CONFIG_BINMAN)

Quoted 6 lines
Quoted 2 lines

worked for me. I see all 8 symbols in spl/u-boot-spl.sym. I can send you a git branch if you want?

But now with your suggestion, that means all i.MX8M boards should use the i.MX binman symbols, that is not expected. The i.MX driver code is expected to support w/o i.MX binman symbols.

Quoted 7 lines
Quoted 5 lines

In my series I'll add a macro like BINMAN_SYMS_OK that is true if binman wrote the declared symbols, and false if it didn't. Then you can check 'if (BINMAN_SYMS_OK)' to decide if the driver should use the symbols. It'll take a day or two for me to test and send. If the macro isn't good enough, maybe you can add a new config for the driver's binman symbols.

Thanks for helping, please also share me a git repo.

I've sent a v2 for my series [1], and pushed a branch to my repo [2] with your changes added on top of mine.

[1] spl: binman: Fixes for BINMAN_SYMBOLS
https://lore.kernel.org/u-boot/[email protected]/T/

[2] alpernebbi/u-boot at imx-ddr-binman-symbols
https://github.com/alpernebbi/u-boot/tree/imx-ddr-binman-symbols

Quoted 9 lines
Quoted 3 lines

(Is there any i.MX8M board that won't have working symbols for ddr_fw files after this series?)

I think NO, but I still prefer symbols could be disabled on demand, some NXP downstream validation boards not have symbols enabled.

Thanks,
Peng.

#30 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

In reply to Peng Fan (OSS)
Quoted 21 lines · Peng Fan (OSS)
Quoted 19 lines · Alper Nebi Yasak
Quoted 18 lines · Alper Nebi Yasak
Quoted 17 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

There is case that CONFIG_BINMAN is defined, but CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

---
   include/binman_sym.h                        | 2 +-
   tools/binman/test/Makefile                  | 2 +-
   tools/binman/test/generated/autoconf.h      | 3 +++
   tools/binman/test/u_boot_binman_syms.c      | 2 +-
   tools/binman/test/u_boot_binman_syms_size.c | 2 +-
   5 files changed, 7 insertions(+), 4 deletions(-)

create mode 100644 tools/binman/test/generated/autoconf.h

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Looks like I have misunderstood things here a bit. CONFIG_BINMAN enables you to declare and use symbols. CONFIG_SPL/TPL_BINMAN_SYMBOLS declares certain symbols ('u_boot_any'). The name is a bit misleading, as if it enables support for using symbols, and that confused me.

I am not sure, but I think CONFIG_SPL/TPL_BINMAN_SYMBOLS are only for certain symbols saying u_boot_any.

I mean I not think BINMAN_SYMBOLS are only for certtain symbols.

Quoted 24 lines

Maybe Simon could comment?

Quoted 7 lines

I have sent a patch [1] that fixes the build error mentioned here, which should be used instead of this patch. Please:

- Rebase on top of that series [1]
- Maybe drop config changes in 1/8 and 2/8 (they're now unnecessary)
- Disable CONFIG_SPL/TPL/VPL_BINMAN_SYMBOLS for i.MX8M boards
- Change the if statement to if (IS_ENABLED(CONFIG_BINMAN)) in patch 5/8

This not work, BINMAN has been enabled for packing images, but we have not generated some i.MX binman symbols
for getting exact blob size. So I use binman symbols to get exact blob size in this patchset.

Thanks,
Peng.

Quoted 6 lines

- Drop this patch 7/8

Sorry for the confusion.

[1] spl: binman: Fix use of undeclared u_boot_any symbols
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F20220610105806.27177-2-alpernebiyasak%40gmail.com%2F&amp;data=05%7C01%7Cpeng.fan%40nxp.com%7C4e7220d3cf724ca71a8e08da4b00e7fa%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637904764505471459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=L9jmVdbr1RUL8gKZa8QWwxFnPhmxjW5bYZKwq8eDsH4%3D&amp;reserved=0

#31 lore raw

Re: [PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Quoted 9 lines · Peng Fan (OSS)
Quoted 7 lines · Alper Nebi Yasak
Quoted 4 lines

Looks like I have misunderstood things here a bit. CONFIG_BINMAN enables you to declare and use symbols. CONFIG_SPL/TPL_BINMAN_SYMBOLS declares certain symbols ('u_boot_any'). The name is a bit misleading, as if it enables support for using symbols, and that confused me.

I am not sure, but I think CONFIG_SPL/TPL_BINMAN_SYMBOLS are only for certain symbols saying u_boot_any.

I mean I not think BINMAN_SYMBOLS are only for certtain symbols.

They are right now, your patch changes that.

I wasn't sure about changing it at first, but it makes more sense to me now. I'll update my series and split things out:

- BINMAN: to run binman after build
- BINMAN_SYMBOLS: to enable binman symbols, binman_sym.h
- BINMAN_UBOOT_SYMBOLS: new config to declare u_boot_any symbols

#32 lore raw

PATCH 8/8 imx: imx8mm-icore: migrate to use BINMAN

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Use BINMAN instead of imx specific packing method.

---
 arch/arm/mach-imx/imx8m/Kconfig                 |  1 +
 arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg | 10 +---------
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig    |  2 +-
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig   |  2 +-
 4 files changed, 4 insertions(+), 11 deletions(-)
arch/arm/mach-imx/imx8m/Kconfig +1 -0
index 61397bf88d1..ba26975544c 100644
@@ -68,6 +68,7 @@ config TARGET_IMX8MM_EVK
 
 config TARGET_IMX8MM_ICORE_MX8MM
 	bool "Engicam i.Core MX8M Mini SOM"
+	select BINMAN
 	select IMX8MM
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg +1 -9
index e06d53ef417..5dcb8ae72f0 100644
@@ -3,13 +3,5 @@
  * Copyright 2019 NXP
  */
 
-
-FIT
 BOOT_FROM	sd
-LOADER		spl/u-boot-spl-ddr.bin	0x7E1000
-SECOND_LOADER	u-boot.itb		0x40200000 0x60000
-
-DDR_FW lpddr4_pmu_train_1d_imem.bin
-DDR_FW lpddr4_pmu_train_1d_dmem.bin
-DDR_FW lpddr4_pmu_train_2d_imem.bin
-DDR_FW lpddr4_pmu_train_2d_dmem.bin
+LOADER		u-boot-spl-ddr.bin	0x7E1000
configs/imx8mm-icore-mx8mm-ctouch2_defconfig +1 -1
index d95a74a7237..dcb12e5d026 100644
@@ -20,7 +20,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mm-icore-mx8mm-ctouch2.dtb"
 CONFIG_SPL_BOARD_INIT=y
configs/imx8mm-icore-mx8mm-edimm2.2_defconfig +1 -1
index 43c697a39d8..22acf7317b4 100644
@@ -20,7 +20,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mm-icore-mx8mm-edimm2.2.dtb"
 CONFIG_SPL_BOARD_INIT=y
Signature · 1 line
2.36.0
Reviewed-by on v1 8/8
#33 lore raw

Re: [PATCH 8/8] imx: imx8mm-icore: migrate to use BINMAN

Quoted 11 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

Use BINMAN instead of imx specific packing method.

---
 arch/arm/mach-imx/imx8m/Kconfig                 |  1 +
 arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg | 10 +---------
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig    |  2 +-
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig   |  2 +-
 4 files changed, 4 insertions(+), 11 deletions(-)
#34 lore raw
In reply to Peng Fan (OSS)
Quoted 1 line

Subject: [PATCH 0/8] arm64: binman: use binman symbols for imx

Sorry I missed to add V6 in patchset subject, but I do add V6 changelog below, please raise if you have concern, and I could resend with V6 in patch subject.

Thanks,
Peng.

Quoted 75 lines

From: Peng Fan <[email protected]>

V6:
Drop no-u-boot-any introduced in V5
Drop binman symbol replacement with @ to _, which is not needed Update
imx8m config to not select RAM IMAGE and RAM DEVICE Update ddr firmware node name Introduce autoconf.h for binman test

V5:
Introduce no-u-boot-any property to drop the X86 guard patch 1 Add
blob-ext type for ddr firmware node Include a missing dts change

V4:
Fix three boards build failure

V3:
Add R-b/T-b
Fix build warning

V2:
resolve some CI failure
include patch 7

binman symbol is a good feature, but only used on X86 for now. This patchset is to use it for i.MX8M platform.

The current imx8m ddr phy firmware consumes lots of space, because we pad them to the largest 32KB and 16KB for IMEM and DMEM.

With this patchset we use binman symbols to get firmware location and size, we could save near 36KB with i.MX8MP-EVK.

Please help check and test

Peng Fan (8):
spl: Kconfig: not select SPL_RAW_IMAGE_SUPPORT for i.MX8M
configs: imx8mm_data_modul_edm_sbc: not select SPL_RAM_DEVICE
arm: dts: imx8m: update binman ddr firmware node name
armv8: u-boot-spl.lds: mark __image_copy_start as symbol
ddr: imx8m: helper: load ddr firmware according to binman symbols
arm: dts: imx8m: shrink ddr firmware size to actual file size
binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
imx: imx8mm-icore: migrate to use BINMAN

 arch/arm/cpu/armv8/u-boot-spl.lds             |  2 +-
 arch/arm/dts/imx8mm-u-boot.dtsi               | 16 +++---
 arch/arm/dts/imx8mn-beacon-kit-u-boot.dtsi    | 20 +++++---
 .../dts/imx8mn-bsh-smm-s2-u-boot-common.dtsi  |  8 +--
 arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi      | 20 +++++---
 arch/arm/dts/imx8mn-evk-u-boot.dtsi           | 20 +++++---
 .../dts/imx8mn-var-som-symphony-u-boot.dtsi   | 16 +++---
 arch/arm/dts/imx8mn-venice-u-boot.dtsi        | 16 +++---
 arch/arm/dts/imx8mp-u-boot.dtsi               | 20 +++++---
 arch/arm/dts/imx8mq-cm-u-boot.dtsi            | 20 +++++---
 arch/arm/dts/imx8mq-u-boot.dtsi               | 16 +++---
 arch/arm/mach-imx/imx8m/Kconfig               |  1 +
 .../mach-imx/imx8m/imximage-8mm-lpddr4.cfg    | 10 +---
 common/spl/Kconfig                            |  1 +
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |  2 +-
configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |  2 +-
 configs/imx8mm_data_modul_edm_sbc_defconfig   |  2 -
 drivers/ddr/imx/imx8m/helper.c                | 51
++++++++++++++++---
 include/binman_sym.h                          |  2 +-
 tools/binman/test/Makefile                    |  2 +-
 tools/binman/test/generated/autoconf.h        |  3 ++
 tools/binman/test/u_boot_binman_syms.c        |  2 +-
 tools/binman/test/u_boot_binman_syms_size.c   |  2 +-
 23 files changed, 152 insertions(+), 102 deletions(-)  create mode 100644

tools/binman/test/generated/autoconf.h

--
2.36.0