ath79: add support for COMFAST CF-E130N v2
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-4.19 / 950-0614-overlays-Add-i2c0-and-i2c1-for-regularity.patch
1 From 9c0f4b3e3b197d5c81f4bd6679f2c2456ab45c9e Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 17 Jul 2019 10:08:55 +0100
4 Subject: [PATCH] overlays: Add i2c0 and i2c1 for regularity
5
6 The new i2c overlays for pi4 (i2c3, i2c4, i2c5, i2c6) have a
7 standardised interface that allows pin groups to be chosen
8 atomically rather than as individual pins. Add i2c0 and i2c1
9 overlays to fit the naming scheme and parameter usage, deprecating
10 i2c0-bcm2708 and i2c1-bcm2708.
11
12 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
13 ---
14 arch/arm/boot/dts/overlays/Makefile | 2 +
15 arch/arm/boot/dts/overlays/README | 33 +++++---
16 .../dts/overlays/i2c0-bcm2708-overlay.dts | 77 +++----------------
17 arch/arm/boot/dts/overlays/i2c0-overlay.dts | 61 +++++++++++++++
18 .../dts/overlays/i2c1-bcm2708-overlay.dts | 46 ++---------
19 arch/arm/boot/dts/overlays/i2c1-overlay.dts | 44 +++++++++++
20 6 files changed, 147 insertions(+), 116 deletions(-)
21 create mode 100644 arch/arm/boot/dts/overlays/i2c0-overlay.dts
22 create mode 100644 arch/arm/boot/dts/overlays/i2c1-overlay.dts
23
24 --- a/arch/arm/boot/dts/overlays/Makefile
25 +++ b/arch/arm/boot/dts/overlays/Makefile
26 @@ -66,7 +66,9 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
27 i2c-rtc.dtbo \
28 i2c-rtc-gpio.dtbo \
29 i2c-sensor.dtbo \
30 + i2c0.dtbo \
31 i2c0-bcm2708.dtbo \
32 + i2c1.dtbo \
33 i2c1-bcm2708.dtbo \
34 i2c3.dtbo \
35 i2c4.dtbo \
36 --- a/arch/arm/boot/dts/overlays/README
37 +++ b/arch/arm/boot/dts/overlays/README
38 @@ -1151,14 +1151,12 @@ Params: addr Set the
39 sensor
40
41
42 -Name: i2c0-bcm2708
43 +Name: i2c0
44 Info: Change i2c0 pin usage. Not all pin combinations are usable on all
45 platforms - platforms other then Compute Modules can only use this
46 to disable transaction combining.
47 -Load: dtoverlay=i2c0-bcm2708,<param>=<val>
48 -Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
49 - scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
50 - pins_0_1 Use pins 0 and 1 (default)
51 +Load: dtoverlay=i2c0,<param>=<val>
52 +Params: pins_0_1 Use pins 0 and 1 (default)
53 pins_28_29 Use pins 28 and 29
54 pins_44_45 Use pins 44 and 45
55 pins_46_47 Use pins 46 and 47
56 @@ -1166,18 +1164,33 @@ Params: sda0_pin GPIO pin
57 "yes")
58
59
60 -Name: i2c1-bcm2708
61 +Name: i2c0-bcm2708
62 +Info: Deprecated, legacy version of i2c0, from which it inherits its
63 + parameters, just adding the explicit individual pin specifiers.
64 +Load: <Deprecated>
65 +Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*)
66 + scl0_pin GPIO pin for SCL0 (deprecated - use pins_*)
67 +
68 +
69 +Name: i2c1
70 Info: Change i2c1 pin usage. Not all pin combinations are usable on all
71 platforms - platforms other then Compute Modules can only use this
72 to disable transaction combining.
73 -Info: Enable the i2c_bcm2708 driver for the i2c1 bus
74 -Load: dtoverlay=i2c1-bcm2708,<param>=<val>
75 +Load: dtoverlay=i2c1,<param>=<val>
76 +Params: pins_2_3 Use pins 2 and 3 (default)
77 + pins_44_45 Use pins 44 and 45
78 + combine Allow transactions to be combined (default
79 + "yes")
80 +
81 +
82 +Name: i2c1-bcm2708
83 +Info: Deprecated, legacy version of i2c1, from which it inherits its
84 + parameters, just adding the explicit individual pin specifiers.
85 +Load: <Deprecated>
86 Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2)
87 scl1_pin GPIO pin for SCL1 (3 or 45 - default 3)
88 pin_func Alternative pin function (4 (alt0), 6 (alt2) -
89 default 4)
90 - combine Allow transactions to be combined (default
91 - "yes")
92
93
94 Name: i2c3
95 --- a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts
96 +++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts
97 @@ -1,69 +1,14 @@
98 -/*
99 - * Device tree overlay for i2c_bcm2708, i2c0 bus
100 - *
101 - * Compile:
102 - * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts
103 - */
104 -
105 -/dts-v1/;
106 -/plugin/;
107 +#include "i2c0-overlay.dts"
108
109 /{
110 - compatible = "brcm,bcm2835";
111 -
112 - fragment@0 {
113 - target = <&i2c0>;
114 - __overlay__ {
115 - status = "okay";
116 - };
117 - };
118 -
119 - fragment@1 {
120 - target = <&i2c0_pins>;
121 - frag1: __overlay__ {
122 - brcm,pins = <0 1>;
123 - brcm,function = <4>; /* alt0 */
124 - };
125 - };
126 -
127 - fragment@2 {
128 - target = <&i2c0_pins>;
129 - __dormant__ {
130 - brcm,pins = <28 29>;
131 - brcm,function = <4>; /* alt0 */
132 - };
133 - };
134 -
135 - fragment@3 {
136 - target = <&i2c0_pins>;
137 - __dormant__ {
138 - brcm,pins = <44 45>;
139 - brcm,function = <5>; /* alt1 */
140 - };
141 - };
142 -
143 - fragment@4 {
144 - target = <&i2c0_pins>;
145 - __dormant__ {
146 - brcm,pins = <46 47>;
147 - brcm,function = <4>; /* alt0 */
148 - };
149 - };
150 -
151 - fragment@5 {
152 - target = <&i2c0>;
153 - __dormant__ {
154 - compatible = "brcm,bcm2708-i2c";
155 - };
156 - };
157 -
158 - __overrides__ {
159 - sda0_pin = <&frag1>,"brcm,pins:0";
160 - scl0_pin = <&frag1>,"brcm,pins:4";
161 - pins_0_1 = <0>,"+1-2-3-4";
162 - pins_28_29 = <0>,"-1+2-3-4";
163 - pins_44_45 = <0>,"-1-2+3-4";
164 - pins_46_47 = <0>,"-1-2-3+4";
165 - combine = <0>, "!5";
166 - };
167 + __overrides__ {
168 + sda0_pin = <&pins1>,"brcm,pins:0",
169 + <&pins2>,"brcm,pins:0",
170 + <&pins3>,"brcm,pins:0",
171 + <&pins4>,"brcm,pins:0";
172 + scl0_pin = <&pins1>,"brcm,pins:4",
173 + <&pins2>,"brcm,pins:4",
174 + <&pins3>,"brcm,pins:4",
175 + <&pins4>,"brcm,pins:4";
176 + };
177 };
178 --- /dev/null
179 +++ b/arch/arm/boot/dts/overlays/i2c0-overlay.dts
180 @@ -0,0 +1,61 @@
181 +/dts-v1/;
182 +/plugin/;
183 +
184 +/{
185 + compatible = "brcm,bcm2835";
186 +
187 + fragment@0 {
188 + target = <&i2c0>;
189 + __overlay__ {
190 + status = "okay";
191 + pinctrl-0 = <&i2c0_pins>;
192 + };
193 + };
194 +
195 + fragment@1 {
196 + target = <&i2c0_pins>;
197 + pins1: __overlay__ {
198 + brcm,pins = <0 1>;
199 + brcm,function = <4>; /* alt0 */
200 + };
201 + };
202 +
203 + fragment@2 {
204 + target = <&i2c0_pins>;
205 + pins2: __dormant__ {
206 + brcm,pins = <28 29>;
207 + brcm,function = <4>; /* alt0 */
208 + };
209 + };
210 +
211 + fragment@3 {
212 + target = <&i2c0_pins>;
213 + pins3: __dormant__ {
214 + brcm,pins = <44 45>;
215 + brcm,function = <5>; /* alt1 */
216 + };
217 + };
218 +
219 + fragment@4 {
220 + target = <&i2c0_pins>;
221 + pins4: __dormant__ {
222 + brcm,pins = <46 47>;
223 + brcm,function = <4>; /* alt0 */
224 + };
225 + };
226 +
227 + fragment@5 {
228 + target = <&i2c0>;
229 + __dormant__ {
230 + compatible = "brcm,bcm2708-i2c";
231 + };
232 + };
233 +
234 + __overrides__ {
235 + pins_0_1 = <0>,"+1-2-3-4";
236 + pins_28_29 = <0>,"-1+2-3-4";
237 + pins_44_45 = <0>,"-1-2+3-4";
238 + pins_46_47 = <0>,"-1-2-3+4";
239 + combine = <0>, "!5";
240 + };
241 +};
242 --- a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts
243 +++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts
244 @@ -1,43 +1,9 @@
245 -/*
246 - * Device tree overlay for i2c_bcm2708, i2c1 bus
247 - *
248 - * Compile:
249 - * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts
250 - */
251 -
252 -/dts-v1/;
253 -/plugin/;
254 +#include "i2c1-overlay.dts"
255
256 /{
257 - compatible = "brcm,bcm2835";
258 -
259 - fragment@0 {
260 - target = <&i2c1>;
261 - __overlay__ {
262 - pinctrl-0 = <&i2c1_pins>;
263 - status = "okay";
264 - };
265 - };
266 -
267 - fragment@1 {
268 - target = <&i2c1_pins>;
269 - pins: __overlay__ {
270 - brcm,pins = <2 3>;
271 - brcm,function = <4>; /* alt 0 */
272 - };
273 - };
274 -
275 - fragment@2 {
276 - target = <&i2c1>;
277 - __dormant__ {
278 - compatible = "brcm,bcm2708-i2c";
279 - };
280 - };
281 -
282 - __overrides__ {
283 - sda1_pin = <&pins>,"brcm,pins:0";
284 - scl1_pin = <&pins>,"brcm,pins:4";
285 - pin_func = <&pins>,"brcm,function:0";
286 - combine = <0>, "!2";
287 - };
288 + __overrides__ {
289 + sda1_pin = <&pins1>,"brcm,pins:0", <&pins2>,"brcm,pins:0";
290 + scl1_pin = <&pins1>,"brcm,pins:4", <&pins1>,"brcm,pins:4";
291 + pin_func = <&pins1>,"brcm,function:0", <&pins2>,"brcm,function:0";
292 + };
293 };
294 --- /dev/null
295 +++ b/arch/arm/boot/dts/overlays/i2c1-overlay.dts
296 @@ -0,0 +1,44 @@
297 +/dts-v1/;
298 +/plugin/;
299 +
300 +/{
301 + compatible = "brcm,bcm2835";
302 +
303 + fragment@0 {
304 + target = <&i2c1>;
305 + __overlay__ {
306 + status = "okay";
307 + pinctrl-names = "default";
308 + pinctrl-0 = <&i2c1_pins>;
309 + };
310 + };
311 +
312 + fragment@1 {
313 + target = <&i2c1_pins>;
314 + pins1: __overlay__ {
315 + brcm,pins = <2 3>;
316 + brcm,function = <4>; /* alt 0 */
317 + };
318 + };
319 +
320 + fragment@2 {
321 + target = <&i2c1_pins>;
322 + pins2: __dormant__ {
323 + brcm,pins = <44 45>;
324 + brcm,function = <6>; /* alt 2 */
325 + };
326 + };
327 +
328 + fragment@3 {
329 + target = <&i2c1>;
330 + __dormant__ {
331 + compatible = "brcm,bcm2708-i2c";
332 + };
333 + };
334 +
335 + __overrides__ {
336 + pins_2_3 = <0>,"=1!2";
337 + pins_44_45 = <0>,"!1=2";
338 + combine = <0>, "!3";
339 + };
340 +};