Skip to content

Instantly share code, notes, and snippets.

@hannesweisbach
Created July 12, 2019 18:01
Show Gist options
  • Save hannesweisbach/c59cd4fa4d4b1955320744d83e5de49f to your computer and use it in GitHub Desktop.
Save hannesweisbach/c59cd4fa4d4b1955320744d83e5de49f to your computer and use it in GitHub Desktop.
Device Tree Overlay to name GPIO lines on a Raspberry Pi 2 Model B. Needed for Kernels < 5.2
// Give GPIO pin names in pre-5.2 kernels
/dts-v1/;
/plugin/;
/ {
compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
fragment@0 {
target = <&gpio>;
__overlay__ {
/*
* Taken from rpi_SCH_2b_1p2_reduced.pdf and
* the official GPU firmware DT blob.
*
* 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_SDA",
"ID_SCL",
"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",
"", /* GPIO30 */
"LAN_RUN",
"CAM_GPIO1",
"", /* GPIO33 */
"", /* GPIO34 */
"PWR_LOW_N",
"", /* GPIO36 */
"", /* GPIO37 */
"USB_LIMIT",
"", /* GPIO39 */
"PWM0_OUT",
"CAM_GPIO0",
"SMPS_SCL",
"SMPS_SDA",
"ETHCLK",
"PWM1_OUT",
"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";
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment