[U-Boot] [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.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- arch/arm/cpu/armv7/sunxi/usb_phy.c | 1 + board/sunxi/Kconfig | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c b/arch/arm/cpu/armv7/sunxi/usb_phy.c index 6ac96cc..0749fbd 100644 --- a/arch/arm/cpu/armv7/sunxi/usb_phy.c +++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c @@ -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; } diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 5e9d3af..5e72fac 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -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

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.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- configs/orangepi_pc_defconfig | 3 +++ configs/orangepi_plus_defconfig | 2 ++ 2 files changed, 5 insertions(+)
diff --git a/configs/orangepi_pc_defconfig b/configs/orangepi_pc_defconfig index aaf0f68..4e9051d 100644 --- a/configs/orangepi_pc_defconfig +++ b/configs/orangepi_pc_defconfig @@ -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="" diff --git a/configs/orangepi_plus_defconfig b/configs/orangepi_plus_defconfig index e52dcfc..c4885f4 100644 --- a/configs/orangepi_plus_defconfig +++ b/configs/orangepi_plus_defconfig @@ -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"

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.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/gpio/sunxi_gpio.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c index 9d8f11e..a7cec18 100644 --- a/drivers/gpio/sunxi_gpio.c +++ b/drivers/gpio/sunxi_gpio.c @@ -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", }, { } };

On Fri, 2016-03-18 at 08:55 +0100, Hans de Goede wrote:
The H3 has USB0 - USB3, add support for having a USB vbus pin for USB3.
Signed-off-by: Hans de Goede hdegoede@redhat.com
All three of these patches: Acked-by: Ian Campbell ijc@hellion.org.uk
participants (2)
-
Hans de Goede
-
Ian Campbell