Skip to contentSkip to conversation

sunxi: H6: Enable USB (2.0) support

PATCH New Andre Przywara 6 participants 24 messages May 16, 2019 – Jun 26, 2019

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

cover sunxi: H6: Enable USB (2.0) support

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Clément, can you please verify that this works for the Beelink box? I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

 arch/arm/Kconfig                      |  1 +
 arch/arm/dts/sun50i-h6-pine-h64.dts   |  5 ++++-
 arch/arm/mach-sunxi/Kconfig           |  1 +
 configs/beelink_gs1_defconfig         |  2 ++
 configs/orangepi_lite2_defconfig      |  2 ++
 configs/orangepi_one_plus_defconfig   |  2 ++
 configs/pine_h64_defconfig            |  3 +++
 drivers/clk/sunxi/clk_h6.c            | 29 +++++++++++++++++++++++++++++
 drivers/gpio/Kconfig                  |  6 ++++++
 drivers/gpio/sunxi_gpio.c             |  2 ++
 drivers/phy/allwinner/phy-sun4i-usb.c | 20 ++++++++++++++++++++
 include/configs/sunxi-common.h        |  3 ---
 scripts/config_whitelist.txt          |  1 -
 13 files changed, 72 insertions(+), 5 deletions(-)
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/6 sunxi: move SUNXI_GPIO to Kconfig

Probably for no particular reason SUNXI_GPIO was still defined the "old way", in header files only.

Introduce SUNXI_GPIO to the Kconfig file in drivers/gpio to remove another line from our dreadful config_whitelist.txt.

---
 arch/arm/Kconfig               | 1 +
 drivers/gpio/Kconfig           | 6 ++++++
 include/configs/sunxi-common.h | 3 ---
 scripts/config_whitelist.txt   | 1 -
 4 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/Kconfig +1 -0
index 3c4af1f299..25af3c0553 100644
@@ -900,6 +900,7 @@ config ARCH_SUNXI
 	select SPL_STACK_R if SPL
 	select SPL_SYS_MALLOC_SIMPLE if SPL
 	select SPL_SYS_THUMB_BUILD if !ARM64
+	select SUNXI_GPIO
 	select SYS_NS16550
 	select SYS_THUMB_BUILD if !ARM64
 	select USB if DISTRO_DEFAULTS
drivers/gpio/Kconfig +6 -0
index e36a8abc42..5a4d7c553e 100644
@@ -205,6 +205,12 @@ config SANDBOX_GPIO_COUNT
 	  of 'anonymous' GPIOs that do not belong to any device or bank.
 	  Select a suitable value depending on your needs.
 
+config SUNXI_GPIO
+	bool "Allwinner GPIO driver"
+	depends on ARCH_SUNXI
+	help
+	  Support the GPIO device in Allwinner SoCs.
+
 config XILINX_GPIO
 	bool "Xilinx GPIO driver"
 	depends on DM_GPIO
include/configs/sunxi-common.h +0 -3
index fceb812448..7be94ee7d1 100644
@@ -257,9 +257,6 @@ extern int soft_i2c_gpio_scl;
 #endif
 #endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */
 
-/* GPIO */
-#define CONFIG_SUNXI_GPIO
-
 #ifdef CONFIG_VIDEO_SUNXI
 /*
  * The amount of RAM to keep free at the top of RAM when relocating u-boot,
scripts/config_whitelist.txt +0 -1
index b16bc6ae34..219e2aae4d 100644
@@ -1924,7 +1924,6 @@ CONFIG_STV0991
 CONFIG_STV0991_HZ
 CONFIG_STV0991_HZ_CLOCK
 CONFIG_ST_SMI
-CONFIG_SUNXI_GPIO
 CONFIG_SUNXI_MAX_FB_SIZE
 CONFIG_SUPERH_ON_CHIP_R8A66597
 CONFIG_SUVD3
Signature · 1 line
2.14.5
#2 lore raw

PATCH 2/6 sunxi: gpio: Enable support for H6 pin controller

In reply to Andre Przywara

The Allwinner H6 pin controller is not really special, at least not when it comes to normal GPIO operation.

Add the H6 compatible strings to the list of recognised strings, to make GPIOs work for H6 boards.

---
 drivers/gpio/sunxi_gpio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/sunxi_gpio.c +2 -0
index cbed8d42b7..780c39962a 100644
@@ -354,12 +354,14 @@ static const struct udevice_id sunxi_gpio_ids[] = {
 	ID("allwinner,sun8i-v3s-pinctrl",	a_all),
 	ID("allwinner,sun9i-a80-pinctrl",	a_all),
 	ID("allwinner,sun50i-a64-pinctrl",	a_all),
+	ID("allwinner,sun50i-h6-pinctrl",	a_all),
 	ID("allwinner,sun6i-a31-r-pinctrl",	l_2),
 	ID("allwinner,sun8i-a23-r-pinctrl",	l_1),
 	ID("allwinner,sun8i-a83t-r-pinctrl",	l_1),
 	ID("allwinner,sun8i-h3-r-pinctrl",	l_1),
 	ID("allwinner,sun9i-a80-r-pinctrl",	l_3),
 	ID("allwinner,sun50i-a64-r-pinctrl",	l_1),
+	ID("allwinner,sun50i-h6-r-pinctrl",	l_1),
 	{ }
 };
 
Signature · 1 line
2.14.5
#3 lore raw

PATCH 2/6 sunxi: gpio: Enable support for H6 pin controller

于 2019年5月16日 GMT+08:00 上午9:26:29, Andre Przywara <[email protected]> 写到:

Quoted 20 lines

The Allwinner H6 pin controller is not really special, at least not when
it comes to normal GPIO operation.

Add the H6 compatible strings to the list of recognised strings, to make
GPIOs work for H6 boards.

---
drivers/gpio/sunxi_gpio.c | 2 ++

1 file changed, 2 insertions(+)
drivers/gpio/sunxi_gpio.c +0 -0
index cbed8d42b7..780c39962a 100644
@@ -354,12 +354,14 @@ static const struct udevice_id sunxi_gpio_ids[] =
 {
 	ID("allwinner,sun8i-v3s-pinctrl",	a_all),

drivers/gpio/sunxi_gpio.c static const struct udevice_id sunxi_gpio_ids[] = · line 365

Quoted 10 lines
drivers/gpio/sunxi_gpio.c +2 -0
 	ID("allwinner,sun9i-a80-pinctrl",	a_all),
 	ID("allwinner,sun50i-a64-pinctrl",	a_all),
+	ID("allwinner,sun50i-h6-pinctrl",	a_all),
 	ID("allwinner,sun6i-a31-r-pinctrl",	l_2),
 	ID("allwinner,sun8i-a23-r-pinctrl",	l_1),
 	ID("allwinner,sun8i-a83t-r-pinctrl",	l_1),
 	ID("allwinner,sun8i-h3-r-pinctrl",	l_1),
 	ID("allwinner,sun9i-a80-r-pinctrl",	l_3),
 	ID("allwinner,sun50i-a64-r-pinctrl",	l_1),
+	ID("allwinner,sun50i-h6-r-pinctrl",	l_1),

Should be l_2 because H6 has PM bank.

Quoted 3 lines
drivers/gpio/sunxi_gpio.c +0 -0
 	{ }
 };
Signature · 1 line
使用 K-9 Mail 发送自我的Android设备。
#4 lore raw

PATCH 2/6 sunxi: gpio: Enable support for H6 pin controller

On Thu, 16 May 2019 10:34:38 +0800
Icenowy Zheng <[email protected]> wrote:

Hi Icenowy,

thanks for having a look!

Quoted 23 lines

于 2019年5月16日 GMT+08:00 上午9:26:29, Andre Przywara <[email protected]> 写到:

Quoted 22 lines

The Allwinner H6 pin controller is not really special, at least not when it comes to normal GPIO operation.

Add the H6 compatible strings to the list of recognised strings, to make GPIOs work for H6 boards.

---
drivers/gpio/sunxi_gpio.c | 2 ++

1 file changed, 2 insertions(+)
drivers/gpio/sunxi_gpio.c +1 -0
index cbed8d42b7..780c39962a 100644
@@ -354,12 +354,14 @@ static const struct udevice_id sunxi_gpio_ids[] =
 {
 	ID("allwinner,sun8i-v3s-pinctrl",	a_all),
 	ID("allwinner,sun9i-a80-pinctrl",	a_all),
 	ID("allwinner,sun50i-a64-pinctrl",	a_all),
+	ID("allwinner,sun50i-h6-pinctrl",	a_all),
 	ID("allwinner,sun6i-a31-r-pinctrl",	l_2),
Quoted 8 lines

drivers/gpio/sunxi_gpio.c static const struct udevice_id sunxi_gpio_ids[] = { · line 364

Quoted 6 lines
drivers/gpio/sunxi_gpio.c +1 -0
 	ID("allwinner,sun8i-a23-r-pinctrl",	l_1),
 	ID("allwinner,sun8i-a83t-r-pinctrl",	l_1),
 	ID("allwinner,sun8i-h3-r-pinctrl",	l_1),
 	ID("allwinner,sun9i-a80-r-pinctrl",	l_3),
 	ID("allwinner,sun50i-a64-r-pinctrl",	l_1),
+	ID("allwinner,sun50i-h6-r-pinctrl",	l_1),  

Should be l_2 because H6 has PM bank.

Oh, indeed, I totally missed that. Thanks for pointing this out!

Cheers,
Andre

#5 lore raw

PATCH 3/6 sunxi: clocks: Add H6 USB clock gates and resets

In reply to Andre Przywara

To enable USB support in U-Boot, add the required clock and reset gates to the H6 clock driver. Once enabled, the generic EHCI/OCHI drivers will pick them up from there automatically.

---
 drivers/clk/sunxi/clk_h6.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/clk/sunxi/clk_h6.c +29 -0
index 0bb00f449a..105c15d869 100644
@@ -28,6 +28,22 @@ static struct ccu_clk_gate h6_gates[] = {
 	[CLK_BUS_SPI1]		= GATE(0x96c, BIT(1)),
 
 	[CLK_BUS_EMAC]		= GATE(0x97c, BIT(0)),
+
+	[CLK_USB_PHY0]		= GATE(0xa70, BIT(29)),
+	[CLK_USB_OHCI0]		= GATE(0xa70, BIT(31)),
+
+	[CLK_USB_PHY1]		= GATE(0xa74, BIT(29)),
+
+	[CLK_USB_HSIC]		= GATE(0xa7c, BIT(26)),
+	[CLK_USB_HSIC_12M]	= GATE(0xa7c, BIT(27)),
+	[CLK_USB_PHY3]		= GATE(0xa7c, BIT(29)),
+	[CLK_USB_OHCI3]		= GATE(0xa7c, BIT(31)),
+
+	[CLK_BUS_OHCI0]		= GATE(0xa8c, BIT(0)),
+	[CLK_BUS_OHCI3]		= GATE(0xa8c, BIT(3)),
+	[CLK_BUS_EHCI0]		= GATE(0xa8c, BIT(4)),
+	[CLK_BUS_EHCI3]		= GATE(0xa8c, BIT(7)),
+	[CLK_BUS_OTG]		= GATE(0xa8c, BIT(8)),
 };
 
 static struct ccu_reset h6_resets[] = {
@@ -43,6 +59,19 @@ static struct ccu_reset h6_resets[] = {
 	[RST_BUS_SPI1]		= RESET(0x96c, BIT(17)),
 
 	[RST_BUS_EMAC]		= RESET(0x97c, BIT(16)),
+
+	[RST_USB_PHY0]		= RESET(0xa70, BIT(30)),
+
+	[RST_USB_PHY1]		= RESET(0xa74, BIT(30)),
+
+	[RST_USB_HSIC]		= RESET(0xa7c, BIT(28)),
+	[RST_USB_PHY3]		= RESET(0xa7c, BIT(30)),
+
+	[RST_BUS_OHCI0]		= RESET(0xa8c, BIT(16)),
+	[RST_BUS_OHCI3]		= RESET(0xa8c, BIT(19)),
+	[RST_BUS_EHCI0]		= RESET(0xa8c, BIT(20)),
+	[RST_BUS_EHCI3]		= RESET(0xa8c, BIT(23)),
+	[RST_BUS_OTG]		= RESET(0xa8c, BIT(24)),
 };
 
 static const struct ccu_desc h6_ccu_desc = {
Signature · 1 line
2.14.5
#6 lore raw

PATCH 4/6 sunxi: phy: Add USB PHY support for Allwinner H6

In reply to Andre Przywara

The USB PHY used in the Allwinner H6 SoC has some pecularities (as usual), which require a small addition to the USB PHY driver:
In this case the second PHY is PHY3, not PHY1, so we need to skip number 1 and 2 in the code. Just use the respective code from Linux for that.

---
 drivers/phy/allwinner/phy-sun4i-usb.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +20 -0
index f206fa3f5d..5e8f87717f 100644
@@ -75,6 +75,7 @@ enum sun4i_usb_phy_type {
 	sun8i_h3_phy,
 	sun8i_v3s_phy,
 	sun50i_a64_phy,
+	sun50i_h6_phy,
 };
 
 struct sun4i_usb_phy_cfg {
@@ -85,6 +86,7 @@ struct sun4i_usb_phy_cfg {
 	bool dedicated_clocks;
 	bool enable_pmu_unk1;
 	bool phy0_dual_route;
+	int missing_phys;
 };
 
 struct sun4i_usb_phy_info {
@@ -349,6 +351,9 @@ static int sun4i_usb_phy_xlate(struct phy *phy,
 	if (args->args_count >= data->cfg->num_phys)
 		return -EINVAL;
 
+	if (data->cfg->missing_phys & BIT(args->args[0]))
+		return -ENODEV;
+
 	if (args->args_count)
 		phy->id = args->args[0];
 	else
@@ -429,6 +434,9 @@ static int sun4i_usb_phy_probe(struct udevice *dev)
 		struct sun4i_usb_phy_info *info = &phy_info[i];
 		char name[16];
 
+		if (data->cfg->missing_phys & BIT(i))
+			continue;
+
 		phy->gpio_vbus = sunxi_name_to_gpio(info->gpio_vbus);
 		if (phy->gpio_vbus >= 0) {
 			ret = gpio_request(phy->gpio_vbus, "usb_vbus");
@@ -583,6 +591,17 @@ static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
 	.phy0_dual_route = true,
 };
 
+static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = {
+	.num_phys = 4,
+	.type = sun50i_h6_phy,
+	.disc_thresh = 3,
+	.phyctl_offset = REG_PHYCTL_A33,
+	.dedicated_clocks = true,
+	.enable_pmu_unk1 = true,
+	.phy0_dual_route = true,
+	.missing_phys = BIT(1) | BIT(2),
+};
+
 static const struct udevice_id sun4i_usb_phy_ids[] = {
 	{ .compatible = "allwinner,sun4i-a10-usb-phy", .data = (ulong)&sun4i_a10_cfg },
 	{ .compatible = "allwinner,sun5i-a13-usb-phy", .data = (ulong)&sun5i_a13_cfg },
@@ -594,6 +613,7 @@ static const struct udevice_id sun4i_usb_phy_ids[] = {
 	{ .compatible = "allwinner,sun8i-h3-usb-phy", .data = (ulong)&sun8i_h3_cfg },
 	{ .compatible = "allwinner,sun8i-v3s-usb-phy", .data = (ulong)&sun8i_v3s_cfg },
 	{ .compatible = "allwinner,sun50i-a64-usb-phy", .data = (ulong)&sun50i_a64_cfg},
+	{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = (ulong)&sun50i_h6_cfg},
 	{ }
 };
 
Signature · 1 line
2.14.5
#7 lore raw

PATCH 4/6 sunxi: phy: Add USB PHY support for Allwinner H6

Hi,

Quoted 2 lines · Andre Przywara

The USB PHY used in the Allwinner H6 SoC has some pecularities (as usual),

Checkpatch warning:
WARNING: 'pecularities' may be misspelled - perhaps 'peculiarities'?

Quoted 78 lines

which require a small addition to the USB PHY driver:
In this case the second PHY is PHY3, not PHY1, so we need to skip number 1 and 2 in the code. Just use the respective code from Linux for that.

---
 drivers/phy/allwinner/phy-sun4i-usb.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +20 -1
index f206fa3f5d..5e8f87717f 100644
@@ -75,6 +75,7 @@ enum sun4i_usb_phy_type {
        sun8i_h3_phy,
        sun8i_v3s_phy,
        sun50i_a64_phy,
+       sun50i_h6_phy,
 };
 
 struct sun4i_usb_phy_cfg {
@@ -85,6 +86,7 @@ struct sun4i_usb_phy_cfg {
        bool dedicated_clocks;
        bool enable_pmu_unk1;
        bool phy0_dual_route;
+       int missing_phys;
 };
 
 struct sun4i_usb_phy_info {
@@ -349,6 +351,9 @@ static int sun4i_usb_phy_xlate(struct phy *phy,
        if (args->args_count >= data->cfg->num_phys)
                return -EINVAL;
 
+       if (data->cfg->missing_phys & BIT(args->args[0]))
+               return -ENODEV;
+
        if (args->args_count)
                phy->id = args->args[0];
        else
@@ -429,6 +434,9 @@ static int sun4i_usb_phy_probe(struct udevice *dev)
                struct sun4i_usb_phy_info *info = &phy_info[i];
                char name[16];
 
+               if (data->cfg->missing_phys & BIT(i))
+                       continue;
+
                phy->gpio_vbus = sunxi_name_to_gpio(info->gpio_vbus);
                if (phy->gpio_vbus >= 0) {
                        ret = gpio_request(phy->gpio_vbus, "usb_vbus");
@@ -583,6 +591,17 @@ static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
        .phy0_dual_route = true,
 };
 
+static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = {
+       .num_phys = 4,
+       .type = sun50i_h6_phy,
+       .disc_thresh = 3,
+       .phyctl_offset = REG_PHYCTL_A33,
+       .dedicated_clocks = true,
+       .enable_pmu_unk1 = true,
+       .phy0_dual_route = true,
+       .missing_phys = BIT(1) | BIT(2),
+};
+
 static const struct udevice_id sun4i_usb_phy_ids[] = {
        { .compatible = "allwinner,sun4i-a10-usb-phy", .data = (ulong)&sun4i_a10_cfg },
        { .compatible = "allwinner,sun5i-a13-usb-phy", .data = (ulong)&sun5i_a13_cfg },
@@ -594,6 +613,7 @@ static const struct udevice_id sun4i_usb_phy_ids[] = {
        { .compatible = "allwinner,sun8i-h3-usb-phy", .data = (ulong)&sun8i_h3_cfg },
        { .compatible = "allwinner,sun8i-v3s-usb-phy", .data = (ulong)&sun8i_v3s_cfg },
        { .compatible = "allwinner,sun50i-a64-usb-phy", .data = (ulong)&sun50i_a64_cfg},
+       { .compatible = "allwinner,sun50i-h6-usb-phy", .data = (ulong)&sun50i_h6_cfg},
        { }
 };
 
--

2.14.5

#8 lore raw

PATCH 5/6 sunxi: H6: Enable USB for existing boards

In reply to Andre Przywara

So far USB was not enabled for the Allwinner H6 boards, as the PHY driver was not ready and the clock gates were missing. Since this is now fixed, let's add the PHY and the OHCI/EHCI drivers to the build, for all existing H6 boards.

---
 arch/arm/mach-sunxi/Kconfig         | 1 +
 configs/beelink_gs1_defconfig       | 2 ++
 configs/orangepi_lite2_defconfig    | 2 ++
 configs/orangepi_one_plus_defconfig | 2 ++
 configs/pine_h64_defconfig          | 3 +++
 5 files changed, 10 insertions(+)
arch/arm/mach-sunxi/Kconfig +1 -0
index 1669e62a6d..ad29139545 100644
@@ -300,6 +300,7 @@ config MACH_SUN50I_H6
 	select ARM64
 	select SUPPORT_SPL
 	select FIT
+	select PHY_SUN4I_USB
 	select SPL_LOAD_FIT
 	select DRAM_SUN50I_H6
 
configs/beelink_gs1_defconfig +2 -0
index ef4dd29549..5c0f294688 100644
@@ -13,3 +13,5 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-beelink-gs1"
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
configs/orangepi_lite2_defconfig +2 -0
index e5c2846eaa..227e1ac873 100644
@@ -11,3 +11,5 @@ CONFIG_SPL_TEXT_BASE=0x20060
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-orangepi-lite2"
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
configs/orangepi_one_plus_defconfig +2 -0
index 65537c422f..2e45909e3a 100644
@@ -11,3 +11,5 @@ CONFIG_SPL_TEXT_BASE=0x20060
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-orangepi-one-plus"
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
configs/pine_h64_defconfig +3 -0
index 5ac89b462c..0c5e47bbf7 100644
@@ -12,3 +12,6 @@ CONFIG_SPL_TEXT_BASE=0x20060
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-pine-h64"
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB3_VBUS_PIN="PL5"
Signature · 1 line
2.14.5
#9 lore raw

PATCH 6/6 sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

In reply to Andre Przywara

The first USB controller on the H6 SoC shares a PHY with the OTG controller. Reportedly to avoid problems with the VBUS regulator under Linux, we don't link OHCI0/EHCI0 to the USB PHY in the H6 .dtsi file.

However on boards which can't use peripheral mode (because they have an always-on VBUS supply on an USB-A socket) we don't need this trick, and can properly connect host controller 0 to the PHY 0.

Amend the Pine H64 .dts to reflect this. This enables the upper USB port in U-Boot on this board.

---
 arch/arm/dts/sun50i-h6-pine-h64.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/dts/sun50i-h6-pine-h64.dts +4 -1
index 4802902e12..aad7646b18 100644
@@ -96,6 +96,8 @@
 };
 
 &ehci0 {
+	phys = <&usb2phy 0>;
+	phy-names = "usb";
 	status = "okay";
 };
 
@@ -120,6 +122,8 @@
 };
 
 &ohci0 {
+	phys = <&usb2phy 0>;
+	phy-names = "usb";
 	status = "okay";
 };
 
@@ -255,7 +259,6 @@
 
 &usb2otg {
 	dr_mode = "host";
-	status = "okay";
 };
 
 &usb2phy {
Signature · 1 line
2.14.5
#10 lore raw

PATCH 6/6 sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Hi,

Quoted 40 lines · Andre Przywara

The first USB controller on the H6 SoC shares a PHY with the OTG controller. Reportedly to avoid problems with the VBUS regulator under Linux, we don't link OHCI0/EHCI0 to the USB PHY in the H6 .dtsi file.

However on boards which can't use peripheral mode (because they have an always-on VBUS supply on an USB-A socket) we don't need this trick, and can properly connect host controller 0 to the PHY 0.

Amend the Pine H64 .dts to reflect this. This enables the upper USB port in U-Boot on this board.

---
 arch/arm/dts/sun50i-h6-pine-h64.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/dts/sun50i-h6-pine-h64.dts +4 -0
index 4802902e12..aad7646b18 100644
@@ -96,6 +96,8 @@
 };
 
 &ehci0 {
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
        status = "okay";
 };
 
@@ -120,6 +122,8 @@
 };
 
 &ohci0 {
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
        status = "okay";
 };
 

arch/arm/dts/sun50i-h6-pine-h64.dts line 262

Quoted 5 lines
arch/arm/dts/sun50i-h6-pine-h64.dts +0 -1
@@ -255,7 +259,6 @@
 
 &usb2otg {
        dr_mode = "host";
-       status = "okay";
 };

Maybe you should add explicit comments in the device-tree to avoid losing this at next sync with linux dt.

Regards,
Clement

Quoted 5 lines
arch/arm/dts/sun50i-h6-pine-h64.dts +0 -1
 &usb2phy {
--

2.14.5

maintainer
#11 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 6/6] sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Dne torek, 18. junij 2019 ob 19:13:16 CEST je Clément Péron napisal(a):

Quoted 54 lines

Hi,

Quoted 51 lines · Andre Przywara

The first USB controller on the H6 SoC shares a PHY with the OTG controller. Reportedly to avoid problems with the VBUS regulator under Linux, we don't link OHCI0/EHCI0 to the USB PHY in the H6 .dtsi file.

However on boards which can't use peripheral mode (because they have an always-on VBUS supply on an USB-A socket) we don't need this trick, and can properly connect host controller 0 to the PHY 0.

Amend the Pine H64 .dts to reflect this. This enables the upper USB port in U-Boot on this board.

---

 arch/arm/dts/sun50i-h6-pine-h64.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/dts/sun50i-h6-pine-h64.dts index 4802902e12..aad7646b18 100644

arch/arm/dts/sun50i-h6-pine-h64.dts +2 -0
@@ -96,6 +96,8 @@
 
 };
 
 &ehci0 {
 
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
 
        status = "okay";

};

arch/arm/dts/sun50i-h6-pine-h64.dts +2 -0
@@ -120,6 +122,8 @@
 
 };
 
 &ohci0 {
 
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
 
        status = "okay";

};

arch/arm/dts/sun50i-h6-pine-h64.dts +0 -0
@@ -255,7 +259,6 @@
 
 &usb2otg {
 
Quoted 8 lines
Quoted 5 lines
arch/arm/dts/sun50i-h6-pine-h64.dts +0 -1
        dr_mode = "host";
 
-       status = "okay";
 

};

Maybe you should add explicit comments in the device-tree to avoid losing this at next sync with linux dt.

If DT change is U-Boot specific, it should be moved to *-u-boot.dtsi file, although I'm not sure if you can delete properties in such way.

Best regards,
Jernej

Quoted 8 lines

Regards,
Clement

Quoted 4 lines

&usb2phy {

--
2.14.5

#12 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 6/6] sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Quoted 60 lines · Jernej Škrabec

Dne torek, 18. junij 2019 ob 19:13:16 CEST je Clément Péron napisal(a):

Quoted 58 lines

Hi,

Quoted 55 lines · Andre Przywara

The first USB controller on the H6 SoC shares a PHY with the OTG controller. Reportedly to avoid problems with the VBUS regulator under Linux, we don't link OHCI0/EHCI0 to the USB PHY in the H6 .dtsi file.

However on boards which can't use peripheral mode (because they have an always-on VBUS supply on an USB-A socket) we don't need this trick, and can properly connect host controller 0 to the PHY 0.

Amend the Pine H64 .dts to reflect this. This enables the upper USB port in U-Boot on this board.

---

 arch/arm/dts/sun50i-h6-pine-h64.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/dts/sun50i-h6-pine-h64.dts index 4802902e12..aad7646b18 100644

arch/arm/dts/sun50i-h6-pine-h64.dts +2 -0
@@ -96,6 +96,8 @@
 
 };
 
 &ehci0 {
 
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
 
        status = "okay";

};

arch/arm/dts/sun50i-h6-pine-h64.dts +2 -0
@@ -120,6 +122,8 @@
 
 };
 
 &ohci0 {
 
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
 
        status = "okay";

};

arch/arm/dts/sun50i-h6-pine-h64.dts +0 -1
@@ -255,7 +259,6 @@
 
 &usb2otg {
 
        dr_mode = "host";
 
-       status = "okay";
 
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

};

Maybe you should add explicit comments in the device-tree to avoid losing this at next sync with linux dt.

If DT change is U-Boot specific, it should be moved to *-u-boot.dtsi file, although I'm not sure if you can delete properties in such way.

You can use /delete-property/. Though in the case of "status", it is best to set it to "disabled", since no property is the same as "okay".

The question then becomes when the *-u-boot.dtsi file is merged in.

ChenYu

#13 lore raw

[U-Boot] [linux-sunxi] Re: [PATCH 6/6] sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

In reply to Jernej Škrabec
Quoted 1 line · Jernej Škrabec

Dne torek, 18. junij 2019 ob 19:13:16 CEST je Clément Péron napisal(a):

Hi,

Quoted 56 lines
Quoted 56 lines · Andre Przywara
Quoted 55 lines

The first USB controller on the H6 SoC shares a PHY with the OTG controller. Reportedly to avoid problems with the VBUS regulator under Linux, we don't link OHCI0/EHCI0 to the USB PHY in the H6 .dtsi file.

However on boards which can't use peripheral mode (because they have an always-on VBUS supply on an USB-A socket) we don't need this trick, and can properly connect host controller 0 to the PHY 0.

Amend the Pine H64 .dts to reflect this. This enables the upper USB port in U-Boot on this board.

---

 arch/arm/dts/sun50i-h6-pine-h64.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/dts/sun50i-h6-pine-h64.dts index 4802902e12..aad7646b18 100644

arch/arm/dts/sun50i-h6-pine-h64.dts +2 -0
@@ -96,6 +96,8 @@
 
 };
 
 &ehci0 {
 
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
 
        status = "okay";

};

arch/arm/dts/sun50i-h6-pine-h64.dts +2 -0
@@ -120,6 +122,8 @@
 
 };
 
 &ohci0 {
 
+       phys = <&usb2phy 0>;
+       phy-names = "usb";
 
        status = "okay";

};

arch/arm/dts/sun50i-h6-pine-h64.dts +0 -1
@@ -255,7 +259,6 @@
 
 &usb2otg {
 
        dr_mode = "host";
 
-       status = "okay";
 
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

};

Maybe you should add explicit comments in the device-tree to avoid losing this at next sync with linux dt.

If DT change is U-Boot specific, it should be moved to *-u-boot.dtsi file, although I'm not sure if you can delete properties in such way.

I never planned to deviate from Linux, just wanted to provide something that works, for now. This change should go into Linux as well, of course. Will push this there ASAP.

Cheers,
Andre.

Quoted 16 lines

Best regards,
Jernej

Quoted 8 lines

Regards,
Clement

Quoted 4 lines

&usb2phy {

--
2.14.5

#14 lore raw

cover sunxi: H6: Enable USB (2.0) support

In reply to Andre Przywara
Quoted 35 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Clément, can you please verify that this works for the Beelink box? I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Except 6/6 (it can be part of DTS sync during MW) and rest

#15 lore raw

cover sunxi: H6: Enable USB (2.0) support

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Works fine on my board:
U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 20 lines
Quoted 9 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Except 6/6 (it can be part of DTS sync during MW) and rest

#16 lore raw

cover sunxi: H6: Enable USB (2.0) support

Quoted 31 lines · Clément Péron

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).
Why not leave it to avoid a difference with linux?

Regards,
Clément

Quoted 38 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 20 lines
Quoted 9 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Except 6/6 (it can be part of DTS sync during MW) and rest

#17 lore raw

cover sunxi: H6: Enable USB (2.0) support

On Tue, 18 Jun 2019 19:22:34 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 32 lines · Clément Péron
Quoted 31 lines

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).

You mean dropping the status="okay"?

Yeah, I figured as well that it works both ways. Actually older kernels require the MUSB driver to be enabled, while newer kernels don't seem to care. As this affects the Debian Buster kernel (4.19, in the installer), I plan on just leaving it as it is right now.

Quoted 1 line

Why not leave it to avoid a difference with linux?

Technically we should disable it, as it's not usable and might clash with EHCI0/OHCI0, but for said reason I just keep it.

Thanks for having a look!

Cheers,
Andre.

Quoted 38 lines
Quoted 38 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 20 lines
Quoted 9 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Except 6/6 (it can be part of DTS sync during MW) and rest

#18 lore raw

cover sunxi: H6: Enable USB (2.0) support

Hi André,

Quoted 39 lines · André Przywara

On Tue, 18 Jun 2019 19:22:34 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 32 lines · Clément Péron
Quoted 31 lines

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).

You mean dropping the status="okay"?

I mean, I have tested with and without the whole patch and it works in both cases.

Quoted 10 lines

Yeah, I figured as well that it works both ways. Actually older kernels require the MUSB driver to be enabled, while newer kernels don't seem to care. As this affects the Debian Buster kernel (4.19, in the installer), I plan on just leaving it as it is right now.

Quoted 1 line

Why not leave it to avoid a difference with linux?

Technically we should disable it, as it's not usable and might clash with EHCI0/OHCI0, but for said reason I just keep it.

That's what I have in mind, if it's not mandatory just leave it as this, this will avoid differences with linux.

Regards,
Clément

Quoted 45 lines

Thanks for having a look!

Cheers,
Andre.

Quoted 38 lines
Quoted 38 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 20 lines
Quoted 9 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Except 6/6 (it can be part of DTS sync during MW) and rest

#19 lore raw

cover sunxi: H6: Enable USB (2.0) support

On Wed, 19 Jun 2019 10:57:14 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 43 lines · André Przywara
Quoted 42 lines

On Tue, 18 Jun 2019 19:22:34 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 35 lines · Clément Péron
Quoted 34 lines

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).

You mean dropping the status="okay"?

I mean, I have tested with and without the whole patch and it works in both cases.

Do you mean it works without adding "phys = <&usb2phy 0>;" to the ehci0 and ohci0 nodes?
Are you sure that USB *really* works? The boot log *always* enumerates the bus and prints one device (the root hub), but does "usb tree" show an actual connected device? The easiest test is to connect a pen drive, at which point U-Boot automatically lists the USB mass storage device in the boot log.

Quoted 11 lines
Quoted 9 lines

Yeah, I figured as well that it works both ways. Actually older kernels require the MUSB driver to be enabled, while newer kernels don't seem to care. As this affects the Debian Buster kernel (4.19, in the installer), I plan on just leaving it as it is right now.

Quoted 1 line

Why not leave it to avoid a difference with linux?

Technically we should disable it, as it's not usable and might clash with EHCI0/OHCI0, but for said reason I just keep it.

That's what I have in mind, if it's not mandatory just leave it as this, this will avoid differences with linux.

There shall be no real differences with Linux, in this case I will push those changes to Linux, so we sync this somewhat the other way. The hardware clearly connects the USB0 controller to PHY0, the DT should reflect this.

Cheers,
Andre.

Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
Quoted 38 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 20 lines
Quoted 9 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Except 6/6 (it can be part of DTS sync during MW) and rest

#20 lore raw

cover sunxi: H6: Enable USB (2.0) support

HI André,

Quoted 57 lines · Andre Przywara

On Wed, 19 Jun 2019 10:57:14 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 43 lines · André Przywara
Quoted 42 lines

On Tue, 18 Jun 2019 19:22:34 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 35 lines · Clément Péron
Quoted 34 lines

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).

You mean dropping the status="okay"?

I mean, I have tested with and without the whole patch and it works in both cases.

Quoted 7 lines

Do you mean it works without adding "phys = <&usb2phy 0>;" to the ehci0 and ohci0 nodes?
Are you sure that USB *really* works? The boot log *always* enumerates the bus and prints one device (the root hub), but does "usb tree" show an actual connected device? The easiest test is to connect a pen drive, at which point U-Boot automatically lists the USB mass storage device in the boot log.

You're right, only the root hub is enumerated.
Actually the VBUS supply on my board is directly provided by the always-on "DC Jack".
So normally this hack is not needed and the USB should work in both case which is kind of expected.
But unfortunately it's doesn't seem to work. I have tested with a storage usb and it's not listed :(
The TX UART of my board is not functional so it's a bit touchy to debug the issue.
Anyway it doesn't make the board reset so it's not blocking. I will try to investigate this later.

Regards,
Clément

Quoted 66 lines
Quoted 6 lines
Quoted 6 lines

Yeah, I figured as well that it works both ways. Actually older kernels require the MUSB driver to be enabled, while newer kernels don't seem to care. As this affects the Debian Buster kernel (4.19, in the installer), I plan on just leaving it as it is right now.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Why not leave it to avoid a difference with linux?

Technically we should disable it, as it's not usable and might clash with EHCI0/OHCI0, but for said reason I just keep it.

That's what I have in mind, if it's not mandatory just leave it as this, this will avoid differences with linux.

There shall be no real differences with Linux, in this case I will push those changes to Linux, so we sync this somewhat the other way. The hardware clearly connects the USB0 controller to PHY0, the DT should reflect this.

Cheers,
Andre.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 17 lines
Quoted 16 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Except 6/6 (it can be part of DTS sync during MW) and rest

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/20190619110302.7c4ea7e8%40donnerap.cambridge.arm.com.
For more options, visit https://groups.google.com/d/optout.

#21 lore raw

cover sunxi: H6: Enable USB (2.0) support

On 20/06/2019 19:01, Clément Péron wrote:

Hi Clément,

thanks for trying that!
...

Quoted 66 lines · Andre Przywara
Quoted 57 lines

On Wed, 19 Jun 2019 10:57:14 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 43 lines · André Przywara
Quoted 42 lines

On Tue, 18 Jun 2019 19:22:34 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 35 lines · Clément Péron
Quoted 34 lines

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).

You mean dropping the status="okay"?

I mean, I have tested with and without the whole patch and it works in both cases.

Quoted 7 lines

Do you mean it works without adding "phys = <&usb2phy 0>;" to the ehci0 and ohci0 nodes?
Are you sure that USB *really* works? The boot log *always* enumerates the bus and prints one device (the root hub), but does "usb tree" show an actual connected device? The easiest test is to connect a pen drive, at which point U-Boot automatically lists the USB mass storage device in the boot log.

Quoted 5 lines

You're right, only the root hub is enumerated.
Actually the VBUS supply on my board is directly provided by the always-on "DC Jack".
So normally this hack is not needed and the USB should work in both case which is kind of expected.

Well, the power part is one thing, but quite some boards do it like this (Pine64, for instance).
This PHY connection property is something separate, it's just needed for U-Boot, because the driver will bail out if it cannot find a PHY. It's a driver shortcoming, if you like, checkout ehci_setup_phy() in drivers/usb/host/ehci-hcd.c and it's call site in drivers/usb/host/ehci-generic.c:ehci_usb_probe().

Quoted 2 lines

But unfortunately it's doesn't seem to work. I have tested with a storage usb and it's not listed :(

Mmmh, interesting. Does it work in Linux?
Also, did you ever try FEL booting, using this port and an A-to-A cable? Just asking to make sure that USB 2.0 port is actually USB0, and not the other USB 2.0 port on the SoC (USB3).

Quoted 2 lines

The TX UART of my board is not functional so it's a bit touchy to debug the issue.

Ah, same as on the Eachlink H6 Mini, then. Did you see what Sven and I came up with?
http://linux-sunxi.org/Eachlink_H6_Mini#Adding_a_serial_port_.28might_void_warranty.3F.29

Quoted 2 lines

Anyway it doesn't make the board reset so it's not blocking. I will try to investigate this later.

OK, thanks!

Cheers,
Andre.

Quoted 65 lines
Quoted 65 lines
Quoted 11 lines
Quoted 9 lines

Yeah, I figured as well that it works both ways. Actually older kernels require the MUSB driver to be enabled, while newer kernels don't seem to care. As this affects the Debian Buster kernel (4.19, in the installer), I plan on just leaving it as it is right now.

Quoted 1 line

Why not leave it to avoid a difference with linux?

Technically we should disable it, as it's not usable and might clash with EHCI0/OHCI0, but for said reason I just keep it.

That's what I have in mind, if it's not mandatory just leave it as this, this will avoid differences with linux.

There shall be no real differences with Linux, in this case I will push those changes to Linux, so we sync this somewhat the other way. The hardware clearly connects the USB0 controller to PHY0, the DT should reflect this.

Cheers,
Andre.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 17 lines
Quoted 16 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Except 6/6 (it can be part of DTS sync during MW) and rest

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/20190619110302.7c4ea7e8%40donnerap.cambridge.arm.com.
For more options, visit https://groups.google.com/d/optout.

#22 lore raw

cover sunxi: H6: Enable USB (2.0) support

Hi André,

Quoted 88 lines · André Przywara

On 20/06/2019 19:01, Clément Péron wrote:

Hi Clément,

thanks for trying that!
...

Quoted 66 lines · Andre Przywara
Quoted 57 lines

On Wed, 19 Jun 2019 10:57:14 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 43 lines · André Przywara
Quoted 42 lines

On Tue, 18 Jun 2019 19:22:34 +0200
Clément Péron <[email protected]> wrote:

Hi,

Quoted 35 lines · Clément Péron
Quoted 34 lines

Hi Andre,

Quoted 27 lines · Jagan Teki
Quoted 25 lines · Andre Przywara

Hi,

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Quoted 1 line
Quoted 1 line

Clément, can you please verify that this works for the Beelink box?

Thank you for the notice.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Works fine on my board:

I have tested with and without the trick in usb2otg node and both seems working. (only tested usb start; usb tree).

You mean dropping the status="okay"?

I mean, I have tested with and without the whole patch and it works in both cases.

Quoted 7 lines

Do you mean it works without adding "phys = <&usb2phy 0>;" to the ehci0 and ohci0 nodes?
Are you sure that USB *really* works? The boot log *always* enumerates the bus and prints one device (the root hub), but does "usb tree" show an actual connected device? The easiest test is to connect a pen drive, at which point U-Boot automatically lists the USB mass storage device in the boot log.

Quoted 5 lines

You're right, only the root hub is enumerated.
Actually the VBUS supply on my board is directly provided by the always-on "DC Jack".
So normally this hack is not needed and the USB should work in both case which is kind of expected.

Well, the power part is one thing, but quite some boards do it like this (Pine64, for instance).
This PHY connection property is something separate, it's just needed for U-Boot, because the driver will bail out if it cannot find a PHY. It's a driver shortcoming, if you like, checkout ehci_setup_phy() in drivers/usb/host/ehci-hcd.c and it's call site in drivers/usb/host/ehci-generic.c:ehci_usb_probe().

Quoted 4 lines
Quoted 2 lines

But unfortunately it's doesn't seem to work. I have tested with a storage usb and it's not listed :(

Mmmh, interesting. Does it work in Linux?

Yes complete bootlog : https://pastebin.com/2kUZR23B
I have tested with 3 USB keys and none are listed in USB Storage Devices found.

Quoted 1 line

Also, did you ever try FEL booting, using this port and an A-to-A cable?

Only with the PhoenixUsb Tools for recovering the original ROM.

Quoted 2 lines

Just asking to make sure that USB 2.0 port is actually USB0, and not the other USB 2.0 port on the SoC (USB3).

There is only 1 USB 2.0 Port on this board and yes it's the USB0.

Quoted 7 lines
Quoted 3 lines

The TX UART of my board is not functional so it's a bit touchy to debug the issue.

Ah, same as on the Eachlink H6 Mini, then. Did you see what Sven and I came up with?
http://linux-sunxi.org/Eachlink_H6_Mini#Adding_a_serial_port_.28might_void_warranty.3F.29

Thanks for the link but I have burnt the pin myself.
It was working at the beggining but one day I have misplugged the pins and this GPIO is now unusable :(.
I should try to switch to the BT UART the day I really need it.

Regards,
Clément

Quoted 75 lines
Quoted 3 lines

Anyway it doesn't make the board reset so it's not blocking. I will try to investigate this later.

OK, thanks!

Cheers,
Andre.

Quoted 65 lines
Quoted 65 lines
Quoted 11 lines
Quoted 9 lines

Yeah, I figured as well that it works both ways. Actually older kernels require the MUSB driver to be enabled, while newer kernels don't seem to care. As this affects the Debian Buster kernel (4.19, in the installer), I plan on just leaving it as it is right now.

Quoted 1 line

Why not leave it to avoid a difference with linux?

Technically we should disable it, as it's not usable and might clash with EHCI0/OHCI0, but for said reason I just keep it.

That's what I have in mind, if it's not mandatory just leave it as this, this will avoid differences with linux.

There shall be no real differences with Linux, in this case I will push those changes to Linux, so we sync this somewhat the other way. The hardware clearly connects the USB0 controller to PHY0, the DT should reflect this.

Cheers,
Andre.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines

U-Boot 2019.07-rc4 (Jun 18 2019 - 19:06:21 +0200) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: Beelink GS1
DRAM:  2 GiB
MMC:   mmc at 4020000: 0, mmc at 4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial at 5000000
Out:   serial at 5000000
Err:   serial at 5000000
Net:   No ethernet found.

starting USB...
Bus usb at 5101000: USB EHCI 1.00
Bus usb at 5101400: USB OHCI 1.0
scanning bus usb at 5101000 for devices... 1 USB Device(s) found

Regards,
Clément

Quoted 17 lines
Quoted 16 lines

I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Except 6/6 (it can be part of DTS sync during MW) and rest

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/20190619110302.7c4ea7e8%40donnerap.cambridge.arm.com.
For more options, visit https://groups.google.com/d/optout.

#23 lore raw

cover sunxi: H6: Enable USB (2.0) support

In reply to Jagan Teki
Quoted 1 line · Jagan Teki

On Thu, May 16, 2019 at 6:56 AM Andre Przywara <[email protected]> wrote:

Hi,

Quoted 40 lines
Quoted 32 lines

this series enables USB support on the H6 boards. This is mostly just adding some missing pieces here and there, the actual controller and PHY are very similar to the previous ones, if not identical. This is for the 2.0 ports only at the moment, USB 3.0 will be done later (started porting Icenowy's Linux driver).
The Pine H64 shares a similar problem as the Pine64+ boards regarding the upper USB port. To enable this port, we need the first patch from the series [1] fixing this issue on the A64 boards.

Patch 1 is a drive-by patch to bring SUNXI_GPIO to Kconfig, as this was lingering in one of my branches for a while.
Patch 2 enables GPIO support for the H6, as this is needed for the Pine H64 to enable the VBUS regulator.
Patch 3 adds the clock and reset gates mappings for the USB controller and the PHY, the values are taken from the manual and verified against Linux.
Patch 4 adds some code to the PHY driver to skip over not implemented PHYs, as the H6 uses a PHY0/PHY3 combination in the DT.
Patch 5 then eventually enables USB in the existing defconfigs. Patch 6 adds the .dts fixes required to get the upper USB port to work on the Pine H64.

Clément, can you please verify that this works for the Beelink box? I guess the USB 2.0 port is probably the OTG one, so this setup would look somewhat similar to the PineH64, which would allow you to copy the USB DT nodes from there.

Cheers,
Andre.

[1] https://lists.denx.de/pipermail/u-boot/2019-May/369520.html

Quoted 7 lines

Andre Przywara (6):
sunxi: move SUNXI_GPIO to Kconfig
sunxi: gpio: Enable support for H6 pin controller
sunxi: clocks: Add H6 USB clock gates and resets
sunxi: phy: Add USB PHY support for Allwinner H6
sunxi: H6: Enable USB for existing boards
sunxi: Pine64: DTS: enable USB PHY 0 for HCI0

Quoted 3 lines

Except 6/6 (it can be part of DTS sync during MW) and rest

Thanks Jagan!
I will do some minor fixes and drop the DT part in a v2, to be send as soon as possible.

Cheers,
Andre.