Skip to contentSkip to conversation

sunxi: SPL FIT support for 32-bit sunxi SoCs

PATCH Superseded Samuel Holland 4 participants 13 messages Jan 22, 2023 – Apr 6, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Samuel Holland

author maintainer
#0 lore raw

v2 cover sunxi: SPL FIT support for 32-bit sunxi SoCs

This series makes the necessary changes so 32-bit sunxi SoCs can load additional device trees or firmware from SPL along with U-Boot proper. Crust (SCP firmware) has support for A33 and H3, and H3 also needs to load an eGon blob to support CPU 0 hotplug (a silicon bug workaround).

FIT unlocks more features (signatures, multiple DTBs, etc.), so enable it by default. A10 (sun4i) only has 24 KiB of SRAM A1, so it needs SPL_FIT_IMAGE_TINY. For consistency, enable that option everywhere.

This series depends on the bugfix series I sent yesterday[1].

After this series is applied, we can increase SPL_MAX_SIZE for H6 and newer SoCs, both 32-bit (e.g. A50, T113) and 64-bit. I did not do that yet because there is some discussion to be had about the correct value:
it must be adjusted to guarantee return-to-FEL functionality, and the exact adjustment depends on the sunxi-fel tool implementation.

[1]: https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Disable padding from SPL_PAD_TO
- Rely on binman min-size instead of using explicit offsets
- Use Kconfig for firmware addresses instead of an #ifdef staircase

Samuel Holland (4):
sunxi: spl: Disable padding from SPL_PAD_TO
sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig
sunxi: binman: Support FIT generation for 32-bit SoCs
sunxi: Enable SPL FIT loading for 32-bit SoCs

 arch/arm/Kconfig               |  1 +
 arch/arm/dts/sunxi-u-boot.dtsi | 39 ++++++++++++++++++----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++
 common/spl/Kconfig             |  6 ++----
 4 files changed, 41 insertions(+), 22 deletions(-)
Signature · 1 line
2.37.4
author maintainer
#1 lore raw

PATCH v2 1/4 sunxi: spl: Disable padding from SPL_PAD_TO

Starting with H6, Allwinner removed the artificial 32 KiB SPL size limit from the boot ROM. Now SPL size is only limited by the available SRAM. This limit ranges from 152 KiB on H6 to a whopping 2052 KiB on R329. To take advantage of this additional space, we must increase SPL_MAX_SIZE. Since we do not want to unnecessarily pad SPL out to these giant sizes, we must set SPL_PAD_TO to zero. This causes no problems because binman already takes care of appending the SPL payload at the right offset.

---

Changes in v2:
- New patch for v2

 common/spl/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
common/spl/Kconfig +1 -2
index 3c2af453ab..a7c55f8c4c 100644
@@ -97,8 +97,7 @@ config SPL_PAD_TO
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
 	default 0x11000 if ARCH_MX7 || (ARCH_MX6 && !MX6_OCRAM_256KB)
 	default 0x10000 if ARCH_KEYSTONE
-	default 0x8000 if ARCH_SUNXI && !MACH_SUN50I_H616
-	default 0x0 if ARCH_MTMIPS
+	default 0x0 if ARCH_MTMIPS || ARCH_SUNXI
 	default TPL_MAX_SIZE if TPL_MAX_SIZE > SPL_MAX_SIZE
 	default SPL_MAX_SIZE
 	help
Signature · 1 line
2.37.4
#2 lore raw

Re: [PATCH v2 1/4] sunxi: spl: Disable padding from SPL_PAD_TO

On Sun, 22 Jan 2023 15:15:27 -0600
Samuel Holland <[email protected]> wrote:

Hi Samuel,

Quoted 7 lines

Starting with H6, Allwinner removed the artificial 32 KiB SPL size limit from the boot ROM. Now SPL size is only limited by the available SRAM. This limit ranges from 152 KiB on H6 to a whopping 2052 KiB on R329. To take advantage of this additional space, we must increase SPL_MAX_SIZE. Since we do not want to unnecessarily pad SPL out to these giant sizes, we must set SPL_PAD_TO to zero. This causes no problems because binman already takes care of appending the SPL payload at the right offset.

So this patch breaks compilation, unless we have CONFIG_SPL_LOAD_FIT=1. Since this becomes only possible for ARM32 at the end of the series, this would need to move there, at the very least.
But then it still would break if someone de-selects this option (it's "imply" only).
I don't have time at the moment to deep dive into this, if someone has an idea how to fix this without forcing SPL_LOAD_FIT, I am all ears.

Cheers,
Andre

Quoted 23 lines

---

Changes in v2:
- New patch for v2

 common/spl/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
common/spl/Kconfig +1 -2
index 3c2af453ab..a7c55f8c4c 100644
@@ -97,8 +97,7 @@ config SPL_PAD_TO
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
 	default 0x11000 if ARCH_MX7 || (ARCH_MX6 && !MX6_OCRAM_256KB)
 	default 0x10000 if ARCH_KEYSTONE
-	default 0x8000 if ARCH_SUNXI && !MACH_SUN50I_H616
-	default 0x0 if ARCH_MTMIPS
+	default 0x0 if ARCH_MTMIPS || ARCH_SUNXI
 	default TPL_MAX_SIZE if TPL_MAX_SIZE > SPL_MAX_SIZE
 	default SPL_MAX_SIZE
 	help
author maintainer
#3 lore raw

PATCH v2 2/4 sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig

In reply to Samuel Holland

This is easier to read than the #ifdef staircase, provides better visibility into the memory map (alongside the other Kconfig definitions), and allows these addresses to be reused from code.

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

 arch/arm/dts/sunxi-u-boot.dtsi | 24 +++++++-----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +7 -17
index 8a6c9e901a..f38359fd42 100644
@@ -1,15 +1,5 @@
 #include <config.h>
 
-#ifdef CONFIG_MACH_SUN50I_H6
-#define BL31_ADDR 0x104000
-#define  SCP_ADDR 0x114000
-#elif defined(CONFIG_MACH_SUN50I_H616)
-#define BL31_ADDR 0x40000000
-#else
-#define BL31_ADDR  0x44000
-#define  SCP_ADDR  0x50000
-#endif
-
 / {
 	aliases {
 #ifndef CONFIG_MACH_SUNIV
@@ -64,8 +54,8 @@
 					os = "arm-trusted-firmware";
 					arch = "arm64";
 					compression = "none";
-					load = <BL31_ADDR>;
-					entry = <BL31_ADDR>;
+					load = <CONFIG_SUNXI_BL31_BASE>;
+					entry = <CONFIG_SUNXI_BL31_BASE>;
 
 					atf-bl31 {
 						filename = "bl31.bin";
@@ -73,13 +63,13 @@
 					};
 				};
 
-#ifdef SCP_ADDR
+#if CONFIG_SUNXI_SCP_BASE
 				scp {
 					description = "SCP firmware";
 					type = "firmware";
 					arch = "or1k";
 					compression = "none";
-					load = <SCP_ADDR>;
+					load = <CONFIG_SUNXI_SCP_BASE>;
 
 					scp {
 						filename = "scp.bin";
@@ -101,10 +91,10 @@
 				@config-SEQ {
 					description = "NAME";
 					firmware = "atf";
-#ifndef SCP_ADDR
-					loadables = "uboot";
-#else
+#if CONFIG_SUNXI_SCP_BASE
 					loadables = "scp", "uboot";
+#else
+					loadables = "uboot";
 #endif
 					fdt = "fdt-SEQ";
 				};
arch/arm/mach-sunxi/Kconfig +17 -0
index dbe6005daa..8e67f7e91d 100644
@@ -110,6 +110,23 @@ config SUNXI_SRAM_ADDRESS
 	Some newer SoCs map the boot ROM at address 0 instead and move the
 	SRAM to a different address.
 
+config SUNXI_BL31_BASE
+	hex
+	default 0x00044000 if MACH_SUN50I || MACH_SUN50I_H5
+	default 0x00104000 if MACH_SUN50I_H6
+	default 0x40000000 if MACH_SUN50I_H616
+	default 0x0
+	help
+	  Address where BL31 (TF-A) is loaded, or zero if BL31 is not used.
+
+config SUNXI_SCP_BASE
+	hex
+	default 0x00050000 if MACH_SUN50I || MACH_SUN50I_H5
+	default 0x00114000 if MACH_SUN50I_H6
+	default 0x0
+	help
+	  Address where SCP firmware is loaded, or zero if it is not used.
+
 config SUNXI_A64_TIMER_ERRATUM
 	bool
 
Signature · 1 line
2.37.4
Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig

HI Samuel,

Quoted 6 lines · Samuel Holland

This is easier to read than the #ifdef staircase, provides better visibility into the memory map (alongside the other Kconfig definitions), and allows these addresses to be reused from code.

Quoted 8 lines

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

 arch/arm/dts/sunxi-u-boot.dtsi | 24 +++++++-----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)

Is this info not in the device tree?

Regards,
Simon

author maintainer
#5 lore raw

Re: [PATCH v2 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig

Hi Simon,

Quoted 14 lines · Simon Glass

HI Samuel,

Quoted 11 lines · Samuel Holland

This is easier to read than the #ifdef staircase, provides better visibility into the memory map (alongside the other Kconfig definitions), and allows these addresses to be reused from code.

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

Quoted 7 lines
Quoted 3 lines
 arch/arm/dts/sunxi-u-boot.dtsi | 24 +++++++-----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)

Is this info not in the device tree?

It is not. These values do not correspond to any hardware property. For example, on A64/H5/H6, BL31 and SCP share a single "SRAM A2" region. The division of the SRAM between them was chosen arbitrarily (though now it is ABI). How would you represent this in the devicetree?

Regards,
Samuel

#6 lore raw

Re: [PATCH v2 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig

Hi Samuel,

Quoted 22 lines · Samuel Holland

Hi Simon,

Quoted 18 lines · Simon Glass

HI Samuel,

Quoted 14 lines · Samuel Holland

This is easier to read than the #ifdef staircase, provides better visibility into the memory map (alongside the other Kconfig definitions), and allows these addresses to be reused from code.

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

 arch/arm/dts/sunxi-u-boot.dtsi | 24 +++++++-----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)
Quoted 8 lines
Quoted 3 lines

Is this info not in the device tree?

It is not. These values do not correspond to any hardware property. For example, on A64/H5/H6, BL31 and SCP share a single "SRAM A2" region. The division of the SRAM between them was chosen arbitrarily (though now it is ABI). How would you represent this in the devicetree?

I would probably add a new node for the SRAM, with partition information within that, as is done for MTD.

Regards,
Simon

#7 lore raw

Re: [PATCH v2 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig

Quoted 29 lines · On Tue, 24 Jan 2023 15:44:30 -0700 Simon Glass <[email protected]> wrote:

Hi Samuel,

Quoted 26 lines · Samuel Holland

Hi Simon,

Quoted 21 lines · Simon Glass

HI Samuel,

Quoted 6 lines · Samuel Holland

This is easier to read than the #ifdef staircase, provides better visibility into the memory map (alongside the other Kconfig definitions), and allows these addresses to be reused from code.

Quoted 8 lines

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

 arch/arm/dts/sunxi-u-boot.dtsi | 24 +++++++-----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)  

Is this info not in the device tree?

Quoted 7 lines
Quoted 4 lines

It is not. These values do not correspond to any hardware property. For example, on A64/H5/H6, BL31 and SCP share a single "SRAM A2" region. The division of the SRAM between them was chosen arbitrarily (though now it is ABI). How would you represent this in the devicetree?

I would probably add a new node for the SRAM, with partition information within that, as is done for MTD.

I am probably missing something, but why would we want to do that? Looks a bit like a solution looking for a problem to me.
The split and assignment of the SRAM regions is an agreement between BL31, crust and U-Boot, with U-Boot taking the lead here, because it's the initial loader of those components, and does the packaging.
So what would putting those addresses in the generic DT bring us, aside from more complicated code to look them up?

Cheers,
Andre

#8 lore raw

Re: [PATCH v2 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig

Hi Andre,

Quoted 41 lines · Andre Przywara
Quoted 29 lines · On Tue, 24 Jan 2023 15:44:30 -0700 Simon Glass <[email protected]> wrote:

Hi Samuel,

Quoted 26 lines · Samuel Holland

Hi Simon,

Quoted 21 lines · Simon Glass

HI Samuel,

Quoted 6 lines · Samuel Holland

This is easier to read than the #ifdef staircase, provides better visibility into the memory map (alongside the other Kconfig definitions), and allows these addresses to be reused from code.

Quoted 8 lines

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

 arch/arm/dts/sunxi-u-boot.dtsi | 24 +++++++-----------------
 arch/arm/mach-sunxi/Kconfig    | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)

Is this info not in the device tree?

Quoted 7 lines
Quoted 4 lines

It is not. These values do not correspond to any hardware property. For example, on A64/H5/H6, BL31 and SCP share a single "SRAM A2" region. The division of the SRAM between them was chosen arbitrarily (though now it is ABI). How would you represent this in the devicetree?

I would probably add a new node for the SRAM, with partition information within that, as is done for MTD.

Quoted 7 lines

I am probably missing something, but why would we want to do that? Looks a bit like a solution looking for a problem to me.
The split and assignment of the SRAM regions is an agreement between BL31, crust and U-Boot, with U-Boot taking the lead here, because it's the initial loader of those components, and does the packaging.
So what would putting those addresses in the generic DT bring us, aside from more complicated code to look them up?

Well I just answered the question. I'm not necessarily advocating for it.

We could perhaps use the new Transfer List to pass this info instead. But if separate projects have implicit hard-coded values it is going to lead to pain when they conflict. It is better to set this all up at packaging time.

Regards,
Simon

author maintainer
#9 lore raw

PATCH v2 3/4 sunxi: binman: Support FIT generation for 32-bit SoCs

In reply to Samuel Holland

Some 32-bit SoCs can use SCP firmware to implement additional PSCI functionality, such as system suspend. In order to load this firmware from SPL, we need to generate and use a FIT instead of a legacy image.

Adjust the binman FIT definition so it does not rely on TF-A BL31, as this is not used on 32-bit SoCs. Instead, after loading the firmware, U-Boot proper is executed directly.

---

Changes in v2:
- Rely on binman min-size instead of using explicit offsets
- Use Kconfig for firmware addresses instead of an #ifdef staircase

 arch/arm/dts/sunxi-u-boot.dtsi | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +18 -5
index f38359fd42..c7089b8619 100644
@@ -1,5 +1,11 @@
 #include <config.h>
 
+#ifdef CONFIG_ARM64
+#define ARCH "arm64"
+#else
+#define ARCH "arm"
+#endif
+
 / {
 	aliases {
 #ifndef CONFIG_MACH_SUNIV
@@ -29,30 +35,32 @@
 			filename = "spl/sunxi-spl.bin";
 		};
 
-#ifdef CONFIG_ARM64
+#ifdef CONFIG_SPL_LOAD_FIT
 		fit {
-			description = "Configuration to load ATF before U-Boot";
+			description = "Configuration to load U-Boot and firmware";
 			#address-cells = <1>;
 			fit,fdt-list = "of-list";
 
 			images {
 				uboot {
-					description = "U-Boot (64-bit)";
+					description = "U-Boot";
 					type = "standalone";
 					os = "u-boot";
-					arch = "arm64";
+					arch = ARCH;
 					compression = "none";
 					load = <CONFIG_TEXT_BASE>;
+					entry = <CONFIG_TEXT_BASE>;
 
 					u-boot-nodtb {
 					};
 				};
 
+#if CONFIG_SUNXI_BL31_BASE
 				atf {
 					description = "ARM Trusted Firmware";
 					type = "firmware";
 					os = "arm-trusted-firmware";
-					arch = "arm64";
+					arch = ARCH;
 					compression = "none";
 					load = <CONFIG_SUNXI_BL31_BASE>;
 					entry = <CONFIG_SUNXI_BL31_BASE>;
@@ -62,6 +70,7 @@
 						missing-msg = "atf-bl31-sunxi";
 					};
 				};
+#endif
 
 #if CONFIG_SUNXI_SCP_BASE
 				scp {
@@ -90,7 +99,11 @@
 
 				@config-SEQ {
 					description = "NAME";
+#if CONFIG_SUNXI_BL31_BASE
 					firmware = "atf";
+#else
+					firmware = "uboot";
+#endif
 #if CONFIG_SUNXI_SCP_BASE
 					loadables = "scp", "uboot";
 #else
Signature · 1 line
2.37.4
#10 lore raw

Re: [PATCH v2 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs

Quoted 23 lines · Samuel Holland

Some 32-bit SoCs can use SCP firmware to implement additional PSCI functionality, such as system suspend. In order to load this firmware from SPL, we need to generate and use a FIT instead of a legacy image.

Adjust the binman FIT definition so it does not rely on TF-A BL31, as this is not used on 32-bit SoCs. Instead, after loading the firmware, U-Boot proper is executed directly.

---

Changes in v2:
- Rely on binman min-size instead of using explicit offsets
- Use Kconfig for firmware addresses instead of an #ifdef staircase

  arch/arm/dts/sunxi-u-boot.dtsi | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)
arch/arm/dts/sunxi-u-boot.dtsi +0 -0
index f38359fd42..c7089b8619 100644

arch/arm/dts/sunxi-u-boot.dtsi line 8

Quoted 8 lines
arch/arm/dts/sunxi-u-boot.dtsi +6 -0
@@ -1,5 +1,11 @@
  #include <config.h>
 
+#ifdef CONFIG_ARM64
+#define ARCH "arm64"
+#else
+#define ARCH "arm"
+#endif
+

There should be a better way to do this, but if not shouldn't the else should be elseif because of the RISCV SOCs.

The rest looks fine to me.

Thanks,
Jesse T

Quoted 61 lines
arch/arm/dts/sunxi-u-boot.dtsi +12 -5
  / {
  	aliases {
  #ifndef CONFIG_MACH_SUNIV
@@ -29,30 +35,32 @@
  			filename = "spl/sunxi-spl.bin";
  		};
 
-#ifdef CONFIG_ARM64
+#ifdef CONFIG_SPL_LOAD_FIT
  		fit {
-			description = "Configuration to load ATF before U-Boot";
+			description = "Configuration to load U-Boot and firmware";
  			#address-cells = <1>;
  			fit,fdt-list = "of-list";
 
  			images {
  				uboot {
-					description = "U-Boot (64-bit)";
+					description = "U-Boot";
  					type = "standalone";
  					os = "u-boot";
-					arch = "arm64";
+					arch = ARCH;
  					compression = "none";
  					load = <CONFIG_TEXT_BASE>;
+					entry = <CONFIG_TEXT_BASE>;
 
  					u-boot-nodtb {
  					};
  				};
 
+#if CONFIG_SUNXI_BL31_BASE
  				atf {
  					description = "ARM Trusted Firmware";
  					type = "firmware";
  					os = "arm-trusted-firmware";
-					arch = "arm64";
+					arch = ARCH;
  					compression = "none";
  					load = <CONFIG_SUNXI_BL31_BASE>;
  					entry = <CONFIG_SUNXI_BL31_BASE>;
@@ -62,6 +70,7 @@
  						missing-msg = "atf-bl31-sunxi";
  					};
  				};
+#endif
 
  #if CONFIG_SUNXI_SCP_BASE
  				scp {
@@ -90,7 +99,11 @@
 
  				@config-SEQ {
  					description = "NAME";
+#if CONFIG_SUNXI_BL31_BASE
  					firmware = "atf";
+#else
+					firmware = "uboot";
+#endif
  #if CONFIG_SUNXI_SCP_BASE
  					loadables = "scp", "uboot";
  #else
author maintainer
#11 lore raw

Re: [PATCH v2 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs

Quoted 21 lines · Jesse Taube
Quoted 18 lines · Samuel Holland

Some 32-bit SoCs can use SCP firmware to implement additional PSCI functionality, such as system suspend. In order to load this firmware from SPL, we need to generate and use a FIT instead of a legacy image.

Adjust the binman FIT definition so it does not rely on TF-A BL31, as this is not used on 32-bit SoCs. Instead, after loading the firmware, U-Boot proper is executed directly.

---

Changes in v2:
  - Rely on binman min-size instead of using explicit offsets
  - Use Kconfig for firmware addresses instead of an #ifdef staircase

  arch/arm/dts/sunxi-u-boot.dtsi | 23 ++++++++++++++++++-----

  1 file changed, 18 insertions(+), 5 deletions(-)
Quoted 15 lines

arch/arm/dts/sunxi-u-boot.dtsi line 8

Quoted 13 lines
arch/arm/dts/sunxi-u-boot.dtsi +0 -0
index f38359fd42..c7089b8619 100644
@@ -1,5 +1,11 @@
   #include <config.h>

  +#ifdef CONFIG_ARM64

arch/arm/dts/sunxi-u-boot.dtsi +5 -0
+#define ARCH "arm64"
+#else
+#define ARCH "arm"
+#endif
+

There should be a better way to do this, but if not shouldn't the else should be elseif because of the RISCV SOCs.

This file is in arch/arm, so it will not be used for RISC-V. RISC-V SoCs have a different firmware (OpenSBI instead of TF-A), so they would need a different binman configuration anyway. If you know of a better way to get the architecture string, I would be happy to use it, but I don't see any code in the U-Boot tree that generates the string "arm64".

Regards,
Samuel

Quoted 55 lines
Quoted 55 lines

  / {
      aliases {
  #ifndef CONFIG_MACH_SUNIV

arch/arm/dts/sunxi-u-boot.dtsi +0 -0
@@ -29,30 +35,32 @@
               filename = "spl/sunxi-spl.bin";
           };

  -#ifdef CONFIG_ARM64
+#ifdef CONFIG_SPL_LOAD_FIT
          fit {
-            description = "Configuration to load ATF before U-Boot"; +            description = "Configuration to load U-Boot and firmware"; #address-cells = <1>;
              fit,fdt-list = "of-list";
                images {
                  uboot {
-                    description = "U-Boot (64-bit)";
+                    description = "U-Boot";
                      type = "standalone";
                      os = "u-boot";
-                    arch = "arm64";
+                    arch = ARCH;
                      compression = "none";
                      load = <CONFIG_TEXT_BASE>;
+                    entry = <CONFIG_TEXT_BASE>; u-boot-nodtb {
                      };
                  };
  +#if CONFIG_SUNXI_BL31_BASE
                  atf {
                      description = "ARM Trusted Firmware"; type = "firmware";
                      os = "arm-trusted-firmware";
-                    arch = "arm64";
+                    arch = ARCH;
                      compression = "none";
                      load = <CONFIG_SUNXI_BL31_BASE>;
                      entry = <CONFIG_SUNXI_BL31_BASE>;

arch/arm/dts/sunxi-u-boot.dtsi +5 -0
@@ -62,6 +70,7 @@
                           missing-msg = "atf-bl31-sunxi";
                       };
                   };
+#endif
     #if CONFIG_SUNXI_SCP_BASE
                   scp {
@@ -90,7 +99,11 @@
                     @config-SEQ {
                       description = "NAME";
+#if CONFIG_SUNXI_BL31_BASE
                       firmware = "atf";
+#else
+                    firmware = "uboot";
+#endif
   #if CONFIG_SUNXI_SCP_BASE
                       loadables = "scp", "uboot";
   #else
author maintainer
#12 lore raw

PATCH v2 4/4 sunxi: Enable SPL FIT loading for 32-bit SoCs

In reply to Samuel Holland

Now that 32-bit SoCs can load U-Boot proper (and possibly other firmware) from a FIT, use this method by default. SPL_FIT_IMAGE_TINY is required to stay within the 24 or 32 KiB SPL size limit on early SoCs; for consistency, enable it everywhere.

---

Changes in v2:
- New patch for v2, split from the .dtsi changes

 arch/arm/Kconfig   | 1 +
 common/spl/Kconfig | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/Kconfig +1 -0
index c9a44ebc22..f150bc3903 100644
@@ -1135,6 +1135,7 @@ config ARCH_SUNXI
 	imply SPL_GPIO
 	imply SPL_LIBCOMMON_SUPPORT
 	imply SPL_LIBGENERIC_SUPPORT
+	imply SPL_LOAD_FIT
 	imply SPL_MMC if MMC
 	imply SPL_POWER
 	imply SPL_SERIAL
common/spl/Kconfig +1 -2
index a7c55f8c4c..502b0f27b8 100644
@@ -575,8 +575,7 @@ config SPL_MD5
 config SPL_FIT_IMAGE_TINY
 	bool "Remove functionality from SPL FIT loading to reduce size"
 	depends on SPL_FIT
-	default y if MACH_SUN50I || MACH_SUN50I_H5 || SUN50I_GEN_H6
-	default y if ARCH_IMX8M || ARCH_IMX9
+	default y if ARCH_IMX8M || ARCH_IMX9 || ARCH_SUNXI
 	help
 	  Enable this to reduce the size of the FIT image loading code
 	  in SPL, if space for the SPL binary is very tight.
Signature · 1 line
2.37.4