Skip to contentSkip to conversation

arm: ls1021atwr: Convert to driver model and enable serial support

PATCH New Bin Meng 5 participants 31 messages Jan 14, 2016 – Jan 21, 2016 Arm (32-bit)

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

v2 cover arm: ls1021atwr: Convert to driver model and enable serial support

This series converts Freescale LS1021A-TWR board to driver model.
- Enable ns16550 serial driver on ls1021atwr_nor configuration
- Convert LPUART serial driver to driver model
- Enable LPUART serial driver on ls1021atwr_nor_lpuart configuration

Changes in v2:
- Rewrite the commit message using 'git revert' format.
- Add missing 'base' parameter in the call to _lpuart_serial_tstc()
- Change internal routines' parameter 'reg' to 'base'
- Split to use two separate U_BOOT_DRIVER()
- New patch to split off board device tree
- Create a ls1021a-twr-lpuart.dts for ls1021atwr_nor_lpuart_defconfig

Bin Meng (9):
Revert "fdt_support: Add multi-serial support for stdout fixup"
arm: ls1021atwr: Convert to driver model and enable serial support
serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
serial: lpuart: Fix several cosmetic issues
serial: lpuart: Call local version of setbrg and putc directly
serial: lpuart: Prepare the driver for DM conversion
serial: lpuart: Add driver model serial support
arm: ls1021atwr: Split off board device tree
arm: ls1021atwr: Enable driver model lpuart serial driver

 arch/arm/dts/Makefile                              |   2 +-
 arch/arm/dts/ls1021a-twr-duart.dts                 |  16 ++
 arch/arm/dts/ls1021a-twr-lpuart.dts                |  16 ++
 arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} |   7 +-
 arch/arm/dts/ls1021a.dtsi                          |   4 -
 common/fdt_support.c                               |  16 +-
 configs/colibri_vf_defconfig                       |   1 +
 configs/colibri_vf_dtb_defconfig                   |   1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig       |   1 +
 configs/ls1021aqds_nor_lpuart_defconfig            |   1 +
 configs/ls1021atwr_nor_defconfig                   |   4 +
 configs/ls1021atwr_nor_lpuart_defconfig            |   5 +
 configs/ls1021atwr_qspi_defconfig                  |   2 +-
 configs/ls1021atwr_sdcard_qspi_defconfig           |   2 +-
 configs/pcm052_defconfig                           |   1 +
 configs/vf610twr_defconfig                         |   1 +
 configs/vf610twr_nand_defconfig                    |   1 +
 doc/driver-model/serial-howto.txt                  |   1 -
 drivers/serial/Kconfig                             |   6 +
 drivers/serial/serial_lpuart.c                     | 286 ++++++++++++++++++---
 include/configs/colibri_vf.h                       |   1 -
 include/configs/ls1021aqds.h                       |   1 -
 include/configs/ls1021atwr.h                       |   3 +-
 include/configs/pcm052.h                           |   1 -
 include/configs/vf610twr.h                         |   1 -
 25 files changed, 311 insertions(+), 70 deletions(-)
 create mode 100644 arch/arm/dts/ls1021a-twr-duart.dts
 create mode 100644 arch/arm/dts/ls1021a-twr-lpuart.dts
 rename arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} (93%)
Signature · 1 line
1.8.2.1
author
#1 lore raw

PATCH v2 1/9 Revert "fdt_support: Add multi-serial support for stdout fixup"

This reverts commit 3e303f748cf57fb23e8ec95ab7eac0074be50e2b.

The fix up in the /aliases node does not work under the following scenarios:
- Not every non-DM serial driver was written to have a driver name that conforms the format of "serial%d" or "eserial%d".
- With driver model serial, the stdio_devices[] stores the serial device node name in the device tree.

---

Changes in v2:
- Rewrite the commit message using 'git revert' format.

 common/fdt_support.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
common/fdt_support.c +1 -15
index a539389..4e0d07c 100644
@@ -131,18 +131,6 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
 			      OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1);
 }
 #elif defined(CONFIG_OF_STDOUT_VIA_ALIAS) && defined(CONFIG_CONS_INDEX)
-static void fdt_fill_multisername(char *sername, size_t maxlen)
-{
-	const char *outname = stdio_devices[stdout]->name;
-
-	if (strcmp(outname, "serial") > 0)
-		strncpy(sername, outname, maxlen);
-
-	/* eserial? */
-	if (strcmp(outname + 1, "serial") > 0)
-		strncpy(sername, outname + 1, maxlen);
-}
-
 static int fdt_fixup_stdout(void *fdt, int chosenoff)
 {
 	int err;
@@ -152,9 +140,7 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
 	int len;
 	char tmp[256]; /* long enough */
 
-	fdt_fill_multisername(sername, sizeof(sername) - 1);
-	if (!sername[0])
-		sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
+	sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
 
 	aliasoff = fdt_path_offset(fdt, "/aliases");
 	if (aliasoff < 0) {
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH v2 1/9 Revert "fdt_support: Add multi-serial support for stdout fixup"

Quoted 11 lines · Bin Meng

This reverts commit 3e303f748cf57fb23e8ec95ab7eac0074be50e2b.

The fix up in the /aliases node does not work under the following scenarios:
- Not every non-DM serial driver was written to have a driver name that conforms the format of "serial%d" or "eserial%d".
- With driver model serial, the stdio_devices[] stores the serial device node name in the device tree.

Quoted 7 lines

---

Changes in v2:
- Rewrite the commit message using 'git revert' format.

 common/fdt_support.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
#3 lore raw

PATCH v2 1/9 Revert "fdt_support: Add multi-serial support for stdout fixup"

Quoted 14 lines · Simon Glass
Quoted 13 lines · Bin Meng

This reverts commit 3e303f748cf57fb23e8ec95ab7eac0074be50e2b.

The fix up in the /aliases node does not work under the following scenarios:
- Not every non-DM serial driver was written to have a driver name that conforms the format of "serial%d" or "eserial%d".
- With driver model serial, the stdio_devices[] stores the serial device node name in the device tree.

---

Quoted 7 lines
Quoted 5 lines

Changes in v2:
- Rewrite the commit message using 'git revert' format.

 common/fdt_support.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

Applied to u-boot-dm, thanks!

author
#4 lore raw

PATCH v2 2/9 arm: ls1021atwr: Convert to driver model and enable serial support

In reply to Bin Meng

Convert ls1021atwr_nor to driver model support. As a start, enable ns16550 serial port driver.

---

Changes in v2: None

 arch/arm/dts/ls1021a-twr.dts     | 4 ++++
 arch/arm/dts/ls1021a.dtsi        | 4 ----
 configs/ls1021atwr_nor_defconfig | 4 ++++
 include/configs/ls1021atwr.h     | 2 ++
 4 files changed, 10 insertions(+), 4 deletions(-)
arch/arm/dts/ls1021a-twr.dts +4 -0
index 6ccd332..aead13f 100644
@@ -19,6 +19,10 @@
 		spi0 = &qspi;
 		spi1 = &dspi1;
 	};
+
+	chosen {
+		stdout-path = &uart0;
+	};
 };
 
 &qspi {
arch/arm/dts/ls1021a.dtsi +0 -4
index 7fadd7c..ee0e554 100644
@@ -218,7 +218,6 @@
 			compatible = "fsl,16550-FIFO64", "ns16550a";
 			reg = <0x21c0500 0x100>;
 			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
-			clock-frequency = <0>;
 			fifo-size = <15>;
 			status = "disabled";
 		};
@@ -227,7 +226,6 @@
 			compatible = "fsl,16550-FIFO64", "ns16550a";
 			reg = <0x21c0600 0x100>;
 			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
-			clock-frequency = <0>;
 			fifo-size = <15>;
 			status = "disabled";
 		};
@@ -236,7 +234,6 @@
 			compatible = "fsl,16550-FIFO64", "ns16550a";
 			reg = <0x21d0500 0x100>;
 			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
-			clock-frequency = <0>;
 			fifo-size = <15>;
 			status = "disabled";
 		};
@@ -245,7 +242,6 @@
 			compatible = "fsl,16550-FIFO64", "ns16550a";
 			reg = <0x21d0600 0x100>;
 			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
-			clock-frequency = <0>;
 			fifo-size = <15>;
 			status = "disabled";
 		};
configs/ls1021atwr_nor_defconfig +4 -0
index aa874fd..2b79443 100644
@@ -1,6 +1,10 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr"
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
 CONFIG_SYS_NS16550=y
include/configs/ls1021atwr.h +2 -0
index c12ba3a..bbef2a7 100644
@@ -271,7 +271,9 @@
 #else
 #define CONFIG_CONS_INDEX		1
 #define CONFIG_SYS_NS16550_SERIAL
+#ifndef CONFIG_DM_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
+#endif
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #endif
 
Signature · 1 line
1.8.2.1
#5 lore raw

PATCH v2 2/9 arm: ls1021atwr: Convert to driver model and enable serial support

Quoted 6 lines · Bin Meng

Convert ls1021atwr_nor to driver model support. As a start, enable ns16550 serial port driver.

---

Quoted 7 lines

Changes in v2: None

 arch/arm/dts/ls1021a-twr.dts     | 4 ++++
 arch/arm/dts/ls1021a.dtsi        | 4 ----
 configs/ls1021atwr_nor_defconfig | 4 ++++
 include/configs/ls1021atwr.h     | 2 ++
 4 files changed, 10 insertions(+), 4 deletions(-)
#6 lore raw

PATCH v2 2/9 arm: ls1021atwr: Convert to driver model and enable serial support

Quoted 9 lines · Simon Glass
Quoted 8 lines · Bin Meng

Convert ls1021atwr_nor to driver model support. As a start, enable ns16550 serial port driver.

---

Changes in v2: None

Quoted 7 lines
Quoted 5 lines
 arch/arm/dts/ls1021a-twr.dts     | 4 ++++
 arch/arm/dts/ls1021a.dtsi        | 4 ----
 configs/ls1021atwr_nor_defconfig | 4 ++++
 include/configs/ls1021atwr.h     | 2 ++
 4 files changed, 10 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!

author
#7 lore raw

PATCH v2 3/9 serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig

In reply to Bin Meng

LPUART is seen on Freescale VF610 and QorIQ Layerscape devices. Create a Kconfig option and move it to defconfig for all boards that have this serial driver.

---

Changes in v2: None

 configs/colibri_vf_defconfig                 | 1 +
 configs/colibri_vf_dtb_defconfig             | 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig      | 1 +
 configs/ls1021atwr_nor_lpuart_defconfig      | 1 +
 configs/pcm052_defconfig                     | 1 +
 configs/vf610twr_defconfig                   | 1 +
 configs/vf610twr_nand_defconfig              | 1 +
 drivers/serial/Kconfig                       | 6 ++++++
 include/configs/colibri_vf.h                 | 1 -
 include/configs/ls1021aqds.h                 | 1 -
 include/configs/ls1021atwr.h                 | 1 -
 include/configs/pcm052.h                     | 1 -
 include/configs/vf610twr.h                   | 1 -
 14 files changed, 14 insertions(+), 5 deletions(-)
configs/colibri_vf_defconfig +1 -0
index f8441e3..45917c8 100644
@@ -8,3 +8,4 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM=y
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y
+CONFIG_FSL_LPUART=y
configs/colibri_vf_dtb_defconfig +1 -0
index 3596cec..b1a843a 100644
@@ -11,3 +11,4 @@ CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y
+CONFIG_FSL_LPUART=y
configs/ls1021aqds_ddr4_nor_lpuart_defconfig +1 -0
index 68bd117..44b2a0d 100644
@@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4,LPUART"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_LPUART=y
configs/ls1021aqds_nor_lpuart_defconfig +1 -0
index b2f6832..1186af2 100644
@@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_LPUART=y
configs/ls1021atwr_nor_lpuart_defconfig +1 -0
index d7afca9..58cd61f 100644
@@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_LPUART=y
configs/pcm052_defconfig +1 -0
index 9125645..26ab733 100644
@@ -3,3 +3,4 @@ CONFIG_TARGET_PCM052=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/phytec/pcm052/imximage.cfg,ENV_IS_IN_NAND"
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
+CONFIG_FSL_LPUART=y
configs/vf610twr_defconfig +1 -0
index dc8df5c..d51c93b 100644
@@ -6,3 +6,4 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/vf610twr/imximage.cfg,ENV_I
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SPI_FLASH=y
+CONFIG_FSL_LPUART=y
configs/vf610twr_nand_defconfig +1 -0
index 98880f3..299fa8f 100644
@@ -6,3 +6,4 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/vf610twr/imximage.cfg,ENV_I
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SPI_FLASH=y
+CONFIG_FSL_LPUART=y
drivers/serial/Kconfig +6 -0
index 1fc287e..3b54511 100644
@@ -186,6 +186,12 @@ config ALTERA_UART
 	  Select this to enable an UART for Altera devices. Please find
 	  details on the "Embedded Peripherals IP User Guide" of Altera.
 
+config FSL_LPUART
+	bool "Freescale LPUART support"
+	help
+	  Select this to enable a Low Power UART for Freescale VF610 and
+	  QorIQ Layerscape devices.
+
 config SYS_NS16550
 	bool "NS16550 UART or compatible"
 	help
include/configs/colibri_vf.h +0 -1
index 708c79a..5aed3a5 100644
@@ -36,7 +36,6 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_FSL_LPUART
 #define LPUART_BASE			UART0_BASE
 
 /* Allow to overwrite serial and ethaddr */
include/configs/ls1021aqds.h +0 -1
index 2e8dbc7..e8b1eca 100644
@@ -371,7 +371,6 @@ unsigned long get_board_ddr_clk(void);
  * Serial Port
  */
 #ifdef CONFIG_LPUART
-#define CONFIG_FSL_LPUART
 #define CONFIG_LPUART_32B_REG
 #else
 #define CONFIG_CONS_INDEX		1
include/configs/ls1021atwr.h +0 -1
index bbef2a7..317ba62 100644
@@ -266,7 +266,6 @@
  * Serial Port
  */
 #ifdef CONFIG_LPUART
-#define CONFIG_FSL_LPUART
 #define CONFIG_LPUART_32B_REG
 #else
 #define CONFIG_CONS_INDEX		1
include/configs/pcm052.h +0 -1
index b851bba..891bdb0 100644
@@ -27,7 +27,6 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_FSL_LPUART
 #define LPUART_BASE			UART1_BASE
 
 /* Allow to overwrite serial and ethaddr */
include/configs/vf610twr.h +0 -1
index 34df6f0..dcfafaf 100644
@@ -34,7 +34,6 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_FSL_LPUART
 #define LPUART_BASE			UART1_BASE
 
 /* Allow to overwrite serial and ethaddr */
Signature · 1 line
1.8.2.1
#8 lore raw

PATCH v2 3/9 serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig

Looks good to me,

Quoted 175 lines · Bin Meng

LPUART is seen on Freescale VF610 and QorIQ Layerscape devices. Create a Kconfig option and move it to defconfig for all boards that have this serial driver.

---

Changes in v2: None

 configs/colibri_vf_defconfig                 | 1 +
 configs/colibri_vf_dtb_defconfig             | 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig      | 1 +
 configs/ls1021atwr_nor_lpuart_defconfig      | 1 +
 configs/pcm052_defconfig                     | 1 +
 configs/vf610twr_defconfig                   | 1 +
 configs/vf610twr_nand_defconfig              | 1 +
 drivers/serial/Kconfig                       | 6 ++++++
 include/configs/colibri_vf.h                 | 1 -
 include/configs/ls1021aqds.h                 | 1 -
 include/configs/ls1021atwr.h                 | 1 -
 include/configs/pcm052.h                     | 1 -
 include/configs/vf610twr.h                   | 1 -
 14 files changed, 14 insertions(+), 5 deletions(-)
configs/colibri_vf_defconfig +1 -0
index f8441e3..45917c8 100644
@@ -8,3 +8,4 @@ CONFIG_CMD_GPIO=y
 CONFIG_DM=y
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y
+CONFIG_FSL_LPUART=y
configs/colibri_vf_dtb_defconfig +1 -0
index 3596cec..b1a843a 100644
@@ -11,3 +11,4 @@ CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_VF610_NFC_60_ECC_BYTES=y
+CONFIG_FSL_LPUART=y
configs/ls1021aqds_ddr4_nor_lpuart_defconfig +1 -0
index 68bd117..44b2a0d 100644
@@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4,LPUART"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_LPUART=y
configs/ls1021aqds_nor_lpuart_defconfig +1 -0
index b2f6832..1186af2 100644
@@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_LPUART=y
configs/ls1021atwr_nor_lpuart_defconfig +1 -0
index d7afca9..58cd61f 100644
@@ -4,3 +4,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
+CONFIG_FSL_LPUART=y
configs/pcm052_defconfig +1 -0
index 9125645..26ab733 100644
@@ -3,3 +3,4 @@ CONFIG_TARGET_PCM052=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/phytec/pcm052/imximage.cfg,ENV_IS_IN_NAND"
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
+CONFIG_FSL_LPUART=y
configs/vf610twr_defconfig +1 -0
index dc8df5c..d51c93b 100644
@@ -6,3 +6,4 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/vf610twr/imximage.cfg,ENV_I
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SPI_FLASH=y
+CONFIG_FSL_LPUART=y
configs/vf610twr_nand_defconfig +1 -0
index 98880f3..299fa8f 100644
@@ -6,3 +6,4 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/vf610twr/imximage.cfg,ENV_I
 CONFIG_NAND_VF610_NFC=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SPI_FLASH=y
+CONFIG_FSL_LPUART=y
drivers/serial/Kconfig +6 -0
index 1fc287e..3b54511 100644
@@ -186,6 +186,12 @@ config ALTERA_UART
 	  Select this to enable an UART for Altera devices. Please find
 	  details on the "Embedded Peripherals IP User Guide" of Altera.
 
+config FSL_LPUART
+	bool "Freescale LPUART support"
+	help
+	  Select this to enable a Low Power UART for Freescale VF610 and
+	  QorIQ Layerscape devices.
+
 config SYS_NS16550
 	bool "NS16550 UART or compatible"
 	help
include/configs/colibri_vf.h +0 -1
index 708c79a..5aed3a5 100644
@@ -36,7 +36,6 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_FSL_LPUART
 #define LPUART_BASE			UART0_BASE
 
 /* Allow to overwrite serial and ethaddr */
include/configs/ls1021aqds.h +0 -1
index 2e8dbc7..e8b1eca 100644
@@ -371,7 +371,6 @@ unsigned long get_board_ddr_clk(void);
  * Serial Port
  */
 #ifdef CONFIG_LPUART
-#define CONFIG_FSL_LPUART
 #define CONFIG_LPUART_32B_REG
 #else
 #define CONFIG_CONS_INDEX		1
include/configs/ls1021atwr.h +0 -1
index bbef2a7..317ba62 100644
@@ -266,7 +266,6 @@
  * Serial Port
  */
 #ifdef CONFIG_LPUART
-#define CONFIG_FSL_LPUART
 #define CONFIG_LPUART_32B_REG
 #else
 #define CONFIG_CONS_INDEX		1
include/configs/pcm052.h +0 -1
index b851bba..891bdb0 100644
@@ -27,7 +27,6 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_FSL_LPUART
 #define LPUART_BASE			UART1_BASE
 
 /* Allow to overwrite serial and ethaddr */
include/configs/vf610twr.h +0 -1
index 34df6f0..dcfafaf 100644
@@ -34,7 +34,6 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_FSL_LPUART
 #define LPUART_BASE			UART1_BASE
 
 /* Allow to overwrite serial and ethaddr */
#9 lore raw

PATCH v2 3/9 serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig

Quoted 31 lines · Stefan Agner

Looks good to me,

Quoted 26 lines · Bin Meng

LPUART is seen on Freescale VF610 and QorIQ Layerscape devices. Create a Kconfig option and move it to defconfig for all boards that have this serial driver.

---

Changes in v2: None

 configs/colibri_vf_defconfig                 | 1 +
 configs/colibri_vf_dtb_defconfig             | 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig      | 1 +
 configs/ls1021atwr_nor_lpuart_defconfig      | 1 +
 configs/pcm052_defconfig                     | 1 +
 configs/vf610twr_defconfig                   | 1 +
 configs/vf610twr_nand_defconfig              | 1 +
 drivers/serial/Kconfig                       | 6 ++++++
 include/configs/colibri_vf.h                 | 1 -
 include/configs/ls1021aqds.h                 | 1 -
 include/configs/ls1021atwr.h                 | 1 -
 include/configs/pcm052.h                     | 1 -
 include/configs/vf610twr.h                   | 1 -
 14 files changed, 14 insertions(+), 5 deletions(-)
#10 lore raw

PATCH v2 3/9 serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig

Quoted 33 lines · Simon Glass
Quoted 31 lines · Stefan Agner

Looks good to me,

Quoted 26 lines · Bin Meng

LPUART is seen on Freescale VF610 and QorIQ Layerscape devices. Create a Kconfig option and move it to defconfig for all boards that have this serial driver.

---

Changes in v2: None

 configs/colibri_vf_defconfig                 | 1 +
 configs/colibri_vf_dtb_defconfig             | 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig      | 1 +
 configs/ls1021atwr_nor_lpuart_defconfig      | 1 +
 configs/pcm052_defconfig                     | 1 +
 configs/vf610twr_defconfig                   | 1 +
 configs/vf610twr_nand_defconfig              | 1 +
 drivers/serial/Kconfig                       | 6 ++++++
 include/configs/colibri_vf.h                 | 1 -
 include/configs/ls1021aqds.h                 | 1 -
 include/configs/ls1021atwr.h                 | 1 -
 include/configs/pcm052.h                     | 1 -
 include/configs/vf610twr.h                   | 1 -
 14 files changed, 14 insertions(+), 5 deletions(-)
Quoted 1 line

Applied to u-boot-dm, thanks!

author
#11 lore raw

PATCH v2 4/9 serial: lpuart: Fix several cosmetic issues

In reply to Bin Meng

Clean up the driver codes a little bit, by:
- Use tab instead of space in the macro defines
- Use single line comment whenever possible
- Fix insertion of blank lines

---

Changes in v2: None

 drivers/serial/serial_lpuart.c | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)
drivers/serial/serial_lpuart.c +15 -20
index 63fc388..ae47183 100644
@@ -12,15 +12,15 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 
-#define US1_TDRE        (1 << 7)
-#define US1_RDRF        (1 << 5)
-#define US1_OR          (1 << 3)
-#define UC2_TE          (1 << 3)
-#define UC2_RE          (1 << 2)
-#define CFIFO_TXFLUSH   (1 << 7)
-#define CFIFO_RXFLUSH   (1 << 6)
-#define SFIFO_RXOF      (1 << 2)
-#define SFIFO_RXUF      (1 << 0)
+#define US1_TDRE	(1 << 7)
+#define US1_RDRF	(1 << 5)
+#define US1_OR		(1 << 3)
+#define UC2_TE		(1 << 3)
+#define UC2_RE		(1 << 2)
+#define CFIFO_TXFLUSH	(1 << 7)
+#define CFIFO_RXFLUSH	(1 << 6)
+#define SFIFO_RXOF	(1 << 2)
+#define SFIFO_RXUF	(1 << 0)
 
 #define STAT_LBKDIF	(1 << 31)
 #define STAT_RXEDGIF	(1 << 30)
@@ -34,7 +34,7 @@
 #define STAT_MA1F	(1 << 15)
 #define STAT_MA2F	(1 << 14)
 #define STAT_FLAGS	(STAT_LBKDIF | STAT_RXEDGIF | STAT_IDLE | STAT_OR | \
-			STAT_NF | STAT_FE | STAT_PF | STAT_MA1F | STAT_MA2F)
+			 STAT_NF | STAT_FE | STAT_PF | STAT_MA1F | STAT_MA2F)
 
 #define CTRL_TE		(1 << 19)
 #define CTRL_RE		(1 << 18)
@@ -59,8 +59,8 @@ static void lpuart_serial_setbrg(void)
 		gd->baudrate = CONFIG_BAUDRATE;
 
 	sbr = (u16)(clk / (16 * gd->baudrate));
-	/* place adjustment later - n/32 BRFA */
 
+	/* place adjustment later - n/32 BRFA */
 	__raw_writeb(sbr >> 8, &base->ubdh);
 	__raw_writeb(sbr & 0xff, &base->ubdl);
 }
@@ -86,9 +86,7 @@ static void lpuart_serial_putc(const char c)
 	__raw_writeb(c, &base->ud);
 }
 
-/*
- * Test whether a character is in the RX buffer
- */
+/* Test whether a character is in the RX buffer */
 static int lpuart_serial_tstc(void)
 {
 	if (__raw_readb(&base->urcfifo) == 0)
@@ -120,7 +118,6 @@ static int lpuart_serial_init(void)
 	__raw_writeb(CFIFO_TXFLUSH | CFIFO_RXFLUSH, &base->ucfifo);
 
 	/* provide data bits, parity, stop bit, etc */
-
 	serial_setbrg();
 
 	__raw_writeb(UC2_RE | UC2_TE, &base->uc2);
@@ -148,8 +145,8 @@ static void lpuart32_serial_setbrg(void)
 		gd->baudrate = CONFIG_BAUDRATE;
 
 	sbr = (clk / (16 * gd->baudrate));
-	/* place adjustment later - n/32 BRFA */
 
+	/* place adjustment later - n/32 BRFA */
 	out_be32(&base->baud, sbr);
 }
 
@@ -176,9 +173,7 @@ static void lpuart32_serial_putc(const char c)
 	out_be32(&base->data, c);
 }
 
-/*
- * Test whether a character is in the RX buffer
- */
+/* Test whether a character is in the RX buffer */
 static int lpuart32_serial_tstc(void)
 {
 	if ((in_be32(&base->water) >> 24) == 0)
@@ -204,8 +199,8 @@ static int lpuart32_serial_init(void)
 	out_be32(&base->fifo, ~(FIFO_TXFE | FIFO_RXFE));
 
 	out_be32(&base->match, 0);
-	/* provide data bits, parity, stop bit, etc */
 
+	/* provide data bits, parity, stop bit, etc */
 	serial_setbrg();
 
 	out_be32(&base->ctrl, CTRL_RE | CTRL_TE);
Signature · 1 line
1.8.2.1
#12 lore raw

PATCH v2 4/9 serial: lpuart: Fix several cosmetic issues

Quoted 5 lines · Bin Meng

Clean up the driver codes a little bit, by:
- Use tab instead of space in the macro defines
- Use single line comment whenever possible
- Fix insertion of blank lines

Quoted 8 lines

---

Changes in v2: None

 drivers/serial/serial_lpuart.c | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)
#13 lore raw

PATCH v2 4/9 serial: lpuart: Fix several cosmetic issues

Quoted 10 lines · Simon Glass
Quoted 9 lines · Bin Meng

Clean up the driver codes a little bit, by:
- Use tab instead of space in the macro defines
- Use single line comment whenever possible
- Fix insertion of blank lines

---

Quoted 6 lines
Quoted 4 lines

Changes in v2: None

 drivers/serial/serial_lpuart.c | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

Applied to u-boot-dm, thanks!

author
#14 lore raw

PATCH v2 5/9 serial: lpuart: Call local version of setbrg and putc directly

In reply to Bin Meng

There is no need to go through serial driver subsystem, instead call the driver's setbrg and putc routines directly.

---

Changes in v2: None

 drivers/serial/serial_lpuart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/serial/serial_lpuart.c +4 -4
index ae47183..0c0ab87 100644
@@ -78,7 +78,7 @@ static int lpuart_serial_getc(void)
 static void lpuart_serial_putc(const char c)
 {
 	if (c == '\n')
-		serial_putc('\r');
+		lpuart_serial_putc('\r');
 
 	while (!(__raw_readb(&base->us1) & US1_TDRE))
 		WATCHDOG_RESET();
@@ -118,7 +118,7 @@ static int lpuart_serial_init(void)
 	__raw_writeb(CFIFO_TXFLUSH | CFIFO_RXFLUSH, &base->ucfifo);
 
 	/* provide data bits, parity, stop bit, etc */
-	serial_setbrg();
+	lpuart_serial_setbrg();
 
 	__raw_writeb(UC2_RE | UC2_TE, &base->uc2);
 
@@ -165,7 +165,7 @@ static int lpuart32_serial_getc(void)
 static void lpuart32_serial_putc(const char c)
 {
 	if (c == '\n')
-		serial_putc('\r');
+		lpuart32_serial_putc('\r');
 
 	while (!(in_be32(&base->stat) & STAT_TDRE))
 		WATCHDOG_RESET();
@@ -201,7 +201,7 @@ static int lpuart32_serial_init(void)
 	out_be32(&base->match, 0);
 
 	/* provide data bits, parity, stop bit, etc */
-	serial_setbrg();
+	lpuart32_serial_setbrg();
 
 	out_be32(&base->ctrl, CTRL_RE | CTRL_TE);
 
Signature · 1 line
1.8.2.1
#15 lore raw

PATCH v2 5/9 serial: lpuart: Call local version of setbrg and putc directly

Quoted 11 lines · Bin Meng

There is no need to go through serial driver subsystem, instead call the driver's setbrg and putc routines directly.

---

Changes in v2: None

 drivers/serial/serial_lpuart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
#16 lore raw

PATCH v2 5/9 serial: lpuart: Call local version of setbrg and putc directly

Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

There is no need to go through serial driver subsystem, instead call the driver's setbrg and putc routines directly.

---

Quoted 6 lines
Quoted 4 lines

Changes in v2: None

 drivers/serial/serial_lpuart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!

author
#17 lore raw

PATCH v2 6/9 serial: lpuart: Prepare the driver for DM conversion

In reply to Bin Meng

Create internal routines which take lpuart's register base as a parameter, in preparation for driver model conversion.

---

Changes in v2:
- Add missing 'base' parameter in the call to _lpuart_serial_tstc()
- Change internal routines' parameter 'reg' to 'base'

 drivers/serial/serial_lpuart.c | 88 +++++++++++++++++++++++++++++++-----------
 1 file changed, 66 insertions(+), 22 deletions(-)
drivers/serial/serial_lpuart.c +66 -22
index 0c0ab87..5cc1997 100644
@@ -50,22 +50,19 @@ DECLARE_GLOBAL_DATA_PTR;
 struct lpuart_fsl *base = (struct lpuart_fsl *)LPUART_BASE;
 
 #ifndef CONFIG_LPUART_32B_REG
-static void lpuart_serial_setbrg(void)
+static void _lpuart_serial_setbrg(struct lpuart_fsl *base, int baudrate)
 {
 	u32 clk = mxc_get_clock(MXC_UART_CLK);
 	u16 sbr;
 
-	if (!gd->baudrate)
-		gd->baudrate = CONFIG_BAUDRATE;
-
-	sbr = (u16)(clk / (16 * gd->baudrate));
+	sbr = (u16)(clk / (16 * baudrate));
 
 	/* place adjustment later - n/32 BRFA */
 	__raw_writeb(sbr >> 8, &base->ubdh);
 	__raw_writeb(sbr & 0xff, &base->ubdl);
 }
 
-static int lpuart_serial_getc(void)
+static int _lpuart_serial_getc(struct lpuart_fsl *base)
 {
 	while (!(__raw_readb(&base->us1) & (US1_RDRF | US1_OR)))
 		WATCHDOG_RESET();
@@ -75,10 +72,10 @@ static int lpuart_serial_getc(void)
 	return __raw_readb(&base->ud);
 }
 
-static void lpuart_serial_putc(const char c)
+static void _lpuart_serial_putc(struct lpuart_fsl *base, const char c)
 {
 	if (c == '\n')
-		lpuart_serial_putc('\r');
+		_lpuart_serial_putc(base, '\r');
 
 	while (!(__raw_readb(&base->us1) & US1_TDRE))
 		WATCHDOG_RESET();
@@ -87,7 +84,7 @@ static void lpuart_serial_putc(const char c)
 }
 
 /* Test whether a character is in the RX buffer */
-static int lpuart_serial_tstc(void)
+static int _lpuart_serial_tstc(struct lpuart_fsl *base)
 {
 	if (__raw_readb(&base->urcfifo) == 0)
 		return 0;
@@ -99,7 +96,7 @@ static int lpuart_serial_tstc(void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-static int lpuart_serial_init(void)
+static int _lpuart_serial_init(struct lpuart_fsl *base)
 {
 	u8 ctrl;
 
@@ -118,13 +115,38 @@ static int lpuart_serial_init(void)
 	__raw_writeb(CFIFO_TXFLUSH | CFIFO_RXFLUSH, &base->ucfifo);
 
 	/* provide data bits, parity, stop bit, etc */
-	lpuart_serial_setbrg();
+	_lpuart_serial_setbrg(base, gd->baudrate);
 
 	__raw_writeb(UC2_RE | UC2_TE, &base->uc2);
 
 	return 0;
 }
 
+static void lpuart_serial_setbrg(void)
+{
+	_lpuart_serial_setbrg(base, gd->baudrate);
+}
+
+static int lpuart_serial_getc(void)
+{
+	return _lpuart_serial_getc(base);
+}
+
+static void lpuart_serial_putc(const char c)
+{
+	_lpuart_serial_putc(base, c);
+}
+
+static int lpuart_serial_tstc(void)
+{
+	return _lpuart_serial_tstc(base);
+}
+
+static int lpuart_serial_init(void)
+{
+	return _lpuart_serial_init(base);
+}
+
 static struct serial_device lpuart_serial_drv = {
 	.name = "lpuart_serial",
 	.start = lpuart_serial_init,
@@ -136,21 +158,18 @@ static struct serial_device lpuart_serial_drv = {
 	.tstc = lpuart_serial_tstc,
 };
 #else
-static void lpuart32_serial_setbrg(void)
+static void _lpuart32_serial_setbrg(struct lpuart_fsl *base, int baudrate)
 {
 	u32 clk = CONFIG_SYS_CLK_FREQ;
 	u32 sbr;
 
-	if (!gd->baudrate)
-		gd->baudrate = CONFIG_BAUDRATE;
-
-	sbr = (clk / (16 * gd->baudrate));
+	sbr = (clk / (16 * baudrate));
 
 	/* place adjustment later - n/32 BRFA */
 	out_be32(&base->baud, sbr);
 }
 
-static int lpuart32_serial_getc(void)
+static int _lpuart32_serial_getc(struct lpuart_fsl *base)
 {
 	u32 stat;
 
@@ -162,10 +181,10 @@ static int lpuart32_serial_getc(void)
 	return in_be32(&base->data) & 0x3ff;
 }
 
-static void lpuart32_serial_putc(const char c)
+static void _lpuart32_serial_putc(struct lpuart_fsl *base, const char c)
 {
 	if (c == '\n')
-		lpuart32_serial_putc('\r');
+		_lpuart32_serial_putc(base, '\r');
 
 	while (!(in_be32(&base->stat) & STAT_TDRE))
 		WATCHDOG_RESET();
@@ -174,7 +193,7 @@ static void lpuart32_serial_putc(const char c)
 }
 
 /* Test whether a character is in the RX buffer */
-static int lpuart32_serial_tstc(void)
+static int _lpuart32_serial_tstc(struct lpuart_fsl *base)
 {
 	if ((in_be32(&base->water) >> 24) == 0)
 		return 0;
@@ -186,7 +205,7 @@ static int lpuart32_serial_tstc(void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-static int lpuart32_serial_init(void)
+static int _lpuart32_serial_init(struct lpuart_fsl *base)
 {
 	u8 ctrl;
 
@@ -201,13 +220,38 @@ static int lpuart32_serial_init(void)
 	out_be32(&base->match, 0);
 
 	/* provide data bits, parity, stop bit, etc */
-	lpuart32_serial_setbrg();
+	_lpuart32_serial_setbrg(base, gd->baudrate);
 
 	out_be32(&base->ctrl, CTRL_RE | CTRL_TE);
 
 	return 0;
 }
 
+static void lpuart32_serial_setbrg(void)
+{
+	_lpuart32_serial_setbrg(base, gd->baudrate);
+}
+
+static int lpuart32_serial_getc(void)
+{
+	return _lpuart32_serial_getc(base);
+}
+
+static void lpuart32_serial_putc(const char c)
+{
+	_lpuart32_serial_putc(base, c);
+}
+
+static int lpuart32_serial_tstc(void)
+{
+	return _lpuart32_serial_tstc(base);
+}
+
+static int lpuart32_serial_init(void)
+{
+	return _lpuart32_serial_init(base);
+}
+
 static struct serial_device lpuart32_serial_drv = {
 	.name = "lpuart32_serial",
 	.start = lpuart32_serial_init,
Signature · 1 line
1.8.2.1
#18 lore raw

PATCH v2 6/9 serial: lpuart: Prepare the driver for DM conversion

Quoted 6 lines · Bin Meng

Create internal routines which take lpuart's register base as a parameter, in preparation for driver model conversion.

Quoted 9 lines

---

Changes in v2:
- Add missing 'base' parameter in the call to _lpuart_serial_tstc()
- Change internal routines' parameter 'reg' to 'base'

 drivers/serial/serial_lpuart.c | 88 +++++++++++++++++++++++++++++++-----------
 1 file changed, 66 insertions(+), 22 deletions(-)
#19 lore raw

PATCH v2 6/9 serial: lpuart: Prepare the driver for DM conversion

Quoted 13 lines · Simon Glass
Quoted 12 lines · Bin Meng

Create internal routines which take lpuart's register base as a parameter, in preparation for driver model conversion.

---

Changes in v2:
- Add missing 'base' parameter in the call to _lpuart_serial_tstc()
- Change internal routines' parameter 'reg' to 'base'

Quoted 5 lines
Quoted 3 lines
 drivers/serial/serial_lpuart.c | 88 +++++++++++++++++++++++++++++++-----------
 1 file changed, 66 insertions(+), 22 deletions(-)

Applied to u-boot-dm, thanks!

author
#20 lore raw

PATCH v2 7/9 serial: lpuart: Add driver model serial support

In reply to Bin Meng

This adds driver model support to lpuart serial driver.

---

Changes in v2:
- Split to use two separate U_BOOT_DRIVER()

 doc/driver-model/serial-howto.txt |   1 -
 drivers/serial/serial_lpuart.c    | 167 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 167 insertions(+), 1 deletion(-)
doc/driver-model/serial-howto.txt +0 -1
index 4706d56..c933b90 100644
@@ -11,7 +11,6 @@ is time for maintainers to start converting over the remaining serial drivers:
    opencores_yanu.c
    serial_bfin.c
    serial_imx.c
-   serial_lpuart.c
    serial_max3100.c
    serial_pxa.c
    serial_s3c24x0.c
drivers/serial/serial_lpuart.c +167 -0

208 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#21 lore raw

PATCH v2 7/9 serial: lpuart: Add driver model serial support

Quoted 1 line · Bin Meng

This adds driver model support to lpuart serial driver.

Tested on Toradex Colibri VF50/VF61 h/w with legacy and DT, works fine as expected.

Quoted 2 lines

also

Quoted 242 lines

---

Changes in v2:
- Split to use two separate U_BOOT_DRIVER()

  doc/driver-model/serial-howto.txt |   1 -
  drivers/serial/serial_lpuart.c    | 167 ++++++++++++++++++++++++++++++++++++++
  2 files changed, 167 insertions(+), 1 deletion(-)
doc/driver-model/serial-howto.txt +0 -1
index 4706d56..c933b90 100644
@@ -11,7 +11,6 @@ is time for maintainers to start converting over the remaining serial drivers:
     opencores_yanu.c
     serial_bfin.c
     serial_imx.c
-   serial_lpuart.c
     serial_max3100.c
     serial_pxa.c
     serial_s3c24x0.c
drivers/serial/serial_lpuart.c +167 -0
index 5cc1997..3f9c4d1 100644
@@ -5,6 +5,7 @@
   */
 
  #include <common.h>
+#include <dm.h>
  #include <watchdog.h>
  #include <asm/io.h>
  #include <serial.h>
@@ -49,6 +50,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
  struct lpuart_fsl *base = (struct lpuart_fsl *)LPUART_BASE;
 
+struct lpuart_serial_platdata {
+	struct lpuart_fsl *reg;
+};
+
  #ifndef CONFIG_LPUART_32B_REG
  static void _lpuart_serial_setbrg(struct lpuart_fsl *base, int baudrate)
  {
@@ -122,6 +127,7 @@ static int _lpuart_serial_init(struct lpuart_fsl *base)
  	return 0;
  }
 
+#ifndef CONFIG_DM_SERIAL
  static void lpuart_serial_setbrg(void)
  {
  	_lpuart_serial_setbrg(base, gd->baudrate);
@@ -157,6 +163,54 @@ static struct serial_device lpuart_serial_drv = {
  	.getc = lpuart_serial_getc,
  	.tstc = lpuart_serial_tstc,
  };
+#else /* CONFIG_DM_SERIAL */
+static int lpuart_serial_setbrg(struct udevice *dev, int baudrate)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	_lpuart_serial_setbrg(reg, baudrate);
+
+	return 0;
+}
+
+static int lpuart_serial_getc(struct udevice *dev)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	return _lpuart_serial_getc(reg);
+}
+
+static int lpuart_serial_putc(struct udevice *dev, const char c)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	_lpuart_serial_putc(reg, c);
+
+	return 0;
+}
+
+static int lpuart_serial_pending(struct udevice *dev, bool input)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	if (input)
+		return _lpuart_serial_tstc(reg);
+	else
+		return __raw_readb(&reg->us1) & US1_TDRE ? 0 : 1;
+}
+
+static int lpuart_serial_probe(struct udevice *dev)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	return _lpuart_serial_init(reg);
+}
+#endif /* CONFIG_DM_SERIAL */
  #else
  static void _lpuart32_serial_setbrg(struct lpuart_fsl *base, int baudrate)
  {
@@ -227,6 +281,7 @@ static int _lpuart32_serial_init(struct lpuart_fsl *base)
  	return 0;
  }
 
+#ifndef CONFIG_DM_SERIAL
  static void lpuart32_serial_setbrg(void)
  {
  	_lpuart32_serial_setbrg(base, gd->baudrate);
@@ -262,8 +317,57 @@ static struct serial_device lpuart32_serial_drv = {
  	.getc = lpuart32_serial_getc,
  	.tstc = lpuart32_serial_tstc,
  };
+#else /* CONFIG_DM_SERIAL */
+static int lpuart32_serial_setbrg(struct udevice *dev, int baudrate)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	_lpuart32_serial_setbrg(reg, baudrate);
+
+	return 0;
+}
+
+static int lpuart32_serial_getc(struct udevice *dev)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	return _lpuart32_serial_getc(reg);
+}
+
+static int lpuart32_serial_putc(struct udevice *dev, const char c)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	_lpuart32_serial_putc(reg, c);
+
+	return 0;
+}
+
+static int lpuart32_serial_pending(struct udevice *dev, bool input)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	if (input)
+		return _lpuart32_serial_tstc(reg);
+	else
+		return in_be32(&reg->stat) & STAT_TDRE ? 0 : 1;
+}
+
+static int lpuart32_serial_probe(struct udevice *dev)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	struct lpuart_fsl *reg = plat->reg;
+
+	return _lpuart32_serial_init(reg);
+}
+#endif /* CONFIG_DM_SERIAL */
  #endif
 
+#ifndef CONFIG_DM_SERIAL
  void lpuart_serial_initialize(void)
  {
  #ifdef CONFIG_LPUART_32B_REG
@@ -281,3 +385,66 @@ __weak struct serial_device *default_serial_console(void)
  	return &lpuart_serial_drv;
  #endif
  }
+#else /* CONFIG_DM_SERIAL */
+static int lpuart_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct lpuart_serial_platdata *plat = dev->platdata;
+	fdt_addr_t addr;
+
+	addr = dev_get_addr(dev);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	plat->reg = (struct lpuart_fsl *)addr;
+
+	return 0;
+}
+
+#ifndef CONFIG_LPUART_32B_REG
+static const struct dm_serial_ops lpuart_serial_ops = {
+	.putc = lpuart_serial_putc,
+	.pending = lpuart_serial_pending,
+	.getc = lpuart_serial_getc,
+	.setbrg = lpuart_serial_setbrg,
+};
+
+static const struct udevice_id lpuart_serial_ids[] = {
+	{ .compatible = "fsl,vf610-lpuart" },
+	{ }
+};
+
+U_BOOT_DRIVER(serial_lpuart) = {
+	.name	= "serial_lpuart",
+	.id	= UCLASS_SERIAL,
+	.of_match = lpuart_serial_ids,
+	.ofdata_to_platdata = lpuart_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata),
+	.probe = lpuart_serial_probe,
+	.ops	= &lpuart_serial_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
+#else /* CONFIG_LPUART_32B_REG */
+static const struct dm_serial_ops lpuart32_serial_ops = {
+	.putc = lpuart32_serial_putc,
+	.pending = lpuart32_serial_pending,
+	.getc = lpuart32_serial_getc,
+	.setbrg = lpuart32_serial_setbrg,
+};
+
+static const struct udevice_id lpuart32_serial_ids[] = {
+	{ .compatible = "fsl,ls1021a-lpuart" },
+	{ }
+};
+
+U_BOOT_DRIVER(serial_lpuart32) = {
+	.name	= "serial_lpuart32",
+	.id	= UCLASS_SERIAL,
+	.of_match = lpuart32_serial_ids,
+	.ofdata_to_platdata = lpuart_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata),
+	.probe = lpuart32_serial_probe,
+	.ops	= &lpuart32_serial_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
+#endif /* CONFIG_LPUART_32B_REG */
+#endif /* CONFIG_DM_SERIAL */
Signature · 2 lines
Best regards,
Bhuvan
#22 lore raw

PATCH v2 7/9 serial: lpuart: Add driver model serial support

In reply to Bin Meng
Quoted 4 lines · Bin Meng

This adds driver model support to lpuart serial driver.

Quoted 8 lines

---

Changes in v2:
- Split to use two separate U_BOOT_DRIVER()

 doc/driver-model/serial-howto.txt |   1 -
 drivers/serial/serial_lpuart.c    | 167 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 167 insertions(+), 1 deletion(-)
#23 lore raw

PATCH v2 7/9 serial: lpuart: Add driver model serial support

Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

This adds driver model support to lpuart serial driver.

---

Quoted 8 lines
Quoted 6 lines

Changes in v2:
- Split to use two separate U_BOOT_DRIVER()

 doc/driver-model/serial-howto.txt |   1 -
 drivers/serial/serial_lpuart.c    | 167 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 167 insertions(+), 1 deletion(-)

Applied to u-boot-dm, thanks!

author
#24 lore raw

PATCH v2 8/9 arm: ls1021atwr: Split off board device tree

In reply to Bin Meng

Move /chosen node out of the board device tree.

---

Changes in v2:
- New patch to split off board device tree

 arch/arm/dts/Makefile                              |  2 +-
 arch/arm/dts/ls1021a-twr-duart.dts                 | 16 ++++++++++++++++
 arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} |  3 +--
 configs/ls1021atwr_nor_defconfig                   |  2 +-
 configs/ls1021atwr_qspi_defconfig                  |  2 +-
 configs/ls1021atwr_sdcard_qspi_defconfig           |  2 +-
 6 files changed, 21 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/ls1021a-twr-duart.dts
 rename arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} (96%)
arch/arm/dts/Makefile +1 -1
index 0bcd316..02b031e 100644
@@ -89,7 +89,7 @@ dtb-$(CONFIG_TARGET_BEAGLE_X15) += am57xx-beagle-x15.dtb
 dtb-$(CONFIG_TARGET_STV0991) += stv0991.dtb
 
 dtb-$(CONFIG_LS102XA) += ls1021a-qds.dtb \
-	ls1021a-twr.dtb
+	ls1021a-twr-duart.dtb
 dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \
 	fsl-ls2080a-rdb.dtb
 dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \
arch/arm/dts/ls1021a-twr-duart.dts new file +16 -0
new file mode 100644
index 0000000..aaf7296
@@ -0,0 +1,16 @@
+/*
+ * Freescale ls1021a TWR board device tree source
+ *
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/dts-v1/;
+#include "ls1021a-twr.dtsi"
+
+/ {
+	chosen {
+		stdout-path = &uart0;
+	};
+};
arch/arm/dts/ls1021a-twr.dtsi renamed from arch/arm/dts/ls1021a-twr.dts +1 -2
similarity index 96%
rename from arch/arm/dts/ls1021a-twr.dts
rename to arch/arm/dts/ls1021a-twr.dtsi
index aead13f..d1be9ae 100644
@@ -1,12 +1,11 @@
 /*
- * Freescale ls1021a TWR board device tree source
+ * Freescale ls1021a TWR board common device tree source
  *
  * Copyright 2013-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-/dts-v1/;
 #include "ls1021a.dtsi"
 
 / {
configs/ls1021atwr_nor_defconfig +1 -1
index 2b79443..b7b3a8d 100644
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
 CONFIG_DM_SERIAL=y
-CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr"
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-duart"
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
configs/ls1021atwr_qspi_defconfig +1 -1
index 0c71df6..d7c7e4c 100644
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
 CONFIG_DM_SPI=y
-CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr"
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-duart"
 CONFIG_SYS_EXTRA_OPTIONS="QSPI_BOOT"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_SETEXPR is not set
configs/ls1021atwr_sdcard_qspi_defconfig +1 -1
index 2b4ebd9..453a3bb 100644
@@ -1,7 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
 CONFIG_DM_SPI=y
-CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr"
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-duart"
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT,SD_BOOT_QSPI"
 CONFIG_OF_CONTROL=y
Signature · 1 line
1.8.2.1
#25 lore raw

PATCH v2 8/9 arm: ls1021atwr: Split off board device tree

Quoted 9 lines · Bin Meng

Move /chosen node out of the board device tree.

---

Changes in v2:
- New patch to split off board device tree

Quoted 9 lines
 arch/arm/dts/Makefile                              |  2 +-
 arch/arm/dts/ls1021a-twr-duart.dts                 | 16 ++++++++++++++++
 arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} |  3 +--
 configs/ls1021atwr_nor_defconfig                   |  2 +-
 configs/ls1021atwr_qspi_defconfig                  |  2 +-
 configs/ls1021atwr_sdcard_qspi_defconfig           |  2 +-
 6 files changed, 21 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/ls1021a-twr-duart.dts
 rename arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} (96%)
#26 lore raw

PATCH v2 8/9 arm: ls1021atwr: Split off board device tree

Quoted 20 lines · Simon Glass
Quoted 9 lines · Bin Meng

Move /chosen node out of the board device tree.

---

Changes in v2:
- New patch to split off board device tree

Quoted 9 lines
 arch/arm/dts/Makefile                              |  2 +-
 arch/arm/dts/ls1021a-twr-duart.dts                 | 16 ++++++++++++++++
 arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} |  3 +--
 configs/ls1021atwr_nor_defconfig                   |  2 +-
 configs/ls1021atwr_qspi_defconfig                  |  2 +-
 configs/ls1021atwr_sdcard_qspi_defconfig           |  2 +-
 6 files changed, 21 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/ls1021a-twr-duart.dts
 rename arch/arm/dts/{ls1021a-twr.dts => ls1021a-twr.dtsi} (96%)
Quoted 1 line

Applied to u-boot-dm, thanks!

author
#27 lore raw

PATCH v2 9/9 arm: ls1021atwr: Enable driver model lpuart serial driver

In reply to Bin Meng

Convert ls1021atwr_nor_lpuart to driver model support. As a start, enable lpuart serial port driver.

---

Changes in v2:
- Create a ls1021a-twr-lpuart.dts for ls1021atwr_nor_lpuart_defconfig

 arch/arm/dts/Makefile                   |  2 +-
 arch/arm/dts/ls1021a-twr-lpuart.dts     | 16 ++++++++++++++++
 configs/ls1021atwr_nor_lpuart_defconfig |  4 ++++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/ls1021a-twr-lpuart.dts
arch/arm/dts/Makefile +1 -1
index 02b031e..4bbf661 100644
@@ -89,7 +89,7 @@ dtb-$(CONFIG_TARGET_BEAGLE_X15) += am57xx-beagle-x15.dtb
 dtb-$(CONFIG_TARGET_STV0991) += stv0991.dtb
 
 dtb-$(CONFIG_LS102XA) += ls1021a-qds.dtb \
-	ls1021a-twr-duart.dtb
+	ls1021a-twr-duart.dtb ls1021a-twr-lpuart.dtb
 dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \
 	fsl-ls2080a-rdb.dtb
 dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \
arch/arm/dts/ls1021a-twr-lpuart.dts new file +16 -0
new file mode 100644
index 0000000..2941ec0
@@ -0,0 +1,16 @@
+/*
+ * Freescale ls1021a TWR board device tree source
+ *
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/dts-v1/;
+#include "ls1021a-twr.dtsi"
+
+/ {
+	chosen {
+		stdout-path = &lpuart0;
+	};
+};
configs/ls1021atwr_nor_lpuart_defconfig +4 -0
index 58cd61f..599342f 100644
@@ -1,7 +1,11 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-lpuart"
 CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
 CONFIG_FSL_LPUART=y
Signature · 1 line
1.8.2.1
#28 lore raw

PATCH v2 9/9 arm: ls1021atwr: Enable driver model lpuart serial driver

Hi,

Quoted 80 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Thursday, January 14, 2016 11:39 AM
To: Simon Glass; Stefan Agner; Bhuvanchandra DV; Albert ARIBAUD (3ADEV); York Sun; Alison Wang; U-Boot Mailing List
Subject: [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver

Convert ls1021atwr_nor_lpuart to driver model support. As a start, enable lpuart serial port driver.

---

Changes in v2:
- Create a ls1021a-twr-lpuart.dts for ls1021atwr_nor_lpuart_defconfig

 arch/arm/dts/Makefile                   |  2 +-
 arch/arm/dts/ls1021a-twr-lpuart.dts     | 16 ++++++++++++++++
 configs/ls1021atwr_nor_lpuart_defconfig |  4 ++++
 3 files changed, 21 insertions(+), 1 deletion(-)  create mode 100644

arch/arm/dts/ls1021a-twr-lpuart.dts

arch/arm/dts/Makefile index renamed from arch/arm/dts/Makefile +0 -0

02b031e..4bbf661 100644

arch/arm/dts/Makefile +0 -0
@@ -89,7 +89,7 @@ dtb-$(CONFIG_TARGET_BEAGLE_X15) += am57xx-beagle-

x15.dtb
dtb-$(CONFIG_TARGET_STV0991) += stv0991.dtb

dtb-$(CONFIG_LS102XA) += ls1021a-qds.dtb \

arch/arm/dts/Makefile +1 -1
-	ls1021a-twr-duart.dtb
+	ls1021a-twr-duart.dtb ls1021a-twr-lpuart.dtb
 dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \
 	fsl-ls2080a-rdb.dtb
 dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \ diff --git

a/arch/arm/dts/ls1021a-twr-lpuart.dts b/arch/arm/dts/ls1021a-twr- lpuart.dts
new file mode 100644
index 0000000..2941ec0

arch/arm/dts/ls1021a-twr-lpuart.dts new file +16 -0
@@ -0,0 +1,16 @@
+/*
+ * Freescale ls1021a TWR board device tree source
+ *
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/dts-v1/;
+#include "ls1021a-twr.dtsi"
+
+/ {
+	chosen {
+		stdout-path = &lpuart0;
+	};
+};
configs/ls1021atwr_nor_lpuart_defconfig +4 -1
index 58cd61f..599342f 100644
@@ -1,7 +1,11 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-lpuart"
 CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
 CONFIG_FSL_LPUART=y
--
Quoted 1 line

1.8.2.1

Best Regards,
Alison Wang

#29 lore raw

PATCH v2 9/9 arm: ls1021atwr: Enable driver model lpuart serial driver

Quoted 88 lines · Huan Wang

Hi,

Quoted 80 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Thursday, January 14, 2016 11:39 AM
To: Simon Glass; Stefan Agner; Bhuvanchandra DV; Albert ARIBAUD (3ADEV); York Sun; Alison Wang; U-Boot Mailing List
Subject: [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver

Convert ls1021atwr_nor_lpuart to driver model support. As a start, enable lpuart serial port driver.

---

Changes in v2:
- Create a ls1021a-twr-lpuart.dts for ls1021atwr_nor_lpuart_defconfig

 arch/arm/dts/Makefile                   |  2 +-
 arch/arm/dts/ls1021a-twr-lpuart.dts     | 16 ++++++++++++++++
 configs/ls1021atwr_nor_lpuart_defconfig |  4 ++++
 3 files changed, 21 insertions(+), 1 deletion(-)  create mode 100644

arch/arm/dts/ls1021a-twr-lpuart.dts

arch/arm/dts/Makefile index renamed from arch/arm/dts/Makefile +0 -0

02b031e..4bbf661 100644

arch/arm/dts/Makefile +0 -0
@@ -89,7 +89,7 @@ dtb-$(CONFIG_TARGET_BEAGLE_X15) += am57xx-beagle-

x15.dtb
dtb-$(CONFIG_TARGET_STV0991) += stv0991.dtb

dtb-$(CONFIG_LS102XA) += ls1021a-qds.dtb \

arch/arm/dts/Makefile +1 -1
-     ls1021a-twr-duart.dtb
+     ls1021a-twr-duart.dtb ls1021a-twr-lpuart.dtb
 dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \
      fsl-ls2080a-rdb.dtb
 dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \ diff --git

a/arch/arm/dts/ls1021a-twr-lpuart.dts b/arch/arm/dts/ls1021a-twr- lpuart.dts
new file mode 100644
index 0000000..2941ec0

arch/arm/dts/ls1021a-twr-lpuart.dts new file +16 -0
@@ -0,0 +1,16 @@
+/*
+ * Freescale ls1021a TWR board device tree source
+ *
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+
+/dts-v1/;
+#include "ls1021a-twr.dtsi"
+
+/ {
+     chosen {
+             stdout-path = &lpuart0;
+     };
+};
configs/ls1021atwr_nor_lpuart_defconfig +4 -1
index 58cd61f..599342f 100644
@@ -1,7 +1,11 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-lpuart"
 CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
 CONFIG_FSL_LPUART=y
--
Quoted 1 line

1.8.2.1

Quoted 2 lines

Best Regards,
Alison Wang

#30 lore raw

PATCH v2 9/9 arm: ls1021atwr: Enable driver model lpuart serial driver

Quoted 89 lines · Simon Glass
Quoted 88 lines · Huan Wang

Hi,

Quoted 80 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Thursday, January 14, 2016 11:39 AM
To: Simon Glass; Stefan Agner; Bhuvanchandra DV; Albert ARIBAUD (3ADEV); York Sun; Alison Wang; U-Boot Mailing List
Subject: [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver

Convert ls1021atwr_nor_lpuart to driver model support. As a start, enable lpuart serial port driver.

---

Changes in v2:
- Create a ls1021a-twr-lpuart.dts for ls1021atwr_nor_lpuart_defconfig

 arch/arm/dts/Makefile                   |  2 +-
 arch/arm/dts/ls1021a-twr-lpuart.dts     | 16 ++++++++++++++++
 configs/ls1021atwr_nor_lpuart_defconfig |  4 ++++
 3 files changed, 21 insertions(+), 1 deletion(-)  create mode 100644

arch/arm/dts/ls1021a-twr-lpuart.dts

arch/arm/dts/Makefile index renamed from arch/arm/dts/Makefile +0 -0

02b031e..4bbf661 100644

arch/arm/dts/Makefile +0 -0
@@ -89,7 +89,7 @@ dtb-$(CONFIG_TARGET_BEAGLE_X15) += am57xx-beagle-

x15.dtb
dtb-$(CONFIG_TARGET_STV0991) += stv0991.dtb

dtb-$(CONFIG_LS102XA) += ls1021a-qds.dtb \

arch/arm/dts/Makefile +1 -1
-     ls1021a-twr-duart.dtb
+     ls1021a-twr-duart.dtb ls1021a-twr-lpuart.dtb
 dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \
      fsl-ls2080a-rdb.dtb
 dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds.dtb \ diff --git

a/arch/arm/dts/ls1021a-twr-lpuart.dts b/arch/arm/dts/ls1021a-twr- lpuart.dts
new file mode 100644
index 0000000..2941ec0

arch/arm/dts/ls1021a-twr-lpuart.dts new file +16 -0
@@ -0,0 +1,16 @@
+/*
+ * Freescale ls1021a TWR board device tree source
+ *
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+
+/dts-v1/;
+#include "ls1021a-twr.dtsi"
+
+/ {
+     chosen {
+             stdout-path = &lpuart0;
+     };
+};
configs/ls1021atwr_nor_lpuart_defconfig +4 -1
index 58cd61f..599342f 100644
@@ -1,7 +1,11 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1021ATWR=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr-lpuart"
 CONFIG_SYS_EXTRA_OPTIONS="LPUART"
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
 CONFIG_NETDEVICES=y
 CONFIG_E1000=y
 CONFIG_FSL_LPUART=y
--
Quoted 1 line

1.8.2.1

Quoted 4 lines
Quoted 2 lines

Best Regards,
Alison Wang

Applied to u-boot-dm, thanks!