Skip to contentSkip to conversation

arm64: layerscape: Various small size reductions for SPL

PATCH New Sean Anderson 1 participant 4 messages Oct 17, 2022 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

v2 cover arm64: layerscape: Various small size reductions for SPL

This series groups a few small size reductions I found while trying to reduce my SPL size. They are all independent of each other.

Changes in v2:
- Fix using || instead of && for ARCH_LS1043

Sean Anderson (3):
arm: layerscape: Don't select FSL_IFC when booting from SD card
arm: layerscape: Disable unused parts of ICID tables
arm: fsl: csu: Reduce size of ns_dev

 arch/arm/cpu/armv8/fsl-layerscape/Kconfig        |  4 ++--
 arch/arm/cpu/armv8/fsl-layerscape/icid.c         |  2 ++
 .../include/asm/arch-fsl-layerscape/fsl_icid.h   | 16 ++++++++++++++--
 include/fsl_csu.h                                |  4 ++--
 4 files changed, 20 insertions(+), 6 deletions(-)
Signature · 1 line
2.35.1.1320.gc452695387.dirty
#1 lore raw

PATCH v2 1/3 arm: layerscape: Don't select FSL_IFC when booting from SD card

FSL_IFC should only be selected when booting from NAND flash (or when NAND_FSL_IFC is enabled). The existing logic does this correctly when QSPI is also enabled, but not when just booting from SD.

---

Changes in v2:
- Fix using || instead of && for ARCH_LS1043

 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +2 -2
index 80a1642447d..9f76c18feaa 100644
@@ -62,7 +62,7 @@ config ARCH_LS1043A
 	bool
 	select ARMV8_SET_SMPEN
 	select ARM_ERRATA_855873 if !TFABOOT
-	select FSL_IFC if TFABOOT || (!QSPI_BOOT && !SD_BOOT_QSPI)
+	select FSL_IFC if TFABOOT || (!QSPI_BOOT && !SD_BOOT_QSPI && !SD_BOOT)
 	select FSL_LAYERSCAPE
 	select FSL_LSCH2
 	select GICV2
@@ -98,7 +98,7 @@ config ARCH_LS1043A
 config ARCH_LS1046A
 	bool
 	select ARMV8_SET_SMPEN
-	select FSL_IFC if TFABOOT || (!QSPI_BOOT && !SD_BOOT_QSPI)
+	select FSL_IFC if TFABOOT || (!QSPI_BOOT && !SD_BOOT_QSPI && !SD_BOOT)
 	select FSL_LAYERSCAPE
 	select FSL_LSCH2
 	select GICV2
Signature · 1 line
2.35.1.1320.gc452695387.dirty
#2 lore raw

PATCH v2 2/3 arm: layerscape: Disable unused parts of ICID tables

In reply to Sean Anderson

Several parts of the ICID table are only necessary for U-Boot proper. Disable them in SPL. This saves around 500 bytes.

---

(no changes since v1)

 arch/arm/cpu/armv8/fsl-layerscape/icid.c         |  2 ++
 .../include/asm/arch-fsl-layerscape/fsl_icid.h   | 16 ++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/icid.c +2 -0
index 25cd82f16eb..2d87281ec21 100644
@@ -46,6 +46,7 @@ void set_icids(void)
 #endif
 }
 
+#ifndef CONFIG_SPL_BUILD
 int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int num_ids)
 {
 	int i, ret;
@@ -190,3 +191,4 @@ void fdt_fixup_icid(void *blob)
 	fdt_fixup_fman_icids(blob, smmu_ph);
 #endif
 }
+#endif
arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h +14 -2
index 3c06a55cb85..8af0d35d27b 100644
@@ -12,11 +12,15 @@
 #include <asm/armv8/sec_firmware.h>
 
 struct icid_id_table {
+#ifndef CONFIG_SPL_BUILD
 	const char *compat;
-	u32 id;
-	u32 reg;
 	phys_addr_t compat_addr;
+#endif
 	phys_addr_t reg_addr;
+	u32 reg;
+#ifndef CONFIG_SPL_BUILD
+	u32 id;
+#endif
 	bool le;
 };
 
@@ -31,6 +35,13 @@ int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int num_ids);
 void set_icids(void);
 void fdt_fixup_icid(void *blob);
 
+#ifdef CONFIG_SPL_BUILD
+#define SET_ICID_ENTRY(name, idA, regA, addr, compataddr, _le) \
+	{ .reg = regA, \
+	  .reg_addr = addr, \
+	  .le = _le \
+	}
+#else
 #define SET_ICID_ENTRY(name, idA, regA, addr, compataddr, _le) \
 	{ .compat = name, \
 	  .id = idA, \
@@ -39,6 +50,7 @@ void fdt_fixup_icid(void *blob);
 	  .reg_addr = addr, \
 	  .le = _le \
 	}
+#endif
 
 #ifdef CONFIG_SYS_FSL_SEC_LE
 #define SEC_IS_LE true
Signature · 1 line
2.35.1.1320.gc452695387.dirty
#3 lore raw

PATCH v2 3/3 arm: fsl: csu: Reduce size of ns_dev

In reply to Sean Anderson

None of the values in this struct are larger than 256, so we can reduce the members to u8s. This saves around 1K.

---

(no changes since v1)

 include/fsl_csu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/fsl_csu.h +2 -2
index 0e59ac3c324..40c29687979 100644
@@ -24,8 +24,8 @@ enum csu_cslx_access {
 };
 
 struct csu_ns_dev {
-	unsigned long ind;
-	uint32_t val;
+	u8 ind;
+	u8 val;
 };
 
 void enable_layerscape_ns_access(void);
Signature · 1 line
2.35.1.1320.gc452695387.dirty