linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
@ 2025-04-19  2:37 John Clark
  2025-04-21 23:12 ` Hugh Cole-Baker
  2025-04-22 21:03 ` [PATCH v2] " John Clark
  0 siblings, 2 replies; 6+ messages in thread
From: John Clark @ 2025-04-19  2:37 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Marcin Juszkiewicz, Sebastian Reichel, Jonas Karlman, John Clark

The USB-C port on the NanoPC-T6 was not providing VBUS (vbus5v0_typec
regulator disabled, gpio-58 out lo) due to misconfiguration. The
original setup with regulator-always-on and regulator-boot-on forced
the port on, masking the issue, but removing these properties revealed
that the fusb302 driver was not enabling the regulator dynamically.

Changes:
- Removed regulator-always-on and regulator-boot-on from vbus5v0_typec
  and vbus5v0_usb to allow driver control.
- Changed power-role from "source" to "dual" in the usb-c-connector
  to support OTG functionality.
- Add pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>; to the FUSB302MPX node
  to specify USB Power Delivery (PD) Revision 2.0, Version 1.2,
  ensuring the driver correctly advertises PD capabilities and
  negotiates power roles (source/sink) per the FUSB302MPX’s supported
  PD protocol.
- Added op-sink-microwatt and sink-pdos for proper sink mode
  configuration (1w min, 15w max).
- Add typec-power-opmode = "3.0A"; to enable 3.0A (15W) fallback for
  non-PD USB-C devices with the FUSB302MPX.
- Set try-power-role to "source" to prioritize VBUS enablement.
- Adjusted usb_host0_xhci dr_mode from "host" to "otg" and added
  usb-role-switch for dual-role support.

Testing:
- Verified VBUS (5V) delivery to a sink device (USB thumb drive).
- Confirmed USB host mode with lsusb detecting connected devices.
- Validated USB device mode with adb devices when connected to a PC.
- Tested dual-role (OTG) functionality with try-power-role set to
  "source" and "sink"; "source" prioritizes faster VBUS activation.
- Validated functionality with a mobile device, including USB Power
  Delivery, file transfer, USB tethering, MIDI, and image transfer.
- Tested USB-C Ethernet adapter compatibility, ensuring proper
  operation in host mode.
- Tested USB-C hub compatibility, ensuring proper operation in host mode.

Signed-off-by: John Clark <inindev@gmail.com>
---
 .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
index cecfb788bf9e..8f2bd30786d9 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
@@ -174,8 +174,6 @@ vbus5v0_typec: regulator-vbus5v0-typec {
 		gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&typec5v_pwren>;
-		regulator-always-on;
-		regulator-boot-on;
 		regulator-name = "vbus5v0_typec";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
@@ -188,8 +186,6 @@ vbus5v0_usb: regulator-vbus5v0-usb {
 		gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&usb5v_pwren>;
-		regulator-always-on;
-		regulator-boot-on;
 		regulator-name = "vbus5v0_usb";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
@@ -465,24 +461,30 @@ regulator-state-mem {
 };
 
 &i2c6 {
-	clock-frequency = <200000>;
 	status = "okay";
 
-	fusb302: typec-portc@22 {
+	usbc0: usb-typec@22 {
 		compatible = "fcs,fusb302";
 		reg = <0x22>;
 		interrupt-parent = <&gpio0>;
 		interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;
-		pinctrl-0 = <&usbc0_int>;
 		pinctrl-names = "default";
+		pinctrl-0 = <&usbc0_int>;
 		vbus-supply = <&vbus5v0_typec>;
+		status = "okay";
 
 		connector {
 			compatible = "usb-c-connector";
 			data-role = "dual";
 			label = "USB-C";
-			power-role = "source";
+			/* fusb302 supports PD Rev 2.0 Ver 1.2 */
+			pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>;
+			power-role = "dual";
+			op-sink-microwatt = <1000000>;
+			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
 			source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
+			try-power-role = "source";
+			typec-power-opmode = "3.0A";
 
 			ports {
 				#address-cells = <1>;
@@ -1135,9 +1137,8 @@ &usb_host0_ohci {
 };
 
 &usb_host0_xhci {
-	dr_mode = "host";
-	status = "okay";
 	usb-role-switch;
+	status = "okay";
 
 	port {
 		usb_host0_xhci_drd_sw: endpoint {
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
  2025-04-19  2:37 [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality John Clark
@ 2025-04-21 23:12 ` Hugh Cole-Baker
  2025-04-22  0:07   ` John Clark
  2025-04-22 21:03 ` [PATCH v2] " John Clark
  1 sibling, 1 reply; 6+ messages in thread
From: Hugh Cole-Baker @ 2025-04-21 23:12 UTC (permalink / raw)
  To: John Clark
  Cc: devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Marcin Juszkiewicz, Sebastian Reichel, Jonas Karlman

Hi John,

On 19/04/2025 03:37, John Clark wrote:
> The USB-C port on the NanoPC-T6 was not providing VBUS (vbus5v0_typec
> regulator disabled, gpio-58 out lo) due to misconfiguration. The
> original setup with regulator-always-on and regulator-boot-on forced
> the port on, masking the issue, but removing these properties revealed
> that the fusb302 driver was not enabling the regulator dynamically.
> 
> Changes:
> - Removed regulator-always-on and regulator-boot-on from vbus5v0_typec
>   and vbus5v0_usb to allow driver control.
> - Changed power-role from "source" to "dual" in the usb-c-connector
>   to support OTG functionality.
> - Add pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>; to the FUSB302MPX node
>   to specify USB Power Delivery (PD) Revision 2.0, Version 1.2,
>   ensuring the driver correctly advertises PD capabilities and
>   negotiates power roles (source/sink) per the FUSB302MPX’s supported
>   PD protocol.
> - Added op-sink-microwatt and sink-pdos for proper sink mode
>   configuration (1w min, 15w max).
> - Add typec-power-opmode = "3.0A"; to enable 3.0A (15W) fallback for
>   non-PD USB-C devices with the FUSB302MPX.
> - Set try-power-role to "source" to prioritize VBUS enablement.
> - Adjusted usb_host0_xhci dr_mode from "host" to "otg" and added
>   usb-role-switch for dual-role support.
> 
> Testing:
> - Verified VBUS (5V) delivery to a sink device (USB thumb drive).
> - Confirmed USB host mode with lsusb detecting connected devices.
> - Validated USB device mode with adb devices when connected to a PC.
> - Tested dual-role (OTG) functionality with try-power-role set to
>   "source" and "sink"; "source" prioritizes faster VBUS activation.
> - Validated functionality with a mobile device, including USB Power
>   Delivery, file transfer, USB tethering, MIDI, and image transfer.
> - Tested USB-C Ethernet adapter compatibility, ensuring proper
>   operation in host mode.
> - Tested USB-C hub compatibility, ensuring proper operation in host mode.
> 
> Signed-off-by: John Clark <inindev@gmail.com>
> ---
>  .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 21 ++++++++++---------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> index cecfb788bf9e..8f2bd30786d9 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> @@ -174,8 +174,6 @@ vbus5v0_typec: regulator-vbus5v0-typec {
>  		gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&typec5v_pwren>;
> -		regulator-always-on;
> -		regulator-boot-on;
>  		regulator-name = "vbus5v0_typec";
>  		regulator-min-microvolt = <5000000>;
>  		regulator-max-microvolt = <5000000>;
> @@ -188,8 +186,6 @@ vbus5v0_usb: regulator-vbus5v0-usb {
>  		gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&usb5v_pwren>;
> -		regulator-always-on;
> -		regulator-boot-on;
>  		regulator-name = "vbus5v0_usb";
>  		regulator-min-microvolt = <5000000>;
>  		regulator-max-microvolt = <5000000>;
> @@ -465,24 +461,30 @@ regulator-state-mem {
>  };
>  
>  &i2c6 {
> -	clock-frequency = <200000>;
>  	status = "okay";
>  
> -	fusb302: typec-portc@22 {
> +	usbc0: usb-typec@22 {
>  		compatible = "fcs,fusb302";
>  		reg = <0x22>;
>  		interrupt-parent = <&gpio0>;
>  		interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;
> -		pinctrl-0 = <&usbc0_int>;
>  		pinctrl-names = "default";
> +		pinctrl-0 = <&usbc0_int>;
>  		vbus-supply = <&vbus5v0_typec>;
> +		status = "okay";
>  
>  		connector {
>  			compatible = "usb-c-connector";
>  			data-role = "dual";
>  			label = "USB-C";
> -			power-role = "source";
> +			/* fusb302 supports PD Rev 2.0 Ver 1.2 */
> +			pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>;
> +			power-role = "dual";
> +			op-sink-microwatt = <1000000>;
> +			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
>  			source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
> +			try-power-role = "source";
> +			typec-power-opmode = "3.0A";

According to the manufacturer wiki [1] "Power Output Capacity" table, the USB-C
port maximum output is 5V/2A. So I think "1.5A" would be a better value here.

[1]: https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6

>  
>  			ports {
>  				#address-cells = <1>;
> @@ -1135,9 +1137,8 @@ &usb_host0_ohci {
>  };
>  
>  &usb_host0_xhci {
> -	dr_mode = "host";
> -	status = "okay";
>  	usb-role-switch;
> +	status = "okay";
>  
>  	port {
>  		usb_host0_xhci_drd_sw: endpoint {

br, Hugh


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
  2025-04-21 23:12 ` Hugh Cole-Baker
@ 2025-04-22  0:07   ` John Clark
  2025-04-22 20:20     ` Hugh Cole-Baker
  0 siblings, 1 reply; 6+ messages in thread
From: John Clark @ 2025-04-22  0:07 UTC (permalink / raw)
  To: sigmaris
  Cc: devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, robh,
	krzk+dt, conor+dt, heiko, mjuszkiewicz, sebastian.reichel, jonas,
	John Clark

On Tue, Apr 22, 2025 at 00:12:02 +0100, Hugh Cole-Baker <sigmaris@gmail.com> wrote:
> Hi John,
>
> On 19/04/2025 03:37, John Clark wrote:
>> The USB-C port on the NanoPC-T6 was not providing VBUS (vbus5v0_typec
>> regulator disabled, gpio-58 out lo) due to misconfiguration. The
>> original setup with regulator-always-on and regulator-boot-on forced
>> the port on, masking the issue, but removing these properties revealed
>> that the fusb302 driver was not enabling the regulator dynamically.
>>
>> Signed-off-by: John Clark <inindev@gmail.com>
>> ---
>>  .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 21 ++++++++++---------
>>  1 file changed, 11 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>> index cecfb788bf9e..8f2bd30786d9 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>> @@ -174,8 +174,6 @@ vbus5v0_typec: regulator-vbus5v0-typec {
>>  		gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
>>  		pinctrl-names = "default";
>>  		pinctrl-0 = <&typec5v_pwren>;
>> -		regulator-always-on;
>> -		regulator-boot-on;
>>  		regulator-name = "vbus5v0_typec";
>> @@ -465,24 +461,30 @@ regulator-state-mem {
>>  &i2c6 {
>> -	clock-frequency = <200000>;
>>  	status = "okay";
>>
>> -	fusb302: typec-portc@22 {
>> +	usbc0: usb-typec@22 {
>>  		compatible = "fcs,fusb302";
>>  		connector {
>>  			compatible = "usb-c-connector";
>>  			data-role = "dual";
>>  			label = "USB-C";
>> -			power-role = "source";
>> +			/* fusb302 supports PD Rev 2.0 Ver 1.2 */
>> +			pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>;
>> +			power-role = "dual";
>> +			op-sink-microwatt = <1000000>;
>> +			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
>>  			source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
>> +			try-power-role = "source";
>> +			typec-power-opmode = "3.0A";
>
> According to the manufacturer wiki [1] "Power Output Capacity" table, the USB-C
> port maximum output is 5V/2A. So I think "1.5A" would be a better value here.
>
> [1]: https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6

Hi Hugh,

Thank you for your feedback and for referencing the manufacturer’s wiki. To clarify, the line in question:

source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;

was not modified in my patch. This value, which sets the USB-C port’s source capability to 5V/2A, is unchanged from the existing device tree.

Furthermore, the schematic for the NanoPC-T6 and the vendor’s upstream Linux device tree (e.g., FriendlyARM’s kernel at https://github.com/friendlyarm/kernel-rockchip/blob/nanopi6-v6.1.y/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L346) also specify the source capability as 5V/2A. Given this consistency across the schematic and vendor sources, I believe 2A is an appropriate value for this configuration.

Please let me know if you have further concerns or suggestions!

Best regards,
John Clark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
  2025-04-22  0:07   ` John Clark
@ 2025-04-22 20:20     ` Hugh Cole-Baker
  0 siblings, 0 replies; 6+ messages in thread
From: Hugh Cole-Baker @ 2025-04-22 20:20 UTC (permalink / raw)
  To: John Clark
  Cc: devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, robh,
	krzk+dt, conor+dt, heiko, mjuszkiewicz, sebastian.reichel, jonas

On 22/04/2025 01:07, John Clark wrote:
> On Tue, Apr 22, 2025 at 00:12:02 +0100, Hugh Cole-Baker <sigmaris@gmail.com> wrote:
>> Hi John,
>>
>> On 19/04/2025 03:37, John Clark wrote:
>>> The USB-C port on the NanoPC-T6 was not providing VBUS (vbus5v0_typec
>>> regulator disabled, gpio-58 out lo) due to misconfiguration. The
>>> original setup with regulator-always-on and regulator-boot-on forced
>>> the port on, masking the issue, but removing these properties revealed
>>> that the fusb302 driver was not enabling the regulator dynamically.
>>>
>>> Signed-off-by: John Clark <inindev@gmail.com>
>>> ---
>>>  .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 21 ++++++++++---------
>>>  1 file changed, 11 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>>> index cecfb788bf9e..8f2bd30786d9 100644
>>> --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>>> @@ -174,8 +174,6 @@ vbus5v0_typec: regulator-vbus5v0-typec {
>>>  		gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
>>>  		pinctrl-names = "default";
>>>  		pinctrl-0 = <&typec5v_pwren>;
>>> -		regulator-always-on;
>>> -		regulator-boot-on;
>>>  		regulator-name = "vbus5v0_typec";
>>> @@ -465,24 +461,30 @@ regulator-state-mem {
>>>  &i2c6 {
>>> -	clock-frequency = <200000>;
>>>  	status = "okay";
>>>
>>> -	fusb302: typec-portc@22 {
>>> +	usbc0: usb-typec@22 {
>>>  		compatible = "fcs,fusb302";
>>>  		connector {
>>>  			compatible = "usb-c-connector";
>>>  			data-role = "dual";
>>>  			label = "USB-C";
>>> -			power-role = "source";
>>> +			/* fusb302 supports PD Rev 2.0 Ver 1.2 */
>>> +			pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>;
>>> +			power-role = "dual";
>>> +			op-sink-microwatt = <1000000>;
>>> +			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
>>>  			source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
>>> +			try-power-role = "source";
>>> +			typec-power-opmode = "3.0A";
>>
>> According to the manufacturer wiki [1] "Power Output Capacity" table, the USB-C
>> port maximum output is 5V/2A. So I think "1.5A" would be a better value here.
>>
>> [1]: https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6
> 
> Hi Hugh,
> 
> Thank you for your feedback and for referencing the manufacturer’s wiki. To clarify, the line in question:
> 
> source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
> 
> was not modified in my patch. This value, which sets the USB-C port’s source capability to 5V/2A, is unchanged from the existing device tree.

source-pdos is OK, I was referring to the typec-power-opmode = "3.0A" line just
above where I commented. As I read it, that'd mean the board would advertise
via the CC pins that it could source 5V/3A when USB PD is not in use.
The wiki says it can only source up to 5V/2A.

br, Hugh

> 
> Furthermore, the schematic for the NanoPC-T6 and the vendor’s upstream Linux device tree (e.g., FriendlyARM’s kernel at https://github.com/friendlyarm/kernel-rockchip/blob/nanopi6-v6.1.y/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L346) also specify the source capability as 5V/2A. Given this consistency across the schematic and vendor sources, I believe 2A is an appropriate value for this configuration.
> 
> Please let me know if you have further concerns or suggestions!
> 
> Best regards,
> John Clark



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
  2025-04-19  2:37 [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality John Clark
  2025-04-21 23:12 ` Hugh Cole-Baker
@ 2025-04-22 21:03 ` John Clark
  2025-05-01 13:29   ` Heiko Stuebner
  1 sibling, 1 reply; 6+ messages in thread
From: John Clark @ 2025-04-22 21:03 UTC (permalink / raw)
  To: heiko, robh, krzk
  Cc: linux-arm-kernel, linux-rockchip, devicetree, sigmaris,
	John Clark

The USB-C port on the NanoPC-T6 was not providing VBUS (vbus5v0_typec
regulator disabled, gpio-58 out lo) due to misconfiguration. The
original setup with regulator-always-on and regulator-boot-on forced
the port on, masking the issue, but removing these properties revealed
that the fusb302 driver was not enabling the regulator dynamically.

Changes:
- Removed regulator-always-on and regulator-boot-on from vbus5v0_typec
  and vbus5v0_usb to allow driver control.
- Changed power-role from "source" to "dual" in the usb-c-connector to
  support OTG functionality.
- Added pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2> to the FUSB302MPX
  node to specify USB Power Delivery (PD) Revision 2.0, Version 1.2,
  ensuring the driver correctly advertises PD capabilities and
  negotiates power roles (source/sink).
- Added op-sink-microwatt and sink-pdos for proper sink mode
  configuration (1W min, 15W max).
- Added typec-power-opmode = "1.5A" to enable 1.5A fallback for non-PD
  USB-C devices, aligning with the 5V/2A hardware limit.
- Set try-power-role to "source" to prioritize VBUS enablement.
- Adjusted usb_host0_xhci dr_mode from "host" to "otg" and added
  usb-role-switch for dual-role support.

Testing:
- Verified VBUS (5V) delivery to a sink device (USB thumb drive).
- Confirmed USB host mode with lsusb detecting connected devices.
- Validated USB device mode with adb devices when connected to a PC.
- Tested dual-role (OTG) functionality with try-power-role set to
  "source" and "sink"; "source" prioritizes faster VBUS activation.
- Validated functionality with a mobile device, including USB Power
  Delivery, file transfer, USB tethering, MIDI, and image transfer.
- Tested USB-C Ethernet adapter compatibility in host mode.
- Tested USB-C hub compatibility in host mode.

Signed-off-by: John Clark <inindev@gmail.com>

---
Changes in v2:
- Changed typec-power-opmode from "3.0A" to "1.5A" to conservatively
  align with the 5V/2A hardware limit, addressing feedback from Hugh
  Cole-Baker.
---
 .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
index cecfb788b..3d8b6f0c5 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
@@ -174,8 +174,6 @@ vbus5v0_typec: regulator-vbus5v0-typec {
 		gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&typec5v_pwren>;
-		regulator-always-on;
-		regulator-boot-on;
 		regulator-name = "vbus5v0_typec";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
@@ -188,8 +186,6 @@ vbus5v0_usb: regulator-vbus5v0-usb {
 		gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&usb5v_pwren>;
-		regulator-always-on;
-		regulator-boot-on;
 		regulator-name = "vbus5v0_usb";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
@@ -465,24 +461,30 @@ regulator-state-mem {
 };
 
 &i2c6 {
-	clock-frequency = <200000>;
 	status = "okay";
 
-	fusb302: typec-portc@22 {
+	usbc0: usb-typec@22 {
 		compatible = "fcs,fusb302";
 		reg = <0x22>;
 		interrupt-parent = <&gpio0>;
 		interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;
-		pinctrl-0 = <&usbc0_int>;
 		pinctrl-names = "default";
+		pinctrl-0 = <&usbc0_int>;
 		vbus-supply = <&vbus5v0_typec>;
+		status = "okay";
 
 		connector {
 			compatible = "usb-c-connector";
 			data-role = "dual";
 			label = "USB-C";
-			power-role = "source";
+			op-sink-microwatt = <1000000>;
+			/* fusb302 supports PD Rev 2.0 Ver 1.2 */
+			pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>;
+			power-role = "dual";
+			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
 			source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
+			try-power-role = "source";
+			typec-power-opmode = "1.5A";
 
 			ports {
 				#address-cells = <1>;
@@ -1135,9 +1137,8 @@ &usb_host0_ohci {
 };
 
 &usb_host0_xhci {
-	dr_mode = "host";
-	status = "okay";
 	usb-role-switch;
+	status = "okay";
 
 	port {
 		usb_host0_xhci_drd_sw: endpoint {
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
  2025-04-22 21:03 ` [PATCH v2] " John Clark
@ 2025-05-01 13:29   ` Heiko Stuebner
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Stuebner @ 2025-05-01 13:29 UTC (permalink / raw)
  To: robh, krzk, John Clark
  Cc: Heiko Stuebner, linux-arm-kernel, linux-rockchip, devicetree,
	sigmaris


On Tue, 22 Apr 2025 17:03:45 -0400, John Clark wrote:
> The USB-C port on the NanoPC-T6 was not providing VBUS (vbus5v0_typec
> regulator disabled, gpio-58 out lo) due to misconfiguration. The
> original setup with regulator-always-on and regulator-boot-on forced
> the port on, masking the issue, but removing these properties revealed
> that the fusb302 driver was not enabling the regulator dynamically.
> 
> Changes:
> - Removed regulator-always-on and regulator-boot-on from vbus5v0_typec
>   and vbus5v0_usb to allow driver control.
> - Changed power-role from "source" to "dual" in the usb-c-connector to
>   support OTG functionality.
> - Added pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2> to the FUSB302MPX
>   node to specify USB Power Delivery (PD) Revision 2.0, Version 1.2,
>   ensuring the driver correctly advertises PD capabilities and
>   negotiates power roles (source/sink).
> - Added op-sink-microwatt and sink-pdos for proper sink mode
>   configuration (1W min, 15W max).
> - Added typec-power-opmode = "1.5A" to enable 1.5A fallback for non-PD
>   USB-C devices, aligning with the 5V/2A hardware limit.
> - Set try-power-role to "source" to prioritize VBUS enablement.
> - Adjusted usb_host0_xhci dr_mode from "host" to "otg" and added
>   usb-role-switch for dual-role support.
> 
> [...]

Applied, thanks!

[1/1] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality
      commit: 60087bcbd1206a546c570c453dee5f5d961ef5b3

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-01 13:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-19  2:37 [PATCH] arm64: dts: rockchip: rk3588-nanopc-t6: fix usb-c port functionality John Clark
2025-04-21 23:12 ` Hugh Cole-Baker
2025-04-22  0:07   ` John Clark
2025-04-22 20:20     ` Hugh Cole-Baker
2025-04-22 21:03 ` [PATCH v2] " John Clark
2025-05-01 13:29   ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).