diff mbox series

[v3,8/8,RFT,WIP] bcm53xx: MR32: replace i2c-gpio with SoC's i2c

Message ID f6ff0158ce8305f4b6bfcbb004ff05f67588f14e.1599945264.git.chunkeey@gmail.com
State Superseded, archived
Headers show
Series [v3,1/8] scripts: mkits.sh make it possible to specify fdt@# | expand

Commit Message

Christian Lamparter Sept. 12, 2020, 9:15 p.m. UTC
During review of the MR32, Florian Fainelli pointed out that the
SoC has a real I2C-controller. Furthermore, the connected pins
(SDA and SCL) would line up perfectly for use. This patch swaps
out the the bitbanged i2c-gpio with the real deal. It can be
applied once it works.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
 target/linux/bcm53xx/image/Makefile           |  2 +-
 .../332-Meraki-MR32-use-hw-i2c.patch          | 73 +++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
diff mbox series

Patch

diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 613f2d533d..74d92a0579 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -323,7 +323,7 @@  TARGET_DEVICES += luxul_xwr-3150
 define Device/meraki_mr32
   DEVICE_VENODR := Meraki
   DEVICE_MODEL := MR32
-  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-i2c-gpio kmod-eeprom-at24 \
+  DEVICE_PACKAGES := $(B43) kmod-i2c-bcm-iproc kmod-eeprom-at24 \
 	kmod-leds-pwm kmod-hwmon-core kmod-hwmon-ina2xx kmod-bluetooth
   DEVICE_DTS := bcm53016-meraki-mr32
 # Meraki FW r23 tries to resize the part.safe partition before it will
diff --git a/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
new file mode 100644
index 0000000000..f61b9fdcdc
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.4/332-Meraki-MR32-use-hw-i2c.patch
@@ -0,0 +1,73 @@ 
+From: Christian Lamparter <chunkeey@gmail.com>
+Date: Sat, 12 Sep 2020 22:11:12 +0200
+Subject: bcm53xx: Meraki MR32 use hw i2c
+
+replace the i2c-gpio provided i2c functionality with the
+hardware in the SoC. This can be activated once the
+internal i2c works as well as the bit-banged i2c-gpio.
+
+Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
+
+--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
+@@ -85,34 +85,6 @@
+ 			max-brightness = <255>;
+ 		};
+ 	};
+-
+-	i2c {
+-		/*
+-		 * The platform provided I2C does not budge.
+-		 * This is a replacement until I can figure
+-		 * out what are the missing bits...
+-		 */
+-
+-		compatible = "i2c-gpio";
+-		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
+-		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
+-		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
+-		#address-cells = <1>;
+-		#size-cells = <0>;
+-
+-		current_sense: ina219@45 {
+-			compatible = "ti,ina219";
+-			reg = <0x45>;
+-			shunt-resistor = <60000>; /* = 60 mOhms */
+-		};
+-
+-		eeprom: eeprom@50 {
+-			compatible = "atmel,24c64";
+-			reg = <0x50>;
+-			pagesize = <32>;
+-			read-only;
+-		};
+-	};
+ };
+ 
+ &uart0 {
+@@ -196,3 +168,25 @@
+ 		};
+ 	};
+ };
++
++&i2c0 {
++	status = "okay";
++
++	pinctrl-names = "default";
++	pinctrl-0 = <&pinmux_i2c>;
++
++	clock-frequency = <100000>;
++
++	current_sense: ina219@45 {
++		compatible = "ti,ina219";
++		reg = <0x45>;
++		shunt-resistor = <60000>; /* = 60 mOhms */
++	};
++
++	eeprom: eeprom@50 {
++		compatible = "atmel,24c64";
++		reg = <0x50>;
++		pagesize = <32>;
++		read-only;
++	};
++};