[PATCH v5 17/23] synquacer: Update for TBBR (BL2) based new FIP layout

Sughosh Ganu
2022-06-09T12:34:01Z

From: Masami Hiramatsu <masami.hiramatsu@linaro.org>

This changes SPI NOR flash partition layout for TBBR and
also make the U-Boot as position independent executable
again because BL33 is loaded on the memory.

With enabling TBBR, TF-A BL2 loads all BL3x images from
FIP image, and the U-Boot image is added to the FIP image
as BL33, and loaded to memory when boot instead of XIP
on SPI NOR flash. To avoid mixing up with the legacy images,
this new FIP image is stored on unused area (0x600000-) and
the U-Boot env vars are also stored at 0x580000 so that
it will not break existing EDK2 area.

NOTE: This introduces an incombatible change to the
synquacer_developerbox_defconfig. If you want to build
U-Boot for booting from legacy FIP image, you need to
specify previous configuration.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
.../synquacer-sc2a11-developerbox-u-boot.dtsi | 26 +++++++++++++------
configs/synquacer_developerbox_defconfig | 5 ++--
include/configs/synquacer.h | 4 +--
3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
index 7a56116d6f..095727e03c 100644
--- a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
+++ b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
@@ -56,7 +56,7 @@
};

partition@180000 {
- label = "FIP-TFA";
+ label = "LegacyFIP";
reg = <0x180000 0x78000>;
};

@@ -66,18 +66,28 @@
};

partition@200000 {
- label = "U-Boot";
- reg = <0x200000 0x100000>;
+ label = "EDK2";
+ reg = <0x200000 0x200000>;
};

- partition@300000 {
- label = "UBoot-Env";
- reg = <0x300000 0x100000>;
+ partition@400000 {
+ label = "EDK2-Env";
+ reg = <0x400000 0x100000>;
};

partition@500000 {
- label = "Ex-OPTEE";
- reg = <0x500000 0x200000>;
+ label = "Metadata";
+ reg = <0x500000 0x80000>;
+ };
+
+ partition@580000 {
+ label = "UBoot-Env";
+ reg = <0x580000 0x80000>;
+ };
+
+ partition@600000 {
+ label = "FIP";
+ reg = <0x600000 0x400000>;
};
};
};
diff --git a/configs/synquacer_developerbox_defconfig b/configs/synquacer_developerbox_defconfig
index add6041e27..29b1e11401 100644
--- a/configs/synquacer_developerbox_defconfig
+++ b/configs/synquacer_developerbox_defconfig
@@ -1,10 +1,11 @@
CONFIG_ARM=y
CONFIG_ARCH_SYNQUACER=y
-CONFIG_SYS_TEXT_BASE=0x08200000
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_SYS_TEXT_BASE=0
CONFIG_SYS_MALLOC_LEN=0x1000000
CONFIG_SYS_MALLOC_F_LEN=0x400
CONFIG_ENV_SIZE=0x30000
-CONFIG_ENV_OFFSET=0x300000
+CONFIG_ENV_OFFSET=0x580000
CONFIG_ENV_SECT_SIZE=0x10000
CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="synquacer-sc2a11-developerbox"
diff --git a/include/configs/synquacer.h b/include/configs/synquacer.h
index 5686a5b910..572f0a42ac 100644
--- a/include/configs/synquacer.h
+++ b/include/configs/synquacer.h
@@ -47,9 +47,7 @@
/* Since U-Boot 64bit PCIe support is limited, disable 64bit MMIO support */

#define DEFAULT_DFU_ALT_INFO "dfu_alt_info=" \
- "mtd nor1=u-boot.bin raw 200000 100000;" \
- "fip.bin raw 180000 78000;" \
- "optee.bin raw 500000 100000\0"
+ "mtd nor1=fip.bin raw 600000 400000\0"

/* GUIDs for capsule updatable firmware images */
#define DEVELOPERBOX_UBOOT_IMAGE_GUID \
--
2.25.1