How to enable I2C in Linux kernel for Android for ConnectCore i.MX53 module

To enable i2c-2 in Linux kernel for Android you may use the following patches:
 
diff --git a/arch/arm/mach-mx5/mx53_ccwmx53js.c b/arch/arm/mach-mx5/mx53_ccwmx53js.c
index 86fef8580197..29f1468a1ea1 100644
--- a/arch/arm/mach-mx5/mx53_ccwmx53js.c
+++ b/arch/arm/mach-mx5/mx53_ccwmx53js.c
@@ -104,7 +104,20 @@ extern int ccxmx53_pm_da9053_mask_irqs(void);
 extern int ccxmx53_pm_da9053_unmask_irqs(void);
 
 static iomux_v3_cfg_t mx53_ccwmx53js_pads[] = {
-    /* I2C3, connected to the DA9053 and MMA7455  */
+    /* I2C1, unconnected in JSK, conflicts with Camera1 and Camera2 */
+    /* Alternative pins conflict with SMSC */
+#if !defined (CONFIG_MXC_CAMERA_MICRON111_1) && \
+    !defined(CONFIG_MXC_CAMERA_MICRON111_1_MODULE)
+    MX53_PAD_CSI0_DAT9__I2C1_SCL,
+#endif
+#if !defined (CONFIG_MXC_CAMERA_MICRON111_2) &&    \
+    !defined(CONFIG_MXC_CAMERA_MICRON111_2_MODULE)
+    MX53_PAD_CSI0_DAT8__I2C1_SDA,
+#endif
+    /* I2C2, unconnected in JSK */
+    MX53_PAD_KEY_COL3__I2C2_SCL,
+    MX53_PAD_KEY_ROW3__I2C2_SDA,
+    /* I2C3, connected to the DA9053, MMA7455, SGTL5000 */
     MX53_PAD_GPIO_5__I2C3_SCL,
     MX53_PAD_GPIO_6__I2C3_SDA,
 };
 
diff --git a/arch/arm/mach-mx5/mx53_ccwmx53js.c b/arch/arm/mach-mx5/mx53_ccwmx53js.c
index 29f1468a1ea1..83d354ecd7c5 100644
--- a/arch/arm/mach-mx5/mx53_ccwmx53js.c
+++ b/arch/arm/mach-mx5/mx53_ccwmx53js.c
@@ -104,6 +104,7 @@ extern int ccxmx53_pm_da9053_mask_irqs(void);
 extern int ccxmx53_pm_da9053_unmask_irqs(void);
 
 static iomux_v3_cfg_t mx53_ccwmx53js_pads[] = {
+#if defined(CONFIG_I2C_MX_SELECT1) || defined(CONFIG_I2C_MX_SELECT1_MODULE)
     /* I2C1, unconnected in JSK, conflicts with Camera1 and Camera2 */
     /* Alternative pins conflict with SMSC */
 #if !defined (CONFIG_MXC_CAMERA_MICRON111_1) && \
@@ -114,12 +115,17 @@ static iomux_v3_cfg_t mx53_ccwmx53js_pads[] = {
     !defined(CONFIG_MXC_CAMERA_MICRON111_2_MODULE)
     MX53_PAD_CSI0_DAT8__I2C1_SDA,
 #endif
+#endif
+#if defined(CONFIG_I2C_MX_SELECT2) || defined(CONFIG_I2C_MX_SELECT2_MODULE)
     /* I2C2, unconnected in JSK */
     MX53_PAD_KEY_COL3__I2C2_SCL,
     MX53_PAD_KEY_ROW3__I2C2_SDA,
+#endif
+#if defined(CONFIG_I2C_MX_SELECT3) || defined(CONFIG_I2C_MX_SELECT3_MODULE)
     /* I2C3, connected to the DA9053, MMA7455, SGTL5000 */
     MX53_PAD_GPIO_5__I2C3_SCL,
     MX53_PAD_GPIO_6__I2C3_SDA,
+#endif
 };
 
static iomux_v3_cfg_t ccwmx53js_keys_leds_pads[] = {
 
    mxc_register_device(&mxc_dma_device, NULL);
    mxc_register_device(&mxc_wdt_device, NULL);
 
#if defined(CONFIG_I2C_MX_SELECT1) || defined(CONFIG_I2C_MX_SELECT1_MODULE)
    mxc_register_device(&mxci2c_devices[0], &mxci2c1_data);
#endif
#if defined(CONFIG_I2C_MX_SELECT2) || defined(CONFIG_I2C_MX_SELECT2_MODULE)
    mxc_register_device(&mxci2c_devices[1], &mxci2c2_data);
#endif
#if defined(CONFIG_I2C_MX_SELECT3) || defined(CONFIG_I2C_MX_SELECT3_MODULE)
    mxc_register_device(&mxci2c_devices[2], &mxci2c3_data);
#endif
 
    mx53_ccwmx53js_init_da9052();
Last updated: Jan 01, 2024

Recently Viewed

No recently viewed articles

Did you find this article helpful?