From 14a41ad0b945a4f20b826c8c501a8f1ff04dd52a Mon Sep 17 00:00:00 2001
From: Peter Li <a0220410@ti.com>
Date: Wed, 16 Jun 2021 14:41:37 +0800
Subject: [PATCH] ethfw use main_uart1 as log console

---
 .../ti/board/src/j7200_evm/J7200_pinmux_data_cpsw.c | 13 ++++++-------
 packages/ti/board/src/j7200_evm/board_utils.c       |  2 +-
 .../utils/V1/enet_appboardutils_j721e_evm.c         |  5 ++++-
 .../drv/enet/examples/utils/include/enet_apputils.h |  2 +-
 packages/ti/drv/enet/examples/utils/makefile        |  2 +-
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/packages/ti/board/src/j7200_evm/J7200_pinmux_data_cpsw.c b/packages/ti/board/src/j7200_evm/J7200_pinmux_data_cpsw.c
index e6ca54d..9303004 100755
--- a/packages/ti/board/src/j7200_evm/J7200_pinmux_data_cpsw.c
+++ b/packages/ti/board/src/j7200_evm/J7200_pinmux_data_cpsw.c
@@ -236,17 +236,16 @@ static pinmuxModuleCfg_t gSystemPinCfg[] =
     {PINMUX_END}
 };
 
-
-static pinmuxPerCfg_t gUart3PinCfg[] =
+static pinmuxPerCfg_t gUart1PinCfg[] =
 {
-    /* MyUART3 -> UART3_RXD -> Y18 */
+    /* MyUART1 -> UART1_RXD -> T18 */
     {
-        PIN_MCAN2_TX, PIN_MODE(11) | \
+        PIN_UART1_RXD, PIN_MODE(0) | \
         ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION))
     },
-    /* MyUART3 -> UART3_TXD -> Y19 */
+    /* MyUART1 -> UART1_TXD -> T20 */
     {
-        PIN_MCAN2_RX, PIN_MODE(11) | \
+        PIN_UART1_TXD, PIN_MODE(0) | \
         ((PIN_PULL_DISABLE) & (~PIN_PULL_DIRECTION & ~PIN_INPUT_ENABLE))
     },
     {PINMUX_END}
@@ -254,7 +253,7 @@ static pinmuxPerCfg_t gUart3PinCfg[] =
 
 static pinmuxModuleCfg_t gUartPinCfg[] =
 {
-    {3, TRUE, gUart3PinCfg},
+    {1, TRUE, gUart1PinCfg},
     {PINMUX_END}
 };
 
diff --git a/packages/ti/board/src/j7200_evm/board_utils.c b/packages/ti/board/src/j7200_evm/board_utils.c
index 20fbc0d..4725e8f 100755
--- a/packages/ti/board/src/j7200_evm/board_utils.c
+++ b/packages/ti/board/src/j7200_evm/board_utils.c
@@ -53,7 +53,7 @@ Board_DetectCfg_t  gBoardDetCfg[BOARD_ID_MAX_BOARDS] =
   {BOARD_COMMON_EEPROM_I2C_INST, BOARD_CP_EEPROM_SLAVE_ADDR, BOARD_SOC_DOMAIN_WKUP, "J7X-BASE-CPB"}};
 
 Board_I2cInitCfg_t gBoardI2cInitCfg = {0, BOARD_SOC_DOMAIN_MAIN, 0};
-Board_initParams_t gBoardInitParams = {BOARD_UART_INSTANCE, BOARD_UART_SOC_DOMAIN, BOARD_PSC_DEVICE_MODE_NONEXCLUSIVE,
+Board_initParams_t gBoardInitParams = {BOARD_UART1_INSTANCE, BOARD_SOC_DOMAIN_MAIN, BOARD_PSC_DEVICE_MODE_NONEXCLUSIVE,
                                        BOARD_MAIN_CLOCK_GROUP_ALL, BOARD_MCU_CLOCK_GROUP_ALL};
 
 /**
diff --git a/packages/ti/drv/enet/examples/utils/V1/enet_appboardutils_j721e_evm.c b/packages/ti/drv/enet/examples/utils/V1/enet_appboardutils_j721e_evm.c
index b5e2d70..f4be2fc 100644
--- a/packages/ti/drv/enet/examples/utils/V1/enet_appboardutils_j721e_evm.c
+++ b/packages/ti/drv/enet/examples/utils/V1/enet_appboardutils_j721e_evm.c
@@ -214,7 +214,7 @@ void EnetBoard_initEthFw(void)
     uint32_t clkModuleId[] = { TISCI_DEV_DDR0,
                                TISCI_DEV_TIMER12,
                                TISCI_DEV_TIMER13,
-                               TISCI_DEV_UART2,
+                               TISCI_DEV_UART1,
                                TISCI_DEV_I2C0, };
 
     appFlags = 0U;
@@ -242,11 +242,14 @@ void EnetBoard_initEthFw(void)
 
     EnetBoard_boardInit(&boardCfg);
 
+    /* the MUX between J7200 SOM UART1 to CPB UART1 are hardware config */
+#if 0
 #if defined(ENETAPPUTILS_UART_ALLOWED) && defined (SOC_J7200) && defined(BUILD_MCU2_0)
     /* Set SOM's MUX2 for UART3 route */
     status = Board_control(BOARD_CTRL_CMD_SET_SOM_UART_MUX, NULL);
     EnetAppUtils_assert(status == BOARD_SOK);
 #endif
+#endif
 
 #if !defined(ENETAPPUTILS_BYPASS_I2C) && defined(BUILD_MCU2_0)
     /* Configure SGMII/QSGMII expansion board
diff --git a/packages/ti/drv/enet/examples/utils/include/enet_apputils.h b/packages/ti/drv/enet/examples/utils/include/enet_apputils.h
index acab1f0..7d77a12 100644
--- a/packages/ti/drv/enet/examples/utils/include/enet_apputils.h
+++ b/packages/ti/drv/enet/examples/utils/include/enet_apputils.h
@@ -109,7 +109,7 @@ extern "C" {
 #define ENET_CTRL_RGMII_ID_NODELAY          (1U)
 
 #if defined(SOC_J7200)
-#define ENET_UTILS_MCU2_0_UART_INSTANCE     (3U)
+#define ENET_UTILS_MCU2_0_UART_INSTANCE     (1U)
 #else
 #define ENET_UTILS_MCU2_0_UART_INSTANCE     (2U)
 #endif
diff --git a/packages/ti/drv/enet/examples/utils/makefile b/packages/ti/drv/enet/examples/utils/makefile
index 64fda61..f2c83da 100644
--- a/packages/ti/drv/enet/examples/utils/makefile
+++ b/packages/ti/drv/enet/examples/utils/makefile
@@ -37,7 +37,7 @@ else
       ifeq ($(SOC),$(filter $(SOC), j721e))
         ENET_CFLAGS += -DENETAPPUTILS_BYPASS_QSGMII
       endif
-      ifneq ($(SOC),$(filter $(SOC), j7200))
+      ifeq ($(SOC),$(filter $(SOC), j7200))
         ENET_CFLAGS += -DENETAPPUTILS_UART_ALLOWED
       endif
     else
-- 
2.17.1

