Message ID | 20230122211531.23181-4-samuel@sholland.org |
---|---|
State | Superseded |
Delegated to: | Andre Przywara |
Headers | show |
Series | sunxi: SPL FIT support for 32-bit sunxi SoCs | expand |
On 1/22/23 16:15, Samuel Holland 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> > --- > > 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 f38359fd42..c7089b8619 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 > + 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 > / { > 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
On 1/22/23 17:37, Jesse Taube wrote: > > > On 1/22/23 16:15, Samuel Holland 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> >> --- >> >> 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 f38359fd42..c7089b8619 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 >> + > 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 >> / { >> 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
diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi index f38359fd42..c7089b8619 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 { #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
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> --- 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(-)