ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
Subsystems (3)
PATCH v3 1/1 ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using tools/gpio/lsgpio.c
v2: Major rewrite by anholt: Flatten each GPIO line to a line in the
file for better diffing, prefix all expansion header pins with "P<number>" or "P5HEADER_P<number>" and drop the mostly-unused GPIO_GEN<smallnumber> names in favor of GPIO<socgpionumber>, fix extra '[]' on a couple of lines, fix locations of SD_CARD_DETECT, CAM_GPIO and STATUS_LED, fix HDMI_HPD polarities, rewrite A+ using unreleased schematics.
v3: More changes by anholt: Drop P<number> / P5HEADER<number>
prefixes. I had been skeptical about adding them, and was convinced to drop them by Gottfried (who probably has more experience with GPIOs in educational contexts than the rest of us). Also drop [] brackets for "is pinmuxed", which didn't seem to clarify, and were ambiguous for things like the SPI_*-labeled pins which may or may not actually be pinmuxed to SPI.
--- arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 65 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-a.dts | 67 ++++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b.dts | 67 ++++++++++++++++++++++++++++++++ 5 files changed, 331 insertions(+)
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +65 -0
@@ -22,6 +22,71 @@ }; &gpio { + /* + * This is based on the unreleased schematic for the Model A+. + * + * Legend: + * "NC" = not connected (no rail from the SoC) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "SDA0", + "SCL0", + "SDA1", + "SCL1", + "GPIO_GCLK", + "GPIO5", + "GPIO6", + "SPI_CE1_N", + "SPI_CE0_N", + "SPI_MISO", + "SPI_MOSI", + "SPI_SCLK", + "GPIO12", + "GPIO13", + /* Serial port */ + "TXD0", + "RXD0", + "GPIO16", + "GPIO17", + "GPIO18", + "GPIO19", + "GPIO20", + "GPIO21", + "GPIO22", + "GPIO23", + "GPIO24", + "GPIO25", + "GPIO26", + "GPIO27", + "SDA0", + "SCL0", + "NC", /* GPIO30 */ + "NC", /* GPIO31 */ + "NC", /* GPIO32 */ + "NC", /* GPIO33 */ + "NC", /* GPIO34 */ + "PWR_LOW_N", /* GPIO35 */ + "NC", /* GPIO36 */ + "NC", /* GPIO37 */ + "NC", /* GPIO38 */ + "NC", /* GPIO39 */ + "PWM0_OUT", /* GPIO40 */ + "CAM_GPIO0", /* GPIO41 */ + "NC", /* GPIO42 */ + "NC", /* GPIO43 */ + "NC", /* GPIO44 */ + "PWM1_OUT", /* GPIO45 */ + "HDMI_HPD_N", + "STATUS_LED", + /* Used by SD Card */ + "SD_CLK_R", + "SD_CMD_R", + "SD_DATA0_R", + "SD_DATA1_R", + "SD_DATA2_R", + "SD_DATA3_R"; + pinctrl-0 = <&gpioout &alt0 &i2s_alt0>; /* I2S interface */
arch/arm/boot/dts/bcm2835-rpi-a.dts +67 -0
73 lines not on this page · raw message
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +66 -0
72 lines not on this page · raw message
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +66 -0
72 lines not on this page · raw message
arch/arm/boot/dts/bcm2835-rpi-b.dts +67 -0
73 lines not on this page · raw message
Signature · 1 line
2.9.3
Hi Eric,
Quoted 8 lines
Eric Anholt <[email protected]> hat am 27. Oktober 2016 um 18:52 geschrieben:
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using
tools/gpio/lsgpio.c
sorry for the late feedback, but did you check your patch against the Firmware DTS [1]?
As an example the GPIO38 is connected and named as USB_LIMIT_1A2 since Raspberry Pi 1 B Plus.
[1] -
https://github.com/raspberrypi/documentation/blob/master/configuration/images/dt-blob.dts
Quoted 11 lines · Stefan Wahren
Hi Eric,
Quoted 8 lines
Eric Anholt <[email protected]> hat am 27. Oktober 2016 um 18:52 geschrieben:
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using
tools/gpio/lsgpio.c
Quoted 8 lines
sorry for the late feedback, but did you check your patch against the Firmware DTS [1]?
As an example the GPIO38 is connected and named as
USB_LIMIT_1A2since Raspberry Pi 1 B Plus.[1] -
https://github.com/raspberrypi/documentation/blob/master/configuration/images/dt-blob.dts
I did use the dt-blob sometimes for cross-checking, but these are
written against the schematics, not the dt-blob. If you've got things
you'd like changed, could you send a patch?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161031/f5aa89db/attachment.sig>
Quoted 25 lines
Eric Anholt <[email protected]> hat am 31. Oktober 2016 um 18:53 geschrieben:
Quoted 19 lines · Stefan Wahren
Hi Eric,
Quoted 8 lines
Eric Anholt <[email protected]> hat am 27. Oktober 2016 um 18:52 geschrieben:
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using
tools/gpio/lsgpio.csorry for the late feedback, but did you check your patch against the Firmware
DTS [1]?As an example the GPIO38 is connected and named as
USB_LIMIT_1A2since Raspberry
Pi 1 B Plus.
Quoted 6 lines
Quoted 2 lines
[1] -
https://github.com/raspberrypi/documentation/blob/master/configuration/images/dt-blob.dtsI did use the dt-blob sometimes for cross-checking, but these are written against the schematics, not the dt-blob. If you've got things you'd like changed, could you send a patch?
A patch against your v3 or my own v4 based on your patch?
Quoted 24 lines · Stefan Wahren
Quoted 24 lines
Eric Anholt <[email protected]> hat am 31. Oktober 2016 um 18:53 geschrieben:
Quoted 19 lines · Stefan Wahren
Hi Eric,
Quoted 8 lines
Eric Anholt <[email protected]> hat am 27. Oktober 2016 um 18:52 geschrieben:
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using
tools/gpio/lsgpio.csorry for the late feedback, but did you check your patch against the Firmware
DTS [1]?As an example the GPIO38 is connected and named as
USB_LIMIT_1A2since Raspberry
Pi 1 B Plus.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
[1] -
https://github.com/raspberrypi/documentation/blob/master/configuration/images/dt-blob.dtsI did use the dt-blob sometimes for cross-checking, but these are written against the schematics, not the dt-blob. If you've got things you'd like changed, could you send a patch?
A patch against your v3 or my own v4 based on your patch?
A followon patch is great, then the changes are obvious and we can
either squash or commit as appropriate.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161101/e9cfffda/attachment.sig>
Quoted 11 lines · Eric Anholt
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using
tools/gpio/lsgpio.carch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 65 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-a.dts | 67 ++++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b.dts | 67 ++++++++++++++++++++++++++++++++
Aren't the A and B rev 2 pinouts the same. If so, why duplicate the content between the files instead of creating an inclue file? Same for A+, B+, Pi 2, and Pi 3. Shouldn't this patch update the Pi 2 and Pi 3 DTs too?
Quoted 18 lines
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +10
-0&gpio { + /* + * This is based on the unreleased schematic for the Model A+. + * + * Legend: + * "NC" = not connected (no rail from the SoC) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "SDA0", + "SCL0",arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +1
-0&gpio { + /*
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts line 36
Quoted 10 lines
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +10
-0+ * Taken from Raspberry-Pi-B-Plus-V1.2-Schematics.pdf + * RPI-BPLUS sheet 1 + * + * Legend: + * "NC" = not connected (no rail from the SoC) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "ID_SD", + "ID_SC",
I think the whole point of naming GPIOs is to give users the same experience across the different boards where the same semantics exist in HW. Both the A+ and B+ use GPIO0/1 (a/k/a ID_SD/ID_SC a/k/a SDA0/SCL0) for the same semantic purpose and are exposed in the same externally visible way (same pins on the expansion header); the board ID EEPROM. Therefore I assert the names of these GPIOs should be identical on all boards that use them for that purpose, to allow SW (or human knowledge) portability between the boards.
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
Quoted 1 line
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +1
-0+ "GPIO17",
This pin is known as GPIO_GEN0 on the expansion header. Given the expansion header is all end-users likely care about, and other pins (e.g. SPI_CE1_N) are named after the expansion header, shouldn't this patch use the GPIO expansion header naming for all pins that are routed to that header?
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Eric Anholt
From: Linus Walleij <[email protected]>
The idea is to give useful names to GPIO lines that an implementer will be using from userspace, e.g. for maker type projects. These are user-visible using
tools/gpio/lsgpio.c
Quoted 7 lines
Quoted 5 lines
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 65 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-a.dts | 67 ++++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b.dts | 67 ++++++++++++++++++++++++++++++++Aren't the A and B rev 2 pinouts the same.
Looking at the contents of the patches and the schematics referenced
Quoted 6 lines
From them: no, they aren't.
If so, why duplicate the
content between the files instead of creating an inclue file? Same for A+, B+, Pi 2, and Pi 3. Shouldn't this patch update the Pi 2 and Pi 3 DTs too?
Pi2 and 3 would be lovely. If someone wants to write them, I'd encourage them to.
Quoted 8 lines
I think the whole point of naming GPIOs is to give users the same experience across the different boards where the same semantics exist in HW. Both the A+ and B+ use GPIO0/1 (a/k/a ID_SD/ID_SC a/k/a SDA0/SCL0) for the same semantic purpose and are exposed in the same externally visible way (same pins on the expansion header); the board ID EEPROM. Therefore I assert the names of these GPIOs should be identical on all boards that use them for that purpose, to allow SW (or human knowledge) portability between the boards.
I weakly agree with this, but find the idea of "consistent semantics" attached to the names rather silly given the number of ways people reconfigure the boards (particularly given that people can pinmux things).
That said, I agree with you on renaming ID_SD to disagree with the schematic in favor of consistency, and I've done so.
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ "GPIO17",This pin is known as
GPIO_GEN0on the expansion header. Given the expansion header is all end-users likely care about, and other pins (e.g.SPI_CE1_N) are named after the expansion header, shouldn't this patch use the GPIO expansion header naming for all pins that are routed to that header?
We've already been through this. Users *don't* know the GENx names and
they were confusing and got eliminated in the later schematics. This
was done for consistency, like you asked for above!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161111/1ba7017a/attachment.sig>