[PATCH] RFC: name the Raspberry Pi GPIO lines
Linus Walleij
linus.walleij at linaro.org
Thu Oct 6 04:15:02 PDT 2016
This is a scratch idea on how to properly name the GPIO lines
on the various Raspberry Pi models.
The idea is to give useful names to GPIO lines that an
implementer will be using from userspace, e.g. for maker type
projects.
See:
commit 521a2ad6f862
("gpio: add userspace ABI for GPIO line information")
commit fd9c55315db9
("gpio: of: make it possible to name GPIO lines")
And watch how nice I think it looks on lsgpio (I do not have
a raspberry pi).
I need help in getting the right names for the lines and
matching the device tree to the right schematic so I don't
get this wrong.
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 38 +++++++++++++++++++++++++++
arch/arm/boot/dts/bcm2835-rpi-a.dts | 42 ++++++++++++++++++++++++++++++
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 44 ++++++++++++++++++++++++++++++++
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 37 +++++++++++++++++++++++++++
arch/arm/boot/dts/bcm2835-rpi-b.dts | 42 ++++++++++++++++++++++++++++++
5 files changed, 203 insertions(+)
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
index 35ff4e7a4aac..561015358314 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
@@ -21,6 +21,44 @@
};
&gpio {
+ /*
+ * Taken from Raspberry-Pi-Rev-2.0-Model-AB-Schematics.pdf
+ * RPI00022 sheet 02
+ *
+ * Legend:
+ * "NC" = not connected (no rail from the SoC)
+ * "[FOO]" = pin is muxed for peripheral FOO (not GPIO)
+ * "" = No idea
+ * "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", "[CAM_CLK]", "LAN_RUN",
+ "[SPI_CE1_N]", "[SPI_CE0_N]", "[SPI_MISO]",
+ "[SPI_MOSI]", "[SPI_SCLK]",
+ "NC", "NC", /* GPIO 12 & 13 unused */
+ "[TXD0]", "[RXD0]", /* Serial port */
+ "STATUS_LED_N",
+ "GPIO_GEN0", "GPIO_GEN1",
+ "NC", "NC", /* GPIO 19 & 20 unused */
+ "CAM_GPIO",
+ "GPIO_GEN3", "GPIO_GEN4",
+ "GPIO_GEN5", "GPIO_GEN6",
+ "NC", /* GPIO 26 unused */
+ "GPIO_GEN2", "GPIO_GEN7", "GPIO_GEN8",
+ "GPIO_GEN9", "GPIO_GEN10",
+ /* GPIOs 32 thru 39 unused */
+ "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC",
+ "[PWM0_OUT]",
+ /* GPIOs 41 thru 44 unused */
+ "NC", "NC", "NC", "NC",
+ "[PWM1_OUT]",
+ /* FIXME: GPIO or device? */
+ "HDMI_HPD_P", "SD_CARD_DET",
+ /* 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 &alt3>;
/* I2S interface */
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a.dts b/arch/arm/boot/dts/bcm2835-rpi-a.dts
index 306a84ee9898..074edcba6bff 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
@@ -14,6 +14,48 @@
};
&gpio {
+ /*
+ * Taken from Raspberry-Pi-Rev-1.0-Model-AB-Schematics.pdf
+ * RPI00021 sheet 02
+ *
+ * Legend:
+ * "NC" = not connected (no rail from the SoC)
+ * "[FOO]" = pin is muxed for peripheral FOO (not GPIO)
+ * "" = No idea
+ * "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", "[CAM_CLK]", "LAN_RUN",
+ "[SPI_CE1_N]", "[SPI_CE0_N]", "[SPI_MISO]",
+ "[SPI_MOSI]", "[SPI_SCLK]",
+ "NC", "NC", /* GPIO 12 & 13 unused */
+ "[TXD0]", "[RXD0]", /* Serial port */
+ "STATUS_LED_N",
+ /*
+ * FIXME: could be named after placement on the P1
+ * pin header.
+ */
+ "GPIO_GEN0", "GPIO_GEN1",
+ "NC", "NC", /* GPIO 19 & 20 unused */
+ "GPIO_GEN2", "GPIO_GEN3", "GPIO_GEN4",
+ "GPIO_GEN5", "GPIO_GEN6",
+ "NC", /* GPIO 26 unused */
+ "CAM_GPIO",
+ /* Binary number representing build/revision */
+ "CONFIG0", "CONFIG1", "CONFIG2", "CONFIG3",
+ /* GPIOs 32 thru 39 unused */
+ "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC",
+ "[PWM0_OUT]",
+ /* GPIOs 41 thru 44 unused */
+ "NC", "NC", "NC", "NC",
+ "[PWM1_OUT]",
+ /* FIXME: GPIO or device? */
+ "HDMI_HPD_P", "SD_CARD_DET",
+ /* 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_alt2 &alt3>;
/* I2S interface */
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index d5fdb8e761a3..2cd6acf68f22 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -22,6 +22,50 @@
};
&gpio {
+ /*
+ * Taken from Raspberry-Pi-B-Plus-V1.2-Schematics.pdf
+ * RPI-BPLUS sheet 1
+ *
+ * Legend:
+ * "NC" = not connected (no rail from the SoC)
+ * "[FOO]" = pin is muxed for peripheral FOO (not GPIO)
+ * "" = No idea
+ * "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]", "[SDA1]", "[SCL1]",
+ "GPIO_GCLK", "GPIO5", "GPIO6",
+ "[SPI_CE1_N]", "[SPI_CE0_N]", "[SPI_MISO]",
+ "[SPI_MOSI]", "[SPI_SCLK]",
+ "GPIO12", "GPIO13",
+ "[TXD0]", "[RXD0]", /* Serial port */
+ "GPIO16",
+ "GPIO_GEN0", "GPIO_GEN1",
+ "GPIO19", "GPIO20", "GPIO21",
+ "GPIO_GEN3", "GPIO_GEN4",
+ "GPIO_GEN5", "GPIO_GEN6",
+ "GPIO26",
+ "GPIO_GEN2",
+ /*
+ * FIXME: all above is routed to J8, is it better
+ * to name the GPIO lines after the J8 placement?
+ * No certain info on the lines below, assume the
+ * same placement as for RPI B?
+ */
+ "GPIO_GEN7", "GPIO_GEN8",
+ "GPIO_GEN9", "GPIO_GEN10",
+ /* GPIOs 32 thru 39 unused */
+ "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC",
+ "[PWM0_OUT]",
+ /* GPIOs 41 thru 44 unused */
+ "NC", "NC", "NC", "NC",
+ "[PWM1_OUT]",
+ /* FIXME: GPIO or device? */
+ "HDMI_HPD_P", "SD_CARD_DET",
+ /* 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 &alt3>;
/* I2S interface */
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
index bfc4bd9b7733..484c073ff9e3 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
@@ -15,6 +15,43 @@
};
&gpio {
+ /*
+ * Taken from Raspberry-Pi-Rev-2.0-Model-AB-Schematics.pdf
+ * RPI00022 sheet 02
+ *
+ * Legend:
+ * "NC" = not connected (no rail from the SoC)
+ * "[FOO]" = pin is muxed for peripheral FOO (not GPIO)
+ * "" = No idea
+ * "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", "[CAM_CLK]", "LAN_RUN",
+ "[SPI_CE1_N]", "[SPI_CE0_N]", "[SPI_MISO]",
+ "[SPI_MOSI]", "[SPI_SCLK]",
+ "NC", "NC", /* GPIO 12 & 13 unused */
+ "[TXD0]", "[RXD0]", /* Serial port */
+ "STATUS_LED_N",
+ "GPIO_GEN0", "GPIO_GEN1",
+ "NC", "NC", /* GPIO 19 & 20 unused */
+ "CAM_GPIO", "GPIO_GEN3", "GPIO_GEN4",
+ "GPIO_GEN5", "GPIO_GEN6",
+ "NC", /* GPIO 26 unused */
+ "GPIO_GEN2", "GPIO_GEN7", "GPIO_GEN8",
+ "GPIO_GEN9", "GPIO_GEN10",
+ /* GPIOs 32 thru 39 unused */
+ "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC",
+ "[PWM0_OUT]",
+ /* GPIOs 41 thru 44 unused */
+ "NC", "NC", "NC", "NC",
+ "[PWM1_OUT]",
+ /* FIXME: GPIO or device? */
+ "HDMI_HPD_P", "SD_CARD_DET",
+ /* 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_alt2 &alt3>;
/* I2S interface */
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 0371bb7374b8..d212fac66563 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -15,6 +15,48 @@
};
&gpio {
+ /*
+ * Taken from Raspberry-Pi-Rev-1.0-Model-AB-Schematics.pdf
+ * RPI00021 sheet 02
+ *
+ * Legend:
+ * "NC" = not connected (no rail from the SoC)
+ * "[FOO]" = pin is muxed for peripheral FOO (not GPIO)
+ * "" = No idea
+ * "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", "[CAM_CLK]", "LAN_RUN",
+ "[SPI_CE1_N]", "[SPI_CE0_N]", "[SPI_MISO]",
+ "[SPI_MOSI]", "[SPI_SCLK]",
+ "NC", "NC", /* GPIO 12 & 13 unused */
+ "[TXD0]", "[RXD0]", /* Serial port */
+ "STATUS_LED_N",
+ /*
+ * FIXME: could be named after placement on the P1
+ * pin header.
+ */
+ "GPIO_GEN0", "GPIO_GEN1",
+ "NC", "NC", /* GPIO 19 & 20 unused */
+ "GPIO_GEN2", "GPIO_GEN3", "GPIO_GEN4",
+ "GPIO_GEN5", "GPIO_GEN6",
+ "NC", /* GPIO 26 unused */
+ "CAM_GPIO",
+ /* Binary number representing build/revision */
+ "CONFIG0", "CONFIG1", "CONFIG2", "CONFIG3",
+ /* GPIOs 32 thru 39 unused */
+ "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC",
+ "[PWM0_OUT]",
+ /* GPIOs 41 thru 44 unused */
+ "NC", "NC", "NC", "NC",
+ "[PWM1_OUT]",
+ /* FIXME: GPIO or device? */
+ "HDMI_HPD_P", "SD_CARD_DET",
+ /* 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 &alt3>;
};
--
2.7.4
More information about the linux-rpi-kernel
mailing list