[U-Boot] [PATCH v3 4/4] colibri_pxa270: transition to driver model for serial

Marcel Ziswiler marcel.ziswiler at toradex.com
Mon Nov 14 21:40:28 CET 2016


Add serial platform data to board file.
Enable driver model for PXA serial driver.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>

---

Changes in v3: None
Changes in v2:
- Drop baudrate checks.
- Use panic instead of just hang() to more gracefully handle
  failure case.
- Drop superfluous parenthesis around plat->base.
- Capitalise header file gating macro.
- Replace tab with space after #define.

 board/toradex/colibri_pxa270/colibri_pxa270.c | 18 ++++++++++++++++--
 configs/colibri_pxa270_defconfig              |  2 ++
 include/configs/colibri_pxa270.h              |  2 --
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c
index de8cb28..932b900 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -9,10 +9,13 @@
 
 #include <common.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/regs-mmc.h>
 #include <asm/arch/pxa.h>
-#include <netdev.h>
+#include <asm/arch/regs-mmc.h>
+#include <asm/arch/regs-uart.h>
 #include <asm/io.h>
+#include <dm/platdata.h>
+#include <dm/platform_data/serial_pxa.h>
+#include <netdev.h>
 #include <serial.h>
 #include <usb.h>
 
@@ -113,3 +116,14 @@ int board_mmc_init(bd_t *bis)
 	return 0;
 }
 #endif
+
+static const struct pxa_serial_platdata serial_platdata = {
+	.base = (struct pxa_uart_regs *)FFUART_BASE,
+	.port = FFUART_INDEX,
+	.baudrate = CONFIG_BAUDRATE,
+};
+
+U_BOOT_DEVICE(pxa_serials) = {
+	.name = "serial_pxa",
+	.platdata = &serial_platdata,
+};
diff --git a/configs/colibri_pxa270_defconfig b/configs/colibri_pxa270_defconfig
index 0b5c20d..e0a36f1 100644
--- a/configs/colibri_pxa270_defconfig
+++ b/configs/colibri_pxa270_defconfig
@@ -16,6 +16,8 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
+CONFIG_DM=y
+CONFIG_DM_SERIAL=y
 CONFIG_PXA_SERIAL=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h
index 9f7c4a5..51f7877 100644
--- a/include/configs/colibri_pxa270.h
+++ b/include/configs/colibri_pxa270.h
@@ -47,8 +47,6 @@
 /*
  * Serial Console Configuration
  */
-#define	CONFIG_FFUART			1
-#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
-- 
2.5.5



More information about the U-Boot mailing list