public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs
@ 2023-10-31  5:17 Samuel Holland
  2023-10-31  5:17 ` [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO Samuel Holland
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Samuel Holland @ 2023-10-31  5:17 UTC (permalink / raw)
  To: Andre Przywara, Jagan Teki
  Cc: u-boot, Icenowy Zheng, Jesse Taube, Samuel Holland

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.

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.

Changes in v3:
 - Rebased and collected tags

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(-)

-- 
2.41.0


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

* [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO
  2023-10-31  5:17 [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Samuel Holland
@ 2023-10-31  5:17 ` Samuel Holland
  2023-12-08  0:25   ` Andre Przywara
  2023-10-31  5:17 ` [PATCH v3 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig Samuel Holland
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Samuel Holland @ 2023-10-31  5:17 UTC (permalink / raw)
  To: Andre Przywara, Jagan Teki
  Cc: u-boot, Icenowy Zheng, Jesse Taube, Samuel Holland

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.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

(no changes since v2)

Changes in v2:
 - New patch for v2

 common/spl/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 25cd18afda7..a0968ff1065 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -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
-- 
2.41.0


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

* [PATCH v3 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig
  2023-10-31  5:17 [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Samuel Holland
  2023-10-31  5:17 ` [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO Samuel Holland
@ 2023-10-31  5:17 ` Samuel Holland
  2023-12-08  0:33   ` Andre Przywara
  2023-10-31  5:17 ` [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs Samuel Holland
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Samuel Holland @ 2023-10-31  5:17 UTC (permalink / raw)
  To: Andre Przywara, Jagan Teki
  Cc: u-boot, Icenowy Zheng, Jesse Taube, Samuel Holland, Simon Glass

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.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---

(no changes since v2)

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(-)

diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index a0c8abb7033..7a8764e463b 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -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 {
 		mmc0 = &mmc0;
@@ -69,8 +59,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";
@@ -78,13 +68,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";
@@ -106,10 +96,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";
 				};
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index a10e4c06b6a..b0fbda0aa09 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -155,6 +155,23 @@ config SUNXI_RVBAR_ALTERNATIVE
 	for all other SoCs, so the content of the SRAM_VER_REG becomes
 	irrelevant there, and we can use the same code.
 
+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
 
-- 
2.41.0


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

* [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs
  2023-10-31  5:17 [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Samuel Holland
  2023-10-31  5:17 ` [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO Samuel Holland
  2023-10-31  5:17 ` [PATCH v3 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig Samuel Holland
@ 2023-10-31  5:17 ` Samuel Holland
  2023-11-02 22:46   ` Simon Glass
                     ` (2 more replies)
  2023-10-31  5:17 ` [PATCH v3 4/4] sunxi: Enable SPL FIT loading " Samuel Holland
  2023-11-01 17:11 ` [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Jesse T
  4 siblings, 3 replies; 15+ messages in thread
From: Samuel Holland @ 2023-10-31  5:17 UTC (permalink / raw)
  To: Andre Przywara, Jagan Teki
  Cc: u-boot, Icenowy Zheng, Jesse Taube, 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.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

(no changes since v2)

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(-)

diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index 7a8764e463b..ed1cb91eeb5 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -1,5 +1,11 @@
 #include <config.h>
 
+#ifdef CONFIG_ARM64
+#define ARCH "arm64"
+#else
+#define ARCH "arm"
+#endif
+
 / {
 	aliases {
 		mmc0 = &mmc0;
@@ -34,30 +40,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>;
@@ -67,6 +75,7 @@
 						missing-msg = "atf-bl31-sunxi";
 					};
 				};
+#endif
 
 #if CONFIG_SUNXI_SCP_BASE
 				scp {
@@ -95,7 +104,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
-- 
2.41.0


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

* [PATCH v3 4/4] sunxi: Enable SPL FIT loading for 32-bit SoCs
  2023-10-31  5:17 [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Samuel Holland
                   ` (2 preceding siblings ...)
  2023-10-31  5:17 ` [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs Samuel Holland
@ 2023-10-31  5:17 ` Samuel Holland
  2023-11-02 22:46   ` Simon Glass
  2023-12-08  1:39   ` Andre Przywara
  2023-11-01 17:11 ` [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Jesse T
  4 siblings, 2 replies; 15+ messages in thread
From: Samuel Holland @ 2023-10-31  5:17 UTC (permalink / raw)
  To: Andre Przywara, Jagan Teki
  Cc: u-boot, Icenowy Zheng, Jesse Taube, 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.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

(no changes since v2)

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(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d812685c984..42781d02f0f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1167,6 +1167,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
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index a0968ff1065..aebbfbf99d2 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -567,8 +567,7 @@ config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
 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.
-- 
2.41.0


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

* Re: [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs
  2023-10-31  5:17 [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Samuel Holland
                   ` (3 preceding siblings ...)
  2023-10-31  5:17 ` [PATCH v3 4/4] sunxi: Enable SPL FIT loading " Samuel Holland
@ 2023-11-01 17:11 ` Jesse T
  4 siblings, 0 replies; 15+ messages in thread
From: Jesse T @ 2023-11-01 17:11 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Andre Przywara, Jagan Teki, u-boot, Icenowy Zheng

On Tue, Oct 31, 2023 at 1:18 AM Samuel Holland <samuel@sholland.org> wrote:
>
> 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.
>
> 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.
>
> Changes in v3:
>  - Rebased and collected tags
>
> 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(-)
>
> --
> 2.41.0
>

Acked-by: Jesse Taube <Mr.Bossman075@gmail.com>

Looks good!

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

* Re: [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs
  2023-10-31  5:17 ` [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs Samuel Holland
@ 2023-11-02 22:46   ` Simon Glass
  2023-12-08  1:26   ` Andre Przywara
  2024-01-29 16:58   ` Andre Przywara
  2 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2023-11-02 22:46 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Andre Przywara, Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Tue, 31 Oct 2023 at 05:18, Samuel Holland <samuel@sholland.org> wrote:
>
> 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.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>
> (no changes since v2)
>
> 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(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH v3 4/4] sunxi: Enable SPL FIT loading for 32-bit SoCs
  2023-10-31  5:17 ` [PATCH v3 4/4] sunxi: Enable SPL FIT loading " Samuel Holland
@ 2023-11-02 22:46   ` Simon Glass
  2023-12-08  1:39   ` Andre Przywara
  1 sibling, 0 replies; 15+ messages in thread
From: Simon Glass @ 2023-11-02 22:46 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Andre Przywara, Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Tue, 31 Oct 2023 at 05:18, Samuel Holland <samuel@sholland.org> wrote:
>
> 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.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>
> (no changes since v2)
>
> 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(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO
  2023-10-31  5:17 ` [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO Samuel Holland
@ 2023-12-08  0:25   ` Andre Przywara
  0 siblings, 0 replies; 15+ messages in thread
From: Andre Przywara @ 2023-12-08  0:25 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Tue, 31 Oct 2023 00:17:38 -0500
Samuel Holland <samuel@sholland.org> wrote:

Hi Samuel,

> 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.

That looks alright now, back in v2023.04 (at time of v2) this still
broke compilation, but this was fixed with your patch 9a4aa31ad514. I
actually cannot see any effect on sunxi builds anymore, apart from the
check in config_fallbacks.h, which is appeased with the value being set
to 0 here. So:

> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
> 
> (no changes since v2)
> 
> Changes in v2:
>  - New patch for v2
> 
>  common/spl/Kconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 25cd18afda7..a0968ff1065 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -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


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

* Re: [PATCH v3 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig
  2023-10-31  5:17 ` [PATCH v3 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig Samuel Holland
@ 2023-12-08  0:33   ` Andre Przywara
  0 siblings, 0 replies; 15+ messages in thread
From: Andre Przywara @ 2023-12-08  0:33 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube, Simon Glass

On Tue, 31 Oct 2023 00:17:39 -0500
Samuel Holland <samuel@sholland.org> wrote:

Hi Samuel,

> 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.

This is indeed much nicer, and simplifies adding more SoCs.
I checked that the addresses are the same:

> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
> 
> (no changes since v2)
> 
> 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(-)
> 
> diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
> index a0c8abb7033..7a8764e463b 100644
> --- a/arch/arm/dts/sunxi-u-boot.dtsi
> +++ b/arch/arm/dts/sunxi-u-boot.dtsi
> @@ -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 {
>  		mmc0 = &mmc0;
> @@ -69,8 +59,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";
> @@ -78,13 +68,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";
> @@ -106,10 +96,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";
>  				};
> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> index a10e4c06b6a..b0fbda0aa09 100644
> --- a/arch/arm/mach-sunxi/Kconfig
> +++ b/arch/arm/mach-sunxi/Kconfig
> @@ -155,6 +155,23 @@ config SUNXI_RVBAR_ALTERNATIVE
>  	for all other SoCs, so the content of the SRAM_VER_REG becomes
>  	irrelevant there, and we can use the same code.
>  
> +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
>  


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

* Re: [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs
  2023-10-31  5:17 ` [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs Samuel Holland
  2023-11-02 22:46   ` Simon Glass
@ 2023-12-08  1:26   ` Andre Przywara
  2024-01-29 16:58   ` Andre Przywara
  2 siblings, 0 replies; 15+ messages in thread
From: Andre Przywara @ 2023-12-08  1:26 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Tue, 31 Oct 2023 00:17:40 -0500
Samuel Holland <samuel@sholland.org> wrote:

Hi,

> 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.

I like that it removes the artificial restriction to use a FIT image
only on arm64 builds, and indeed hinges that on the relevant
CONFIG_SPL_LOAD_FIT variable.
The changes look alright, even "uboot" being mentioned twice (once as
firmware, once as loadable): the SPL code can cope with that.

> Signed-off-by: Samuel Holland <samuel@sholland.org>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
> 
> (no changes since v2)
> 
> 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(-)
> 
> diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
> index 7a8764e463b..ed1cb91eeb5 100644
> --- a/arch/arm/dts/sunxi-u-boot.dtsi
> +++ b/arch/arm/dts/sunxi-u-boot.dtsi
> @@ -1,5 +1,11 @@
>  #include <config.h>
>  
> +#ifdef CONFIG_ARM64
> +#define ARCH "arm64"
> +#else
> +#define ARCH "arm"
> +#endif
> +
>  / {
>  	aliases {
>  		mmc0 = &mmc0;
> @@ -34,30 +40,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>;
> @@ -67,6 +75,7 @@
>  						missing-msg = "atf-bl31-sunxi";
>  					};
>  				};
> +#endif
>  
>  #if CONFIG_SUNXI_SCP_BASE
>  				scp {
> @@ -95,7 +104,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


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

* Re: [PATCH v3 4/4] sunxi: Enable SPL FIT loading for 32-bit SoCs
  2023-10-31  5:17 ` [PATCH v3 4/4] sunxi: Enable SPL FIT loading " Samuel Holland
  2023-11-02 22:46   ` Simon Glass
@ 2023-12-08  1:39   ` Andre Przywara
  2024-01-17  0:19     ` Andre Przywara
  1 sibling, 1 reply; 15+ messages in thread
From: Andre Przywara @ 2023-12-08  1:39 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Tue, 31 Oct 2023 00:17:41 -0500
Samuel Holland <samuel@sholland.org> wrote:

Hi,

> 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.

Mmh, so that changes the build for an awful lot of boards, especially
old ones that no one can be bothered to test anymore. I am bit scared
of that change there, especially with the limited SRAM size there.

I think the main motivation stems from crust on H3, and since H3 boards
are still in good use and get tested, I'd prefer to enable it just for
H3 boards, at least for now.
If we don't hear anything bad for a while, we could try to enable it
(by default) on the other SoCs as well.

What do you think?

Cheers,
Andre



> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
> (no changes since v2)
> 
> 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(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index d812685c984..42781d02f0f 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1167,6 +1167,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
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index a0968ff1065..aebbfbf99d2 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -567,8 +567,7 @@ config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
>  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.


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

* Re: [PATCH v3 4/4] sunxi: Enable SPL FIT loading for 32-bit SoCs
  2023-12-08  1:39   ` Andre Przywara
@ 2024-01-17  0:19     ` Andre Przywara
  2024-01-29 16:19       ` Andre Przywara
  0 siblings, 1 reply; 15+ messages in thread
From: Andre Przywara @ 2024-01-17  0:19 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Fri, 8 Dec 2023 01:39:45 +0000
Andre Przywara <andre.przywara@arm.com> wrote:

Hi Samuel,

> On Tue, 31 Oct 2023 00:17:41 -0500
> Samuel Holland <samuel@sholland.org> wrote:
> 
> Hi,
> 
> > 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.  
> 
> Mmh, so that changes the build for an awful lot of boards, especially
> old ones that no one can be bothered to test anymore. I am bit scared
> of that change there, especially with the limited SRAM size there.
> 
> I think the main motivation stems from crust on H3, and since H3 boards
> are still in good use and get tested, I'd prefer to enable it just for
> H3 boards, at least for now.
> If we don't hear anything bad for a while, we could try to enable it
> (by default) on the other SoCs as well.
> 
> What do you think?

Any ideas here? I plan to take the other three patches, which would
already allow people to enable FIT in their (def)config.
I can just leave this one off for now, and we can merge a changed
version later?

Cheers,
Andre

> > 
> > Signed-off-by: Samuel Holland <samuel@sholland.org>
> > ---
> > 
> > (no changes since v2)
> > 
> > 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(-)
> > 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index d812685c984..42781d02f0f 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -1167,6 +1167,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
> > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > index a0968ff1065..aebbfbf99d2 100644
> > --- a/common/spl/Kconfig
> > +++ b/common/spl/Kconfig
> > @@ -567,8 +567,7 @@ config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
> >  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.  
> 


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

* Re: [PATCH v3 4/4] sunxi: Enable SPL FIT loading for 32-bit SoCs
  2024-01-17  0:19     ` Andre Przywara
@ 2024-01-29 16:19       ` Andre Przywara
  0 siblings, 0 replies; 15+ messages in thread
From: Andre Przywara @ 2024-01-29 16:19 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube

On Wed, 17 Jan 2024 00:19:05 +0000
Andre Przywara <andre.przywara@arm.com> wrote:

Hi,

> On Fri, 8 Dec 2023 01:39:45 +0000
> Andre Przywara <andre.przywara@arm.com> wrote:
> 
> Hi Samuel,
> 
> > On Tue, 31 Oct 2023 00:17:41 -0500
> > Samuel Holland <samuel@sholland.org> wrote:
> > 
> > Hi,
> >   
> > > 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.    
> > 
> > Mmh, so that changes the build for an awful lot of boards, especially
> > old ones that no one can be bothered to test anymore. I am bit scared
> > of that change there, especially with the limited SRAM size there.
> > 
> > I think the main motivation stems from crust on H3, and since H3 boards
> > are still in good use and get tested, I'd prefer to enable it just for
> > H3 boards, at least for now.
> > If we don't hear anything bad for a while, we could try to enable it
> > (by default) on the other SoCs as well.
> > 
> > What do you think?  
> 
> Any ideas here? I plan to take the other three patches, which would
> already allow people to enable FIT in their (def)config.
> I can just leave this one off for now, and we can merge a changed
> version later?

So I took this patch as well, but removed the hunk with "imply
SPL_LOAD_FIT" below. This means we still allow people to enable FIT images
individually, but no defconfig or Kconfig option would default to it.
Happy to discuss this decision and maybe take a later patch to rectify the
situation.

Cheers,
Andre

> > > 
> > > Signed-off-by: Samuel Holland <samuel@sholland.org>
> > > ---
> > > 
> > > (no changes since v2)
> > > 
> > > 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(-)
> > > 
> > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > index d812685c984..42781d02f0f 100644
> > > --- a/arch/arm/Kconfig
> > > +++ b/arch/arm/Kconfig
> > > @@ -1167,6 +1167,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
> > > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > > index a0968ff1065..aebbfbf99d2 100644
> > > --- a/common/spl/Kconfig
> > > +++ b/common/spl/Kconfig
> > > @@ -567,8 +567,7 @@ config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
> > >  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.    
> >   
> 


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

* Re: [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs
  2023-10-31  5:17 ` [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs Samuel Holland
  2023-11-02 22:46   ` Simon Glass
  2023-12-08  1:26   ` Andre Przywara
@ 2024-01-29 16:58   ` Andre Przywara
  2 siblings, 0 replies; 15+ messages in thread
From: Andre Przywara @ 2024-01-29 16:58 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Jagan Teki, u-boot, Icenowy Zheng, Jesse Taube,
	Heinrich Schuchardt, Simon Glass

On Tue, 31 Oct 2023 00:17:40 -0500
Samuel Holland <samuel@sholland.org> wrote:

Hi,

> 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.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

So I merged this patch (along with the others), but with one change below:

> ---
> 
> (no changes since v2)
> 
> 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(-)
> 
> diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
> index 7a8764e463b..ed1cb91eeb5 100644
> --- a/arch/arm/dts/sunxi-u-boot.dtsi
> +++ b/arch/arm/dts/sunxi-u-boot.dtsi
> @@ -1,5 +1,11 @@
>  #include <config.h>
>  
> +#ifdef CONFIG_ARM64
> +#define ARCH "arm64"
> +#else
> +#define ARCH "arm"
> +#endif
> +
>  / {
>  	aliases {
>  		mmc0 = &mmc0;
> @@ -34,30 +40,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>;

This line for some odd reason broke the Debian arm64 Grub execution for
me: U-Boot would run fine, it would load grub.efi, but then I see U-Boot's
exception handler, with an ESR 0x20000000 ("unknown reason"), and a reset.

It also confuses sunxi-fel's FIT loader, which expects exactly one image
with an "entry" property, and thus refuses to load such an image. This
is admittedly a limitation of sunxi-fel, but nevertheless would mean we
cannot FEL boot those images at the moment.
I will look into fixing this there, but together with the first problem, I
decided to make this line conditional, by bracketing it with a check for
CONFIG_SUNXI_BL31_BASE being 0.
This means we never get two "entry" properties:
- for arm64, BL31_BASE is never 0, so we skip it here, but get it below,
for the "atf" node.
- for arm, BL31_BASE is always 0, so we get it here, but skip the entire
"atf" node below.

Happy to revisit this problem with a proper fix, but to not hold this
series back any longer, because it's a nice series and cleans up some
mess, I merged it with this modification, plus the removal of the
unconditional enablement in the last patch.

Cheers,
Andre.

>  
>  					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>;
> @@ -67,6 +75,7 @@
>  						missing-msg = "atf-bl31-sunxi";
>  					};
>  				};
> +#endif
>  
>  #if CONFIG_SUNXI_SCP_BASE
>  				scp {
> @@ -95,7 +104,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


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

end of thread, other threads:[~2024-01-29 16:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31  5:17 [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Samuel Holland
2023-10-31  5:17 ` [PATCH v3 1/4] sunxi: spl: Disable padding from SPL_PAD_TO Samuel Holland
2023-12-08  0:25   ` Andre Przywara
2023-10-31  5:17 ` [PATCH v3 2/4] sunxi: binman: Move BL31 and SCP firmware addresses to Kconfig Samuel Holland
2023-12-08  0:33   ` Andre Przywara
2023-10-31  5:17 ` [PATCH v3 3/4] sunxi: binman: Support FIT generation for 32-bit SoCs Samuel Holland
2023-11-02 22:46   ` Simon Glass
2023-12-08  1:26   ` Andre Przywara
2024-01-29 16:58   ` Andre Przywara
2023-10-31  5:17 ` [PATCH v3 4/4] sunxi: Enable SPL FIT loading " Samuel Holland
2023-11-02 22:46   ` Simon Glass
2023-12-08  1:39   ` Andre Przywara
2024-01-17  0:19     ` Andre Przywara
2024-01-29 16:19       ` Andre Przywara
2023-11-01 17:11 ` [PATCH v3 0/4] sunxi: SPL FIT support for 32-bit sunxi SoCs Jesse T

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox