]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/mcasp-lld.git/commitdiff
Cleaning up Board_control hack
authorStephen Molfetta <sjmolfetta@ti.com>
Mon, 24 Jun 2019 14:08:14 +0000 (09:08 -0500)
committerMahesh Radhakrishnan <a0875154@ti.com>
Mon, 24 Jun 2019 21:56:14 +0000 (16:56 -0500)
Adding comments to remove when Board library issue has been resolved

example/j721e/src/audio_evmInit.c

index 2bb350078dce9101d14f953a80d58a1e6951fcde..42ab5737f50bd9ee429079eaab45efec42a243a8 100644 (file)
@@ -199,16 +199,18 @@ void McASP_Enable(void)
                                    SCICLIENT_SERVICE_WAIT_FOREVER);
 }
 
-//#define USE_BOARD_LIB_FOR_I2C_HANDLE
+/* This is defined to override using Board_control for I2C3 configuration to
+ * release PCM3168a from reset. Remove this once PDK-4278 is resovled.
+ */
+#define USE_BOARD_LIB_FOR_I2C3_HANDLE 0
 
+#if !(USE_BOARD_LIB_FOR_I2C3_HANDLE)
 extern I2C_Handle gIoExpI2cHandle;
+#endif
+
 void IoExpanderConfig(void)
 {
        Board_STATUS stat = BOARD_SOK;
-    I2C_Params      i2cParams;
-    I2C_Handle      handle, tmpHandle;
-    I2C_HwAttrs     i2cCfg;
-    bool            enableIntrTmp;
     uint8_t         ioExpData;
 
     /* Init IO Expander context */
@@ -237,11 +239,18 @@ void IoExpanderConfig(void)
     {
            MCASP_log("I2C IO Exp Init failed\n");
        }
-#if !defined(USE_BOARD_LIB_FOR_I2C_HANDLE)
+
+#if !(USE_BOARD_LIB_FOR_I2C3_HANDLE)
+    I2C_Params      i2cParams;
+    I2C_Handle      handle, tmpHandle;
+    I2C_HwAttrs     i2cCfg;
+    bool            enableIntrTmp;
+
     /* Configure I2C3 needed for IOEXP_DEVICE3 */
     I2C_Params_init(&i2cParams);
     i2cParams.transferMode = I2C_MODE_BLOCKING;
 
+    /* Force I2C3 to be polling mode */
     I2C_socGetInitCfg(3, &i2cCfg);
     enableIntrTmp     = i2cCfg.enableIntr;
     i2cCfg.baseAddr   = CSL_I2C3_CFG_BASE;
@@ -255,7 +264,7 @@ void IoExpanderConfig(void)
         MCASP_log("Failed to open I2C3\n");
     }
 
-    /* Hack: swap out the global I2C handle to configure board mux on a different instance */
+    /* Swap out the global I2C handle to configure board mux on a different instance */
     tmpHandle = gIoExpI2cHandle;
     gIoExpI2cHandle = handle;
 
@@ -276,8 +285,19 @@ void IoExpanderConfig(void)
     {
            MCASP_log("I2C IO Exp Init failed\n");
        }
+
+    /* Close I2C3 */
+    I2C_close(handle);
+
+    /* Reset mode of I2C3 operation back to driver default */
+    i2cCfg.enableIntr = enableIntrTmp;
+    I2C_socSetInitCfg(3, &i2cCfg);
+
+    /* Restore global IO Exp handle */
+    gIoExpI2cHandle = tmpHandle;
 #else
     Board_IoExpCfg_t ioExpCfg;
+
     ioExpCfg.slaveAddr   = BOARD_I2C_IOEXP_DEVICE3_ADDR;
     ioExpCfg.i2cInst     = BOARD_I2C_IOEXP_DEVICE3_INSTANCE;
     ioExpCfg.socDomain   = BOARD_SOC_DOMAIN_MAIN;
@@ -287,24 +307,8 @@ void IoExpanderConfig(void)
     ioExpCfg.pinNum      = PIN_NUM_0;
     ioExpCfg.signalLevel = GPIO_SIGNAL_LEVEL_HIGH;
 
-    //UART_printf("IoExpanderConfig: About to call Board_control, BOARD_I2C_IOEXP_DEVICE3_ADDR = 0x%x, " \
-    //            "BOARD_I2C_IOEXP_DEVICE3_INSTANCE = %d, PORTNUM_0 = %d, PIN_NUM_0 = %d, GPIO_SIGNAL_LEVEL_HIGH = %d\n",
-    //            BOARD_I2C_IOEXP_DEVICE3_ADDR,
-    //            BOARD_I2C_IOEXP_DEVICE3_INSTANCE, PORTNUM_0, PIN_NUM_0,
-    //            GPIO_SIGNAL_LEVEL_HIGH);
     Board_control(BOARD_CTRL_CMD_SET_IO_EXP_PIN_OUT, (void *)&ioExpCfg);
 #endif
-#if !defined(USE_BOARD_LIB_FOR_I2C_HANDLE)
-    /* Close I2C3 */
-    I2C_close(handle);
-
-    /* Reset mode of I2C1 operation back to driver default */
-    i2cCfg.enableIntr = enableIntrTmp;
-    I2C_socSetInitCfg(3, &i2cCfg);
-
-    /* Restore global IO Exp handle */
-    gIoExpI2cHandle = tmpHandle;
-#endif
 }
 
 /*