devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: dts: qcom: db410c: Enable USB OTG support
@ 2019-12-11 16:50 Loic Poulain
  2019-12-12  6:49 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2019-12-11 16:50 UTC (permalink / raw)
  To: robh+dt, agross
  Cc: linux-arm-msm, devicetree, amit.pundir, bjorn.andersson, Loic Poulain

The Dragonboard-410c is able to act either as USB Host or Device.
The role can be determined at runtime via the USB_HS_ID pin which is
derived from the micro-usb port VBUS pin.

In Host role, SoC USB D+/D- are routed to the onboard USB 2.0 HUB.
In Device role, SoC USB D+/D- are routed to the USB 2.0 micro B port.
Routing is selected via USB_SW_SEL_PM gpio.

In device role USB HUB can be held in reset.

chipidea driver expects two extcon device pointers, one for the
EXTCON_USB event and one for the EXTCON_USB_HOST event. Since
the extcon-usb-gpio device is capable of generating both these
events, point two times to this extcon device.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi | 19 +++++++++++++++++++
 arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi           | 11 ++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi
index ec2f0de..aff218c 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi
@@ -8,6 +8,15 @@
 		pinconf {
 			pins = "gpio3";
 			function = PMIC_GPIO_FUNC_NORMAL;
+			input-disable;
+			output-high;
+		};
+	};
+
+	usb_hub_reset_pm_device: usb_hub_reset_pm_device {
+		pinconf {
+			pins = "gpio3";
+			function = PMIC_GPIO_FUNC_NORMAL;
 			output-low;
 		};
 	};
@@ -22,6 +31,16 @@
 		};
 	};
 
+	usb_sw_sel_pm_device: usb_sw_sel_pm_device {
+		pinconf {
+			pins = "gpio4";
+			function = PMIC_GPIO_FUNC_NORMAL;
+			power-source = <PM8916_GPIO_VPH>;
+			input-disable;
+			output-low;
+		};
+	};
+
 	pm8916_gpios_leds: pm8916_gpios_leds {
 		pinconf {
 			pins = "gpio1", "gpio2";
diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
index e12a36c..037e26b 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
@@ -358,14 +358,15 @@
 		};
 
 		usb@78d9000 {
-			extcon = <&usb_id>;
+			extcon = <&usb_id>, <&usb_id>;
 			status = "okay";
 			adp-disable;
 			hnp-disable;
 			srp-disable;
-			dr_mode = "host";
-			pinctrl-names = "default";
-			pinctrl-0 = <&usb_sw_sel_pm>;
+			dr_mode = "otg";
+			pinctrl-names = "default", "device";
+			pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>;
+			pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>;
 			ulpi {
 				phy {
 					v1p8-supply = <&pm8916_l7>;
@@ -504,7 +505,7 @@
 
 	usb_id: usb-id {
 		compatible = "linux,extcon-usb-gpio";
-		vbus-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
+		id-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&usb_id_default>;
 	};
-- 
2.7.4


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

* Re: [PATCH] arm: dts: qcom: db410c: Enable USB OTG support
  2019-12-11 16:50 [PATCH] arm: dts: qcom: db410c: Enable USB OTG support Loic Poulain
@ 2019-12-12  6:49 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2019-12-12  6:49 UTC (permalink / raw)
  To: Loic Poulain; +Cc: robh+dt, agross, linux-arm-msm, devicetree, amit.pundir

On Wed 11 Dec 08:50 PST 2019, Loic Poulain wrote:

> The Dragonboard-410c is able to act either as USB Host or Device.
> The role can be determined at runtime via the USB_HS_ID pin which is
> derived from the micro-usb port VBUS pin.
> 
> In Host role, SoC USB D+/D- are routed to the onboard USB 2.0 HUB.
> In Device role, SoC USB D+/D- are routed to the USB 2.0 micro B port.
> Routing is selected via USB_SW_SEL_PM gpio.
> 
> In device role USB HUB can be held in reset.
> 
> chipidea driver expects two extcon device pointers, one for the
> EXTCON_USB event and one for the EXTCON_USB_HOST event. Since
> the extcon-usb-gpio device is capable of generating both these
> events, point two times to this extcon device.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

Applied

Thanks,
Bjorn

> ---
>  arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi | 19 +++++++++++++++++++
>  arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi           | 11 ++++++-----
>  2 files changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi
> index ec2f0de..aff218c 100644
> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi
> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc-pmic-pins.dtsi
> @@ -8,6 +8,15 @@
>  		pinconf {
>  			pins = "gpio3";
>  			function = PMIC_GPIO_FUNC_NORMAL;
> +			input-disable;
> +			output-high;
> +		};
> +	};
> +
> +	usb_hub_reset_pm_device: usb_hub_reset_pm_device {
> +		pinconf {
> +			pins = "gpio3";
> +			function = PMIC_GPIO_FUNC_NORMAL;
>  			output-low;
>  		};
>  	};
> @@ -22,6 +31,16 @@
>  		};
>  	};
>  
> +	usb_sw_sel_pm_device: usb_sw_sel_pm_device {
> +		pinconf {
> +			pins = "gpio4";
> +			function = PMIC_GPIO_FUNC_NORMAL;
> +			power-source = <PM8916_GPIO_VPH>;
> +			input-disable;
> +			output-low;
> +		};
> +	};
> +
>  	pm8916_gpios_leds: pm8916_gpios_leds {
>  		pinconf {
>  			pins = "gpio1", "gpio2";
> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> index e12a36c..037e26b 100644
> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> @@ -358,14 +358,15 @@
>  		};
>  
>  		usb@78d9000 {
> -			extcon = <&usb_id>;
> +			extcon = <&usb_id>, <&usb_id>;
>  			status = "okay";
>  			adp-disable;
>  			hnp-disable;
>  			srp-disable;
> -			dr_mode = "host";
> -			pinctrl-names = "default";
> -			pinctrl-0 = <&usb_sw_sel_pm>;
> +			dr_mode = "otg";
> +			pinctrl-names = "default", "device";
> +			pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>;
> +			pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>;
>  			ulpi {
>  				phy {
>  					v1p8-supply = <&pm8916_l7>;
> @@ -504,7 +505,7 @@
>  
>  	usb_id: usb-id {
>  		compatible = "linux,extcon-usb-gpio";
> -		vbus-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
> +		id-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&usb_id_default>;
>  	};
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2019-12-12  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 16:50 [PATCH] arm: dts: qcom: db410c: Enable USB OTG support Loic Poulain
2019-12-12  6:49 ` Bjorn Andersson

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).