Skip to contentSkip to conversation

ARM: dts: sun8i-h2-plus-bananapi-m2-zero: add gpio-line-names

PATCH Superseded Michael Klein 3 participants 7 messages Nov 15, 2020 – Nov 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: sun8i-h2-plus-bananapi-m2-zero: add gpio-line-names

Add gpio-line-names as documented in the Banana Pi wiki [1] and in the schematics [2].

[1]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#GPIO_PIN_define
[2]: https://drive.google.com/file/d/0B4PAo2nW2KfnMW5sVkxWSW9qa28/view

---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +64 -0
index 4c6704e4c57e..b4ddfaf01b45 100644
@@ -136,6 +136,70 @@ bluetooth {
 
 };
 
+&pio {
+	gpio-line-names =
+		/* PA */
+		"UART2-TX", "UART2-RX", "UART2-RTS", "UART2-CTS",
+			"UART0-TXD", "UART0-RXD", "PWM1", "PA7-EINT7",
+		"PA8-EINT8", "PA9-EINT9", "PA10-EINT10", "TWI0-SCK",
+			"TWI0-SDA", "UART3-TX", "UART3-RX", "UART3-RTS",
+		"UART3-CTS", "PA17-EINT17", "TWI1-SCK", "TWI1-SDA",
+			"PA20-EINT20", "PA21-EINT21", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PB */
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PC */
+		"SPI0-MOSI", "SPI0-MISO", "SPI0-CLK", "SPI0-CS", "PC4", "", "",
+			"PC7",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PD */
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "CSI-PWR-EN", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PE */
+		"CSI0-PCLK", "CSI0-MCLK", "CSI0-HSYNC", "CSI0-VSYNC",
+			"CSI0-D0", "CSI0-D1", "CSI0-D2", "CSI0-D3",
+		"CSI0-D4", "CSI0-D5", "CSI0-D6", "CSI0-D7",
+			"CSI0-SCK", "CSI0-SDA", "CSI0-RST#", "CSI0-PWDN",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PF */
+		"SDC0-D1", "SDC0-D0", "SDC0-CLK", "SDC0-CMD", "SDC0-D3",
+			"SDC0-D2", "SDC0-DET", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PG */
+		"WL-SDIO-CLK", "WL-SDIO-CMD", "WL-SDIO-D0", "WL-SDIO-D1",
+			"WL-SDIO-D2", "WL-SDIO-D3", "UART1-TX", "UART1-RX",
+		"UART1-RTS", "UART1-CTS", "WL-WAKE-AP", "BT-WAKE-AP",
+			"BT-RST-N", "AP-WAKE-BT", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "";
+};
+
+&r_pio {
+	gpio-line-names =
+		/* PL */
+		"", "CPUX-SET", "PL2-S-EINT2", "POWER-KEY", "PL4-S-EINT4",
+			"VCC-IO-EN", "USB0-ID", "WIFI-EN",
+		"PWR-STB", "PWR-DRAM", "PWR-LED", "IR-RX", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "";
+};
+
 &usb_otg {
 	dr_mode = "otg";
 	status = "okay";
Signature · 7 lines
2.28.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hi!

Quoted 19 lines · Michael Klein

Add gpio-line-names as documented in the Banana Pi wiki [1] and in the schematics [2].

[1]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#GPIO_PIN_define
[2]: https://drive.google.com/file/d/0B4PAo2nW2KfnMW5sVkxWSW9qa28/view

---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +0 -0
index 4c6704e4c57e..b4ddfaf01b45 100644
@@ -136,6 +136,70 @@ bluetooth {
 
 };
 

arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts bluetooth { · line 148

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +10 -0
+&pio {
+	gpio-line-names =
+		/* PA */
+		"UART2-TX", "UART2-RX", "UART2-RTS", "UART2-CTS",
+			"UART0-TXD", "UART0-RXD", "PWM1", "PA7-EINT7",
+		"PA8-EINT8", "PA9-EINT9", "PA10-EINT10", "TWI0-SCK",
+			"TWI0-SDA", "UART3-TX", "UART3-RX", "UART3-RTS",
+		"UART3-CTS", "PA17-EINT17", "TWI1-SCK", "TWI1-SDA",
+			"PA20-EINT20", "PA21-EINT21", "", "",
+		"", "", "", "", "", "", "", "",

IIRC, the point is to have the pin names that the vendor publishes.

Looking at Documentation/devicetree/bindings/gpio/gpio.txt, it says:

"""
Optionally, a GPIO controller may have a "gpio-line-names" property. This is an array of strings defining the names of the GPIO lines going out of the GPIO controller. This name should be the most meaningful producer name for the system, such as a rail name indicating the usage. Package names such as pin name are discouraged: such lines have opaque names (since they are by definition generic purpose) and such names are usually not very helpful.
"""

In this case, from the link you gave above, I think having the CON*-P* names make more sense.

Maxime

#2 lore raw

Thank you for having a look at the patch!

Quoted 45 lines · Maxime Ripard
Quoted 19 lines · Michael Klein

Add gpio-line-names as documented in the Banana Pi wiki [1] and in the schematics [2].

[1]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#GPIO_PIN_define
[2]: https://drive.google.com/file/d/0B4PAo2nW2KfnMW5sVkxWSW9qa28/view

---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +0 -0
index 4c6704e4c57e..b4ddfaf01b45 100644
@@ -136,6 +136,70 @@ bluetooth {
 
 };
 

arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts bluetooth { · line 148

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +10 -0
+&pio {
+	gpio-line-names =
+		/* PA */
+		"UART2-TX", "UART2-RX", "UART2-RTS", "UART2-CTS",
+			"UART0-TXD", "UART0-RXD", "PWM1", "PA7-EINT7",
+		"PA8-EINT8", "PA9-EINT9", "PA10-EINT10", "TWI0-SCK",
+			"TWI0-SDA", "UART3-TX", "UART3-RX", "UART3-RTS",
+		"UART3-CTS", "PA17-EINT17", "TWI1-SCK", "TWI1-SDA",
+			"PA20-EINT20", "PA21-EINT21", "", "",
+		"", "", "", "", "", "", "", "",

IIRC, the point is to have the pin names that the vendor publishes.

Looking at Documentation/devicetree/bindings/gpio/gpio.txt, it says:

"""
Optionally, a GPIO controller may have a "gpio-line-names" property. This is an array of strings defining the names of the GPIO lines going out of the GPIO controller. This name should be the most meaningful producer name for the system, such as a rail name indicating the usage. Package names such as pin name are discouraged: such lines have opaque names (since they are by definition generic purpose) and such names are usually not very helpful.
"""

Quoted 2 lines

In this case, from the link you gave above, I think having the CON*-P* names make more sense.

Hm, but these are the pin names (of the connector) and should thus not be used, right?

For e.g. the PA0 pin, the wiki link gives three candidates:

- CON2-P13 (GPIO Pin Name -> pin 13 of the 40 pin GPIO header)
- UART2-TX (Default Function)
- PA0-EINT0 (Function2 : GPIO)

IMHO, the CON*-P* name is the least helpful of the above, as it tells nothing about the usage. I'm not sure about the other two names, though.

Michael

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 55 lines · Michael Klein

Thank you for having a look at the patch!

Quoted 45 lines · Maxime Ripard
Quoted 19 lines · Michael Klein

Add gpio-line-names as documented in the Banana Pi wiki [1] and in the schematics [2].

[1]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#GPIO_PIN_define
[2]: https://drive.google.com/file/d/0B4PAo2nW2KfnMW5sVkxWSW9qa28/view

---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +0 -0
index 4c6704e4c57e..b4ddfaf01b45 100644
@@ -136,6 +136,70 @@ bluetooth {
 
 };
 

arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts bluetooth { · line 148

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +10 -0
+&pio {
+    gpio-line-names =
+            /* PA */
+            "UART2-TX", "UART2-RX", "UART2-RTS", "UART2-CTS",
+                    "UART0-TXD", "UART0-RXD", "PWM1", "PA7-EINT7",
+            "PA8-EINT8", "PA9-EINT9", "PA10-EINT10", "TWI0-SCK",
+                    "TWI0-SDA", "UART3-TX", "UART3-RX", "UART3-RTS",
+            "UART3-CTS", "PA17-EINT17", "TWI1-SCK", "TWI1-SDA",
+                    "PA20-EINT20", "PA21-EINT21", "", "",
+            "", "", "", "", "", "", "", "",

IIRC, the point is to have the pin names that the vendor publishes.

Looking at Documentation/devicetree/bindings/gpio/gpio.txt, it says:

"""
Optionally, a GPIO controller may have a "gpio-line-names" property. This is an array of strings defining the names of the GPIO lines going out of the GPIO controller. This name should be the most meaningful producer name for the system, such as a rail name indicating the usage. Package names such as pin name are discouraged: such lines have opaque names (since they are by definition generic purpose) and such names are usually not very helpful.
"""

Quoted 2 lines

In this case, from the link you gave above, I think having the CON*-P* names make more sense.

Hm, but these are the pin names (of the connector) and should thus not be used, right?

Quoted 8 lines

For e.g. the PA0 pin, the wiki link gives three candidates:

- CON2-P13 (GPIO Pin Name -> pin 13 of the 40 pin GPIO header)
- UART2-TX (Default Function)
- PA0-EINT0 (Function2 : GPIO)

IMHO, the CON*-P* name is the least helpful of the above, as it tells nothing about the usage. I'm not sure about the other two names, though.

I believe the function names are pretty useless in this case, as you cannot use the GPIO subsystem to mux functions. That is what pinctrl does. And in our case, the pinctrl drivers already know all the available functions each pin has.

Using the pin count and connector name provides the user direct mapping of the software representation of the pin against the actual pin on the hardware. The user can then proceed to request and use that pin.

Again, you can not request "functions" from userspace, only GPIO usage.

Also using "one" function name creates confusion if the same function is available on multiple pins.

ChenYu

Quoted 6 lines

Michael

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw
Quoted 65 lines · Chen-Yu Tsai
Quoted 55 lines · Michael Klein

Thank you for having a look at the patch!

Quoted 45 lines · Maxime Ripard
Quoted 19 lines · Michael Klein

Add gpio-line-names as documented in the Banana Pi wiki [1] and in the schematics [2].

[1]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#GPIO_PIN_define
[2]: https://drive.google.com/file/d/0B4PAo2nW2KfnMW5sVkxWSW9qa28/view

---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +0 -0
index 4c6704e4c57e..b4ddfaf01b45 100644
@@ -136,6 +136,70 @@ bluetooth {
 
 };
 

arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts bluetooth { · line 148

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +10 -0
+&pio {
+    gpio-line-names =
+            /* PA */
+            "UART2-TX", "UART2-RX", "UART2-RTS", "UART2-CTS",
+                    "UART0-TXD", "UART0-RXD", "PWM1", "PA7-EINT7",
+            "PA8-EINT8", "PA9-EINT9", "PA10-EINT10", "TWI0-SCK",
+                    "TWI0-SDA", "UART3-TX", "UART3-RX", "UART3-RTS",
+            "UART3-CTS", "PA17-EINT17", "TWI1-SCK", "TWI1-SDA",
+                    "PA20-EINT20", "PA21-EINT21", "", "",
+            "", "", "", "", "", "", "", "",

IIRC, the point is to have the pin names that the vendor publishes.

Looking at Documentation/devicetree/bindings/gpio/gpio.txt, it says:

"""
Optionally, a GPIO controller may have a "gpio-line-names" property. This is an array of strings defining the names of the GPIO lines going out of the GPIO controller. This name should be the most meaningful producer name for the system, such as a rail name indicating the usage. Package names such as pin name are discouraged: such lines have opaque names (since they are by definition generic purpose) and such names are usually not very helpful.
"""

Quoted 2 lines

In this case, from the link you gave above, I think having the CON*-P* names make more sense.

Hm, but these are the pin names (of the connector) and should thus not be used, right?

Quoted 8 lines

For e.g. the PA0 pin, the wiki link gives three candidates:

- CON2-P13 (GPIO Pin Name -> pin 13 of the 40 pin GPIO header)
- UART2-TX (Default Function)
- PA0-EINT0 (Function2 : GPIO)

IMHO, the CON*-P* name is the least helpful of the above, as it tells nothing about the usage. I'm not sure about the other two names, though.

Quoted 8 lines

I believe the function names are pretty useless in this case, as you cannot use the GPIO subsystem to mux functions. That is what pinctrl does. And in our case, the pinctrl drivers already know all the available functions each pin has.

Using the pin count and connector name provides the user direct mapping of the software representation of the pin against the actual pin on the hardware. The user can then proceed to request and use that pin.

Thank you for the explanation, that makes sense. I'll update the patch then.

Michael

#5 lore raw

PATCH v2 1/1 ARM: dts: sun8i-h2-plus-bananapi-m2-zero: add gpio-line-names

Add gpio-line-names as documented in the Banana Pi wiki [1] and in the schematics [2].

[1]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#GPIO_PIN_define
[2]: https://drive.google.com/file/d/0B4PAo2nW2KfnMW5sVkxWSW9qa28/view

---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +64 -0
index 4c6704e4c57e..e76d56a3df9c 100644
@@ -136,6 +136,70 @@ bluetooth {
 
 };
 
+&pio {
+	gpio-line-names =
+		/* PA */
+		"CON2-P13", "CON2-P11", "CON2-P22", "CON2-P15",
+			"CON3-P03", "CON3-P02", "CON2-P07", "CON2-P29",
+		"CON2-P31", "CON2-P33", "CON2-P35", "CON2-P05",
+			"CON2-P03", "CON2-P08", "CON2-P10", "CON2-P16",
+		"CON2-P12", "CON2-P37", "CON2-P28", "CON2-P27",
+			"CON2-P40", "CON2-P38", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PB */
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PC */
+		"CON2-P19", "CON2-P21", "CON2-P23", "CON2-P24",
+			"CON2-P18", "", "", "CON2-P26",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PD */
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "CSI-PWR-EN", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PE */
+		"CN3-P17", "CN3-P13", "CN3-P09", "CN3-P07",
+			"CN3-P19", "CN3-P21", "CN3-P22", "CN3-P20",
+		"CN3-P18", "CN3-P16", "CN3-P14", "CN3-P12",
+			"CN3-P05", "CN3-P03", "CN3-P06", "CN3-P08",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PF */
+		"SDC0-D1", "SDC0-D0", "SDC0-CLK", "SDC0-CMD", "SDC0-D3",
+			"SDC0-D2", "SDC0-DET", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+
+		/* PG */
+		"WL-SDIO-CLK", "WL-SDIO-CMD", "WL-SDIO-D0", "WL-SDIO-D1",
+			"WL-SDIO-D2", "WL-SDIO-D3", "BT-UART-TX", "BT-UART-RX",
+		"BT-UART-RTS", "BT-UART-CTS", "WL-WAKE-AP", "BT-WAKE-AP",
+			"BT-RST-N", "AP-WAKE-BT", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "";
+};
+
+&r_pio {
+	gpio-line-names =
+		/* PL */
+		"", "CPUX-SET", "CON2-P32", "POWER-KEY", "CON2-P36",
+			"VCC-IO-EN", "USB0-ID", "WL-PWR-EN",
+		"PWR-STB", "PWR-DRAM", "PWR-LED", "IR-RX", "", "", "", "",
+		"", "", "", "", "", "", "", "",
+		"", "", "", "", "", "", "", "";
+};
+
 &usb_otg {
 	dr_mode = "otg";
 	status = "okay";
Signature · 7 lines
2.29.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel