da6c3b624df57bb6c0f4f5c42465fd11e4494c96
[openwrt/staging/linusw.git] /
1 From 731b26a6ac17f24057c559361c6d0cb7cb79baed Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Thu, 6 Oct 2016 13:15:02 +0200
4 Subject: [PATCH] ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
5
6 The idea is to give useful names to GPIO lines that an implementer
7 will be using from userspace, e.g. for maker type projects. These are
8 user-visible using tools/gpio/lsgpio.c
9
10 v2: Major rewrite by anholt: Flatten each GPIO line to a line in the
11 file for better diffing, prefix all expansion header pins with
12 "P<number>" or "P5HEADER_P<number>" and drop the mostly-unused
13 GPIO_GEN<smallnumber> names in favor of GPIO<socgpionumber>, fix
14 extra '[]' on a couple of lines, fix locations of SD_CARD_DETECT,
15 CAM_GPIO and STATUS_LED, fix HDMI_HPD polarities, rewrite A+ using
16 unreleased schematics.
17
18 v3: More changes by anholt: Drop P<number> / P5HEADER<number>
19 prefixes. I had been skeptical about adding them, and was
20 convinced to drop them by Gottfried (who probably has more
21 experience with GPIOs in educational contexts than the rest of
22 us). Also drop [] brackets for "is pinmuxed", which didn't seem
23 to clarify, and were ambiguous for things like the SPI_*-labeled
24 pins which may or may not actually be pinmuxed to SPI.
25
26 v4: Rename B+'s SDA0/SCL0 to match the other boards, despite the
27 naming on its schematic.
28
29 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
30 Signed-off-by: Eric Anholt <eric@anholt.net>
31 ---
32 arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 65 +++++++++++++++++++++++++++++++
33 arch/arm/boot/dts/bcm2835-rpi-a.dts | 67 ++++++++++++++++++++++++++++++++
34 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 66 +++++++++++++++++++++++++++++++
35 arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 66 +++++++++++++++++++++++++++++++
36 arch/arm/boot/dts/bcm2835-rpi-b.dts | 67 ++++++++++++++++++++++++++++++++
37 5 files changed, 331 insertions(+)
38
39 --- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
40 +++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
41 @@ -22,6 +22,71 @@
42 };
43
44 &gpio {
45 + /*
46 + * This is based on the unreleased schematic for the Model A+.
47 + *
48 + * Legend:
49 + * "NC" = not connected (no rail from the SoC)
50 + * "FOO" = GPIO line named "FOO" on the schematic
51 + * "FOO_N" = GPIO line named "FOO" on schematic, active low
52 + */
53 + gpio-line-names = "SDA0",
54 + "SCL0",
55 + "SDA1",
56 + "SCL1",
57 + "GPIO_GCLK",
58 + "GPIO5",
59 + "GPIO6",
60 + "SPI_CE1_N",
61 + "SPI_CE0_N",
62 + "SPI_MISO",
63 + "SPI_MOSI",
64 + "SPI_SCLK",
65 + "GPIO12",
66 + "GPIO13",
67 + /* Serial port */
68 + "TXD0",
69 + "RXD0",
70 + "GPIO16",
71 + "GPIO17",
72 + "GPIO18",
73 + "GPIO19",
74 + "GPIO20",
75 + "GPIO21",
76 + "GPIO22",
77 + "GPIO23",
78 + "GPIO24",
79 + "GPIO25",
80 + "GPIO26",
81 + "GPIO27",
82 + "SDA0",
83 + "SCL0",
84 + "NC", /* GPIO30 */
85 + "NC", /* GPIO31 */
86 + "NC", /* GPIO32 */
87 + "NC", /* GPIO33 */
88 + "NC", /* GPIO34 */
89 + "PWR_LOW_N", /* GPIO35 */
90 + "NC", /* GPIO36 */
91 + "NC", /* GPIO37 */
92 + "NC", /* GPIO38 */
93 + "NC", /* GPIO39 */
94 + "PWM0_OUT", /* GPIO40 */
95 + "CAM_GPIO0", /* GPIO41 */
96 + "NC", /* GPIO42 */
97 + "NC", /* GPIO43 */
98 + "NC", /* GPIO44 */
99 + "PWM1_OUT", /* GPIO45 */
100 + "HDMI_HPD_N",
101 + "STATUS_LED",
102 + /* Used by SD Card */
103 + "SD_CLK_R",
104 + "SD_CMD_R",
105 + "SD_DATA0_R",
106 + "SD_DATA1_R",
107 + "SD_DATA2_R",
108 + "SD_DATA3_R";
109 +
110 pinctrl-0 = <&gpioout &alt0 &i2s_alt0>;
111
112 /* I2S interface */
113 --- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
114 +++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
115 @@ -15,6 +15,73 @@
116 };
117
118 &gpio {
119 + /*
120 + * Taken from Raspberry-Pi-Rev-1.0-Model-AB-Schematics.pdf
121 + * RPI00021 sheet 02
122 + *
123 + * Legend:
124 + * "NC" = not connected (no rail from the SoC)
125 + * "FOO" = GPIO line named "FOO" on the schematic
126 + * "FOO_N" = GPIO line named "FOO" on schematic, active low
127 + */
128 + gpio-line-names = "SDA0",
129 + "SCL0",
130 + "SDA1",
131 + "SCL1",
132 + "GPIO_GCLK",
133 + "CAM_CLK",
134 + "LAN_RUN",
135 + "SPI_CE1_N",
136 + "SPI_CE0_N",
137 + "SPI_MISO",
138 + "SPI_MOSI",
139 + "SPI_SCLK",
140 + "NC", /* GPIO12 */
141 + "NC", /* GPIO13 */
142 + /* Serial port */
143 + "TXD0",
144 + "RXD0",
145 + "STATUS_LED_N",
146 + "GPIO17",
147 + "GPIO18",
148 + "NC", /* GPIO19 */
149 + "NC", /* GPIO20 */
150 + "GPIO21",
151 + "GPIO22",
152 + "GPIO23",
153 + "GPIO24",
154 + "GPIO25",
155 + "NC", /* GPIO26 */
156 + "CAM_GPIO",
157 + /* Binary number representing build/revision */
158 + "CONFIG0",
159 + "CONFIG1",
160 + "CONFIG2",
161 + "CONFIG3",
162 + "NC", /* GPIO32 */
163 + "NC", /* GPIO33 */
164 + "NC", /* GPIO34 */
165 + "NC", /* GPIO35 */
166 + "NC", /* GPIO36 */
167 + "NC", /* GPIO37 */
168 + "NC", /* GPIO38 */
169 + "NC", /* GPIO39 */
170 + "PWM0_OUT",
171 + "NC", /* GPIO41 */
172 + "NC", /* GPIO42 */
173 + "NC", /* GPIO43 */
174 + "NC", /* GPIO44 */
175 + "PWM1_OUT",
176 + "HDMI_HPD_P",
177 + "SD_CARD_DET",
178 + /* Used by SD Card */
179 + "SD_CLK_R",
180 + "SD_CMD_R",
181 + "SD_DATA0_R",
182 + "SD_DATA1_R",
183 + "SD_DATA2_R",
184 + "SD_DATA3_R";
185 +
186 pinctrl-0 = <&gpioout &alt0 &i2s_alt2>;
187
188 /* I2S interface */
189 --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
190 +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
191 @@ -23,6 +23,72 @@
192 };
193
194 &gpio {
195 + /*
196 + * Taken from Raspberry-Pi-B-Plus-V1.2-Schematics.pdf
197 + * RPI-BPLUS sheet 1
198 + *
199 + * Legend:
200 + * "NC" = not connected (no rail from the SoC)
201 + * "FOO" = GPIO line named "FOO" on the schematic
202 + * "FOO_N" = GPIO line named "FOO" on schematic, active low
203 + */
204 + gpio-line-names = "SDA0",
205 + "SCL0",
206 + "SDA1",
207 + "SCL1",
208 + "GPIO_GCLK",
209 + "GPIO5",
210 + "GPIO6",
211 + "SPI_CE1_N",
212 + "SPI_CE0_N",
213 + "SPI_MISO",
214 + "SPI_MOSI",
215 + "SPI_SCLK",
216 + "GPIO12",
217 + "GPIO13",
218 + /* Serial port */
219 + "TXD0",
220 + "RXD0",
221 + "GPIO16",
222 + "GPIO17",
223 + "GPIO18",
224 + "GPIO19",
225 + "GPIO20",
226 + "GPIO21",
227 + "GPIO22",
228 + "GPIO23",
229 + "GPIO24",
230 + "GPIO25",
231 + "GPIO26",
232 + "GPIO27",
233 + "SDA0",
234 + "SCL0",
235 + "NC", /* GPIO30 */
236 + "LAN_RUN", /* GPIO31 */
237 + "CAM_GPIO1", /* GPIO32 */
238 + "NC", /* GPIO33 */
239 + "NC", /* GPIO34 */
240 + "PWR_LOW_N", /* GPIO35 */
241 + "NC", /* GPIO36 */
242 + "NC", /* GPIO37 */
243 + "NC", /* GPIO38 */
244 + "NC", /* GPIO39 */
245 + "PWM0_OUT", /* GPIO40 */
246 + "CAM_GPIO0", /* GPIO41 */
247 + "NC", /* GPIO42 */
248 + "NC", /* GPIO43 */
249 + "ETHCLK", /* GPIO44 */
250 + "PWM1_OUT", /* GPIO45 */
251 + "HDMI_HPD_N",
252 + "STATUS_LED",
253 + /* Used by SD Card */
254 + "SD_CLK_R",
255 + "SD_CMD_R",
256 + "SD_DATA0_R",
257 + "SD_DATA1_R",
258 + "SD_DATA2_R",
259 + "SD_DATA3_R";
260 +
261 pinctrl-0 = <&gpioout &alt0 &i2s_alt0>;
262
263 /* I2S interface */
264 --- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
265 +++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
266 @@ -16,6 +16,72 @@
267 };
268
269 &gpio {
270 + /*
271 + * Taken from Raspberry-Pi-Rev-2.0-Model-AB-Schematics.pdf
272 + * RPI00022 sheet 02
273 + *
274 + * Legend:
275 + * "NC" = not connected (no rail from the SoC)
276 + * "FOO" = GPIO line named "FOO" on the schematic
277 + * "FOO_N" = GPIO line named "FOO" on schematic, active low
278 + */
279 + gpio-line-names = "SDA0",
280 + "SCL0",
281 + "SDA1",
282 + "SCL1",
283 + "GPIO_GCLK",
284 + "CAM_CLK",
285 + "LAN_RUN",
286 + "SPI_CE1_N",
287 + "SPI_CE0_N",
288 + "SPI_MISO",
289 + "SPI_MOSI",
290 + "SPI_SCLK",
291 + "NC", /* GPIO12 */
292 + "NC", /* GPIO13 */
293 + /* Serial port */
294 + "TXD0",
295 + "RXD0",
296 + "STATUS_LED_N",
297 + "GPIO17",
298 + "GPIO18",
299 + "NC", /* GPIO19 */
300 + "NC", /* GPIO20 */
301 + "CAM_GPIO",
302 + "GPIO22",
303 + "GPIO23",
304 + "GPIO24",
305 + "GPIO25",
306 + "NC", /* GPIO26 */
307 + "GPIO27",
308 + "GPIO28",
309 + "GPIO29",
310 + "GPIO30",
311 + "GPIO31",
312 + "NC", /* GPIO32 */
313 + "NC", /* GPIO33 */
314 + "NC", /* GPIO34 */
315 + "NC", /* GPIO35 */
316 + "NC", /* GPIO36 */
317 + "NC", /* GPIO37 */
318 + "NC", /* GPIO38 */
319 + "NC", /* GPIO39 */
320 + "PWM0_OUT",
321 + "NC", /* GPIO41 */
322 + "NC", /* GPIO42 */
323 + "NC", /* GPIO43 */
324 + "NC", /* GPIO44 */
325 + "PWM1_OUT",
326 + "HDMI_HPD_P",
327 + "SD_CARD_DET",
328 + /* Used by SD Card */
329 + "SD_CLK_R",
330 + "SD_CMD_R",
331 + "SD_DATA0_R",
332 + "SD_DATA1_R",
333 + "SD_DATA2_R",
334 + "SD_DATA3_R";
335 +
336 pinctrl-0 = <&gpioout &alt0 &i2s_alt2>;
337
338 /* I2S interface */
339 --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
340 +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
341 @@ -16,6 +16,73 @@
342 };
343
344 &gpio {
345 + /*
346 + * Taken from Raspberry-Pi-Rev-1.0-Model-AB-Schematics.pdf
347 + * RPI00021 sheet 02
348 + *
349 + * Legend:
350 + * "NC" = not connected (no rail from the SoC)
351 + * "FOO" = GPIO line named "FOO" on the schematic
352 + * "FOO_N" = GPIO line named "FOO" on schematic, active low
353 + */
354 + gpio-line-names = "SDA0",
355 + "SCL0",
356 + "SDA1",
357 + "SCL1",
358 + "GPIO_GCLK",
359 + "CAM_CLK",
360 + "LAN_RUN",
361 + "SPI_CE1_N",
362 + "SPI_CE0_N",
363 + "SPI_MISO",
364 + "SPI_MOSI",
365 + "SPI_SCLK",
366 + "NC", /* GPIO12 */
367 + "NC", /* GPIO13 */
368 + /* Serial port */
369 + "TXD0",
370 + "RXD0",
371 + "STATUS_LED_N",
372 + "GPIO17",
373 + "GPIO18",
374 + "NC", /* GPIO19 */
375 + "NC", /* GPIO20 */
376 + "GPIO21",
377 + "GPIO22",
378 + "GPIO23",
379 + "GPIO24",
380 + "GPIO25",
381 + "NC", /* GPIO26 */
382 + "CAM_GPIO",
383 + /* Binary number representing build/revision */
384 + "CONFIG0",
385 + "CONFIG1",
386 + "CONFIG2",
387 + "CONFIG3",
388 + "NC", /* GPIO32 */
389 + "NC", /* GPIO33 */
390 + "NC", /* GPIO34 */
391 + "NC", /* GPIO35 */
392 + "NC", /* GPIO36 */
393 + "NC", /* GPIO37 */
394 + "NC", /* GPIO38 */
395 + "NC", /* GPIO39 */
396 + "PWM0_OUT",
397 + "NC", /* GPIO41 */
398 + "NC", /* GPIO42 */
399 + "NC", /* GPIO43 */
400 + "NC", /* GPIO44 */
401 + "PWM1_OUT",
402 + "HDMI_HPD_P",
403 + "SD_CARD_DET",
404 + /* Used by SD Card */
405 + "SD_CLK_R",
406 + "SD_CMD_R",
407 + "SD_DATA0_R",
408 + "SD_DATA1_R",
409 + "SD_DATA2_R",
410 + "SD_DATA3_R";
411 +
412 pinctrl-0 = <&gpioout &alt0>;
413 };
414