2022-04-25 17:17:02

by Michael Riesch

[permalink] [raw]
Subject: [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
device tree.

Signed-off-by: Michael Riesch <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 55e6dcb948cc..f611aaf2d238 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -266,7 +266,7 @@ usb_host0_xhci: usb@fcc00000 {
<&cru ACLK_USB3OTG0>;
clock-names = "ref_clk", "suspend_clk",
"bus_clk";
- dr_mode = "host";
+ dr_mode = "otg";
phy_type = "utmi_wide";
power-domains = <&power RK3568_PD_PIPE>;
resets = <&cru SRST_USB3OTG0>;
--
2.30.2


2022-04-25 18:45:49

by Michael Riesch

[permalink] [raw]
Subject: [PATCH 2/3] arm64: dts: rockchip: add usb3 support to the radxa rock3 model a

The Radxa ROCK3 Model A features one USB 3.0 host port and one USB 3.0
OTG/DRD port. Enable them in the device tree.

Signed-off-by: Michael Riesch <[email protected]>
---
.../boot/dts/rockchip/rk3568-rock-3a.dts | 46 +++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
index 53cf444ecb04..d7e2bc96fde7 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
@@ -96,6 +96,26 @@ vcc5v0_usb_host: vcc5v0-usb-host {
regulator-max-microvolt = <5000000>;
vin-supply = <&vcc5v0_usb>;
};
+
+ vcc5v0_usb_otg: vcc5v0-usb-otg {
+ compatible = "regulator-fixed";
+ enable-active-high;
+ gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&vcc5v0_usb_otg_en>;
+ regulator-name = "vcc5v0_usb_otg";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&vcc5v0_usb>;
+ };
+};
+
+&combphy0 {
+ status = "okay";
+};
+
+&combphy1 {
+ status = "okay";
};

&cpu0 {
@@ -416,6 +436,9 @@ usb {
vcc5v0_usb_host_en: vcc5v0_usb_host_en {
rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
};
+ vcc5v0_usb_otg_en: vcc5v0_usb_otg_en {
+ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
};
};

@@ -479,6 +502,11 @@ &usb_host0_ohci {
status = "okay";
};

+&usb_host0_xhci {
+ extcon = <&usb2phy0>;
+ status = "okay";
+};
+
&usb_host1_ehci {
status = "okay";
};
@@ -487,6 +515,24 @@ &usb_host1_ohci {
status = "okay";
};

+&usb_host1_xhci {
+ status = "okay";
+};
+
+&usb2phy0 {
+ status = "okay";
+};
+
+&usb2phy0_host {
+ phy-supply = <&vcc5v0_usb_host>;
+ status = "okay";
+};
+
+&usb2phy0_otg {
+ vbus-supply = <&vcc5v0_usb_otg>;
+ status = "okay";
+};
+
&usb2phy1 {
status = "okay";
};
--
2.30.2

2022-04-26 00:12:00

by Michael Riesch

[permalink] [raw]
Subject: [PATCH 3/3] arm64: dts: rockchip: enable usb hub on the radxa rock3 model a

One USB 2.0 host port on the Radxa ROCK3 Model A is connected to the
SoC via a hub. Introduce a voltage regulator to enable this USB hub.

Signed-off-by: Michael Riesch <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
index d7e2bc96fde7..75bc2824764f 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
@@ -97,6 +97,17 @@ vcc5v0_usb_host: vcc5v0-usb-host {
vin-supply = <&vcc5v0_usb>;
};

+ vcc5v0_usb_hub: vcc5v0-usb-hub {
+ compatible = "regulator-fixed";
+ enable-active-high;
+ gpio = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&vcc5v0_usb_hub_en>;
+ regulator-name = "vcc5v0_usb_hub";
+ regulator-always-on;
+ vin-supply = <&vcc5v0_usb>;
+ };
+
vcc5v0_usb_otg: vcc5v0-usb-otg {
compatible = "regulator-fixed";
enable-active-high;
@@ -436,6 +447,9 @@ usb {
vcc5v0_usb_host_en: vcc5v0_usb_host_en {
rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
};
+ vcc5v0_usb_hub_en: vcc5v0_usb_hub_en {
+ rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
vcc5v0_usb_otg_en: vcc5v0_usb_otg_en {
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
};
--
2.30.2

2022-04-28 19:28:56

by Michael Riesch

[permalink] [raw]
Subject: Re: [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

Hi Nicolas,

On 4/28/22 13:15, Nicolas Frattaroli wrote:
> On Montag, 25. April 2022 15:35:00 CEST Michael Riesch wrote:
>> This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
>> device tree.
>>
>> Signed-off-by: Michael Riesch <[email protected]>
>> ---
>> arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>> index 55e6dcb948cc..f611aaf2d238 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>> @@ -266,7 +266,7 @@ usb_host0_xhci: usb@fcc00000 {
>> <&cru ACLK_USB3OTG0>;
>> clock-names = "ref_clk", "suspend_clk",
>> "bus_clk";
>> - dr_mode = "host";
>> + dr_mode = "otg";
>> phy_type = "utmi_wide";
>> power-domains = <&power RK3568_PD_PIPE>;
>> resets = <&cru SRST_USB3OTG0>;
>>
>
> Hi Michael,
>
> according to official specs[1], only the RK3568 is capable of using the
> USB 3.0 controller in OTG mode. For the RK3566, OTG is USB 2.0, if I
> understand this correctly.
>
> So I think this should be an override in rk3568.dtsi.

Thanks for pointing that out -- will change in v2 (I'll wait a bit,
though, as I hope that patches 2 and 3 will be applied as they are ;-)

Best regards,
Michael

>
> Regards,
> Nicolas Frattaroli
>
> [1]: Compare page 17 of the RK3568 datasheet to page 16 of the RK3566
> datasheet
>
>

2022-04-29 21:01:47

by Nicolas Frattaroli

[permalink] [raw]
Subject: Re: [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

On Montag, 25. April 2022 15:35:00 CEST Michael Riesch wrote:
> This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
> device tree.
>
> Signed-off-by: Michael Riesch <[email protected]>
> ---
> arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> index 55e6dcb948cc..f611aaf2d238 100644
> --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> @@ -266,7 +266,7 @@ usb_host0_xhci: usb@fcc00000 {
> <&cru ACLK_USB3OTG0>;
> clock-names = "ref_clk", "suspend_clk",
> "bus_clk";
> - dr_mode = "host";
> + dr_mode = "otg";
> phy_type = "utmi_wide";
> power-domains = <&power RK3568_PD_PIPE>;
> resets = <&cru SRST_USB3OTG0>;
>

Hi Michael,

according to official specs[1], only the RK3568 is capable of using the
USB 3.0 controller in OTG mode. For the RK3566, OTG is USB 2.0, if I
understand this correctly.

So I think this should be an override in rk3568.dtsi.

Regards,
Nicolas Frattaroli

[1]: Compare page 17 of the RK3568 datasheet to page 16 of the RK3566
datasheet


2022-05-01 08:43:19

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

Am Donnerstag, 28. April 2022, 15:24:09 CEST schrieb Michael Riesch:
> Hi Nicolas,
>
> On 4/28/22 13:15, Nicolas Frattaroli wrote:
> > On Montag, 25. April 2022 15:35:00 CEST Michael Riesch wrote:
> >> This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
> >> device tree.
> >>
> >> Signed-off-by: Michael Riesch <[email protected]>
> >> ---
> >> arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> >> index 55e6dcb948cc..f611aaf2d238 100644
> >> --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> >> +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
> >> @@ -266,7 +266,7 @@ usb_host0_xhci: usb@fcc00000 {
> >> <&cru ACLK_USB3OTG0>;
> >> clock-names = "ref_clk", "suspend_clk",
> >> "bus_clk";
> >> - dr_mode = "host";
> >> + dr_mode = "otg";
> >> phy_type = "utmi_wide";
> >> power-domains = <&power RK3568_PD_PIPE>;
> >> resets = <&cru SRST_USB3OTG0>;
> >>
> >
> > Hi Michael,
> >
> > according to official specs[1], only the RK3568 is capable of using the
> > USB 3.0 controller in OTG mode. For the RK3566, OTG is USB 2.0, if I
> > understand this correctly.
> >
> > So I think this should be an override in rk3568.dtsi.
>
> Thanks for pointing that out -- will change in v2 (I'll wait a bit,
> though, as I hope that patches 2 and 3 will be applied as they are ;-)

that can be arranged ;-)

Heiko


2022-05-02 15:43:58

by Michael Riesch

[permalink] [raw]
Subject: Re: [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

Hello again,

On 4/28/22 15:24, Michael Riesch wrote:
> Hi Nicolas,
>
> On 4/28/22 13:15, Nicolas Frattaroli wrote:
>> On Montag, 25. April 2022 15:35:00 CEST Michael Riesch wrote:
>>> This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
>>> device tree.
>>>
>>> Signed-off-by: Michael Riesch <[email protected]>
>>> ---
>>> arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>>> index 55e6dcb948cc..f611aaf2d238 100644
>>> --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>>> +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>>> @@ -266,7 +266,7 @@ usb_host0_xhci: usb@fcc00000 {
>>> <&cru ACLK_USB3OTG0>;
>>> clock-names = "ref_clk", "suspend_clk",
>>> "bus_clk";
>>> - dr_mode = "host";
>>> + dr_mode = "otg";
>>> phy_type = "utmi_wide";
>>> power-domains = <&power RK3568_PD_PIPE>;
>>> resets = <&cru SRST_USB3OTG0>;
>>>
>>
>> Hi Michael,
>>
>> according to official specs[1], only the RK3568 is capable of using the
>> USB 3.0 controller in OTG mode. For the RK3566, OTG is USB 2.0, if I
>> understand this correctly.
>>
>> So I think this should be an override in rk3568.dtsi.
>
> Thanks for pointing that out -- will change in v2 (I'll wait a bit,
> though, as I hope that patches 2 and 3 will be applied as they are ;-)

I have sent out v2 and got Peter's valuable comment in return that the
v1 patch is actually correct.

> [...]
>> [1]: Compare page 17 of the RK3568 datasheet to page 16 of the RK3566
>> datasheet

These data sheets can be quite confusing, which is why I seem to change
my opinion about how things should be from mail to mail :-) Let's see if
we can figure it out together:

The Multi-PHY Interface section mentions a "USB 3.0 xHCI Host
Controller" for both RK3566 and RK3568. Additionally, on the RK3568 a
"USB 3.0 Dual-Role Device (DRD) Controller" is present. On the RK3566,
on the other hand, a "USB 2.0 OTG" is mentioned (extra item outside of
the Multi-PHY Interface section).

When I read your mail, I mistook the ehci/ohci controllers for the USB
controllers in charge for USB 2.0 OTG and found your comment to be
correct. However, they are related to "USB 2.0 Host" on RK3566 and
RK3568. Also, since it is explicitly stated that "USB 2.0 OTG" is a xHCI
controller, it becomes apparent that usb_host0_xhci corresponds to "USB
2.0 OTG" on RK3566 and to "USB 3.0 Dual-Role Device (DRD) Controller" on
RK3568.

Long story short, I agree with Peter and the patch at hand (v1) is the
correct one. Sorry for the confusion!

Best regards,
Michael

2022-05-03 01:12:54

by Heiko Stuebner

[permalink] [raw]
Subject: Re: (subset) [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

On Mon, 25 Apr 2022 15:35:00 +0200, Michael Riesch wrote:
> This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
> device tree.

Applied, thanks!

[2/3] arm64: dts: rockchip: add usb3 support to the radxa rock3 model a
commit: 254a1f6a29e7a273adb1a1d032305ec58ef83a69
[3/3] arm64: dts: rockchip: enable usb hub on the radxa rock3 model a
commit: 160f126b89e10bd58491e10067a44c7e3f85fa2c

Best regards,
--
Heiko Stuebner <[email protected]>

2022-05-11 09:50:12

by Heiko Stuebner

[permalink] [raw]
Subject: Re: (subset) [PATCH 1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x

On Mon, 25 Apr 2022 15:35:00 +0200, Michael Riesch wrote:
> This USB 3.0 controller is capable of OTG/DRD operation. Enable it in the
> device tree.

Applied, thanks!

[1/3] arm64: dts: rockchip: enable otg/drd operation of usb_host0_xhci in rk356x
commit: bc405bb3eeee4b711830ab569e7f3811b92196ab

Best regards,
--
Heiko Stuebner <[email protected]>