Skip to contentSkip to conversation

sunxi: Add support for USB vbus pin for USB3

PATCH New Hans de Goede 2 participants 4 messages Mar 18, 2016 – Mar 22, 2016

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

PATCH 1/3 sunxi: Add support for USB vbus pin for USB3

The H3 has USB0 - USB3, add support for having a USB vbus pin for USB3.

---
 arch/arm/cpu/armv7/sunxi/usb_phy.c | 1 +
 board/sunxi/Kconfig                | 6 ++++++
 2 files changed, 7 insertions(+)
arch/arm/cpu/armv7/sunxi/usb_phy.c +1 -0
index 6ac96cc..0749fbd 100644
@@ -76,6 +76,7 @@ static int get_vbus_gpio(int index)
 	case 0: return sunxi_name_to_gpio(CONFIG_USB0_VBUS_PIN);
 	case 1: return sunxi_name_to_gpio(CONFIG_USB1_VBUS_PIN);
 	case 2: return sunxi_name_to_gpio(CONFIG_USB2_VBUS_PIN);
+	case 3: return sunxi_name_to_gpio(CONFIG_USB3_VBUS_PIN);
 	}
 	return -EINVAL;
 }
board/sunxi/Kconfig +6 -0
index 5e9d3af..5e72fac 100644
@@ -342,6 +342,12 @@ config USB2_VBUS_PIN
 	---help---
 	See USB1_VBUS_PIN help text.
 
+config USB3_VBUS_PIN
+	string "Vbus enable pin for usb3 (ehci2)"
+	default ""
+	---help---
+	See USB1_VBUS_PIN help text.
+
 config I2C0_ENABLE
 	bool "Enable I2C/TWI controller 0"
 	default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
Signature · 1 line
2.7.3
#1 lore raw

PATCH 2/3 sunxi: Specify USB vbus pins for orangepi boards

This fixes the USB ports not working on the orangepi_plus and stops us from messing with gpio-s which we should not touch on the orangepi_pc.

---
 configs/orangepi_pc_defconfig   | 3 +++
 configs/orangepi_plus_defconfig | 2 ++
 2 files changed, 5 insertions(+)
configs/orangepi_pc_defconfig +3 -0
index aaf0f68..4e9051d 100644
@@ -14,3 +14,6 @@ CONFIG_SPL=y
 CONFIG_CMD_GPIO=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB1_VBUS_PIN=""
+CONFIG_USB2_VBUS_PIN=""
+CONFIG_USB3_VBUS_PIN=""
configs/orangepi_plus_defconfig +2 -0
index e52dcfc..c4885f4 100644
@@ -14,3 +14,5 @@ CONFIG_SPL=y
 CONFIG_CMD_GPIO=y
 CONFIG_SY8106A_POWER=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB1_VBUS_PIN="PG13"
+CONFIG_USB3_VBUS_PIN="PG11"
Signature · 1 line
2.7.3
#2 lore raw

PATCH 3/3 sunxi: Add a bunch of missing compatible strings to sunxi_gpio.c

In reply to Hans de Goede

The kernel has different compatible strings for the pio block because the pin-muxing is different on all the different SoCs, but sunxi_gpio.c only support the basic gpio functionality, which is identical everywhere. Add the missing compatible strings for various SoC models.

---
 drivers/gpio/sunxi_gpio.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpio/sunxi_gpio.c +14 -1
index 9d8f11e..a7cec18 100644
@@ -277,9 +277,17 @@ static int gpio_sunxi_bind(struct udevice *parent)
 		start = 'L' - 'A';
 		no_banks = 2; /* L & M */
 	} else if (fdt_node_check_compatible(gd->fdt_blob, parent->of_offset,
-				"allwinner,sun8i-a23-r-pinctrl") == 0) {
+				"allwinner,sun8i-a23-r-pinctrl") == 0 ||
+		   fdt_node_check_compatible(gd->fdt_blob, parent->of_offset,
+				"allwinner,sun8i-a83t-r-pinctrl") == 0 ||
+		   fdt_node_check_compatible(gd->fdt_blob, parent->of_offset,
+				"allwinner,sun8i-h3-r-pinctrl") == 0) {
 		start = 'L' - 'A';
 		no_banks = 1; /* L only */
+	} else if (fdt_node_check_compatible(gd->fdt_blob, parent->of_offset,
+				"allwinner,sun9i-a80-r-pinctrl") == 0) {
+		start = 'L' - 'A';
+		no_banks = 3; /* L, M & N */
 	} else {
 		start = 0;
 		no_banks = SUNXI_GPIO_BANKS;
@@ -316,9 +324,14 @@ static const struct udevice_id sunxi_gpio_ids[] = {
 	{ .compatible = "allwinner,sun7i-a20-pinctrl" },
 	{ .compatible = "allwinner,sun8i-a23-pinctrl" },
 	{ .compatible = "allwinner,sun8i-a33-pinctrl" },
+	{ .compatible = "allwinner,sun8i-a83t-pinctrl", },
+	{ .compatible = "allwinner,sun8i-h3-pinctrl" },
 	{ .compatible = "allwinner,sun9i-a80-pinctrl" },
 	{ .compatible = "allwinner,sun6i-a31-r-pinctrl" },
 	{ .compatible = "allwinner,sun8i-a23-r-pinctrl" },
+	{ .compatible = "allwinner,sun8i-a83t-r-pinctrl" },
+	{ .compatible = "allwinner,sun8i-h3-r-pinctrl", },
+	{ .compatible = "allwinner,sun9i-a80-r-pinctrl", },
 	{ }
 };
 
Signature · 1 line
2.7.3