arm64: sunxi: h616: Add USB support
cover arm64: sunxi: h616: Add USB support
The USB IP used in the Allwinner H616 SoC is very similar to the one used in the H3 chip: it contains four USB 2.0 host controllers and four PHYs, where the first PHY is shared with a separate USB-OTG controller.
But out of the four ports, only port 2 works out of the box, the other ports require some resources and registers of port 2 to be enabled as well.
Implement the required workaround in the Allwinner USB PHY driver, and key this off the respective compatible string. This core code is contained in patch 3/7. The first two patches add the respective DT binding documentation, whereas patch 4/7 encodes all the configuration options for the H616 USB PHY into the driver.
The last three patches add the respective devicetree nodes, to the H616 .dtsi, but also to the DTs of the two supported boards.
This allows USB to be used on any H616 based machine. This was tested on the X96 Mate box.
This series is an update on what was included in earlier versions of the initial H616 support series, but was later dropped to get the basic support in first more quickly.
It is now based on v6.0-rc4 and is also available here:
https://github.com/apritzel/linux/commits/h616-usb
Please have a look and test on your hardware, especically on all ports exposed on header pins of the OrangePi Zero2 board.
Cheers,
Andre
Andre Przywara (7):
dt-bindings: usb: Add H616 compatible string
dt-bindings: usb: Add special clock for Allwinner H616 PHY
phy: sun4i-usb: Introduce port2 SIDDQ quirk
phy: sun4i-usb: Add support for the H616 USB PHY
arm64: dts: allwinner: h616: Add USB nodes
arm64: dts: allwinner: h616: OrangePi Zero 2: Add USB nodes
arm64: dts: allwinner: h616: X96 Mate: Add USB nodes
.../phy/allwinner,sun8i-h3-usb-phy.yaml | 19 +++ .../devicetree/bindings/usb/generic-ehci.yaml | 1 + .../devicetree/bindings/usb/generic-ohci.yaml | 1 + .../allwinner/sun50i-h616-orangepi-zero2.dts | 42 +++++ .../dts/allwinner/sun50i-h616-x96-mate.dts | 25 +++ .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 160 ++++++++++++++++++ drivers/phy/allwinner/phy-sun4i-usb.c | 71 ++++++++ 7 files changed, 319 insertions(+)
Signature · 1 line
2.35.3
PATCH 2/7 dt-bindings: usb: Add special clock for Allwinner H616 PHY
The USB PHY IP in the Allwinner H616 SoC requires a quirk that involves some resources from port 2's PHY and HCI IP. In particular the PMU clock for port 2 must be surely ungated before accessing the REG_HCI_PHY_CTL register of port 2. To allow each USB port to be controlled independently of port 2, we need a handle to that particular PMU clock in the *PHY* node, as the HCI and PHY part might be handled by separate drivers.
Add that clock to the requirements of the H616 PHY binding, so that a PHY driver can apply the quirk in isolation, without requiring help from port 2's HCI driver.
--- .../phy/allwinner,sun8i-h3-usb-phy.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml +19 -0
@@ -36,18 +36,22 @@ properties: - const: pmu3 clocks: + minItems: 4 items: - description: USB OTG PHY bus clock - description: USB Host 0 PHY bus clock - description: USB Host 1 PHY bus clock - description: USB Host 2 PHY bus clock + - description: PMU clock for host port 2 clock-names: + minItems: 4 items: - const: usb0_phy - const: usb1_phy - const: usb2_phy - const: usb3_phy + - const: pmu2_clk resets: items:
@@ -98,6 +102,21 @@ required: additionalProperties: false +if: + properties: + compatible: + contains: + enum: + - sun50i-h616-usb-phy + +then: + properties: + clocks: + minItems: 5 + + clock-names: + minItems: 5 + examples: - | #include <dt-bindings/gpio/gpio.h>
Signature · 1 line
2.35.3
PATCH 1/7 dt-bindings: usb: Add H616 compatible string
In reply to Andre PrzywaraThe Allwinner H616 contains four fully OHCI/EHCI compatible USB host controllers, so just add their compatible strings to the list of generic OHCI/EHCI controllers.
--- Documentation/devicetree/bindings/usb/generic-ehci.yaml | 1 + Documentation/devicetree/bindings/usb/generic-ohci.yaml | 1 + 2 files changed, 2 insertions(+)
Documentation/devicetree/bindings/usb/generic-ehci.yaml +1 -0
@@ -30,6 +30,7 @@ properties: - allwinner,sun4i-a10-ehci - allwinner,sun50i-a64-ehci - allwinner,sun50i-h6-ehci + - allwinner,sun50i-h616-ehci - allwinner,sun5i-a13-ehci - allwinner,sun6i-a31-ehci - allwinner,sun7i-a20-ehci
Documentation/devicetree/bindings/usb/generic-ohci.yaml +1 -0
@@ -20,6 +20,7 @@ properties: - allwinner,sun4i-a10-ohci - allwinner,sun50i-a64-ohci - allwinner,sun50i-h6-ohci + - allwinner,sun50i-h616-ohci - allwinner,sun5i-a13-ohci - allwinner,sun6i-a31-ohci - allwinner,sun7i-a20-ohci
Signature · 1 line
2.35.3
PATCH 3/7 phy: sun4i-usb: Introduce port2 SIDDQ quirk
In reply to Andre PrzywaraAt least the Allwinner H616 SoC requires a weird quirk to make most USB PHYs work: Only port2 works out of the box, but all other ports need some help from this port2 to work correctly: The CLK_BUS_PHY2 and RST_USB_PHY2 clock and reset need to be enabled, and the SIDDQ bit in the PMU PHY control register needs to be cleared. For this register to be accessible, CLK_BUS_ECHI2 needs to be ungated. Don't ask ....
Instead of disguising this as some generic feature, treat it more like a quirk (what it really is):
If the quirk bit is set, and we initialise a PHY other than PHY2, ungate this one special clock, and clear the SIDDQ bit. We also pick the clock and reset from PHY2 and enable them as well.
--- drivers/phy/allwinner/phy-sun4i-usb.c | 59 +++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +59 -0
@@ -120,6 +120,7 @@ struct sun4i_usb_phy_cfg {u8 phyctl_offset;bool dedicated_clocks;bool phy0_dual_route; +bool needs_phy2_siddq;int missing_phys; };
@@ -289,6 +290,50 @@ static int sun4i_usb_phy_init(struct phy *_phy)return ret; } +/* Some PHYs on some SoCs need the help of PHY2 to work. */ +if (data->cfg->needs_phy2_siddq && phy->index !=2 ) { +struct sun4i_usb_phy *phy2 = &data->phys[2 ]; + + ret =clk_prepare_enable (phy2->clk); +if (ret) { +reset_control_assert (phy->reset); +clk_disable_unprepare (phy->clk2); +clk_disable_unprepare (phy->clk); +return ret; + } + + ret =reset_control_deassert (phy2->reset); +if (ret) { +clk_disable_unprepare (phy2->clk); +reset_control_assert (phy->reset); +clk_disable_unprepare (phy->clk2); +clk_disable_unprepare (phy->clk); +return ret; + } + +/* +* This extra clock is just needed to access the +* REG_HCI_PHY_CTL PMU register for PHY2. +*/ + ret =clk_prepare_enable (phy2->clk2); +if (ret) { +reset_control_assert (phy2->reset); +clk_disable_unprepare (phy2->clk); +reset_control_assert (phy->reset); +clk_disable_unprepare (phy->clk2); +clk_disable_unprepare (phy->clk); +return ret; + } + +if (phy2->pmu && data->cfg->hci_phy_ctl_clear) { + val =readl (phy2->pmu +REG_HCI_PHY_CTL ); + val &= ~data->cfg->hci_phy_ctl_clear; +writel (val, phy2->pmu +REG_HCI_PHY_CTL ); + } + +clk_disable_unprepare (phy->clk2); + } +if (phy->pmu && data->cfg->hci_phy_ctl_clear) { val =readl (phy->pmu +REG_HCI_PHY_CTL ); val &= ~data->cfg->hci_phy_ctl_clear;
@@ -354,6 +399,13 @@ static int sun4i_usb_phy_exit(struct phy *_phy) data->phy0_init = false; } +if (data->cfg->needs_phy2_siddq && phy->index !=2 ) { +struct sun4i_usb_phy *phy2 = &data->phys[2 ]; + +clk_disable_unprepare (phy2->clk); +reset_control_assert (phy2->reset); + } +sun4i_usb_phy_passby (phy,0 );reset_control_assert (phy->reset);clk_disable_unprepare (phy->clk2);
@@ -785,6 +837,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)dev_err (dev,"failed to get clock %s\n" , name);return PTR_ERR (phy->clk2); } + }else { +snprintf (name,sizeof (name),"pmu%d_clk" , i); + phy->clk2 =devm_clk_get_optional (dev, name); +if (IS_ERR (phy->clk2)) { +dev_err (dev,"failed to get clock %s\n" , name); +return PTR_ERR (phy->clk2); + } }snprintf (name,sizeof (name),"usb%d_reset" , i);
Signature · 1 line
2.35.3
PATCH 4/7 phy: sun4i-usb: Add support for the H616 USB PHY
In reply to Andre PrzywaraThe USB PHY used in the Allwinner H616 SoC inherits some traits from its various predecessors: it has four full PHYs like the H3, needs some extra bits to be set like the H6, and puts SIDDQ on a different bit like the A100. Plus it needs this weird PHY2 quirk.
Name all those properties in a new config struct and assign a new compatible name to it.
--- drivers/phy/allwinner/phy-sun4i-usb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/phy/allwinner/phy-sun4i-usb.c +12 -0
@@ -1032,6 +1032,17 @@ static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = { .missing_phys = BIT(1) | BIT(2), }; +static const struct sun4i_usb_phy_cfg sun50i_h616_cfg = { + .num_phys =4 , + .type = sun50i_h6_phy, + .disc_thresh =3 , + .phyctl_offset =REG_PHYCTL_A33 , + .dedicated_clocks = true, + .phy0_dual_route = true, + .hci_phy_ctl_clear =PHY_CTL_SIDDQ , + .needs_phy2_siddq = true, +}; +static const struct of_device_id sun4i_usb_phy_of_match[] = { { .compatible ="allwinner,sun4i-a10-usb-phy" , .data = &sun4i_a10_cfg }, { .compatible ="allwinner,sun5i-a13-usb-phy" , .data = &sun5i_a13_cfg },
@@ -1047,6 +1058,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = { { .compatible = "allwinner,sun50i-a64-usb-phy", .data = &sun50i_a64_cfg}, { .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg }, + { .compatible = "allwinner,sun50i-h616-usb-phy", .data = &sun50i_h616_cfg }, { }, };MODULE_DEVICE_TABLE (of, sun4i_usb_phy_of_match);
Signature · 1 line
2.35.3
PATCH 5/7 arm64: dts: allwinner: h616: Add USB nodes
In reply to Andre PrzywaraAdd the nodes for the MUSB and the four USB host controllers to the SoC .dtsi, along with the PHY node needed to bind all of them together.
EHCI/OHCI and MUSB are compatible to previous SoCs, but the PHY requires some quirks (handled in the driver).
--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +160 -0
@@ -504,6 +504,166 @@ mdio0: mdio { }; }; + usbotg: usb@5100000 { + compatible = "allwinner,sun50i-h616-musb", + "allwinner,sun8i-h3-musb"; + reg = <0x05100000 0x0400>; + clocks = <&ccu CLK_BUS_OTG>; + resets = <&ccu RST_BUS_OTG>; + interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "mc"; + phys = <&usbphy 0>; + phy-names = "usb"; + extcon = <&usbphy 0>; + status = "disabled"; + }; + + usbphy: phy@5100400 { + compatible = "allwinner,sun50i-h616-usb-phy"; + reg = <0x05100400 0x24>, + <0x05101800 0x14>, + <0x05200800 0x14>, + <0x05310800 0x14>, + <0x05311800 0x14>; + reg-names = "phy_ctrl", + "pmu0", + "pmu1", + "pmu2", + "pmu3"; + clocks = <&ccu CLK_USB_PHY0>, + <&ccu CLK_USB_PHY1>, + <&ccu CLK_USB_PHY2>, + <&ccu CLK_USB_PHY3>, + <&ccu CLK_BUS_EHCI2>; + clock-names = "usb0_phy", + "usb1_phy", + "usb2_phy", + "usb3_phy", + "pmu2_clk"; + resets = <&ccu RST_USB_PHY0>, + <&ccu RST_USB_PHY1>, + <&ccu RST_USB_PHY2>, + <&ccu RST_USB_PHY3>; + reset-names = "usb0_reset", + "usb1_reset", + "usb2_reset", + "usb3_reset"; + status = "disabled"; + #phy-cells = <1>; + }; + + ehci0: usb@5101000 { + compatible = "allwinner,sun50i-h616-ehci", + "generic-ehci"; + reg = <0x05101000 0x100>; + interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI0>, + <&ccu CLK_BUS_EHCI0>, + <&ccu CLK_USB_OHCI0>; + resets = <&ccu RST_BUS_OHCI0>, + <&ccu RST_BUS_EHCI0>; + phys = <&usbphy 0>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci0: usb@5101400 { + compatible = "allwinner,sun50i-h616-ohci", + "generic-ohci"; + reg = <0x05101400 0x100>; + interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI0>, + <&ccu CLK_USB_OHCI0>; + resets = <&ccu RST_BUS_OHCI0>; + phys = <&usbphy 0>; + phy-names = "usb"; + status = "disabled"; + }; + + ehci1: usb@5200000 { + compatible = "allwinner,sun50i-h616-ehci", + "generic-ehci"; + reg = <0x05200000 0x100>; + interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI1>, + <&ccu CLK_BUS_EHCI1>, + <&ccu CLK_USB_OHCI1>; + resets = <&ccu RST_BUS_OHCI1>, + <&ccu RST_BUS_EHCI1>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci1: usb@5200400 { + compatible = "allwinner,sun50i-h616-ohci", + "generic-ohci"; + reg = <0x05200400 0x100>; + interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI1>, + <&ccu CLK_USB_OHCI1>; + resets = <&ccu RST_BUS_OHCI1>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + + ehci2: usb@5310000 { + compatible = "allwinner,sun50i-h616-ehci", + "generic-ehci"; + reg = <0x05310000 0x100>; + interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI2>, + <&ccu CLK_BUS_EHCI2>, + <&ccu CLK_USB_OHCI2>; + resets = <&ccu RST_BUS_OHCI2>, + <&ccu RST_BUS_EHCI2>; + phys = <&usbphy 2>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci2: usb@5310400 { + compatible = "allwinner,sun50i-h616-ohci", + "generic-ohci"; + reg = <0x05310400 0x100>; + interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI2>, + <&ccu CLK_USB_OHCI2>; + resets = <&ccu RST_BUS_OHCI2>; + phys = <&usbphy 2>; + phy-names = "usb"; + status = "disabled"; + }; + + ehci3: usb@5311000 { + compatible = "allwinner,sun50i-h616-ehci", + "generic-ehci"; + reg = <0x05311000 0x100>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI3>, + <&ccu CLK_BUS_EHCI3>, + <&ccu CLK_USB_OHCI3>; + resets = <&ccu RST_BUS_OHCI3>, + <&ccu RST_BUS_EHCI3>; + phys = <&usbphy 3>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci3: usb@5311400 { + compatible = "allwinner,sun50i-h616-ohci", + "generic-ohci"; + reg = <0x05311400 0x100>; + interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_OHCI3>, + <&ccu CLK_USB_OHCI3>; + resets = <&ccu RST_BUS_OHCI3>; + phys = <&usbphy 3>; + phy-names = "usb"; + status = "disabled"; + }; + rtc: rtc@7000000 { compatible = "allwinner,sun50i-h616-rtc"; reg = <0x07000000 0x400>;
Signature · 1 line
2.35.3
PATCH 6/7 arm64: dts: allwinner: h616: OrangePi Zero 2: Add USB nodes
In reply to Andre PrzywaraThe OrangePi Zero 2 has one USB-A host port, VBUS is provided by a GPIO controlled regulator.
The USB-C port is meant to power the board, but is also connected to the USB 0 port, which we configure as an MUSB peripheral.
--- .../allwinner/sun50i-h616-orangepi-zero2.dts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts +42 -0
@@ -49,8 +49,25 @@ reg_vcc5v: vcc5v { regulator-max-microvolt = <5000000>; regulator-always-on; }; + + reg_usb1_vbus: usb1-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb1-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_vcc5v>; + enable-active-high; + gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */ + status = "okay"; + }; }; +&ehci1 { + status = "okay"; +}; + +/* USB 2 & 3 are on headers only. */ + &emac0 { pinctrl-names = "default"; pinctrl-0 = <&ext_rgmii_pins>;
@@ -76,6 +93,10 @@ &mmc0 { status = "okay"; }; +&ohci1 { + status = "okay"; +}; + &r_rsb { status = "okay";
@@ -211,3 +232,24 @@ &uart0 { pinctrl-0 = <&uart0_ph_pins>; status = "okay"; }; + +&usbotg { + /* + * PHY0 pins are connected to a USB-C socket, but a role switch + * is not implemented: both CC pins are pulled to GND. + * The VBUS pins power the device, so a fixed peripheral mode + * is the best choice. + * The board can be powered via GPIOs, in this case port0 *can* + * act as a host (with a cable/adapter ignoring CC), as VBUS is + * then provided by the GPIOs. Any user of this setup would + * need to adjust the DT accordingly: dr_mode set to "host", + * enabling OHCI0 and EHCI0. + */ + dr_mode = "peripheral"; + status = "okay"; +}; + +&usbphy { + usb1_vbus-supply = <®_usb1_vbus>; + status = "okay"; +};
Signature · 1 line
2.35.3
PATCH 7/7 arm64: dts: allwinner: h616: X96 Mate: Add USB nodes
In reply to Andre PrzywaraThe X96 Mate TV box has two USB-A ports, VBUS is always on and connected to the DC input.
Since USB port 0 is connected to an USB-A receptable, we configure it as a host port. Using it as a peripheral is dangerous, because VBUS is always on.
--- .../dts/allwinner/sun50i-h616-x96-mate.dts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h616-x96-mate.dts +25 -0
@@ -32,6 +32,14 @@ reg_vcc5v: vcc5v { }; }; +&ehci0 { + status = "okay"; +}; + +&ehci2 { + status = "okay"; +}; + &ir { status = "okay"; };
@@ -54,6 +62,14 @@ &mmc2 { status = "okay"; }; +&ohci0 { + status = "okay"; +}; + +&ohci2 { + status = "okay"; +}; + &r_rsb { status = "okay";
@@ -175,3 +191,12 @@ &uart0 { pinctrl-0 = <&uart0_ph_pins>; status = "okay"; }; + +&usbotg { + dr_mode = "host"; /* USB A type receptable */ + status = "okay"; +}; + +&usbphy { + status = "okay"; +};
Signature · 1 line
2.35.3
Re: [PATCH 2/7] dt-bindings: usb: Add special clock for Allwinner H616 PHY
In reply to Andre PrzywaraOn 12/09/2022 01:59, Andre Przywara wrote:
Thank you for your patch. There is something to discuss/improve.
Quoted 21 lines
clocks:
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml +4
-0+ minItems: 4 items: - description: USB OTG PHY bus clock - description: USB Host 0 PHY bus clock - description: USB Host 1 PHY bus clock - description: USB Host 2 PHY bus clock + - description: PMU clock for host port 2 clock-names: + minItems: 4 items: - const: usb0_phy - const: usb1_phy - const: usb2_phy - const: usb3_phy + - const: pmu2_clk resets: items:
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml required: · line 105
Quoted 4 lines
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml +1
-0@@ -98,6 +102,21 @@ required: additionalProperties: false +if:
Please enclose it within allOf: block. Helps to reduce indentation changes later when this grows.
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml required: · line 118
Quoted 13 lines
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml +13
-0+ properties: + compatible: + contains: + enum: + - sun50i-h616-usb-phy + +then: + properties: + clocks: + minItems: 5 + + clock-names: + minItems: 5
I assume other variants do not have this clock? If correct, then:
else:
clocks:
maxItems: 4
and the same for clock-names
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml required: · line 122
Quoted 4 lines
Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml +1
-0+ examples: - | #include <dt-bindings/gpio/gpio.h>
Best regards,
Krzysztof
Re: [PATCH 1/7] dt-bindings: usb: Add H616 compatible string
In reply to Andre PrzywaraQuoted 5 lines · Andre Przywara
The Allwinner H616 contains four fully OHCI/EHCI compatible USB host controllers, so just add their compatible strings to the list of generic OHCI/EHCI controllers.
Signed-off-by Andre Przywara <[email protected]>
Best regards,
Krzysztof
Re: [PATCH 6/7] arm64: dts: allwinner: h616: OrangePi Zero 2: Add USB nodes
In reply to Andre PrzywaraQuoted 15 lines · Andre Przywara
The OrangePi Zero 2 has one USB-A host port, VBUS is provided by a GPIO controlled regulator.
The USB-C port is meant to power the board, but is also connected to the USB 0 port, which we configure as an MUSB peripheral.Signed-off-by Andre Przywara <[email protected]>--- .../allwinner/sun50i-h616-orangepi-zero2.dts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts +0
-0
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts reg_vcc5v: vcc5v { · line 53
Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts +2
-0@@ -49,8 +49,25 @@ reg_vcc5v: vcc5v { regulator-max-microvolt = <5000000>; regulator-always-on; }; + + reg_usb1_vbus: usb1-vbus {
Generic node names, so at least generic prefix/suffix (regulator-usb1-vbus)
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts reg_vcc5v: vcc5v { · line 61
Quoted 8 lines
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts +8
-0+ compatible = "regulator-fixed"; + regulator-name = "usb1-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_vcc5v>; + enable-active-high; + gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */ + status = "okay";
No need for status.
Best regards,
Krzysztof
Vinod Koul
maintainerRe: [PATCH 2/7] dt-bindings: usb: Add special clock for Allwinner H616 PHY
In reply to Andre PrzywaraQuoted 11 lines · Andre Przywara
The USB PHY IP in the Allwinner H616 SoC requires a quirk that involves some resources from port 2's PHY and HCI IP. In particular the PMU clock for port 2 must be surely ungated before accessing the
REG_HCI_PHY_CTLregister of port 2. To allow each USB port to be controlled independently of port 2, we need a handle to that particular PMU clock in the *PHY* node, as the HCI and PHY part might be handled by separate drivers.Add that clock to the requirements of the H616 PHY binding, so that a PHY driver can apply the quirk in isolation, without requiring help from port 2's HCI driver.
This is phy binding patch and not a usb one, pls fix the subystem name for patch
Quoted 57 lines
Signed-off-by Andre Przywara <[email protected]>--- .../phy/allwinner,sun8i-h3-usb-phy.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Documentation/devicetree/bindings/phy/allwinner,sun8i-h3-usb-phy.yaml +19
-0@@ -36,18 +36,22 @@ properties: - const: pmu3 clocks: + minItems: 4 items: - description: USB OTG PHY bus clock - description: USB Host 0 PHY bus clock - description: USB Host 1 PHY bus clock - description: USB Host 2 PHY bus clock + - description: PMU clock for host port 2 clock-names: + minItems: 4 items: - const: usb0_phy - const: usb1_phy - const: usb2_phy - const: usb3_phy + - const: pmu2_clk resets: items:@@ -98,6 +102,21 @@ required: additionalProperties: false +if: + properties: + compatible: + contains: + enum: + - sun50i-h616-usb-phy + +then: + properties: + clocks: + minItems: 5 + + clock-names: + minItems: 5 + examples: - | #include <dt-bindings/gpio/gpio.h>Signature · 1 line
2.35.3
Signature · 1 line
~Vinod
On 09/12, Andre Przywara wrote:
<snip>
Quoted 2 lines
Please have a look and test on your hardware, especically on all ports exposed on header pins of the OrangePi Zero2 board.
I tested this patch set on an OrangePi Zero 2 with each of the USB ports:
Port 0: I tested this with a UART gadget to make sure I could access a console over the port. Ports 1-3: I tested these with a USB memory stick - I was able to see the device and mount a partition.
As would be expected: for ports 2-3 I had to enable the ohci and ehci entries in the target dts file to test them.
Karl