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