arm64: dts: imx8mp-evk: add support for I2C5
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Fri, 11 Feb 2022 15:38:43 +0000 (10:38 -0500)
committerShawn Guo <shawnguo@kernel.org>
Mon, 21 Feb 2022 03:18:30 +0000 (11:18 +0800)
Add support for i2c5, which is used to access the
external I2C bus on connector J22 of the imx8mp-evk.

Limit the speed to 100kHz since this is an external I2C bus.

Disabled by default, since it is shared with the CAN1 bus.

To enable i2c5, you need to disable the CAN1 function, enable the i2c5
function and also configure the CAN1/I2C5_SEL GPIO to HIGH to
select i2c5 instead of CAN1. This can be done by defining a gpio-hog
inside the pca6416 node, in your board device tree, like in this example:

&flexcan1 {
status = "disabled";
};

&i2c5 {
status = "okay";
};

&pca6416 {
can1-i2c5-sel-hog {
gpio-hog;
gpios = <2 GPIO_ACTIVE_HIGH>;
output-high;
line-name = "can1-i2c5-sel";
};
};

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
arch/arm64/boot/dts/freescale/imx8mp-evk.dts

index a82c31d..4c3ac42 100644 (file)
        };
 };
 
+/* I2C on expansion connector J22. */
+&i2c5 {
+       clock-frequency = <100000>; /* Lower clock speed for external bus. */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c5>;
+       status = "disabled"; /* can1 pins conflict with i2c5 */
+
+       /* GPIO 2 of PCA6416 is used to switch between CAN1 and I2C5 functions:
+        *     LOW:  CAN1 (default, pull-down)
+        *     HIGH: I2C5
+        * You need to set it to high to enable I2C5 (for example, add gpio-hog
+        * in pca6416 node).
+        */
+};
+
 &snvs_pwrkey {
        status = "okay";
 };
                >;
        };
 
+       pinctrl_i2c5: i2c5grp {
+               fsl,pins = <
+                       MX8MP_IOMUXC_SPDIF_RX__I2C5_SDA         0x400001c3
+                       MX8MP_IOMUXC_SPDIF_TX__I2C5_SCL         0x400001c3
+               >;
+       };
+
        pinctrl_pmic: pmicgrp {
                fsl,pins = <
                        MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03     0x000001c0