Skip to contentSkip to conversation

arm: xea: Provide enhancements for XEA board

PATCH In review Lukasz Majewski 2 participants 8 messages Mar 28, 2024 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

cover arm: xea: Provide enhancements for XEA board

This patch series is a preparatory patch for supporting different versions of XEA board HW (until problem with Linux kernel support for multiple revisions is resorted).

Moreover, limits for u-boot.sb and u-boot.img has been set to avoid binary sizes exceeding in the future.

Lukasz Majewski (6):
arm: spl: xea: Remove I2S pins configuration from early initialization
arm: xea: Add support for reading SoM (CPU) and base board HW revision
arm: spl: Add definition for PHY reset GPIO for XEA HW rev. 2
config: xea: Enable late board initialization to set revision variable
arm: xea: Print information about XEA's SoM HW revision
config: xea: Add limits for SPL and u-boot proper sizes

 board/liebherr/xea/spl_xea.c   | 21 ++++++++------
 board/liebherr/xea/xea.c       | 50 ++++++++++++++++++++++++++++++++++
 configs/imx28_xea_defconfig    |  4 +++
 configs/imx28_xea_sb_defconfig |  1 +
 4 files changed, 68 insertions(+), 8 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/6 arm: spl: xea: Remove I2S pins configuration from early initialization

XEA is not supporting and using I2S codec, so there is no need to configure pins for it.

---

 board/liebherr/xea/spl_xea.c | 7 -------
 1 file changed, 7 deletions(-)
board/liebherr/xea/spl_xea.c +0 -7
index df354cac64..551ed6fbae 100644
@@ -112,13 +112,6 @@ const iomux_cfg_t iomux_setup[] = {
 	MX28_PAD_I2C0_SCL__I2C0_SCL,
 	MX28_PAD_I2C0_SDA__I2C0_SDA,
 
-	/* I2S Codec */
-	MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK,
-	MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK,
-	MX28_PAD_SAIF0_MCLK__SAIF0_MCLK,
-	MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0,
-	MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0,
-
 	/* PWR-Hold */
 	MX28_PAD_SPDIF__GPIO_3_27,
 
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/6 arm: xea: Add support for reading SoM (CPU) and base board HW revision

In reply to Lukasz Majewski

The XEA board now has several HW revisions for both SoM and base boards. This patch provides support for reading those revision ID values in SPL (u-boot.sb) and then pass this information to u-boot proper, as the maximal SPL size (~55KiB) is not allowing for having FIT support in it.

It was necessary to handle reading GPIOs values solely in u-boot proper as one configuration (i.e. 'single binary' - imx28_xea_sb_defconfig) is not using SPL framework.

---

 board/liebherr/xea/spl_xea.c | 11 +++++++++++
 board/liebherr/xea/xea.c     | 29 +++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
board/liebherr/xea/spl_xea.c +11 -0
index 551ed6fbae..71194db235 100644
@@ -230,6 +230,17 @@ const iomux_cfg_t iomux_setup[] = {
 	/* TIVA boot control */
 	MX28_PAD_GPMI_RDY3__GPIO_0_23 | MUX_CONFIG_BOOT, /* TIVA0 */
 	MX28_PAD_GPMI_WRN__GPIO_0_25 | MUX_CONFIG_BOOT, /* TIVA1 */
+
+	/* HW revision ID Base Board */
+	MX28_PAD_LCD_D12__GPIO_1_12,
+	MX28_PAD_LCD_D13__GPIO_1_13,
+	MX28_PAD_LCD_D14__GPIO_1_14,
+
+	/* HW revision ID (SoM) */
+	MX28_PAD_LCD_D15__GPIO_1_15,
+	MX28_PAD_LCD_D16__GPIO_1_16,
+	MX28_PAD_LCD_D17__GPIO_1_17,
+	MX28_PAD_LCD_D18__GPIO_1_18,
 };
 
 u32 mxs_dram_vals[] = {
board/liebherr/xea/xea.c +29 -0
index c8ac526cb4..d9cf27c81b 100644
@@ -48,6 +48,35 @@ DECLARE_GLOBAL_DATA_PTR;
  * Functions
  */
 
+/*
+ * Reading the HW ID number for XEA SoM module
+ *
+ * GPIOs from Port 1 (GPIO1_15, GPIO1_16, GPIO1_17 and GPIO1_18)
+ * are used to store HW revision information.
+ * Reading of GPIOs values is performed before the Device Model is
+ * bring up as the proper DTB needs to be chosen first.
+ *
+ * Moreover, this approach is required as "single binary" configuration
+ * of U-Boot (imx28_xea_sb_defconfig) is NOT using SPL framework, so
+ * only minimal subset of functionality is provided when ID is read.
+ *
+ * Hence, the direct registers' access.
+ */
+#define XEA_SOM_HW_ID_GPIO_PORT (MXS_PINCTRL_BASE + (0x0900 + ((1) * 0x10)))
+#define XEA_SOM_REV_MASK GENMASK(18, 15)
+#define XEA_SOM_REV_SHIFT 15
+
+static inline u8 get_som_rev(void)
+{
+	struct mxs_register_32 *reg =
+		(struct mxs_register_32 *)XEA_SOM_HW_ID_GPIO_PORT;
+
+	u32 tmp = ~readl(&reg->reg);
+	u8 id = (tmp & XEA_SOM_REV_MASK) >> XEA_SOM_REV_SHIFT;
+
+	return id;
+}
+
 static void init_clocks(void)
 {
 	/* IO0 clock at 480MHz */
Signature · 1 line
2.39.2
reviewer
#3 lore raw

Re: [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision

Hi Lukasz,

Quoted 1 line · Lukasz Majewski

+static inline u8 get_som_rev(void)

There is no need for 'inline' here.

Also, get_som_rev() is only used 5/6, so I suggest to squash this patch with 5/6.

Besides that, the series looks good.

#4 lore raw

PATCH 3/6 arm: spl: Add definition for PHY reset GPIO for XEA HW rev. 2

In reply to Lukasz Majewski

The imx287 based XEA board's revision 2 uses GPIO_3_21 for PHY reset

It is safe to keep the GPIO_2_13 as well, as in the SPL SPI1 is not used for transmission. This simplifies the code, as the proper configuration is performed either in falcon boot's read DTB or in u-boot proper (with correct FIT configuration chosen).

---

 board/liebherr/xea/spl_xea.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
board/liebherr/xea/spl_xea.c +2 -1
index 71194db235..6cf8f8390e 100644
@@ -225,7 +225,8 @@ const iomux_cfg_t iomux_setup[] = {
 	MX28_PAD_ENET0_TXD0__ENET0_TXD0 | MUX_CONFIG_ENET,
 	MX28_PAD_ENET0_TXD1__ENET0_TXD1 | MUX_CONFIG_ENET,
 	MX28_PAD_ENET0_TXD3__ENET1_TXD1 | MUX_CONFIG_ENET,
-	MX28_PAD_SSP1_CMD__GPIO_2_13, /* PHY reset */
+	MX28_PAD_SSP1_CMD__GPIO_2_13, /* PHY reset HW Rev. 1*/
+	MX28_PAD_SAIF0_LRCLK__GPIO_3_21, /* PHY reset HW Rev. 2*/
 
 	/* TIVA boot control */
 	MX28_PAD_GPMI_RDY3__GPIO_0_23 | MUX_CONFIG_BOOT, /* TIVA0 */
Signature · 1 line
2.39.2
#5 lore raw

PATCH 4/6 config: xea: Enable late board initialization to set revision variable

In reply to Lukasz Majewski

The 'board_som_rev' environment variable will be used to point correct configuration from the Linux FIT file.

---

 board/liebherr/xea/xea.c       | 12 ++++++++++++
 configs/imx28_xea_defconfig    |  1 +
 configs/imx28_xea_sb_defconfig |  1 +
 3 files changed, 14 insertions(+)
board/liebherr/xea/xea.c +12 -0
index d9cf27c81b..90a1e03077 100644
@@ -282,6 +282,18 @@ int board_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_BOARD_LATE_INIT)
+int board_late_init(void)
+{
+	int ret = env_set_ulong("board_som_rev", get_som_rev());
+
+	if (ret)
+		printf("Cannot set XEA's SoM revision env variable!\n");
+
+	return 0;
+}
+#endif
+
 int dram_init(void)
 {
 	return mxs_dram_init();
configs/imx28_xea_defconfig +1 -0
index 64a0561a34..6098c1f3be 100644
@@ -39,6 +39,7 @@ CONFIG_BOOTCOMMAND="run ${bootpri} ; run ${bootsec}"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="run prebootcmd"
 CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
configs/imx28_xea_sb_defconfig +1 -0
index 9872d35c1b..8d48d8c507 100644
@@ -23,6 +23,7 @@ CONFIG_BOOTARGS="console=ttyAMA0,115200n8"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="run prebootcmd"
 CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_LATE_INIT=y
 # CONFIG_SPL_FRAMEWORK is not set
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
Signature · 1 line
2.39.2
#6 lore raw

PATCH 5/6 arm: xea: Print information about XEA's SoM HW revision

In reply to Lukasz Majewski

As now XEA has its second HW revision - this information is printed when u-boot proper starts.

---

 board/liebherr/xea/xea.c | 9 +++++++++
 1 file changed, 9 insertions(+)
board/liebherr/xea/xea.c +9 -0
index 90a1e03077..c117a8cb19 100644
@@ -294,6 +294,15 @@ int board_late_init(void)
 }
 #endif
 
+#if defined(CONFIG_DISPLAY_BOARDINFO)
+int checkboard(void)
+{
+	printf("Board: LWE XEA SoM HW rev %d\n", get_som_rev());
+
+	return 0;
+}
+#endif
+
 int dram_init(void)
 {
 	return mxs_dram_init();
Signature · 1 line
2.39.2
#7 lore raw

PATCH 6/6 config: xea: Add limits for SPL and u-boot proper sizes

In reply to Lukasz Majewski

The XEA board has following hard constraints regarding size of binaries:
- u-boot.sb < 48 KiB
- u-boot.img < 448 KiB

Added values are supposed to avoid exceeding size of binaries during future u-boot development.

---

 configs/imx28_xea_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/imx28_xea_defconfig +3 -0
index 6098c1f3be..822a329187 100644
@@ -21,12 +21,15 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_STACK=0x20000
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
+CONFIG_SPL_SIZE_LIMIT=0xa000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x90000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_SYS_LOAD_ADDR=0x42000000
 CONFIG_SPL_PAYLOAD="u-boot.img"
+CONFIG_HAS_BOARD_SIZE_LIMIT=y
+CONFIG_BOARD_SIZE_LIMIT=458752
 CONFIG_TIMESTAMP=y
 CONFIG_FIT=y
 # CONFIG_BOOTMETH_EXTLINUX is not set
Signature · 1 line
2.39.2