diff mbox series

[v4,17/18] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM usb-role-switching for usb_1

Message ID 20230318121828.739424-18-bryan.odonoghue@linaro.org (mailing list archive)
State Superseded
Headers show
Series Add Qualcomm PMIC TPCM support | expand

Commit Message

Bryan O'Donoghue March 18, 2023, 12:18 p.m. UTC
Switch on usb-role-switching for usb_1 via TCPM. We need to declare
usb-role-switch in &usb_1 and associate with the remote-endpoint in TCPM
which provides the necessary signal.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Konrad Dybcio March 18, 2023, 1:10 p.m. UTC | #1
On 18.03.2023 13:18, Bryan O'Donoghue wrote:
> Switch on usb-role-switching for usb_1 via TCPM. We need to declare
> usb-role-switch in &usb_1 and associate with the remote-endpoint in TCPM
> which provides the necessary signal.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
> index 965742a5be7ae..43d549d6672e9 100644
> --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
> +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
> @@ -1273,7 +1273,13 @@ &usb_1 {
>  };
>  
>  &usb_1_dwc3 {
> -	dr_mode = "peripheral";
> +	dr_mode = "otg";
> +	usb-role-switch;
This could maybe go to the SoC DTSI.. Bjorn, Krzysztof, WDYT?

Also, please add a newline before the subnode.

> +	port {
> +		dwc3_drd_switch: endpoint {
> +			remote-endpoint = <&usb3_role>;
> +		};
> +	};
DWC3 ports (@0 for HS, @1 for SS and @2 for altmode) can definitely
go to the SoC DTSI.

>  };
>  
>  &usb_1_hsphy {
> @@ -1356,6 +1362,12 @@ &pm8150b_vbus {
>  
>  &tcpm {
>  	status = "okay";
Please add a newline before the subnode.

Konrad

> +	port {
> +		usb3_role: endpoint {
> +			remote-endpoint = <&dwc3_drd_switch>;
> +		};
> +	};
> +
>  	connector {
>  		compatible = "usb-c-connector";
>
Bryan O'Donoghue March 18, 2023, 5:46 p.m. UTC | #2
On 18/03/2023 13:10, Konrad Dybcio wrote:
>> +	usb-role-switch;
> This could maybe go to the SoC DTSI.. Bjorn, Krzysztof, WDYT?

Eh well I think this is a correct comment.

There's no good reason to have this as board-specific since it is a 
controller property. Moreover it only does something when there is a an 
agent to feed data into it.

arch/arm64/boot/dts/qcom/sc7280.dtsi:				usb-role-switch;

---
bod
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
index 965742a5be7ae..43d549d6672e9 100644
--- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
+++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
@@ -1273,7 +1273,13 @@  &usb_1 {
 };
 
 &usb_1_dwc3 {
-	dr_mode = "peripheral";
+	dr_mode = "otg";
+	usb-role-switch;
+	port {
+		dwc3_drd_switch: endpoint {
+			remote-endpoint = <&usb3_role>;
+		};
+	};
 };
 
 &usb_1_hsphy {
@@ -1356,6 +1362,12 @@  &pm8150b_vbus {
 
 &tcpm {
 	status = "okay";
+	port {
+		usb3_role: endpoint {
+			remote-endpoint = <&dwc3_drd_switch>;
+		};
+	};
+
 	connector {
 		compatible = "usb-c-connector";