All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support
@ 2016-01-14  3:38 Bin Meng
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup" Bin Meng
                   ` (8 more replies)
  0 siblings, 9 replies; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:38 UTC (permalink / raw)
  To: u-boot

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

-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup"
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
@ 2016-01-14  3:38 ` Bin Meng
  2016-01-20 20:26   ` Simon Glass
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:38 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

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

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

diff --git a/common/fdt_support.c b/common/fdt_support.c
index a539389..4e0d07c 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -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) {
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup" Bin Meng
@ 2016-01-14  3:38 ` Bin Meng
  2016-01-20 20:26   ` Simon Glass
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig Bin Meng
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:38 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

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

diff --git a/arch/arm/dts/ls1021a-twr.dts b/arch/arm/dts/ls1021a-twr.dts
index 6ccd332..aead13f 100644
--- a/arch/arm/dts/ls1021a-twr.dts
+++ b/arch/arm/dts/ls1021a-twr.dts
@@ -19,6 +19,10 @@
 		spi0 = &qspi;
 		spi1 = &dspi1;
 	};
+
+	chosen {
+		stdout-path = &uart0;
+	};
 };
 
 &qspi {
diff --git a/arch/arm/dts/ls1021a.dtsi b/arch/arm/dts/ls1021a.dtsi
index 7fadd7c..ee0e554 100644
--- a/arch/arm/dts/ls1021a.dtsi
+++ b/arch/arm/dts/ls1021a.dtsi
@@ -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";
 		};
diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig
index aa874fd..2b79443 100644
--- a/configs/ls1021atwr_nor_defconfig
+++ b/configs/ls1021atwr_nor_defconfig
@@ -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
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index c12ba3a..bbef2a7 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -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
 
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup" Bin Meng
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-15 21:11   ` Stefan Agner
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues Bin Meng
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

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

diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig
index f8441e3..45917c8 100644
--- a/configs/colibri_vf_defconfig
+++ b/configs/colibri_vf_defconfig
@@ -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
diff --git a/configs/colibri_vf_dtb_defconfig b/configs/colibri_vf_dtb_defconfig
index 3596cec..b1a843a 100644
--- a/configs/colibri_vf_dtb_defconfig
+++ b/configs/colibri_vf_dtb_defconfig
@@ -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
diff --git a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
index 68bd117..44b2a0d 100644
--- a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
@@ -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
diff --git a/configs/ls1021aqds_nor_lpuart_defconfig b/configs/ls1021aqds_nor_lpuart_defconfig
index b2f6832..1186af2 100644
--- a/configs/ls1021aqds_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_nor_lpuart_defconfig
@@ -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
diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig
index d7afca9..58cd61f 100644
--- a/configs/ls1021atwr_nor_lpuart_defconfig
+++ b/configs/ls1021atwr_nor_lpuart_defconfig
@@ -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
diff --git a/configs/pcm052_defconfig b/configs/pcm052_defconfig
index 9125645..26ab733 100644
--- a/configs/pcm052_defconfig
+++ b/configs/pcm052_defconfig
@@ -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
diff --git a/configs/vf610twr_defconfig b/configs/vf610twr_defconfig
index dc8df5c..d51c93b 100644
--- a/configs/vf610twr_defconfig
+++ b/configs/vf610twr_defconfig
@@ -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
diff --git a/configs/vf610twr_nand_defconfig b/configs/vf610twr_nand_defconfig
index 98880f3..299fa8f 100644
--- a/configs/vf610twr_nand_defconfig
+++ b/configs/vf610twr_nand_defconfig
@@ -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
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 1fc287e..3b54511 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -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
diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
index 708c79a..5aed3a5 100644
--- a/include/configs/colibri_vf.h
+++ b/include/configs/colibri_vf.h
@@ -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 */
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 2e8dbc7..e8b1eca 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -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
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index bbef2a7..317ba62 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -266,7 +266,6 @@
  * Serial Port
  */
 #ifdef CONFIG_LPUART
-#define CONFIG_FSL_LPUART
 #define CONFIG_LPUART_32B_REG
 #else
 #define CONFIG_CONS_INDEX		1
diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h
index b851bba..891bdb0 100644
--- a/include/configs/pcm052.h
+++ b/include/configs/pcm052.h
@@ -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 */
diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h
index 34df6f0..dcfafaf 100644
--- a/include/configs/vf610twr.h
+++ b/include/configs/vf610twr.h
@@ -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 */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (2 preceding siblings ...)
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-20 20:27   ` Simon Glass
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly Bin Meng
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

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

diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 63fc388..ae47183 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -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);
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (3 preceding siblings ...)
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-20 20:27   ` Simon Glass
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion Bin Meng
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

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

diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index ae47183..0c0ab87 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -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);
 
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (4 preceding siblings ...)
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-20 20:27   ` Simon Glass
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support Bin Meng
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

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

diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 0c0ab87..5cc1997 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -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,
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (5 preceding siblings ...)
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-14  8:14   ` Bhuvanchandra DV
  2016-01-20 20:27   ` Simon Glass
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree Bin Meng
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver Bin Meng
  8 siblings, 2 replies; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

This adds driver model support to lpuart serial driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

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

diff --git a/doc/driver-model/serial-howto.txt b/doc/driver-model/serial-howto.txt
index 4706d56..c933b90 100644
--- a/doc/driver-model/serial-howto.txt
+++ b/doc/driver-model/serial-howto.txt
@@ -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
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 5cc1997..3f9c4d1 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -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 */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (6 preceding siblings ...)
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-20 20:27   ` Simon Glass
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver Bin Meng
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

Move /chosen node out of the board device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

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

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0bcd316..02b031e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -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 \
diff --git a/arch/arm/dts/ls1021a-twr-duart.dts b/arch/arm/dts/ls1021a-twr-duart.dts
new file mode 100644
index 0000000..aaf7296
--- /dev/null
+++ b/arch/arm/dts/ls1021a-twr-duart.dts
@@ -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;
+	};
+};
diff --git a/arch/arm/dts/ls1021a-twr.dts b/arch/arm/dts/ls1021a-twr.dtsi
similarity index 96%
rename from arch/arm/dts/ls1021a-twr.dts
rename to arch/arm/dts/ls1021a-twr.dtsi
index aead13f..d1be9ae 100644
--- a/arch/arm/dts/ls1021a-twr.dts
+++ b/arch/arm/dts/ls1021a-twr.dtsi
@@ -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"
 
 / {
diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig
index 2b79443..b7b3a8d 100644
--- a/configs/ls1021atwr_nor_defconfig
+++ b/configs/ls1021atwr_nor_defconfig
@@ -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
diff --git a/configs/ls1021atwr_qspi_defconfig b/configs/ls1021atwr_qspi_defconfig
index 0c71df6..d7c7e4c 100644
--- a/configs/ls1021atwr_qspi_defconfig
+++ b/configs/ls1021atwr_qspi_defconfig
@@ -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
diff --git a/configs/ls1021atwr_sdcard_qspi_defconfig b/configs/ls1021atwr_sdcard_qspi_defconfig
index 2b4ebd9..453a3bb 100644
--- a/configs/ls1021atwr_sdcard_qspi_defconfig
+++ b/configs/ls1021atwr_sdcard_qspi_defconfig
@@ -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
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver
  2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
                   ` (7 preceding siblings ...)
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree Bin Meng
@ 2016-01-14  3:39 ` Bin Meng
  2016-01-18  9:39   ` Huan Wang
  8 siblings, 1 reply; 31+ messages in thread
From: Bin Meng @ 2016-01-14  3:39 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

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

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 02b031e..4bbf661 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -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 \
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
--- /dev/null
+++ b/arch/arm/dts/ls1021a-twr-lpuart.dts
@@ -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;
+	};
+};
diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig
index 58cd61f..599342f 100644
--- a/configs/ls1021atwr_nor_lpuart_defconfig
+++ b/configs/ls1021atwr_nor_lpuart_defconfig
@@ -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
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support Bin Meng
@ 2016-01-14  8:14   ` Bhuvanchandra DV
  2016-01-20 20:27   ` Simon Glass
  1 sibling, 0 replies; 31+ messages in thread
From: Bhuvanchandra DV @ 2016-01-14  8:14 UTC (permalink / raw)
  To: u-boot

On 01/14/2016 09:09 AM, Bin Meng wrote:
> 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.

>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Acked-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
also
Tested-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>

>
> ---
>
> 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(-)
>
> diff --git a/doc/driver-model/serial-howto.txt b/doc/driver-model/serial-howto.txt
> index 4706d56..c933b90 100644
> --- a/doc/driver-model/serial-howto.txt
> +++ b/doc/driver-model/serial-howto.txt
> @@ -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
> diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
> index 5cc1997..3f9c4d1 100644
> --- a/drivers/serial/serial_lpuart.c
> +++ b/drivers/serial/serial_lpuart.c
> @@ -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 */
>

-- 
Best regards,
Bhuvan

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

* [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig Bin Meng
@ 2016-01-15 21:11   ` Stefan Agner
  2016-01-20 20:26     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Stefan Agner @ 2016-01-15 21:11 UTC (permalink / raw)
  To: u-boot

Looks good to me,

Acked-by: Stefan Agner <stefan.agner@toradex.com>

On 13.01.2016 19:39, Bin Meng wrote:
> 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.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> 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(-)
>
> diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig
> index f8441e3..45917c8 100644
> --- a/configs/colibri_vf_defconfig
> +++ b/configs/colibri_vf_defconfig
> @@ -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
> diff --git a/configs/colibri_vf_dtb_defconfig b/configs/colibri_vf_dtb_defconfig
> index 3596cec..b1a843a 100644
> --- a/configs/colibri_vf_dtb_defconfig
> +++ b/configs/colibri_vf_dtb_defconfig
> @@ -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
> diff --git a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
> index 68bd117..44b2a0d 100644
> --- a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
> +++ b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
> @@ -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
> diff --git a/configs/ls1021aqds_nor_lpuart_defconfig b/configs/ls1021aqds_nor_lpuart_defconfig
> index b2f6832..1186af2 100644
> --- a/configs/ls1021aqds_nor_lpuart_defconfig
> +++ b/configs/ls1021aqds_nor_lpuart_defconfig
> @@ -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
> diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig
> index d7afca9..58cd61f 100644
> --- a/configs/ls1021atwr_nor_lpuart_defconfig
> +++ b/configs/ls1021atwr_nor_lpuart_defconfig
> @@ -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
> diff --git a/configs/pcm052_defconfig b/configs/pcm052_defconfig
> index 9125645..26ab733 100644
> --- a/configs/pcm052_defconfig
> +++ b/configs/pcm052_defconfig
> @@ -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
> diff --git a/configs/vf610twr_defconfig b/configs/vf610twr_defconfig
> index dc8df5c..d51c93b 100644
> --- a/configs/vf610twr_defconfig
> +++ b/configs/vf610twr_defconfig
> @@ -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
> diff --git a/configs/vf610twr_nand_defconfig b/configs/vf610twr_nand_defconfig
> index 98880f3..299fa8f 100644
> --- a/configs/vf610twr_nand_defconfig
> +++ b/configs/vf610twr_nand_defconfig
> @@ -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
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 1fc287e..3b54511 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -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
> diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
> index 708c79a..5aed3a5 100644
> --- a/include/configs/colibri_vf.h
> +++ b/include/configs/colibri_vf.h
> @@ -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 */
> diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
> index 2e8dbc7..e8b1eca 100644
> --- a/include/configs/ls1021aqds.h
> +++ b/include/configs/ls1021aqds.h
> @@ -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
> diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
> index bbef2a7..317ba62 100644
> --- a/include/configs/ls1021atwr.h
> +++ b/include/configs/ls1021atwr.h
> @@ -266,7 +266,6 @@
>   * Serial Port
>   */
>  #ifdef CONFIG_LPUART
> -#define CONFIG_FSL_LPUART
>  #define CONFIG_LPUART_32B_REG
>  #else
>  #define CONFIG_CONS_INDEX		1
> diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h
> index b851bba..891bdb0 100644
> --- a/include/configs/pcm052.h
> +++ b/include/configs/pcm052.h
> @@ -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 */
> diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h
> index 34df6f0..dcfafaf 100644
> --- a/include/configs/vf610twr.h
> +++ b/include/configs/vf610twr.h
> @@ -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 */

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

* [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver Bin Meng
@ 2016-01-18  9:39   ` Huan Wang
  2016-01-20 20:27     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Huan Wang @ 2016-01-18  9:39 UTC (permalink / raw)
  To: u-boot

Hi,

> -----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.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> ---
> 
> 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
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index
> 02b031e..4bbf661 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -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 \ 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
> --- /dev/null
> +++ b/arch/arm/dts/ls1021a-twr-lpuart.dts
> @@ -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;
> +	};
> +};
> diff --git a/configs/ls1021atwr_nor_lpuart_defconfig
> b/configs/ls1021atwr_nor_lpuart_defconfig
> index 58cd61f..599342f 100644
> --- a/configs/ls1021atwr_nor_lpuart_defconfig
> +++ b/configs/ls1021atwr_nor_lpuart_defconfig
> @@ -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
> --
> 1.8.2.1

Reviewed-by: Alison Wang <alison.wang@nxp.com>
Tested-by: Alison Wang <alison.wang@nxp.com>


Best Regards,
Alison Wang

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

* [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup"
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup" Bin Meng
@ 2016-01-20 20:26   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:26 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:38, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - Rewrite the commit message using 'git revert' format.
>
>  common/fdt_support.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support
  2016-01-14  3:38 ` [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
@ 2016-01-20 20:26   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:26 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:38, Bin Meng <bmeng.cn@gmail.com> wrote:
> Convert ls1021atwr_nor to driver model support. As a start, enable
> ns16550 serial port driver.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> 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(-)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
  2016-01-15 21:11   ` Stefan Agner
@ 2016-01-20 20:26     ` Simon Glass
  2016-01-21 15:18       ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:26 UTC (permalink / raw)
  To: u-boot

On 15 January 2016 at 14:11, Stefan Agner <stefan.agner@toradex.com> wrote:
> Looks good to me,
>
> Acked-by: Stefan Agner <stefan.agner@toradex.com>
>
> On 13.01.2016 19:39, Bin Meng wrote:
>> 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.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> 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(-)
>>

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues Bin Meng
@ 2016-01-20 20:27   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:27 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/serial/serial_lpuart.c | 35 +++++++++++++++--------------------
>  1 file changed, 15 insertions(+), 20 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly Bin Meng
@ 2016-01-20 20:27   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:27 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
> There is no need to go through serial driver subsystem, instead
> call the driver's setbrg and putc routines directly.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/serial/serial_lpuart.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion Bin Meng
@ 2016-01-20 20:27   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:27 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
> Create internal routines which take lpuart's register base as
> a parameter, in preparation for driver model conversion.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> ---
>
> 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(-)
>

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support Bin Meng
  2016-01-14  8:14   ` Bhuvanchandra DV
@ 2016-01-20 20:27   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  1 sibling, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:27 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
> This adds driver model support to lpuart serial driver.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> 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(-)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree
  2016-01-14  3:39 ` [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree Bin Meng
@ 2016-01-20 20:27   ` Simon Glass
  2016-01-21 15:18     ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:27 UTC (permalink / raw)
  To: u-boot

On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
> Move /chosen node out of the board device tree.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> 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%)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver
  2016-01-18  9:39   ` Huan Wang
@ 2016-01-20 20:27     ` Simon Glass
  2016-01-21 15:18       ` Simon Glass
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Glass @ 2016-01-20 20:27 UTC (permalink / raw)
  To: u-boot

On 18 January 2016 at 02:39, Huan Wang <alison.wang@nxp.com> wrote:
> Hi,
>
>> -----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.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> ---
>>
>> 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
>>
>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index
>> 02b031e..4bbf661 100644
>> --- a/arch/arm/dts/Makefile
>> +++ b/arch/arm/dts/Makefile
>> @@ -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 \ 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
>> --- /dev/null
>> +++ b/arch/arm/dts/ls1021a-twr-lpuart.dts
>> @@ -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;
>> +     };
>> +};
>> diff --git a/configs/ls1021atwr_nor_lpuart_defconfig
>> b/configs/ls1021atwr_nor_lpuart_defconfig
>> index 58cd61f..599342f 100644
>> --- a/configs/ls1021atwr_nor_lpuart_defconfig
>> +++ b/configs/ls1021atwr_nor_lpuart_defconfig
>> @@ -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
>> --
>> 1.8.2.1
>
> Reviewed-by: Alison Wang <alison.wang@nxp.com>
> Tested-by: Alison Wang <alison.wang@nxp.com>
>
>
> Best Regards,
> Alison Wang

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup"
  2016-01-20 20:26   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:26, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:38, Bin Meng <bmeng.cn@gmail.com> wrote:
>> 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.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> Changes in v2:
>> - Rewrite the commit message using 'git revert' format.
>>
>>  common/fdt_support.c | 16 +---------------
>>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support
  2016-01-20 20:26   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:26, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:38, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Convert ls1021atwr_nor to driver model support. As a start, enable
>> ns16550 serial port driver.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> 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(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig
  2016-01-20 20:26     ` Simon Glass
@ 2016-01-21 15:18       ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:26, Simon Glass <sjg@chromium.org> wrote:
> On 15 January 2016 at 14:11, Stefan Agner <stefan.agner@toradex.com> wrote:
>> Looks good to me,
>>
>> Acked-by: Stefan Agner <stefan.agner@toradex.com>
>>
>> On 13.01.2016 19:39, Bin Meng wrote:
>>> 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.
>>>
>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>> ---
>>>
>>> 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(-)
>>>
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues
  2016-01-20 20:27   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:27, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
>> 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
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2: None
>>
>>  drivers/serial/serial_lpuart.c | 35 +++++++++++++++--------------------
>>  1 file changed, 15 insertions(+), 20 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly
  2016-01-20 20:27   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:27, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
>> There is no need to go through serial driver subsystem, instead
>> call the driver's setbrg and putc routines directly.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2: None
>>
>>  drivers/serial/serial_lpuart.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion
  2016-01-20 20:27   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:27, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Create internal routines which take lpuart's register base as
>> a parameter, in preparation for driver model conversion.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> ---
>>
>> 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(-)
>>
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support
  2016-01-20 20:27   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:27, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
>> This adds driver model support to lpuart serial driver.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> 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(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree
  2016-01-20 20:27   ` Simon Glass
@ 2016-01-21 15:18     ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:27, Simon Glass <sjg@chromium.org> wrote:
> On 13 January 2016 at 20:39, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Move /chosen node out of the board device tree.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> 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%)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver
  2016-01-20 20:27     ` Simon Glass
@ 2016-01-21 15:18       ` Simon Glass
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Glass @ 2016-01-21 15:18 UTC (permalink / raw)
  To: u-boot

On 20 January 2016 at 13:27, Simon Glass <sjg@chromium.org> wrote:
> On 18 January 2016 at 02:39, Huan Wang <alison.wang@nxp.com> wrote:
>> Hi,
>>
>>> -----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.
>>>
>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> ---
>>>
>>> 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
>>>
>>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index
>>> 02b031e..4bbf661 100644
>>> --- a/arch/arm/dts/Makefile
>>> +++ b/arch/arm/dts/Makefile
>>> @@ -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 \ 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
>>> --- /dev/null
>>> +++ b/arch/arm/dts/ls1021a-twr-lpuart.dts
>>> @@ -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;
>>> +     };
>>> +};
>>> diff --git a/configs/ls1021atwr_nor_lpuart_defconfig
>>> b/configs/ls1021atwr_nor_lpuart_defconfig
>>> index 58cd61f..599342f 100644
>>> --- a/configs/ls1021atwr_nor_lpuart_defconfig
>>> +++ b/configs/ls1021atwr_nor_lpuart_defconfig
>>> @@ -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
>>> --
>>> 1.8.2.1
>>
>> Reviewed-by: Alison Wang <alison.wang@nxp.com>
>> Tested-by: Alison Wang <alison.wang@nxp.com>
>>
>>
>> Best Regards,
>> Alison Wang
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

end of thread, other threads:[~2016-01-21 15:18 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-14  3:38 [U-Boot] [PATCH v2 0/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
2016-01-14  3:38 ` [U-Boot] [PATCH v2 1/9] Revert "fdt_support: Add multi-serial support for stdout fixup" Bin Meng
2016-01-20 20:26   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:38 ` [U-Boot] [PATCH v2 2/9] arm: ls1021atwr: Convert to driver model and enable serial support Bin Meng
2016-01-20 20:26   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 3/9] serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig Bin Meng
2016-01-15 21:11   ` Stefan Agner
2016-01-20 20:26     ` Simon Glass
2016-01-21 15:18       ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 4/9] serial: lpuart: Fix several cosmetic issues Bin Meng
2016-01-20 20:27   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 5/9] serial: lpuart: Call local version of setbrg and putc directly Bin Meng
2016-01-20 20:27   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 6/9] serial: lpuart: Prepare the driver for DM conversion Bin Meng
2016-01-20 20:27   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 7/9] serial: lpuart: Add driver model serial support Bin Meng
2016-01-14  8:14   ` Bhuvanchandra DV
2016-01-20 20:27   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 8/9] arm: ls1021atwr: Split off board device tree Bin Meng
2016-01-20 20:27   ` Simon Glass
2016-01-21 15:18     ` Simon Glass
2016-01-14  3:39 ` [U-Boot] [PATCH v2 9/9] arm: ls1021atwr: Enable driver model lpuart serial driver Bin Meng
2016-01-18  9:39   ` Huan Wang
2016-01-20 20:27     ` Simon Glass
2016-01-21 15:18       ` Simon Glass

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.