6118e98cc5aab8ddc3f7f4118ceabe8cce065999
[openwrt/staging/ldir.git] / target / linux / bcm53xx / patches-5.10 / 034-v5.17-0004-ARM-BCM53016-MR32-convert-to-Broadcom-iProc-I2C-Driv.patch
1 From de7880016665afe7fa7d40e1fafa859260d53ba1 Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@gmail.com>
3 Date: Thu, 28 Oct 2021 09:03:44 +0200
4 Subject: [PATCH] ARM: BCM53016: MR32: convert to Broadcom iProc I2C Driver
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 replaces the bit-banged i2c-gpio provided i2c functionality
10 with the hardware in the SoC.
11
12 During review of the MR32, Florian Fainelli pointed out that the
13 SoC has a real I2C-controller. Furthermore, the connected pins
14 (SDA and SCL) would line up perfectly for use. Back then I couldn't
15 get it working though and I left it with i2c-gpio (which worked).
16
17 Now we know the reason: the interrupt was incorrectly specified.
18 (Hence, this patch depends on Florian Fainelli's
19 "ARM: dts: BCM5301X: Fix I2C controller interrupt" patch).
20
21 Cc: Florian Fainelli <f.fainelli@gmail.com>
22 Cc: Rafał Miłecki <zajec5@gmail.com>
23 Cc: Matthew Hagan <mnhagan88@gmail.com>
24 Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
25 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
26 ---
27 arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 62 ++++++++++------------
28 1 file changed, 28 insertions(+), 34 deletions(-)
29
30 --- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
31 +++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts
32 @@ -84,40 +84,6 @@
33 max-brightness = <255>;
34 };
35 };
36 -
37 - i2c {
38 - /*
39 - * The platform provided I2C does not budge.
40 - * This is a replacement until I can figure
41 - * out what are the missing bits...
42 - */
43 -
44 - compatible = "i2c-gpio";
45 - sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
46 - scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
47 - i2c-gpio,delay-us = <10>; /* close to 100 kHz */
48 - #address-cells = <1>;
49 - #size-cells = <0>;
50 -
51 - current_sense: ina219@45 {
52 - compatible = "ti,ina219";
53 - reg = <0x45>;
54 - shunt-resistor = <60000>; /* = 60 mOhms */
55 - };
56 -
57 - eeprom: eeprom@50 {
58 - compatible = "atmel,24c64";
59 - reg = <0x50>;
60 - pagesize = <32>;
61 - read-only;
62 - #address-cells = <1>;
63 - #size-cells = <1>;
64 -
65 - mac_address: mac-address@66 {
66 - reg = <0x66 0x6>;
67 - };
68 - };
69 - };
70 };
71
72 &uart0 {
73 @@ -250,3 +216,31 @@
74 };
75 };
76 };
77 +
78 +&i2c0 {
79 + status = "okay";
80 +
81 + pinctrl-names = "default";
82 + pinctrl-0 = <&pinmux_i2c>;
83 +
84 + clock-frequency = <100000>;
85 +
86 + current_sense: ina219@45 {
87 + compatible = "ti,ina219";
88 + reg = <0x45>;
89 + shunt-resistor = <60000>; /* = 60 mOhms */
90 + };
91 +
92 + eeprom: eeprom@50 {
93 + compatible = "atmel,24c64";
94 + reg = <0x50>;
95 + pagesize = <32>;
96 + read-only;
97 + #address-cells = <1>;
98 + #size-cells = <1>;
99 +
100 + mac_address: mac-address@66 {
101 + reg = <0x66 0x6>;
102 + };
103 + };
104 +};