This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6412: I2C bus swapping

Part Number: AM6412

I2C bus swapping

We're attempting to swap all the devices on i2c_main0 to i2c_main1 and vice-versa. So when we do a i2cdetect on both buses we expect the devices that are shown on both buses to be swapped as well.

However, at the moment, our device tree changes have no effect. We have the following device tree diff:

diff --git a/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts b/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts
index e300fd0..deb0b61 100644
--- a/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts
+++ b/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts
@@ -250,15 +250,15 @@

main_i2c0_pins_default: main_i2c0_pins_default {
pinctrl-single,pins = <
- AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */
- AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */
+ AM64X_IOPAD(0x0268, PIN_INPUT_PULLUP, 0) /* (C18) I2C1_SCL */
+ AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) I2C1_SDA */
>;
};

main_i2c1_pins_default: main-i2c1-pins-default {
pinctrl-single,pins = <
- AM64X_IOPAD(0x0268, PIN_INPUT_PULLUP, 0) /* (C18) I2C1_SCL */
- AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) I2C1_SDA */
+ AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */
+ AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */
>;
};

@@ -547,14 +547,8 @@
};

&main_i2c0 {
- pinctrl-names = "default";
- pinctrl-0 = <&main_i2c0_pins_default>;
- status = "okay";
-};
-
-&main_i2c1 {
pinctrl-names = "default";
- pinctrl-0 = <&main_i2c1_pins_default>;
+ pinctrl-0 = <&main_i2c0_pins_default>;
/* clock-frequency = <400000>; */

exp1: gpio@22 {
@@ -590,6 +584,12 @@
};
};

+&main_i2c1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&main_i2c1_pins_default>;
+ status = "okay";
+};
+
&main_i2c2 {
pinctrl-names = "default";
pinctrl-0 = <&main_i2c2_pins_default>;
(END)

  • Hi Romir,

    Yout DT change is assigning I2C1_SCL/SDA (C18/B19) to &main_i2c0, and I2C0_SCL/SDA (A18/B18) to &main_i2c1.

    It basically let I2C0 controller uses I2C1 pins while I2C1 controller uses I2C0 pins. I don't think the modification is correct.

    I recommend you make the following changes, it basically moves all devices on I2C0 bus to I2C1, and move all devices on I2C1 to I2C0:

    &main_i2c0 {
        dev0-0 {
        };
        dev0-1 {
        };
    };

    &main_i2c1 {
        dev1-2 {
        };
        dev1-3 {
        };
    };

    ==>

    &main_i2c0 {
        dev1-2 {
        };
        dev1-3 {
        };
    };

    &main_i2c1 {
        dev0-0 {
        };
        dev0-1 {
        };
    };

  • Hey bin, 
    I applied your changes but don't see a difference. 

    root@rscm-m4010:~# i2cdetect -r -y 2
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- -- -- 0c -- -- --
    10: 10 -- -- -- -- 15 -- 17 -- -- -- -- -- -- -- 1f
    20: 20 -- -- -- 24 -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 -- -- -- -- -- -- -- -- -- 5a -- -- -- -- --
    60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    root@rscm-m4010:~# i2cdetect -r -y 3
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --


    Here's the diff:

    diff --git a/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts b/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts
    index e300fd0..7d3235e 100644
    --- a/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts
    +++ b/recipes-kernel/linux/linux-ti-staging/rscm-m4010.dts
    @@ -547,12 +547,6 @@
    };

    &main_i2c0 {
    - pinctrl-names = "default";
    - pinctrl-0 = <&main_i2c0_pins_default>;
    - status = "okay";
    -};
    -
    -&main_i2c1 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_i2c1_pins_default>;
    /* clock-frequency = <400000>; */
    @@ -590,6 +584,12 @@
    };
    };

    +&main_i2c1 {
    + pinctrl-names = "default";
    + pinctrl-0 = <&main_i2c0_pins_default>;
    + status = "okay";
    +};
    +
    &main_i2c2 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_i2c2_pins_default>;

    I wanted to re-iterate over the changes I am expecting. I am expecting any device (that may or not be specified on the device tree beforehand) on the first bus to now be present on the second bus and vice-versa.

  • Hi! The subject owner is currently out of the office, returning mid next week. Please allow a couple of days for a response. Thanks.

  • Hi Romir,

    Sorry for my late response.

    Is this issue resolved now or do you still need support?