Use DM for the pl01x serial driver on hikey. Also migrate over to UART3
as the latest version of ATF outputs to this UART. UART3 comes out on the
LS connector, rather than UART1 which goes to a unpopulated header.

NB: Upstream Linux kernel doesn't yet support UART3, so serial console
will still be output on UART1 when booting a upstream kernel.

Signed-off-by: Peter Griffin <[email protected]>
---
 arch/arm/Kconfig              |  2 +-
 board/hisilicon/hikey/hikey.c | 12 ++++++++++++
 configs/hikey_defconfig       |  1 +
 include/configs/hikey.h       | 10 +++-------
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 74a04e8..3958eaa 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -744,6 +744,7 @@ config TARGET_HIKEY
        select ARM64
        select DM
        select DM_GPIO
+       select DM_SERIAL
          help
          Support for HiKey 96boards platform. It features a HI6220
          SoC, with 8xA53 CPU, mali450 gpu, and 1GB RAM.
@@ -752,7 +753,6 @@ config TARGET_LS1021AQDS
        bool "Support ls1021aqds"
        select CPU_V7
        select SUPPORT_SPL
-
 config TARGET_LS1021ATWR
        bool "Support ls1021atwr"
        select CPU_V7
diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c
index 9948747..1c34447 100644
--- a/board/hisilicon/hikey/hikey.c
+++ b/board/hisilicon/hikey/hikey.c
@@ -6,6 +6,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <dm/platform_data/serial_pl01x.h>
 #include <errno.h>
 #include <malloc.h>
 #include <netdev.h>
@@ -69,6 +70,17 @@ U_BOOT_DEVICES(hi6220_gpios) = {
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static const struct pl01x_serial_platdata serial_platdata = {
+       .base = HI6220_UART3_BASE,
+       .type = TYPE_PL011,
+       .clock = 19200000
+};
+
+U_BOOT_DEVICE(hikey_serials) = {
+       .name = "serial_pl01x",
+       .platdata = &serial_platdata,
+};
+
 struct peri_sc_periph_regs *peri_sc =
        (struct peri_sc_periph_regs *)HI6220_PERI_BASE;
 
diff --git a/configs/hikey_defconfig b/configs/hikey_defconfig
index aa4fb0d..ee67c29 100644
--- a/configs/hikey_defconfig
+++ b/configs/hikey_defconfig
@@ -2,4 +2,5 @@
 CONFIG_ARM=y
 CONFIG_TARGET_HIKEY=y
 CONFIG_NET=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 # CONFIG_CMD_IMLS is not set
diff --git a/include/configs/hikey.h b/include/configs/hikey.h
index d16f552..578cccd 100644
--- a/include/configs/hikey.h
+++ b/include/configs/hikey.h
@@ -59,14 +59,10 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN          SZ_8M
 
-/* PL011 Serial Configuration */
-#define CONFIG_PL011_SERIAL
-
-#define CONFIG_PL011_CLOCK             19200000
-#define CONFIG_PL01x_PORTS             {(void *)0xF8015000}
-#define CONFIG_CONS_INDEX              0
-
+/* Serial port PL010/PL011 through the device model */
+#define CONFIG_PL01X_SERIAL
 #define CONFIG_BAUDRATE                        115200
+#define CONFIG_CONS_INDEX              0
 
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
-- 
1.9.1

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to