All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] arm: xea: Provide enhancements for XEA board
@ 2024-03-28 15:34 Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 1/6] arm: spl: xea: Remove I2S pins configuration from early initialization Lukasz Majewski
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam
  Cc: Lukasz Majewski, Anatolij Gustschin, Simon Glass, Tom Rini


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

-- 
2.39.2


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

* [PATCH 1/6] arm: spl: xea: Remove I2S pins configuration from early initialization
  2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
@ 2024-03-28 15:34 ` Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision Lukasz Majewski
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam; +Cc: Lukasz Majewski, Tom Rini

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

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/xea/spl_xea.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/board/liebherr/xea/spl_xea.c b/board/liebherr/xea/spl_xea.c
index df354cac64..551ed6fbae 100644
--- a/board/liebherr/xea/spl_xea.c
+++ b/board/liebherr/xea/spl_xea.c
@@ -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,
 
-- 
2.39.2


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

* [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision
  2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 1/6] arm: spl: xea: Remove I2S pins configuration from early initialization Lukasz Majewski
@ 2024-03-28 15:34 ` Lukasz Majewski
  2024-03-28 16:42   ` Fabio Estevam
  2024-03-28 15:34 ` [PATCH 3/6] arm: spl: Add definition for PHY reset GPIO for XEA HW rev. 2 Lukasz Majewski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam
  Cc: Lukasz Majewski, Anatolij Gustschin, Tom Rini

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.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/xea/spl_xea.c | 11 +++++++++++
 board/liebherr/xea/xea.c     | 29 +++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/board/liebherr/xea/spl_xea.c b/board/liebherr/xea/spl_xea.c
index 551ed6fbae..71194db235 100644
--- a/board/liebherr/xea/spl_xea.c
+++ b/board/liebherr/xea/spl_xea.c
@@ -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[] = {
diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
index c8ac526cb4..d9cf27c81b 100644
--- a/board/liebherr/xea/xea.c
+++ b/board/liebherr/xea/xea.c
@@ -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 */
-- 
2.39.2


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

* [PATCH 3/6] arm: spl: Add definition for PHY reset GPIO for XEA HW rev. 2
  2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 1/6] arm: spl: xea: Remove I2S pins configuration from early initialization Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision Lukasz Majewski
@ 2024-03-28 15:34 ` Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 4/6] config: xea: Enable late board initialization to set revision variable Lukasz Majewski
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam; +Cc: Lukasz Majewski, Tom Rini

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

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/xea/spl_xea.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/board/liebherr/xea/spl_xea.c b/board/liebherr/xea/spl_xea.c
index 71194db235..6cf8f8390e 100644
--- a/board/liebherr/xea/spl_xea.c
+++ b/board/liebherr/xea/spl_xea.c
@@ -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 */
-- 
2.39.2


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

* [PATCH 4/6] config: xea: Enable late board initialization to set revision variable
  2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
                   ` (2 preceding siblings ...)
  2024-03-28 15:34 ` [PATCH 3/6] arm: spl: Add definition for PHY reset GPIO for XEA HW rev. 2 Lukasz Majewski
@ 2024-03-28 15:34 ` Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 5/6] arm: xea: Print information about XEA's SoM HW revision Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 6/6] config: xea: Add limits for SPL and u-boot proper sizes Lukasz Majewski
  5 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam
  Cc: Lukasz Majewski, Anatolij Gustschin, Simon Glass, Tom Rini

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

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/xea/xea.c       | 12 ++++++++++++
 configs/imx28_xea_defconfig    |  1 +
 configs/imx28_xea_sb_defconfig |  1 +
 3 files changed, 14 insertions(+)

diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
index d9cf27c81b..90a1e03077 100644
--- a/board/liebherr/xea/xea.c
+++ b/board/liebherr/xea/xea.c
@@ -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();
diff --git a/configs/imx28_xea_defconfig b/configs/imx28_xea_defconfig
index 64a0561a34..6098c1f3be 100644
--- a/configs/imx28_xea_defconfig
+++ b/configs/imx28_xea_defconfig
@@ -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
diff --git a/configs/imx28_xea_sb_defconfig b/configs/imx28_xea_sb_defconfig
index 9872d35c1b..8d48d8c507 100644
--- a/configs/imx28_xea_sb_defconfig
+++ b/configs/imx28_xea_sb_defconfig
@@ -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
-- 
2.39.2


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

* [PATCH 5/6] arm: xea: Print information about XEA's SoM HW revision
  2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
                   ` (3 preceding siblings ...)
  2024-03-28 15:34 ` [PATCH 4/6] config: xea: Enable late board initialization to set revision variable Lukasz Majewski
@ 2024-03-28 15:34 ` Lukasz Majewski
  2024-03-28 15:34 ` [PATCH 6/6] config: xea: Add limits for SPL and u-boot proper sizes Lukasz Majewski
  5 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam
  Cc: Lukasz Majewski, Anatolij Gustschin, Tom Rini

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

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/xea/xea.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
index 90a1e03077..c117a8cb19 100644
--- a/board/liebherr/xea/xea.c
+++ b/board/liebherr/xea/xea.c
@@ -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();
-- 
2.39.2


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

* [PATCH 6/6] config: xea: Add limits for SPL and u-boot proper sizes
  2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
                   ` (4 preceding siblings ...)
  2024-03-28 15:34 ` [PATCH 5/6] arm: xea: Print information about XEA's SoM HW revision Lukasz Majewski
@ 2024-03-28 15:34 ` Lukasz Majewski
  5 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-03-28 15:34 UTC (permalink / raw)
  To: Stefano Babic, u-boot, Fabio Estevam
  Cc: Lukasz Majewski, Simon Glass, Tom Rini

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.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

 configs/imx28_xea_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/imx28_xea_defconfig b/configs/imx28_xea_defconfig
index 6098c1f3be..822a329187 100644
--- a/configs/imx28_xea_defconfig
+++ b/configs/imx28_xea_defconfig
@@ -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
-- 
2.39.2


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

* Re: [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision
  2024-03-28 15:34 ` [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision Lukasz Majewski
@ 2024-03-28 16:42   ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2024-03-28 16:42 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: Stefano Babic, u-boot, Anatolij Gustschin, Tom Rini

Hi Lukasz,

On Thu, Mar 28, 2024 at 12:34 PM Lukasz Majewski <lukma@denx.de> wrote:

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

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

end of thread, other threads:[~2024-03-28 16:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 15:34 [PATCH 0/6] arm: xea: Provide enhancements for XEA board Lukasz Majewski
2024-03-28 15:34 ` [PATCH 1/6] arm: spl: xea: Remove I2S pins configuration from early initialization Lukasz Majewski
2024-03-28 15:34 ` [PATCH 2/6] arm: xea: Add support for reading SoM (CPU) and base board HW revision Lukasz Majewski
2024-03-28 16:42   ` Fabio Estevam
2024-03-28 15:34 ` [PATCH 3/6] arm: spl: Add definition for PHY reset GPIO for XEA HW rev. 2 Lukasz Majewski
2024-03-28 15:34 ` [PATCH 4/6] config: xea: Enable late board initialization to set revision variable Lukasz Majewski
2024-03-28 15:34 ` [PATCH 5/6] arm: xea: Print information about XEA's SoM HW revision Lukasz Majewski
2024-03-28 15:34 ` [PATCH 6/6] config: xea: Add limits for SPL and u-boot proper sizes Lukasz Majewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.