board: freescale: ls1028a: mux changes for lpuart
authorYuantian Tang <andy.tang@nxp.com>
Thu, 19 Mar 2020 08:48:23 +0000 (16:48 +0800)
committerPriyanka Jain <priyanka.jain@nxp.com>
Wed, 29 Apr 2020 05:40:54 +0000 (11:10 +0530)
mux changes in board file to enable lpuart1 and macro
define for lpuart1 used for mux changes in board configuation
register 13

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
board/freescale/ls1028a/ls1028a.c
include/configs/ls1028aqds.h

index 0b7504aea125faa60f3410179e46a9aad95a1edb..1e2973f0c8f351529f01e47cdd0d6aea3efb7a2b 100644 (file)
@@ -31,6 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int config_board_mux(void)
 {
+#ifndef CONFIG_LPUART
 #if defined(CONFIG_TARGET_LS1028AQDS) && defined(CONFIG_FSL_QIXIS)
        u8 reg;
 
@@ -55,9 +56,18 @@ int config_board_mux(void)
        reg &= ~(0xc0);
        QIXIS_WRITE(brdcfg[15], reg);
 #endif
+#endif
+
        return 0;
 }
 
+#ifdef CONFIG_LPUART
+u32 get_lpuart_clk(void)
+{
+       return gd->bus_clk / CONFIG_SYS_FSL_LPUART_CLK_DIV;
+}
+#endif
+
 int board_init(void)
 {
 #ifdef CONFIG_ENV_IS_NOWHERE
@@ -120,11 +130,33 @@ int misc_init_r(void)
 
 int board_early_init_f(void)
 {
+#ifdef CONFIG_LPUART
+       u8 uart;
+#endif
+
 #ifdef CONFIG_SYS_I2C_EARLY_INIT
        i2c_early_init_f();
 #endif
 
        fsl_lsch3_early_init_f();
+
+#ifdef CONFIG_LPUART
+       /*
+        * Field| Function
+        * --------------------------------------------------------------
+        * 7-6  | Controls I2C3 routing (net CFG_MUX_I2C3):
+        * I2C3 | 11= Routes {SCL, SDA} to LPUART1 header as {SOUT, SIN}.
+        * --------------------------------------------------------------
+        * 5-4  | Controls I2C4 routing (net CFG_MUX_I2C4):
+        * I2C4 |11= Routes {SCL, SDA} to LPUART1 header as {CTS_B, RTS_B}.
+        */
+       /* use lpuart0 as system console */
+       uart = QIXIS_READ(brdcfg[13]);
+       uart &= ~CFG_LPUART_MUX_MASK;
+       uart |= CFG_LPUART_EN;
+       QIXIS_WRITE(brdcfg[13], uart);
+#endif
+
        return 0;
 }
 
index 818b994b907cd36d46d6de117538fda08a7d92be..b91016987b2145f99c697b8bb644384293c0a8a4 100644 (file)
 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
 #endif
 
+/* LPUART */
+#ifdef CONFIG_LPUART
+#define CONFIG_LPUART_32B_REG
+#define CFG_LPUART_MUX_MASK    0xf0
+#define CFG_LPUART_EN          0xf0
+#endif
+
 /* SATA */
 #define CONFIG_SCSI_AHCI_PLAT