diff mbox series

[2/3] arm64: dts: qcom: qdu1000-idp: enable USB nodes

Message ID 20240319091020.15137-3-quic_kbajaj@quicinc.com (mailing list archive)
State Superseded
Headers show
Series Add devicetree support of USB for QDU/QRU1000 | expand

Commit Message

Komal Bajaj March 19, 2024, 9:10 a.m. UTC
Enable both USB controllers and associated hsphy and qmp phy
nodes on QDU1000 IDP. Add the usb type B port linked with the
DWC3 USB controller switched to OTG mode and tagged with
usb-role-switch.

Co-developed-by: Amrit Anand <quic_amrianan@quicinc.com>
Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
---
 arch/arm64/boot/dts/qcom/qdu1000-idp.dts | 65 ++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

--
2.42.0

Comments

Dmitry Baryshkov March 19, 2024, 9:52 a.m. UTC | #1
On Tue, 19 Mar 2024 at 11:11, Komal Bajaj <quic_kbajaj@quicinc.com> wrote:
>
> Enable both USB controllers and associated hsphy and qmp phy
> nodes on QDU1000 IDP. Add the usb type B port linked with the
> DWC3 USB controller switched to OTG mode and tagged with
> usb-role-switch.
>
> Co-developed-by: Amrit Anand <quic_amrianan@quicinc.com>
> Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
> Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
> ---
>  arch/arm64/boot/dts/qcom/qdu1000-idp.dts | 65 ++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> index 89b84fb0f70a..26442e707b5e 100644
> --- a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> +++ b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> @@ -46,6 +46,33 @@ ppvar_sys: ppvar-sys-regulator {
>                 regulator-boot-on;
>         };
>
> +       usb_conn_gpio: usb-conn-gpio {
> +               compatible = "gpio-usb-b-connector";

If this board has only a USB-B connector, can it really handle USB 3.0?

> +               vbus-gpio =  <&pm8150_gpios 7 GPIO_ACTIVE_HIGH>;
> +               id-gpio = <&tlmm 42 GPIO_ACTIVE_HIGH>;
> +               vbus-supply = <&vbus_supply_regulator>;
> +
> +               pinctrl-0 = <&usb_vbus_det_default
> +                            &usb_id_det_default>;
> +               pinctrl-names = "default";
> +
> +               port {
> +                       usb_port0_connector: endpoint {
> +                               remote-endpoint = <&usb_1_dwc3_hs>;
> +                       };
> +               };
> +       };
> +
> +       vbus_supply_regulator: vbus-supply-regulator {
> +               compatible = "regulator-fixed";
> +               regulator-name = "vbus_supply";
> +
> +               gpio = <&tlmm 43 GPIO_ACTIVE_HIGH>;
> +               pinctrl-0 = <&usb_vbus_boost_default>;
> +               pinctrl-names = "default";
> +               enable-active-high;
> +       };
> +
>         vph_pwr: vph-pwr-regulator {
>                 compatible = "regulator-fixed";
>                 regulator-name = "vph_pwr";
> @@ -239,6 +266,16 @@ vreg_l18a_1p2: ldo18 {
>         };
>  };
>
> +&pm8150_gpios {
> +       usb_vbus_det_default: usb-vbus-det-default {
> +               pins = "gpio7";
> +               function = "normal";
> +               input-enable;
> +               bias-pull-up;
> +               power-source = <0>;
> +       };
> +};
> +
>  &qup_i2c1_data_clk {
>         drive-strength = <2>;
>         bias-pull-up;
> @@ -500,3 +537,31 @@ &tlmm {
>  &uart7 {
>         status = "okay";
>  };
> +
> +&usb_1 {
> +       status = "okay";
> +};
> +
> +&usb_1_dwc3 {
> +       dr_mode = "otg";

Nit: this is the default setting.

> +       usb-role-switch;
> +};
> +
> +&usb_1_dwc3_hs {
> +       remote-endpoint = <&usb_port0_connector>;
> +};
> +
> +&usb_1_hsphy {
> +       vdda-pll-supply = <&vreg_l8a_0p91>;
> +       vdda18-supply = <&vreg_l14a_1p8>;
> +       vdda33-supply = <&vreg_l2a_2p3>;
> +
> +       status = "okay";
> +};
> +
> +&usb_1_qmpphy {
> +       vdda-phy-supply = <&vreg_l8a_0p91>;
> +       vdda-pll-supply = <&vreg_l3a_1p2>;
> +
> +       status = "okay";
> +};
> --
> 2.42.0
>
>
Bjorn Andersson April 1, 2024, 10:55 p.m. UTC | #2
On Tue, Mar 19, 2024 at 11:52:15AM +0200, Dmitry Baryshkov wrote:
> On Tue, 19 Mar 2024 at 11:11, Komal Bajaj <quic_kbajaj@quicinc.com> wrote:
> >
> > Enable both USB controllers and associated hsphy and qmp phy
> > nodes on QDU1000 IDP. Add the usb type B port linked with the
> > DWC3 USB controller switched to OTG mode and tagged with
> > usb-role-switch.
> >
> > Co-developed-by: Amrit Anand <quic_amrianan@quicinc.com>
> > Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
> > Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
> > ---
> >  arch/arm64/boot/dts/qcom/qdu1000-idp.dts | 65 ++++++++++++++++++++++++
> >  1 file changed, 65 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> > index 89b84fb0f70a..26442e707b5e 100644
> > --- a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> > +++ b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> > @@ -46,6 +46,33 @@ ppvar_sys: ppvar-sys-regulator {
> >                 regulator-boot-on;
> >         };
> >
> > +       usb_conn_gpio: usb-conn-gpio {
> > +               compatible = "gpio-usb-b-connector";
> 
> If this board has only a USB-B connector, can it really handle USB 3.0?
> 

Here's a USB 3.0 Type-B cable, so no problem there:
https://en.wikipedia.org/wiki/USB_hardware#/media/File:USB_3.0_plug,_type_B_-_1709.jpg


@Komal, please confirm that this is the connector you have on the IDP?

Regards,
Bjorn
Krishna Kurapati April 3, 2024, 7:50 a.m. UTC | #3
On 4/2/2024 4:25 AM, Bjorn Andersson wrote:
> On Tue, Mar 19, 2024 at 11:52:15AM +0200, Dmitry Baryshkov wrote:
>> On Tue, 19 Mar 2024 at 11:11, Komal Bajaj <quic_kbajaj@quicinc.com> wrote:
>>>
>>> Enable both USB controllers and associated hsphy and qmp phy
>>> nodes on QDU1000 IDP. Add the usb type B port linked with the
>>> DWC3 USB controller switched to OTG mode and tagged with
>>> usb-role-switch.
>>>
>>> Co-developed-by: Amrit Anand <quic_amrianan@quicinc.com>
>>> Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
>>> Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
>>> ---
>>>   arch/arm64/boot/dts/qcom/qdu1000-idp.dts | 65 ++++++++++++++++++++++++
>>>   1 file changed, 65 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
>>> index 89b84fb0f70a..26442e707b5e 100644
>>> --- a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
>>> +++ b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
>>> @@ -46,6 +46,33 @@ ppvar_sys: ppvar-sys-regulator {
>>>                  regulator-boot-on;
>>>          };
>>>
>>> +       usb_conn_gpio: usb-conn-gpio {
>>> +               compatible = "gpio-usb-b-connector";
>>
>> If this board has only a USB-B connector, can it really handle USB 3.0?
>>
> 
> Here's a USB 3.0 Type-B cable, so no problem there:
> https://en.wikipedia.org/wiki/USB_hardware#/media/File:USB_3.0_plug,_type_B_-_1709.jpg
> 
> 
> @Komal, please confirm that this is the connector you have on the IDP?
> 

Hi Bjorn,

  Sorry for the confusion. The QDU1000 IDP has a Type-C connector. The 
type-c switch present between SoC and the connector is HD3SS3220 (from TI).

  I think Dmitry's comment was that if it is 3.0, is it Type-C ? and if 
it is Type-C, then the compatible written in the being 
"gpio-usb-b-connector" would mean that there is a Type-B connector for 
someone who looks at the DT. (Dmitry, Please correct me if I understood 
the comment wrong).

  I tried to push a series for adding a compatible to gpio conn driver 
[1] to resolve this and explained the connection specifics to Dmitry [2] 
and he suggested me to add a compatible for just the switch present on 
qdu1000 idp.

Dmitry, Krzysztof,

I was looking into the code again and it turns out there is a driver 
specific to HD3SS3220 switch [3] in linux already. I tried to check if 
it can be reused here but that driver relies on I2C communication 
between the SoC and the HD3SS3220 chip to get information on role 
switch. But in QDU1000 IDP board, there is no I2C communication present 
between SoC and the switch. Those lines have been cut off. The SoC only 
knows about VBUS/ID pins (other than DM/DP/SS Lanes) and no other I2C 
connections between the switch and the SoC. We still need to make use of 
vbus/id pins to decide which role we need to shift into. Can we still go 
ahead with using usb-conn-gpio driver by adding the compatible 
(qcom,qdu1000-hd3ss3220) and using it in DT ?

Let me know your thoughts on this.

[1]: 
https://lore.kernel.org/all/6f2df222-36d4-468e-99a7-9c48fae85aa9@quicinc.com/

[2]: 
https://lore.kernel.org/all/6f2df222-36d4-468e-99a7-9c48fae85aa9@quicinc.com/

[3]: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/typec/hd3ss3220.c?h=v6.9-rc2

Regards,
Krishna,
Dmitry Baryshkov April 3, 2024, 3:52 p.m. UTC | #4
On Wed, 3 Apr 2024 at 10:50, Krishna Kurapati PSSNV
<quic_kriskura@quicinc.com> wrote:
>
>
>
> On 4/2/2024 4:25 AM, Bjorn Andersson wrote:
> > On Tue, Mar 19, 2024 at 11:52:15AM +0200, Dmitry Baryshkov wrote:
> >> On Tue, 19 Mar 2024 at 11:11, Komal Bajaj <quic_kbajaj@quicinc.com> wrote:
> >>>
> >>> Enable both USB controllers and associated hsphy and qmp phy
> >>> nodes on QDU1000 IDP. Add the usb type B port linked with the
> >>> DWC3 USB controller switched to OTG mode and tagged with
> >>> usb-role-switch.
> >>>
> >>> Co-developed-by: Amrit Anand <quic_amrianan@quicinc.com>
> >>> Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
> >>> Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
> >>> ---
> >>>   arch/arm64/boot/dts/qcom/qdu1000-idp.dts | 65 ++++++++++++++++++++++++
> >>>   1 file changed, 65 insertions(+)
> >>>
> >>> diff --git a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> >>> index 89b84fb0f70a..26442e707b5e 100644
> >>> --- a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> >>> +++ b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
> >>> @@ -46,6 +46,33 @@ ppvar_sys: ppvar-sys-regulator {
> >>>                  regulator-boot-on;
> >>>          };
> >>>
> >>> +       usb_conn_gpio: usb-conn-gpio {
> >>> +               compatible = "gpio-usb-b-connector";
> >>
> >> If this board has only a USB-B connector, can it really handle USB 3.0?
> >>
> >
> > Here's a USB 3.0 Type-B cable, so no problem there:
> > https://en.wikipedia.org/wiki/USB_hardware#/media/File:USB_3.0_plug,_type_B_-_1709.jpg
> >
> >
> > @Komal, please confirm that this is the connector you have on the IDP?
> >
>
> Hi Bjorn,
>
>   Sorry for the confusion. The QDU1000 IDP has a Type-C connector. The
> type-c switch present between SoC and the connector is HD3SS3220 (from TI).
>
>   I think Dmitry's comment was that if it is 3.0, is it Type-C ? and if
> it is Type-C, then the compatible written in the being
> "gpio-usb-b-connector" would mean that there is a Type-B connector for
> someone who looks at the DT. (Dmitry, Please correct me if I understood
> the comment wrong).
>
>   I tried to push a series for adding a compatible to gpio conn driver
> [1] to resolve this and explained the connection specifics to Dmitry [2]
> and he suggested me to add a compatible for just the switch present on
> qdu1000 idp.
>
> Dmitry, Krzysztof,
>
> I was looking into the code again and it turns out there is a driver
> specific to HD3SS3220 switch [3] in linux already. I tried to check if
> it can be reused here but that driver relies on I2C communication
> between the SoC and the HD3SS3220 chip to get information on role
> switch. But in QDU1000 IDP board, there is no I2C communication present
> between SoC and the switch. Those lines have been cut off. The SoC only
> knows about VBUS/ID pins (other than DM/DP/SS Lanes) and no other I2C
> connections between the switch and the SoC. We still need to make use of
> vbus/id pins to decide which role we need to shift into. Can we still go
> ahead with using usb-conn-gpio driver by adding the compatible
> (qcom,qdu1000-hd3ss3220) and using it in DT ?

Is Qualcomm a manufacturer of the device? It is not.
Is qdu1000 a part of the device? It is not.

So the compatible string should be "ti,hd3ss3220". Which is fine to be
used in the platform driver. Just describe the differences in the
schema.


>
> Let me know your thoughts on this.
>
> [1]:
> https://lore.kernel.org/all/6f2df222-36d4-468e-99a7-9c48fae85aa9@quicinc.com/
>
> [2]:
> https://lore.kernel.org/all/6f2df222-36d4-468e-99a7-9c48fae85aa9@quicinc.com/
>
> [3]:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/typec/hd3ss3220.c?h=v6.9-rc2
>
> Regards,
> Krishna,
>
>
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
index 89b84fb0f70a..26442e707b5e 100644
--- a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
+++ b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts
@@ -46,6 +46,33 @@  ppvar_sys: ppvar-sys-regulator {
 		regulator-boot-on;
 	};

+	usb_conn_gpio: usb-conn-gpio {
+		compatible = "gpio-usb-b-connector";
+		vbus-gpio =  <&pm8150_gpios 7 GPIO_ACTIVE_HIGH>;
+		id-gpio = <&tlmm 42 GPIO_ACTIVE_HIGH>;
+		vbus-supply = <&vbus_supply_regulator>;
+
+		pinctrl-0 = <&usb_vbus_det_default
+			     &usb_id_det_default>;
+		pinctrl-names = "default";
+
+		port {
+			usb_port0_connector: endpoint {
+				remote-endpoint = <&usb_1_dwc3_hs>;
+			};
+		};
+	};
+
+	vbus_supply_regulator: vbus-supply-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "vbus_supply";
+
+		gpio = <&tlmm 43 GPIO_ACTIVE_HIGH>;
+		pinctrl-0 = <&usb_vbus_boost_default>;
+		pinctrl-names = "default";
+		enable-active-high;
+	};
+
 	vph_pwr: vph-pwr-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "vph_pwr";
@@ -239,6 +266,16 @@  vreg_l18a_1p2: ldo18 {
 	};
 };

+&pm8150_gpios {
+	usb_vbus_det_default: usb-vbus-det-default {
+		pins = "gpio7";
+		function = "normal";
+		input-enable;
+		bias-pull-up;
+		power-source = <0>;
+	};
+};
+
 &qup_i2c1_data_clk {
 	drive-strength = <2>;
 	bias-pull-up;
@@ -500,3 +537,31 @@  &tlmm {
 &uart7 {
 	status = "okay";
 };
+
+&usb_1 {
+	status = "okay";
+};
+
+&usb_1_dwc3 {
+	dr_mode = "otg";
+	usb-role-switch;
+};
+
+&usb_1_dwc3_hs {
+	remote-endpoint = <&usb_port0_connector>;
+};
+
+&usb_1_hsphy {
+	vdda-pll-supply = <&vreg_l8a_0p91>;
+	vdda18-supply = <&vreg_l14a_1p8>;
+	vdda33-supply = <&vreg_l2a_2p3>;
+
+	status = "okay";
+};
+
+&usb_1_qmpphy {
+	vdda-phy-supply = <&vreg_l8a_0p91>;
+	vdda-pll-supply = <&vreg_l3a_1p2>;
+
+	status = "okay";
+};