[U-Boot] [PATCH 4/4] armv8/ls1043aqds: Initizlize NS16550 if enalbed LPUART

Wenbin Song wenbin.song at nxp.com
Tue Jan 19 07:48:28 CET 2016


From: Wenbin Song <Wenbin.Song at freescale.com>

Need to initialize ns16550 to support earlycon on kernel.

Signed-off-by: Wenbin Song <Wenbin.Song at freescale.com>
Signed-off-by: Mingkai Hu <Mingkai.Hu at freescale.com>
---
 board/freescale/ls1043aqds/ls1043aqds.c | 12 ++++++++++++
 configs/ls1043aqds_lpuart_defconfig     |  1 +
 include/configs/ls1043aqds.h            |  3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/board/freescale/ls1043aqds/ls1043aqds.c b/board/freescale/ls1043aqds/ls1043aqds.c
index 1da3fe1..fcbd95c 100644
--- a/board/freescale/ls1043aqds/ls1043aqds.c
+++ b/board/freescale/ls1043aqds/ls1043aqds.c
@@ -21,6 +21,7 @@
 #include <fsl_esdhc.h>
 #include <fsl_ifc.h>
 #include <spl.h>
+#include <ns16550.h>
 
 #include "../common/qixis.h"
 #include "ls1043aqds_qixis.h"
@@ -219,6 +220,17 @@ void board_retimer_init(void)
 	i2c_write(I2C_RETIMER_ADDR, 0x64, 1, &reg, 1);
 }
 
+int board_early_init_r(void)
+{
+#ifdef CONFIG_LPUART
+    /* Initialize ns16500 for earlycon on kernel.*/
+	NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+		     DIV_ROUND_CLOSEST(CONFIG_SYS_NS16550_CLK,
+				       16 * CONFIG_BAUDRATE));
+#endif
+	return 0;
+}
+
 int board_early_init_f(void)
 {
 #ifdef CONFIG_LPUART
diff --git a/configs/ls1043aqds_lpuart_defconfig b/configs/ls1043aqds_lpuart_defconfig
index ca06abe..26f7b36 100644
--- a/configs/ls1043aqds_lpuart_defconfig
+++ b/configs/ls1043aqds_lpuart_defconfig
@@ -1,6 +1,7 @@
 CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4,LPUART"
 CONFIG_ARM=y
 CONFIG_TARGET_LS1043AQDS=y
+CONFIG_SYS_NS16550=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1043a-qds"
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 88f4bc0..d66d8f9 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -30,6 +30,8 @@ unsigned long get_board_ddr_clk(void);
 
 #define CONFIG_LAYERSCAPE_NS_ACCESS
 
+#define CONFIG_BOARD_EARLY_INIT_R
+
 #define CONFIG_DIMM_SLOTS_PER_CTLR	1
 /* Physical Memory Map */
 #define CONFIG_CHIP_SELECTS_PER_CTRL	4
@@ -96,7 +98,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_LPUART_32B_REG
 #undef CONFIG_CONS_INDEX
 #undef CONFIG_SYS_NS16550_SERIAL
-#undef CONFIG_SYS_NS16550_CLK
 #endif
 
 /* SATA */
-- 
2.1.0.27.g96db324



More information about the U-Boot mailing list