]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mvebu: x240: Use i2c-gpio instead of built in controller
authorChris Packham <judge.packham@gmail.com>
Tue, 25 Jul 2023 23:13:09 +0000 (11:13 +1200)
committerStefan Roese <sr@denx.de>
Mon, 31 Jul 2023 11:50:57 +0000 (13:50 +0200)
There is an Errata with the built-in I2C controller where various I2C
hardware errors cause a complete lockup of the CPU (which eventually
results in an watchdog reset).

Put the I2C MPP pins into GPIO mode and use the i2c-gpio driver instead.
This uses a bit-banged implementation of an I2C controller and avoids
triggering the Errata.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/dts/ac5-98dx35xx-atl-x240.dts
configs/x240_defconfig

index 820ec18b435550da1ee938378b6b39e34588b4c4..c19b25925ba2aace211e69b8fcc55eecc3cb4258 100644 (file)
@@ -16,7 +16,7 @@
                gpio0 = &gpio0;
                gpio1 = &gpio1;
                spi0 = &spi0;
-               i2c0 = &i2c0;
+               i2c0 = &i2cgpio;
                usb0 = &usb0;
                pinctrl0 = &pinctrl0;
        };
                        default-state = "on";
                };
        };
+
+       i2cgpio: i2c-gpio-0 {
+                       compatible = "i2c-gpio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       pinctrl-names = "default";
+                       pinctrl-0 =  <&i2c0_gpio>;
+                       scl-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+                       sda-gpios = <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+                       i2c-gpio,delay-us = <2>;
+                       status = "okay";
+                };
 };
 
 &nand {
@@ -70,9 +83,7 @@
        status = "okay";
 };
 
-&i2c0 {
-       status = "okay";
-
+&i2cgpio {
        mux@71 {
                #address-cells = <1>;
                #size-cells = <0>;
         * LED_OE_N              [23]
         * USB_PWR_FLT_N         [24]
         * SFP_INT_N             [25]
-        * I2C0_SCL              [26]
-        * I2C0_SDA              [27]
+        * I2C0_SCL              [26] (GPIO)
+        * I2C0_SDA              [27] (GPIO)
         * USB_EN                [28]
         * MONITOR_INT_N         [29]
         * XM1_MDC               [30]
        /*           0    1    2    3    4    5    6    7    8    9 */
        pin-func = < 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
                     0xff 0xff 1    1    1    1    0xff 0xff 0    0
-                    0    0    0    0    0    0    1    1    0    0
+                    0    0    0    0    0    0    0xff 0xff 0    0
                     1    1    1    1    0    0    0    0    0    0
                     0    0    0    1    1    1    >;
 
                marvell,pins = <0 1 2 3 4 5 6 7 8 9 10 11 16 17>;
                marvell,function = <2>;
        };
+
+       i2c0_gpio: i2c0-gpio-pins {
+               marvell,pins = <26 27>;
+               marvell,function = <0>;
+       };
 };
index a78cb3ce6cbf55353bda282400ae2f2ae8c35306..7d2b8603e6f40eef2663dcfcfd0c056e44d130ed 100644 (file)
@@ -42,6 +42,7 @@ CONFIG_CLK_MVEBU=y
 CONFIG_GPIO_HOG=y
 CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
+CONFIG_DM_I2C_GPIO=y
 CONFIG_SYS_I2C_MVTWSI=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX_PCA954x=y