]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: ventana: remove setup of I2C3 from SPL
authorTim Harvey <tharvey@gateworks.com>
Mon, 4 Feb 2019 21:10:49 +0000 (13:10 -0800)
committerStefano Babic <sbabic@denx.de>
Fri, 15 Feb 2019 21:01:15 +0000 (22:01 +0100)
Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
board/gateworks/gw_ventana/common.c
board/gateworks/gw_ventana/common.h
board/gateworks/gw_ventana/gw_ventana.c
board/gateworks/gw_ventana/gw_ventana_spl.c

index f577bdbdfb1144226d7b0d0960859ee37066fc8a..676a1a8f426adf1f6907364f83e465d92ea6218c 100644 (file)
@@ -78,95 +78,96 @@ static iomux_v3_cfg_t const usdhc3_pads[] = {
        IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00  | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
 };
 
-/* I2C1: GSC */
-static struct i2c_pads_info mx6q_i2c_pad_info0 = {
-       .scl = {
-               .i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC,
-               .gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | PC,
-               .gp = IMX_GPIO_NR(3, 21)
-       },
-       .sda = {
-               .i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC,
-               .gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | PC,
-               .gp = IMX_GPIO_NR(3, 28)
-       }
-};
-static struct i2c_pads_info mx6dl_i2c_pad_info0 = {
-       .scl = {
-               .i2c_mode = MX6DL_PAD_EIM_D21__I2C1_SCL | PC,
-               .gpio_mode = MX6DL_PAD_EIM_D21__GPIO3_IO21 | PC,
-               .gp = IMX_GPIO_NR(3, 21)
-       },
-       .sda = {
-               .i2c_mode = MX6DL_PAD_EIM_D28__I2C1_SDA | PC,
-               .gpio_mode = MX6DL_PAD_EIM_D28__GPIO3_IO28 | PC,
-               .gp = IMX_GPIO_NR(3, 28)
-       }
-};
-
-/* I2C2: PMIC/PCIe Switch/PCIe Clock/Mezz */
-static struct i2c_pads_info mx6q_i2c_pad_info1 = {
-       .scl = {
-               .i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC,
-               .gpio_mode = MX6Q_PAD_KEY_COL3__GPIO4_IO12 | PC,
-               .gp = IMX_GPIO_NR(4, 12)
-       },
-       .sda = {
-               .i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC,
-               .gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO4_IO13 | PC,
-               .gp = IMX_GPIO_NR(4, 13)
-       }
-};
-static struct i2c_pads_info mx6dl_i2c_pad_info1 = {
-       .scl = {
-               .i2c_mode = MX6DL_PAD_KEY_COL3__I2C2_SCL | PC,
-               .gpio_mode = MX6DL_PAD_KEY_COL3__GPIO4_IO12 | PC,
-               .gp = IMX_GPIO_NR(4, 12)
-       },
-       .sda = {
-               .i2c_mode = MX6DL_PAD_KEY_ROW3__I2C2_SDA | PC,
-               .gpio_mode = MX6DL_PAD_KEY_ROW3__GPIO4_IO13 | PC,
-               .gp = IMX_GPIO_NR(4, 13)
+/*
+ * I2C pad configs:
+ * I2C1: GSC
+ * I2C2: PMIC,PCIe Switch,Clock,Mezz
+ * I2C3: Multimedia/Expansion
+ */
+static struct i2c_pads_info mx6q_i2c_pad_info[] = {
+       {
+               .scl = {
+                       .i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC,
+                       .gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | PC,
+                       .gp = IMX_GPIO_NR(3, 21)
+               },
+               .sda = {
+                       .i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC,
+                       .gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | PC,
+                       .gp = IMX_GPIO_NR(3, 28)
+               }
+       }, {
+               .scl = {
+                       .i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC,
+                       .gpio_mode = MX6Q_PAD_KEY_COL3__GPIO4_IO12 | PC,
+                       .gp = IMX_GPIO_NR(4, 12)
+               },
+               .sda = {
+                       .i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC,
+                       .gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO4_IO13 | PC,
+                       .gp = IMX_GPIO_NR(4, 13)
+               }
+       }, {
+               .scl = {
+                       .i2c_mode = MX6Q_PAD_GPIO_3__I2C3_SCL | PC,
+                       .gpio_mode = MX6Q_PAD_GPIO_3__GPIO1_IO03 | PC,
+                       .gp = IMX_GPIO_NR(1, 3)
+               },
+               .sda = {
+                       .i2c_mode = MX6Q_PAD_GPIO_6__I2C3_SDA | PC,
+                       .gpio_mode = MX6Q_PAD_GPIO_6__GPIO1_IO06 | PC,
+                       .gp = IMX_GPIO_NR(1, 6)
+               }
        }
 };
 
-/* I2C3: Misc/Expansion */
-static struct i2c_pads_info mx6q_i2c_pad_info2 = {
-       .scl = {
-               .i2c_mode = MX6Q_PAD_GPIO_3__I2C3_SCL | PC,
-               .gpio_mode = MX6Q_PAD_GPIO_3__GPIO1_IO03 | PC,
-               .gp = IMX_GPIO_NR(1, 3)
-       },
-       .sda = {
-               .i2c_mode = MX6Q_PAD_GPIO_6__I2C3_SDA | PC,
-               .gpio_mode = MX6Q_PAD_GPIO_6__GPIO1_IO06 | PC,
-               .gp = IMX_GPIO_NR(1, 6)
-       }
-};
-static struct i2c_pads_info mx6dl_i2c_pad_info2 = {
-       .scl = {
-               .i2c_mode = MX6DL_PAD_GPIO_3__I2C3_SCL | PC,
-               .gpio_mode = MX6DL_PAD_GPIO_3__GPIO1_IO03 | PC,
-               .gp = IMX_GPIO_NR(1, 3)
-       },
-       .sda = {
-               .i2c_mode = MX6DL_PAD_GPIO_6__I2C3_SDA | PC,
-               .gpio_mode = MX6DL_PAD_GPIO_6__GPIO1_IO06 | PC,
-               .gp = IMX_GPIO_NR(1, 6)
+static struct i2c_pads_info mx6dl_i2c_pad_info[] = {
+       {
+               .scl = {
+                       .i2c_mode = MX6DL_PAD_EIM_D21__I2C1_SCL | PC,
+                       .gpio_mode = MX6DL_PAD_EIM_D21__GPIO3_IO21 | PC,
+                       .gp = IMX_GPIO_NR(3, 21)
+               },
+               .sda = {
+                       .i2c_mode = MX6DL_PAD_EIM_D28__I2C1_SDA | PC,
+                       .gpio_mode = MX6DL_PAD_EIM_D28__GPIO3_IO28 | PC,
+                       .gp = IMX_GPIO_NR(3, 28)
+               }
+       }, {
+               .scl = {
+                       .i2c_mode = MX6DL_PAD_KEY_COL3__I2C2_SCL | PC,
+                       .gpio_mode = MX6DL_PAD_KEY_COL3__GPIO4_IO12 | PC,
+                       .gp = IMX_GPIO_NR(4, 12)
+               },
+               .sda = {
+                       .i2c_mode = MX6DL_PAD_KEY_ROW3__I2C2_SDA | PC,
+                       .gpio_mode = MX6DL_PAD_KEY_ROW3__GPIO4_IO13 | PC,
+                       .gp = IMX_GPIO_NR(4, 13)
+               }
+       }, {
+               .scl = {
+                       .i2c_mode = MX6DL_PAD_GPIO_3__I2C3_SCL | PC,
+                       .gpio_mode = MX6DL_PAD_GPIO_3__GPIO1_IO03 | PC,
+                       .gp = IMX_GPIO_NR(1, 3)
+               },
+               .sda = {
+                       .i2c_mode = MX6DL_PAD_GPIO_6__I2C3_SDA | PC,
+                       .gpio_mode = MX6DL_PAD_GPIO_6__GPIO1_IO06 | PC,
+                       .gp = IMX_GPIO_NR(1, 6)
+               }
        }
 };
 
-void setup_ventana_i2c(void)
+void setup_ventana_i2c(int i2c)
 {
-       if (is_cpu_type(MXC_CPU_MX6Q)) {
-               setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info0);
-               setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info1);
-               setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info2);
-       } else {
-               setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info0);
-               setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info1);
-               setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info2);
-       }
+       struct i2c_pads_info *p;
+
+       if (is_cpu_type(MXC_CPU_MX6Q))
+               p = &mx6q_i2c_pad_info[i2c];
+       else
+               p = &mx6dl_i2c_pad_info[i2c];
+
+       setup_i2c(i2c, CONFIG_SYS_I2C_SPEED, 0x7f, p);
 }
 
 /*
index 8019e27f6e04224a54fe775e0d2dea9ad830610c..027e972280296d33dc2c7ca36a29df81c2b9726a 100644 (file)
@@ -85,7 +85,7 @@ struct ventana {
 extern struct ventana gpio_cfg[GW_UNKNOWN];
 
 /* configure i2c iomux */
-void setup_ventana_i2c(void);
+void setup_ventana_i2c(int);
 /* configure uart iomux */
 void setup_iomux_uart(void);
 /* conifgure PMIC */
index 27a3911acdae3f5d4379961c8ccfbd37b92cf72f..c0b0cc9bb9b5c53d3345a3678143c269d988dd9a 100644 (file)
@@ -631,7 +631,9 @@ int board_init(void)
 #ifdef CONFIG_MXC_SPI
        setup_spi();
 #endif
-       setup_ventana_i2c();
+       setup_ventana_i2c(0);
+       setup_ventana_i2c(1);
+       setup_ventana_i2c(2);
 
 #ifdef CONFIG_SATA
        setup_sata();
index a6ac546e9599cc03d8aac142a76bdb98cb8a210c..80ade9f4376adc64b3a981fcbc83bda63325608b 100644 (file)
@@ -599,9 +599,10 @@ void board_init_f(ulong dummy)
        /* setup AXI */
        gpr_init();
 
-       /* iomux and setup of i2c */
+       /* iomux and setup of uart/i2c */
        setup_iomux_uart();
-       setup_ventana_i2c();
+       setup_ventana_i2c(0);
+       setup_ventana_i2c(1);
 
        /* setup GP timer */
        timer_init();