[openwrt/openwrt] ramips: use i2c-gpio driver for EX400

LEDE Commits lede-commits at lists.infradead.org
Sun May 11 02:56:11 PDT 2025


blocktrron pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/f828be4d10d795e2bd74ea77ea12dec285107974

commit f828be4d10d795e2bd74ea77ea12dec285107974
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Tue May 6 18:23:50 2025 +0200

    ramips: use i2c-gpio driver for EX400
    
    Configure the i2c pins as GPIO outputs and use the i2c-gpio driver to
    control the Semtech SX9512 touch controller.
    
    This fixes spurious errors in i2c transactions even at 1kHz with the
    native i2c driver.
    
    leds green:wan: Setting an LED's brightness failed (-6)
    
    Signed-off-by: David Bauer <mail at david-bauer.net>
---
 .../ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi   | 17 +++++++++++++++--
 target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts  |  4 +---
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi
index a3bc70e8ce..ebcf558359 100644
--- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi
+++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi
@@ -41,6 +41,18 @@
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		};
 	};
+
+	i2c_gpio: i2c-gpio {
+		compatible = "i2c-gpio";
+
+		sda-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
+		scl-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
+
+		i2c-gpio,delay-us = <50>;
+		i2c-gpio,timeout-ms = <100>;
+
+		/* Semtech SX9512 */
+	};
 };
 
 &pcie {
@@ -92,7 +104,8 @@
 };
 
 &i2c {
-	status = "okay";
+	/* Uses i2c-gpio */
+	status = "disabled";
 };
 
 &ethphy0 {
@@ -101,7 +114,7 @@
 
 &state_default {
 	gpio {
-		groups = "uart2", "uart3";
+		groups = "i2c", "uart2", "uart3";
 		function = "gpio";
 	};
 };
diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts
index 61b3e869d7..ad8a22ad79 100644
--- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts
+++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts
@@ -22,9 +22,7 @@
 	};
 };
 
-&i2c {
-	clock-frequency = <1000>;
-
+&i2c_gpio {
 	touch at 2b {
 		compatible = "semtech,sx9512";
 




More information about the lede-commits mailing list