5ec631f7fd046e3b1404ca053f81d7ecc6a422e6
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0654-overlays-Add-baudrate-parameter-to-i2c3-i2c6.patch
1 From 114845b6010b6e6a320804f2d86ab4d5dc5a06de Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 5 Aug 2019 14:17:14 +0100
4 Subject: [PATCH] overlays: Add baudrate parameter to i2c3-i2c6
5
6 The overlays for enabling the new BCM2711 I2C interfaces were lacking
7 the means to configure the baud/clock rate.
8
9 Also explictly set the default pins, rather than relying on the values
10 in the base DTB.
11
12 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
13 ---
14  arch/arm/boot/dts/overlays/README           |  8 ++++++++
15  arch/arm/boot/dts/overlays/i2c3-overlay.dts | 15 ++++++++++++---
16  arch/arm/boot/dts/overlays/i2c4-overlay.dts | 15 ++++++++++++---
17  arch/arm/boot/dts/overlays/i2c5-overlay.dts | 15 ++++++++++++---
18  arch/arm/boot/dts/overlays/i2c6-overlay.dts | 15 ++++++++++++---
19  5 files changed, 56 insertions(+), 12 deletions(-)
20
21 --- a/arch/arm/boot/dts/overlays/README
22 +++ b/arch/arm/boot/dts/overlays/README
23 @@ -1221,6 +1221,8 @@ Info:   Enable the i2c3 bus
24  Load:   dtoverlay=i2c3,<param>
25  Params: pins_2_3                Use GPIOs 2 and 3
26          pins_4_5                Use GPIOs 4 and 5 (default)
27 +        baudrate                Set the baudrate for the interface (default
28 +                                "100000")
29  
30  
31  Name:   i2c4
32 @@ -1228,6 +1230,8 @@ Info:   Enable the i2c4 bus
33  Load:   dtoverlay=i2c4,<param>
34  Params: pins_6_7                Use GPIOs 6 and 7
35          pins_8_9                Use GPIOs 8 and 9 (default)
36 +        baudrate                Set the baudrate for the interface (default
37 +                                "100000")
38  
39  
40  Name:   i2c5
41 @@ -1235,6 +1239,8 @@ Info:   Enable the i2c5 bus
42  Load:   dtoverlay=i2c5,<param>
43  Params: pins_10_11              Use GPIOs 10 and 11
44          pins_12_13              Use GPIOs 12 and 13 (default)
45 +        baudrate                Set the baudrate for the interface (default
46 +                                "100000")
47  
48  
49  Name:   i2c6
50 @@ -1242,6 +1248,8 @@ Info:   Enable the i2c6 bus
51  Load:   dtoverlay=i2c6,<param>
52  Params: pins_0_1                Use GPIOs 0 and 1
53          pins_22_23              Use GPIOs 22 and 23 (default)
54 +        baudrate                Set the baudrate for the interface (default
55 +                                "100000")
56  
57  
58  Name:   i2s-gpio28-31
59 --- a/arch/arm/boot/dts/overlays/i2c3-overlay.dts
60 +++ b/arch/arm/boot/dts/overlays/i2c3-overlay.dts
61 @@ -6,10 +6,11 @@
62  
63         fragment@0 {
64                 target = <&i2c3>;
65 -               __overlay__ {
66 +               frag0: __overlay__ {
67                         status = "okay";
68                         pinctrl-names = "default";
69                         pinctrl-0 = <&i2c3_pins>;
70 +                       clock-frequency = <100000>;
71                 };
72         };
73  
74 @@ -20,8 +21,16 @@
75                 };
76         };
77  
78 +       fragment@2 {
79 +               target = <&i2c3_pins>;
80 +               __overlay__ {
81 +                       brcm,pins = <4 5>;
82 +               };
83 +       };
84 +
85         __overrides__ {
86 -               pins_2_3 = <0>,"=1";
87 -               pins_4_5 = <0>,"!1";
88 +               pins_2_3 = <0>,"=1!2";
89 +               pins_4_5 = <0>,"!1=2";
90 +               baudrate = <&frag0>, "clock-frequency:0";
91         };
92  };
93 --- a/arch/arm/boot/dts/overlays/i2c4-overlay.dts
94 +++ b/arch/arm/boot/dts/overlays/i2c4-overlay.dts
95 @@ -6,10 +6,11 @@
96  
97         fragment@0 {
98                 target = <&i2c4>;
99 -               __overlay__ {
100 +               frag0: __overlay__ {
101                         status = "okay";
102                         pinctrl-names = "default";
103                         pinctrl-0 = <&i2c4_pins>;
104 +                       clock-frequency = <100000>;
105                 };
106         };
107  
108 @@ -20,8 +21,16 @@
109                 };
110         };
111  
112 +       fragment@2 {
113 +               target = <&i2c4_pins>;
114 +               __overlay__ {
115 +                       brcm,pins = <8 9>;
116 +               };
117 +       };
118 +
119         __overrides__ {
120 -               pins_6_7 = <0>,"=1";
121 -               pins_8_9 = <0>,"!1";
122 +               pins_6_7 = <0>,"=1!2";
123 +               pins_8_9 = <0>,"!1=2";
124 +               baudrate = <&frag0>, "clock-frequency:0";
125         };
126  };
127 --- a/arch/arm/boot/dts/overlays/i2c5-overlay.dts
128 +++ b/arch/arm/boot/dts/overlays/i2c5-overlay.dts
129 @@ -6,10 +6,11 @@
130  
131         fragment@0 {
132                 target = <&i2c5>;
133 -               __overlay__ {
134 +               frag0: __overlay__ {
135                         status = "okay";
136                         pinctrl-names = "default";
137                         pinctrl-0 = <&i2c5_pins>;
138 +                       clock-frequency = <100000>;
139                 };
140         };
141  
142 @@ -20,8 +21,16 @@
143                 };
144         };
145  
146 +       fragment@2 {
147 +               target = <&i2c5_pins>;
148 +               __overlay__ {
149 +                       brcm,pins = <12 13>;
150 +               };
151 +       };
152 +
153         __overrides__ {
154 -               pins_10_11 = <0>,"=1";
155 -               pins_12_13 = <0>,"!1";
156 +               pins_10_11 = <0>,"=1!2";
157 +               pins_12_13 = <0>,"!1=2";
158 +               baudrate = <&frag0>, "clock-frequency:0";
159         };
160  };
161 --- a/arch/arm/boot/dts/overlays/i2c6-overlay.dts
162 +++ b/arch/arm/boot/dts/overlays/i2c6-overlay.dts
163 @@ -6,10 +6,11 @@
164  
165         fragment@0 {
166                 target = <&i2c6>;
167 -               __overlay__ {
168 +               frag0: __overlay__ {
169                         status = "okay";
170                         pinctrl-names = "default";
171                         pinctrl-0 = <&i2c6_pins>;
172 +                       clock-frequency = <100000>;
173                 };
174         };
175  
176 @@ -20,8 +21,16 @@
177                 };
178         };
179  
180 +       fragment@2 {
181 +               target = <&i2c6_pins>;
182 +               __overlay__ {
183 +                       brcm,pins = <22 23>;
184 +               };
185 +       };
186 +
187         __overrides__ {
188 -               pins_0_1 = <0>,"=1";
189 -               pins_22_23 = <0>,"!1";
190 +               pins_0_1 = <0>,"=1!2";
191 +               pins_22_23 = <0>,"!1=2";
192 +               baudrate = <&frag0>, "clock-frequency:0";
193         };
194  };