From patchwork Tue Oct 18 16:38:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 78104 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp973299qge; Tue, 18 Oct 2016 09:38:59 -0700 (PDT) X-Received: by 10.99.55.90 with SMTP id g26mr1664192pgn.65.1476808739740; Tue, 18 Oct 2016 09:38:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si36495505pfk.263.2016.10.18.09.38.59; Tue, 18 Oct 2016 09:38:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938742AbcJRQi4 (ORCPT + 27 others); Tue, 18 Oct 2016 12:38:56 -0400 Received: from anholt.net ([50.246.234.109]:45071 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936591AbcJRQir (ORCPT ); Tue, 18 Oct 2016 12:38:47 -0400 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 5A5802C9C06E; Tue, 18 Oct 2016 09:38:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AT4D_umEdL9v; Tue, 18 Oct 2016 09:38:44 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id B7D332C9C06D; Tue, 18 Oct 2016 09:38:44 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id DCB662E6E00; Tue, 18 Oct 2016 09:38:10 -0700 (PDT) From: Eric Anholt To: Linus Walleij Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stephen Warren , Lee Jones , bcm-kernel-feedback-list@broadcom.com, Eric Anholt Subject: [PATCH v2] ARM: bcm2835: Add names for the Raspberry Pi GPIO lines Date: Tue, 18 Oct 2016 09:38:08 -0700 Message-Id: <20161018163808.6318-1-eric@anholt.net> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij 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" or "P5HEADER_P" and drop the mostly-unused GPIO_GEN names in favor of GPIO, 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. Signed-off-by: Linus Walleij Signed-off-by: Eric Anholt --- Note: I haven't actually booted these and checked that the names line up, just tried to visually review them. Hopefully with more GPIO values, it's easier to spot errors. The only other thing here I think I would do is drop the [] around names for behavior when pinmuxed. I find it more confusing than helpful. Linus, are these names considered ABI? Will we be locked into whatever set of names we merge and release? My assumption would be "yes". arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 66 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-a.dts | 68 ++++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 67 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 67 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/bcm2835-rpi-b.dts | 68 ++++++++++++++++++++++++++++++++ 5 files changed, 336 insertions(+) -- 2.9.3 diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts index 21507c922783..cec4c6e49e7b 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts @@ -22,6 +22,72 @@ }; &gpio { + /* + * This is based on the unreleased schematic for the Model A+. + * + * Legend: + * "NC" = not connected (no rail from the SoC) + * "[FOO]" = pin is muxed for peripheral FOO (not GPIO) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "[SDA0]", + "[SCL0]", + "[P3_SDA1]", + "[P5_SCL1]", + "[P7_GPIO_GCLK]", + "P29_GPIO5", + "P31_GPIO6", + "[P26_SPI_CE1_N]", + "[P24_SPI_CE0_N]", + "[P21_SPI_MISO]", + "[P19_SPI_MOSI]", + "[P23_SPI_SCLK]", + "P32_GPIO12", + "P33_GPIO13", + /* Serial port */ + "[P8_TXD0]", + "[P10_RXD0]", + "P36_GPIO16", + "P11_GPIO17", + "P12_GPIO18", + "P35_GPIO19", + "P38_GPIO20", + "P40_GPIO21", + "P15_GPIO22", + "P16_GPIO23", + "P18_GPIO24", + "P22_GPIO25", + "P37_GPIO26", + "P13_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 */ diff --git a/arch/arm/boot/dts/bcm2835-rpi-a.dts b/arch/arm/boot/dts/bcm2835-rpi-a.dts index 5afba0900449..0ff96ed4d15b 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-a.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts @@ -15,6 +15,74 @@ }; &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) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "[P3_SDA0]", + "[P5_SCL0]", + "[SDA1]", + "[SCL1]", + "[P7_GPIO_GCLK]", + "[CAM_CLK]", + "LAN_RUN", + "[P26_SPI_CE1_N]", + "[P24_SPI_CE0_N]", + "[P21_SPI_MISO]", + "[P19_SPI_MOSI]", + "[P23_SPI_SCLK]", + "NC", /* GPIO12 */ + "NC", /* GPIO13 */ + /* Serial port */ + "[P8_TXD0]", + "[P10_RXD0]", + "STATUS_LED_N", + "P11_GPIO17", + "P12_GPIO18", + "NC", /* GPIO19 */ + "NC", /* GPIO20 */ + "P13_GPIO21", + "P15_GPIO22", + "P16_GPIO23", + "P18_GPIO24", + "P22_GPIO25", + "NC", /* GPIO26 */ + "CAM_GPIO", + /* Binary number representing build/revision */ + "CONFIG0", + "CONFIG1", + "CONFIG2", + "CONFIG3", + "NC", /* GPIO32 */ + "NC", /* GPIO33 */ + "NC", /* GPIO34 */ + "NC", /* GPIO35 */ + "NC", /* GPIO36 */ + "NC", /* GPIO37 */ + "NC", /* GPIO38 */ + "NC", /* GPIO39 */ + "[PWM0_OUT]", + "NC", /* GPIO41 */ + "NC", /* GPIO42 */ + "NC", /* GPIO43 */ + "NC", /* GPIO44 */ + "[PWM1_OUT]", + "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>; /* 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 38f66aa244fe..0e04fc2eb65e 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts @@ -23,6 +23,73 @@ }; &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) + * "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]", + "[P3_SDA1]", + "[P5_SCL1]", + "[P7_GPIO_GCLK]", + "P29_GPIO5", + "P31_GPIO6", + "[P26_SPI_CE1_N]", + "[P24_SPI_CE0_N]", + "[P21_SPI_MISO]", + "[P19_SPI_MOSI]", + "[P23_SPI_SCLK]", + "P23_GPIO12", + "P33_GPIO13", + /* Serial port */ + "[P8_TXD0]", + "[P10_RXD0]", + "P36_GPIO16", + "P11_GPIO17", + "P12_GPIO18", + "P35_GPIO19", + "P38_GPIO20", + "P40_GPIO21", + "P15_GPIO22", + "P16_GPIO23", + "P18_GPIO24", + "P22_GPIO25", + "P37_GPIO26", + "P13_GPIO27", + "[SDA0]", + "[SCL0]", + "NC", /* GPIO30 */ + "LAN_RUN", /* GPIO31 */ + "CAM_GPIO1", /* 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 */ + "ETHCLK", /* 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 */ diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts index 75e045aba7ce..6c91c9f0536c 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts @@ -16,6 +16,73 @@ }; &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) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "[SDA0]", + "[SCL0]", + "[P3_SDA1]", + "[P5_SCL1]", + "[P7_GPIO_GCLK]", + "[CAM_CLK]", + "LAN_RUN", + "[P26_SPI_CE1_N]", + "[P24_SPI_CE0_N]", + "[P21_SPI_MISO]", + "[P19_SPI_MOSI]", + "[P23_SPI_SCLK]", + "NC", /* GPIO12 */ + "NC", /* GPIO13 */ + /* Serial port */ + "[P8_TXD0]", + "[P10_RXD0]", + "STATUS_LED_N", + "P11_GPIO17", + "P12_GPIO18", + "NC", /* GPIO19 */ + "NC", /* GPIO20 */ + "CAM_GPIO", + "P15_GPIO22", + "P16_GPIO23", + "P18_GPIO24", + "P22_GPIO25", + "NC", /* GPIO 26 */ + "P13_GPIO27", + "P5HEADER_P3_GPIO28", + "P5HEADER_P4_GPIO29", + "P5HEADER_P5_GPIO30", + "P5HEADER_P6_GPIO31", + "NC", /* GPIO32 */ + "NC", /* GPIO33 */ + "NC", /* GPIO34 */ + "NC", /* GPIO35 */ + "NC", /* GPIO36 */ + "NC", /* GPIO37 */ + "NC", /* GPIO38 */ + "NC", /* GPIO39 */ + "[PWM0_OUT]", + "NC", /* GPIO41 */ + "NC", /* GPIO42 */ + "NC", /* GPIO43 */ + "NC", /* GPIO44 */ + "[PWM1_OUT]", + "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>; /* I2S interface */ diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts index 76a254b3219a..023239946826 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts @@ -16,6 +16,74 @@ }; &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) + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "[P3_SDA0]", + "[P5_SCL0]", + "[SDA1]", + "[SCL1]", + "[P7_GPIO_GCLK]", + "[CAM_CLK]", + "LAN_RUN", + "[P26_SPI_CE1_N]", + "[P24_SPI_CE0_N]", + "[P21_SPI_MISO]", + "[P19_SPI_MOSI]", + "[P23_SPI_SCLK]", + "NC", /* GPIO12 */ + "NC", /* GPIO13 */ + /* Serial port */ + "[P8_TXD0]", + "[P10_RXD0]", + "STATUS_LED_N", + "P11_GPIO17", + "P12_GPIO18", + "NC", /* GPIO19 */ + "NC", /* GPIO20 */ + "P13_GPIO21", + "P15_GPIO22", + "P16_GPIO23", + "P18_GPIO24", + "P22_GPIO25", + "NC", /* GPIO26 */ + "CAM_GPIO", + /* Binary number representing build/revision */ + "CONFIG0", + "CONFIG1", + "CONFIG2", + "CONFIG3", + "NC", /* GPIO32 */ + "NC", /* GPIO33 */ + "NC", /* GPIO34 */ + "NC", /* GPIO35 */ + "NC", /* GPIO36 */ + "NC", /* GPIO37 */ + "NC", /* GPIO38 */ + "NC", /* GPIO39 */ + "[PWM0_OUT]", + "NC", /* GPIO41 */ + "NC", /* GPIO42 */ + "NC", /* GPIO43 */ + "NC", /* GPIO44 */ + "[PWM1_OUT]", + "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>; };