Skip to contentSkip to conversation

arm: xea: Update i.MX28 XEA board to use DM_SERIAL

PATCH New Lukasz Majewski 2 participants 33 messages May 19, 2023 – Jul 11, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm: xea: Update i.MX28 XEA board to use DM_SERIAL

This patch series fixes i.MX28 based XEA board to utilize DM_SERIAL

Changes:
- Patches 1-3 - fix DTS (after Linux update) to debrick XEA
- Patches 4-8 - prepare XEA's DTS to support DM_SERIAL
- Patches 9-11 - fixes serial_pl01x.c driver (as this driver is used by XEA, I would prefer to have this in a single patchset - otherwise board may be bricked
- Patches 12-14 - XEA and imx28 generic code fixes to support DM_SERIAL with OF_PLATDATA
- Patches 15-16 - config modification to support DM_SERIAL

CI:
https://dev.azure.com/lukma633/U-Boot/_build/results?buildId=44&view=results

Applied on top of u-boot/master branch
SHA1: 6e1852ca2c418e2536ead4b51c4d84a59926b3f1

Lukasz Majewski (16):
dts: xea: Delete not used in u-boot DTS nodes
dts: xea: Provide missing FEC required properties (mac0 and

    reg_fec_3v3)

defconfig: xea: Change default spi-nor memory bus to 2
spl: xea: Provide stub DM driver for imx28 clocks
dts: xea: Enable debug UART support in XEA's SPL (DM_SERIAL)
dts: xea: Add u-boot specific 'type' property to duart
dts: xea: Remove clocks property from debug UART on XEA
dts: xea: Disable 'clks' node for xea (imx287)
serial: pl01x: Change OF_CONTROL to OF_REAL
serial: pl01x: Prepare the driver to support SPL_OF_PLATDATA
serial: pl01x: Modify pending callback to test if transmit FIFO is
empty
arm: mxs: Prevent serial console init when in very early SPL boot code
arm: xea: Call spl_early_init() before DM serial console is enabled in
SPL
arm: Kconfig: Switch XEA (imx287 based) board to use
CONFIG_PL01X_SERIAL
config: xea: Enable DM_SERIAL for the XEA (imx287 based) board
config: xea: Enable DM_SERIAL for the XEA - single binary (SB) u-boot

 arch/arm/Kconfig                        |  2 +-
 arch/arm/cpu/arm926ejs/mxs/spl_boot.c   |  6 ++--
 arch/arm/dts/imx28-xea-u-boot.dtsi      | 45 +++++++++++++++++++++++++
 arch/arm/mach-imx/mxs/Kconfig           |  1 +
 board/liebherr/xea/xea.c                | 20 ++++++++++-
 configs/imx28_xea_defconfig             |  5 +--
 configs/imx28_xea_sb_defconfig          |  2 ++
 drivers/serial/serial_pl01x.c           | 16 +++++++--
 include/dm/platform_data/serial_pl01x.h |  4 +++
 9 files changed, 93 insertions(+), 8 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/16 dts: xea: Delete not used in u-boot DTS nodes

After the re-sync with Linux Kernel's DTS
(SHA1: 7d08ddd09b75e7a3c103cc0d0d3ed700287f268e), the XEA's descripion has nodes and properties, which are NOT utilized in the u-boot.

To avoid confusion - those are deleted.

---

 arch/arm/dts/imx28-xea-u-boot.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/dts/imx28-xea-u-boot.dtsi +16 -0
index f6488154d8..22dd7bc8a8 100644
@@ -12,6 +12,11 @@
  */
 #include "imx28-u-boot.dtsi"
 / {
+	aliases {
+		/delete-property/ spi1;
+		/delete-property/ usbphy0;
+		/delete-property/ usbphy1;
+	};
 	apb@80000000 {
 		bootph-pre-ram;
 
@@ -34,6 +39,8 @@
 };
 
 &pinctrl {
+	/delete-property/ pinctrl-names;
+	/delete-property/ pinctrl-0;
 	bootph-pre-ram;
 };
 
@@ -46,3 +53,12 @@
 	spi-max-frequency = <40000000>;
 	bootph-pre-ram;
 };
+
+/delete-node/ &ssp2;
+/delete-node/ &usb0;
+/delete-node/ &usbphy0;
+/delete-node/ &usb1;
+/delete-node/ &usbphy1;
+/delete-node/ &hog_pins_a;
+/delete-node/ &hog_pins_tiva;
+/delete-node/ &hog_pins_coding;
Signature · 1 line
2.30.2
#2 lore raw

PATCH 1/16 dts: xea: Delete not used in u-boot DTS nodes

Quoted 6 lines

After the re-sync with Linux Kernel's DTS
(SHA1: 7d08ddd09b75e7a3c103cc0d0d3ed700287f268e), the XEA's descripion has nodes and properties, which are NOT utilized in the u-boot.
To avoid confusion - those are deleted.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#3 lore raw

PATCH 2/16 dts: xea: Provide missing FEC required properties (mac0 and reg_fec_3v3)

In reply to Lukasz Majewski

After the commit (SHA1: 7d08ddd09b75e7a3c103cc0d0d3ed700287f268e) some u-boot specific XEA FEC related properties have been replaced by ones from the Linux kernel.

To be more specific - XEA board (and imx287 in general) has built L2 switch connected to FEC, which needs some special treatment.

In u-boot it is handled with 'mac0' node, whereas Linux uses dedicated switch DTS node.

---

 arch/arm/dts/imx28-xea-u-boot.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/dts/imx28-xea-u-boot.dtsi +22 -0
index 22dd7bc8a8..9f1e261b2f 100644
@@ -38,12 +38,34 @@
 	bootph-pre-ram;
 };
 
+&mac0 {
+	phy-mode = "rmii";
+	pinctrl-names = "default";
+	pinctrl-0 = <&mac0_pins_a>;
+	phy-supply = <&reg_fec_3v3>;
+	phy-reset-gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
+	phy-reset-duration = <1>;
+	phy-reset-post-delay = <1>;
+	status = "okay";
+
+	fixed-link {
+		speed = <100>;
+		full-duplex;
+	};
+};
+
 &pinctrl {
 	/delete-property/ pinctrl-names;
 	/delete-property/ pinctrl-0;
 	bootph-pre-ram;
 };
 
+&reg_fec_3v3 {
+	gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+	enable-active-high;
+	regulator-boot-on;
+};
+
 &ssp0 {
 	bootph-pre-ram;
 };
Signature · 1 line
2.30.2
#4 lore raw

PATCH 2/16 dts: xea: Provide missing FEC required properties (mac0 and reg_fec_3v3)

Quoted 8 lines

After the commit (SHA1: 7d08ddd09b75e7a3c103cc0d0d3ed700287f268e) some u-boot specific XEA FEC related properties have been replaced by ones from the Linux kernel.
To be more specific - XEA board (and imx287 in general) has built L2 switch connected to FEC, which needs some special treatment. In u-boot it is handled with 'mac0' node, whereas Linux uses dedicated switch DTS node.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#5 lore raw

PATCH 3/16 defconfig: xea: Change default spi-nor memory bus to 2

In reply to Lukasz Majewski

After the re-sync with Linux kernel (v6.0) of the XEA DTS (SHA1: 7d08ddd09b75e7a3c103cc0d0d3ed700287f268e) the alias for SPI bus, to which SPI-NOR memory is connected, has changed from 'spi3' to 'spi2'.

To be in sync with current u-boot's xea dts, the default bus number (which allows running 'sf probe' without any extra parameters given) has been adjusted.

---

 configs/imx28_xea_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/imx28_xea_defconfig +1 -1
index 06dd6b1f0e..4a217b1f91 100644
@@ -95,7 +95,7 @@ CONFIG_MMC_MXS=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_DM_SPI_FLASH=y
-CONFIG_SF_DEFAULT_BUS=3
+CONFIG_SF_DEFAULT_BUS=2
 CONFIG_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPI_FLASH_ISSI=y
 CONFIG_SPI_FLASH_SPANSION=y
Signature · 1 line
2.30.2
#6 lore raw

PATCH 3/16 defconfig: xea: Change default spi-nor memory bus to 2

Quoted 8 lines

After the re-sync with Linux kernel (v6.0) of the XEA DTS (SHA1: 7d08ddd09b75e7a3c103cc0d0d3ed700287f268e) the alias for SPI bus, to which SPI-NOR memory is connected, has changed from 'spi3' to 'spi2'.
To be in sync with current u-boot's xea dts, the default bus number (which allows running 'sf probe' without any extra parameters given) has been adjusted.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#7 lore raw

PATCH 4/16 spl: xea: Provide stub DM driver for imx28 clocks

In reply to Lukasz Majewski

This code fixes following WARNING:
DTOC spl/dts/dt-plat.c
fsl_imx28_clkctrl: WARNING: the driver fsl_imx28_clkctrl was not found in the driver list

As imx28 doesn't yet support common clock framework, this prevents from DTOC warnings during SPL build.

---

 board/liebherr/xea/xea.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
board/liebherr/xea/xea.c +18 -1
index 38e841c5f6..ed2b39f70e 100644
@@ -203,5 +203,22 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 	return 0;
 }
 #endif
-
+/*
+ * NOTE:
+ *
+ * IMX28 clock "stub" DM driver!
+ *
+ * Only used for SPL stage, which is NOT using DM; serial and
+ * eMMC configuration.
+ */
+static const struct udevice_id imx28_clk_ids[] = {
+	{ .compatible = "fsl,imx28-clkctrl", },
+	{ }
+};
+
+U_BOOT_DRIVER(fsl_imx28_clkctrl) = {
+	.name           = "fsl_imx28_clkctrl",
+	.id             = UCLASS_CLK,
+	.of_match       = imx28_clk_ids,
+};
 #endif	/* CONFIG_SPL_BUILD */
Signature · 1 line
2.30.2
#8 lore raw

PATCH 4/16 spl: xea: Provide stub DM driver for imx28 clocks

Quoted 6 lines

This code fixes following WARNING:
DTOC spl/dts/dt-plat.c
fsl_imx28_clkctrl: WARNING: the driver fsl_imx28_clkctrl was not found in the driver list As imx28 doesn't yet support common clock framework, this prevents from DTOC warnings during SPL build.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#9 lore raw

PATCH 5/16 dts: xea: Enable debug UART support in XEA's SPL (DM_SERIAL)

In reply to Lukasz Majewski

After enabling DM_SERIAL for XEA board, the same serial shall be used in the SPL (with SPL_OF_PLATDATA support).

---

 arch/arm/dts/imx28-xea-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/imx28-xea-u-boot.dtsi +4 -0
index 9f1e261b2f..e40a6d240c 100644
@@ -34,6 +34,10 @@
 	bootph-pre-ram;
 };
 
+&duart {
+	bootph-pre-ram;
+};
+
 &gpio0 {
 	bootph-pre-ram;
 };
Signature · 1 line
2.30.2
#10 lore raw

PATCH 5/16 dts: xea: Enable debug UART support in XEA's SPL (DM_SERIAL)

Quoted 3 lines

After enabling DM_SERIAL for XEA board, the same serial shall be used in the SPL (with SPL_OF_PLATDATA support).

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#11 lore raw

PATCH 6/16 dts: xea: Add u-boot specific 'type' property to duart

In reply to Lukasz Majewski

The DM_SERIAL implicitly requires CONFIG_PL01X_SERIAL, which allows support for both serial IP block versions (i.e. PL011 and PL010).

The decision about used IP block is based on the compatible string, when DM is used.

In the XEA, the OF_PLATDATA is used to allow usage of serial driver in the SPL (as the size of SPL is crucial). In this case one cannot extract the type of IP block from .data field (corresponding to compatible) and it must be explicitly read at probe from dtoc generated, u-boot specific property.

---

 arch/arm/dts/imx28-xea-u-boot.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/imx28-xea-u-boot.dtsi +1 -0
index e40a6d240c..50289cf6d7 100644
@@ -36,6 +36,7 @@
 
 &duart {
 	bootph-pre-ram;
+	type = <1>; /* TYPE_PL011 */
 };
 
 &gpio0 {
Signature · 1 line
2.30.2
#12 lore raw

PATCH 6/16 dts: xea: Add u-boot specific 'type' property to duart

Quoted 11 lines

The DM_SERIAL implicitly requires CONFIG_PL01X_SERIAL, which allows support for both serial IP block versions (i.e. PL011 and PL010).
The decision about used IP block is based on the compatible string, when DM is used.
In the XEA, the OF_PLATDATA is used to allow usage of serial driver in the SPL (as the size of SPL is crucial). In this case one cannot extract the type of IP block from .data field (corresponding to compatible) and it must be explicitly read at probe from dtoc generated, u-boot specific property.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#13 lore raw

PATCH 7/16 dts: xea: Remove clocks property from debug UART on XEA

In reply to Lukasz Majewski

The imx287 SoC doesn't support common clock framework (CCF), so the 'clocks' property is removed to avoid early (i.e. in SPL) errors when SPL_OF_PLATDATA is used.

---

 arch/arm/dts/imx28-xea-u-boot.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/imx28-xea-u-boot.dtsi +1 -0
index 50289cf6d7..52fec31fbb 100644
@@ -35,6 +35,7 @@
 };
 
 &duart {
+	/delete-property/ clocks;
 	bootph-pre-ram;
 	type = <1>; /* TYPE_PL011 */
 };
Signature · 1 line
2.30.2
#14 lore raw

PATCH 7/16 dts: xea: Remove clocks property from debug UART on XEA

Quoted 4 lines

The imx287 SoC doesn't support common clock framework (CCF), so the 'clocks' property is removed to avoid early (i.e. in SPL) errors when SPL_OF_PLATDATA is used.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#15 lore raw

PATCH 8/16 dts: xea: Disable 'clks' node for xea (imx287)

In reply to Lukasz Majewski

As imx28 family of SoCs is NOT supporting the Common Clock Framework (CCF) the 'clks' property shall NOT be enabled by default.

Without this change u-boot proper before relocation tries to bind driver (which doesn't exists) for this device. As a result, pre-relocation DTB parsing is finished with error and the board hangs in a very early stage of u-boot proper boot process.

---

 arch/arm/dts/imx28-xea-u-boot.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/imx28-xea-u-boot.dtsi +1 -0
index 52fec31fbb..bdbeca528c 100644
@@ -32,6 +32,7 @@
 
 &clks {
 	bootph-pre-ram;
+	status = "disable";
 };
 
 &duart {
Signature · 1 line
2.30.2
#16 lore raw

PATCH 8/16 dts: xea: Disable 'clks' node for xea (imx287)

Quoted 7 lines

As imx28 family of SoCs is NOT supporting the Common Clock Framework (CCF) the 'clks' property shall NOT be enabled by default.
Without this change u-boot proper before relocation tries to bind driver (which doesn't exists) for this device. As a result, pre-relocation DTB parsing is finished with error and the board hangs in a very early stage of u-boot proper boot process.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#17 lore raw

PATCH 9/16 serial: pl01x: Change OF_CONTROL to OF_REAL

In reply to Lukasz Majewski

Before this change, building this driver for SPL with enabled SPL_DM_SERIAL was problematic, as '-Wunused-const-variable=' warning was visible.

Now, the code is only considered when u-boot proper is build.

---

 drivers/serial/serial_pl01x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/serial/serial_pl01x.c +1 -1
index f5468353e1..18332c2192 100644
@@ -331,7 +331,7 @@ static const struct dm_serial_ops pl01x_serial_ops = {
 	.setbrg = pl01x_serial_setbrg,
 };
 
-#if CONFIG_IS_ENABLED(OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_REAL)
 static const struct udevice_id pl01x_serial_id[] ={
 	{.compatible = "arm,pl011", .data = TYPE_PL011},
 	{.compatible = "arm,pl010", .data = TYPE_PL010},
Signature · 1 line
2.30.2
#18 lore raw

PATCH 9/16 serial: pl01x: Change OF_CONTROL to OF_REAL

Quoted 4 lines

Before this change, building this driver for SPL with enabled SPL_DM_SERIAL was problematic, as '-Wunused-const-variable=' warning was visible. Now, the code is only considered when u-boot proper is build.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#19 lore raw

PATCH 10/16 serial: pl01x: Prepare the driver to support SPL_OF_PLATDATA

In reply to Lukasz Majewski

This commit prepares the pl01x serial driver to be used with SPL_OF_PLATDATA enabled.

---

 drivers/serial/serial_pl01x.c           | 12 ++++++++++++
 include/dm/platform_data/serial_pl01x.h |  4 ++++
 2 files changed, 16 insertions(+)
drivers/serial/serial_pl01x.c +12 -0
index 18332c2192..dbf2b2df34 100644
@@ -291,8 +291,16 @@ int pl01x_serial_probe(struct udevice *dev)
 	struct pl01x_serial_plat *plat = dev_get_plat(dev);
 	struct pl01x_priv *priv = dev_get_priv(dev);
 
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct dtd_serial_pl01x *dtplat = &plat->dtplat;
+
+	priv->regs = (struct pl01x_regs *)dtplat->reg[0];
+	plat->type = dtplat->type;
+#else
 	priv->regs = (struct pl01x_regs *)plat->base;
+#endif
 	priv->type = plat->type;
+
 	if (!plat->skip_init)
 		return pl01x_generic_serial_init(priv->regs, priv->type);
 	else
@@ -380,8 +388,10 @@ int pl01x_serial_of_to_plat(struct udevice *dev)
 U_BOOT_DRIVER(serial_pl01x) = {
 	.name	= "serial_pl01x",
 	.id	= UCLASS_SERIAL,
+#if CONFIG_IS_ENABLED(OF_REAL)
 	.of_match = of_match_ptr(pl01x_serial_id),
 	.of_to_plat = of_match_ptr(pl01x_serial_of_to_plat),
+#endif
 	.plat_auto	= sizeof(struct pl01x_serial_plat),
 	.probe = pl01x_serial_probe,
 	.ops	= &pl01x_serial_ops,
@@ -389,6 +399,8 @@ U_BOOT_DRIVER(serial_pl01x) = {
 	.priv_auto	= sizeof(struct pl01x_priv),
 };
 
+DM_DRIVER_ALIAS(serial_pl01x, arm_pl011)
+DM_DRIVER_ALIAS(serial_pl01x, arm_pl010)
 #endif
 
 #if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011)
include/dm/platform_data/serial_pl01x.h +4 -0
index e3d4e308a1..811697ce5c 100644
@@ -20,7 +20,11 @@ enum pl01x_type {
  * @skip_init: Don't attempt to change port configuration (also means @clock
  * is ignored)
  */
+#include <dt-structs.h>
 struct pl01x_serial_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct dtd_serial_pl01x dtplat;
+#endif
 	unsigned long base;
 	enum pl01x_type type;
 	unsigned int clock;
Signature · 1 line
2.30.2
#20 lore raw

PATCH 10/16 serial: pl01x: Prepare the driver to support SPL_OF_PLATDATA

Quoted 3 lines

This commit prepares the pl01x serial driver to be used with SPL_OF_PLATDATA enabled.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#21 lore raw

PATCH 11/16 serial: pl01x: Modify pending callback to test if transmit FIFO is empty

In reply to Lukasz Majewski

Before this change the FR_TXFF (Transmit FIFO full) bit (5 in HW_UARTDBG_FR) has been used to assess if there is still data pending to be sent via UART.

This approach is problematic, as it may happen that serial is in the middle of transmission (so the TX FIFO is NOT full anymore) and this test returns true infinitely. As a result, for example in _serial_flush() DM serial function we are locked in endless while().

The fix here is to test explicitly if the TX FIFO is empty.

---

 drivers/serial/serial_pl01x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/serial/serial_pl01x.c +1 -1
index dbf2b2df34..428a4d210d 100644
@@ -329,7 +329,7 @@ int pl01x_serial_pending(struct udevice *dev, bool input)
 	if (input)
 		return pl01x_tstc(priv->regs);
 	else
-		return fr & UART_PL01x_FR_TXFF ? 0 : 1;
+		return fr & UART_PL01x_FR_TXFE ? 0 : 1;
 }
 
 static const struct dm_serial_ops pl01x_serial_ops = {
Signature · 1 line
2.30.2
#22 lore raw

PATCH 11/16 serial: pl01x: Modify pending callback to test if transmit FIFO is empty

Quoted 9 lines

Before this change the FR_TXFF (Transmit FIFO full) bit (5 in HW_UARTDBG_FR) has been used to assess if there is still data pending to be sent via UART.
This approach is problematic, as it may happen that serial is in the middle of transmission (so the TX FIFO is NOT full anymore) and this test returns true infinitely. As a result, for example in _serial_flush() DM serial function we are locked in endless while().
The fix here is to test explicitly if the TX FIFO is empty.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#23 lore raw

PATCH 12/16 arm: mxs: Prevent serial console init when in very early SPL boot code

In reply to Lukasz Majewski

When DM_SERIAL is enabled on mxs (i.e. imx28) platform, the console early initialization must be postponed until the driver model is correctly setup.

---

 arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/mxs/spl_boot.c +4 -2
index 763d79e803..5598c552ab 100644
@@ -128,8 +128,10 @@ void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr,
 
 	mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size);
 
-	mxs_spl_console_init();
-	debug("SPL: Serial Console Initialised\n");
+	if (!CONFIG_IS_ENABLED(DM_SERIAL)) {
+		mxs_spl_console_init();
+		debug("SPL: Serial Console Initialised\n");
+	}
 
 	mxs_power_init();
 
Signature · 1 line
2.30.2
#24 lore raw

PATCH 12/16 arm: mxs: Prevent serial console init when in very early SPL boot code

Quoted 4 lines

When DM_SERIAL is enabled on mxs (i.e. imx28) platform, the console early initialization must be postponed until the driver model is correctly setup.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#25 lore raw

PATCH 13/16 arm: xea: Call spl_early_init() before DM serial console is enabled in SPL

In reply to Lukasz Majewski

The in-spl enabled DM serial console requires the board setup to be able to parse SPL_OF_PLATDATA based serial driver (pl01x) for the imx28 based XEA board.

---

 board/liebherr/xea/xea.c | 1 +
 1 file changed, 1 insertion(+)
board/liebherr/xea/xea.c +1 -0
index ed2b39f70e..e4d2eb65cc 100644
@@ -62,6 +62,7 @@ static void init_clocks(void)
 void board_init_f(ulong arg)
 {
 	init_clocks();
+	spl_early_init();
 	preloader_console_init();
 }
 
Signature · 1 line
2.30.2
#26 lore raw

PATCH 13/16 arm: xea: Call spl_early_init() before DM serial console is enabled in SPL

Quoted 4 lines

The in-spl enabled DM serial console requires the board setup to be able to parse SPL_OF_PLATDATA based serial driver (pl01x) for the imx28 based XEA board.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#27 lore raw

PATCH 14/16 arm: Kconfig: Switch XEA (imx287 based) board to use CONFIG_PL01X_SERIAL

In reply to Lukasz Majewski

The CONFIG_PL011 used by all other ARCH_MX28 based boards is not supporting DM_SERIAL. Instead, other define - namely CONFIG_PL01X_SERIAL shall be used by boards supporting DM_SERIAL.

---

 arch/arm/Kconfig              | 2 +-
 arch/arm/mach-imx/mxs/Kconfig | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 99264a6478..4604d41410 100644
@@ -919,7 +919,7 @@ config ARCH_MX28
 	bool "NXP i.MX28 family"
 	select CPU_ARM926EJS
 	select GPIO_EXTRA_HEADER
-	select PL011_SERIAL
+	select PL011_SERIAL if !TARGET_XEA
 	select MACH_IMX
 	select SUPPORT_SPL
 
arch/arm/mach-imx/mxs/Kconfig +1 -0
index b2026a3758..ded16aac46 100644
@@ -45,6 +45,7 @@ config TARGET_MX28EVK
 
 config TARGET_XEA
 	bool "Support XEA"
+	select PL01X_SERIAL
 
 endchoice
 
Signature · 1 line
2.30.2
#28 lore raw

PATCH 14/16 arm: Kconfig: Switch XEA (imx287 based) board to use CONFIG_PL01X_SERIAL

Quoted 4 lines

The CONFIG_PL011 used by all other ARCH_MX28 based boards is not supporting DM_SERIAL. Instead, other define - namely CONFIG_PL01X_SERIAL shall be used by boards supporting DM_SERIAL.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#29 lore raw

PATCH 15/16 config: xea: Enable DM_SERIAL for the XEA (imx287 based) board

In reply to Lukasz Majewski

The XEA board now supports the DM_SERIAL feature in u-boot.

The SPL is using the SPL_OF_PLATDATA - i.e. NOT SPL_DM_SERIAL to reduce the overall size of the SPL binary.

---

 configs/imx28_xea_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
configs/imx28_xea_defconfig +2 -1
index 4a217b1f91..b4a051a859 100644
@@ -113,7 +113,8 @@ CONFIG_PINCTRL_MXS=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
-CONFIG_CONS_INDEX=0
+CONFIG_SPECIFY_CONSOLE_INDEX=y
+CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_MXS_SPI=y
Signature · 1 line
2.30.2
#30 lore raw

PATCH 15/16 config: xea: Enable DM_SERIAL for the XEA (imx287 based) board

Quoted 4 lines

The XEA board now supports the DM_SERIAL feature in u-boot. The SPL is using the SPL_OF_PLATDATA - i.e. NOT SPL_DM_SERIAL to reduce the overall size of the SPL binary.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#31 lore raw

PATCH 16/16 config: xea: Enable DM_SERIAL for the XEA - single binary (SB) u-boot

In reply to Lukasz Majewski

The single binary version of u-boot for XEA board is used to debrick and factory programming.

The produced u-boot.sb is a single file, which allows having fully operational u-boot prompt loaded with imx287 ROM.

---

 configs/imx28_xea_sb_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/imx28_xea_sb_defconfig +2 -0
index bb7bf5d9da..a43183444d 100644
@@ -94,7 +94,9 @@ CONFIG_PINCTRL_MXS=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_CONS_INDEX=0
+CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_MXS_SPI=y
Signature · 1 line
2.30.2
#32 lore raw

PATCH 16/16 config: xea: Enable DM_SERIAL for the XEA - single binary (SB) u-boot

Quoted 5 lines

The single binary version of u-boot for XEA board is used to debrick and factory programming.
The produced u-boot.sb is a single file, which allows having fully operational u-boot prompt loaded with imx287 ROM.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================