linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support
@ 2014-08-26  7:30 Sjoerd Simons
  2014-08-26  7:30 ` [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi Sjoerd Simons
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sjoerd Simons @ 2014-08-26  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

When building a kernel with support for both USB host and USB Gadget support on
the dwc3 controller on the Exynos5 soc will go into USB OTG mode unless
otherwise specified in the dtb, which is unhelpful for boards hooked up to run
as USB host.

First patch in this set explicitely set the dual-role mode for the dwc3
controller on Peach pi and Peach pit boards to host mode. Second patch enables
gadget mode in the default exynos config to more easily catch/trigger issues
like these.

I suspect other boards base using exynos5420/5800 might need the similar fixes
(Arndale Octa and Samsung SMDK5420) to their dts files, so would be great if
folks with those board could verify this.

Changes in v2: alphabetically sort the dts entries

Sjoerd Simons (2):
  ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi
  ARM: exynos_defconfig: enable USB gadget support

 arch/arm/boot/dts/exynos5420-peach-pit.dts | 8 ++++++++
 arch/arm/boot/dts/exynos5420.dtsi          | 4 ++--
 arch/arm/boot/dts/exynos5800-peach-pi.dts  | 8 ++++++++
 arch/arm/configs/exynos_defconfig          | 1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

-- 
2.1.0

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

* [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi
  2014-08-26  7:30 [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Sjoerd Simons
@ 2014-08-26  7:30 ` Sjoerd Simons
  2014-08-26 22:59   ` Andreas Färber
  2014-08-26  7:30 ` [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support Sjoerd Simons
  2014-08-27  2:08 ` [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Andreas Färber
  2 siblings, 1 reply; 8+ messages in thread
From: Sjoerd Simons @ 2014-08-26  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

In case the optional dr_mode property isn't set in the dwc3 nodes the
the controller will go into OTG mode iff both USB host and USB gadget
functionality are enabled in the kernel configuration. Unfortunately this
results in USB not working on exynos5420-peach-pit and
exynos5800-peach-pi with such a kernel configuration unless manually
change the mode. To resolve that explicitely configure the dual role
mode as host

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
  Changes in v2: alphabetically sort the dts entries

 arch/arm/boot/dts/exynos5420-peach-pit.dts | 8 ++++++++
 arch/arm/boot/dts/exynos5420.dtsi          | 4 ++--
 arch/arm/boot/dts/exynos5800-peach-pi.dts  | 8 ++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index 228a6b1..29d3a59 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -427,6 +427,14 @@
 	status = "okay";
 };
 
+&usbdrd_dwc3_0 {
+	dr_mode = "host";
+};
+
+&usbdrd_dwc3_1 {
+	dr_mode = "host";
+};
+
 &usbdrd_phy0 {
 	vbus-supply = <&usb300_vbus_reg>;
 };
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index bfe056d..8617a03 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -815,7 +815,7 @@
 		#size-cells = <1>;
 		ranges;
 
-		dwc3 {
+		usbdrd_dwc3_0: dwc3 {
 			compatible = "snps,dwc3";
 			reg = <0x12000000 0x10000>;
 			interrupts = <0 72 0>;
@@ -841,7 +841,7 @@
 		#size-cells = <1>;
 		ranges;
 
-		dwc3 {
+		usbdrd_dwc3_1: dwc3 {
 			compatible = "snps,dwc3";
 			reg = <0x12400000 0x10000>;
 			interrupts = <0 73 0>;
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index f3ee48b..2064550 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -425,6 +425,14 @@
 	status = "okay";
 };
 
+&usbdrd_dwc3_0 {
+	dr_mode = "host";
+};
+
+&usbdrd_dwc3_1 {
+	dr_mode = "host";
+};
+
 &usbdrd_phy0 {
 	vbus-supply = <&usb300_vbus_reg>;
 };
-- 
2.1.0

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

* [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support
  2014-08-26  7:30 [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Sjoerd Simons
  2014-08-26  7:30 ` [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi Sjoerd Simons
@ 2014-08-26  7:30 ` Sjoerd Simons
  2014-08-27  1:38   ` Andreas Färber
  2014-08-27  2:08 ` [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Andreas Färber
  2 siblings, 1 reply; 8+ messages in thread
From: Sjoerd Simons @ 2014-08-26  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

Enable USB gadget support without support for any specific gadgets to
more easily catch cases where a devices dts doesn't specify the usb
controllers dr_mode while it should.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
 Changes in v2: none

 arch/arm/configs/exynos_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index fc7d168..3664120 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -54,6 +54,7 @@ CONFIG_SMSC911X=y
 CONFIG_USB_USBNET=y
 CONFIG_USB_NET_SMSC75XX=y
 CONFIG_USB_NET_SMSC95XX=y
+CONFIG_USB_GADGET=y
 CONFIG_INPUT_EVDEV=y
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_CROS_EC=y
-- 
2.1.0

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

* [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi
  2014-08-26  7:30 ` [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi Sjoerd Simons
@ 2014-08-26 22:59   ` Andreas Färber
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Färber @ 2014-08-26 22:59 UTC (permalink / raw)
  To: linux-arm-kernel

Am 26.08.2014 09:30, schrieb Sjoerd Simons:
> In case the optional dr_mode property isn't set in the dwc3 nodes the
> the controller will go into OTG mode iff both USB host and USB gadget
> functionality are enabled in the kernel configuration. Unfortunately this
> results in USB not working on exynos5420-peach-pit and
> exynos5800-peach-pi with such a kernel configuration unless manually
> change the mode. To resolve that explicitely configure the dual role

"explicitly"

> mode as host
> 
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
>   Changes in v2: alphabetically sort the dts entries
> 
>  arch/arm/boot/dts/exynos5420-peach-pit.dts | 8 ++++++++
>  arch/arm/boot/dts/exynos5420.dtsi          | 4 ++--
>  arch/arm/boot/dts/exynos5800-peach-pi.dts  | 8 ++++++++
>  3 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
> index 228a6b1..29d3a59 100644
> --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
> +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
> @@ -427,6 +427,14 @@
>  	status = "okay";
>  };
>  
> +&usbdrd_dwc3_0 {
> +	dr_mode = "host";
> +};
> +
> +&usbdrd_dwc3_1 {
> +	dr_mode = "host";
> +};
> +
>  &usbdrd_phy0 {
>  	vbus-supply = <&usb300_vbus_reg>;
>  };
> diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
> index bfe056d..8617a03 100644
> --- a/arch/arm/boot/dts/exynos5420.dtsi
> +++ b/arch/arm/boot/dts/exynos5420.dtsi
> @@ -815,7 +815,7 @@
>  		#size-cells = <1>;
>  		ranges;
>  
> -		dwc3 {
> +		usbdrd_dwc3_0: dwc3 {
>  			compatible = "snps,dwc3";
>  			reg = <0x12000000 0x10000>;
>  			interrupts = <0 72 0>;
> @@ -841,7 +841,7 @@
>  		#size-cells = <1>;
>  		ranges;
>  
> -		dwc3 {
> +		usbdrd_dwc3_1: dwc3 {
>  			compatible = "snps,dwc3";
>  			reg = <0x12400000 0x10000>;
>  			interrupts = <0 73 0>;
> diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
> index f3ee48b..2064550 100644
> --- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
> +++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
> @@ -425,6 +425,14 @@
>  	status = "okay";
>  };
>  
> +&usbdrd_dwc3_0 {
> +	dr_mode = "host";
> +};
> +
> +&usbdrd_dwc3_1 {
> +	dr_mode = "host";
> +};
> +
>  &usbdrd_phy0 {
>  	vbus-supply = <&usb300_vbus_reg>;
>  };

Thanks,

Reviewed-by: Andreas F?rber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg

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

* [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support
  2014-08-26  7:30 ` [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support Sjoerd Simons
@ 2014-08-27  1:38   ` Andreas Färber
  2014-08-27  7:28     ` Sjoerd Simons
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2014-08-27  1:38 UTC (permalink / raw)
  To: linux-arm-kernel

Am 26.08.2014 09:30, schrieb Sjoerd Simons:
> Enable USB gadget support without support for any specific gadgets to
> more easily catch cases where a devices dts doesn't specify the usb
> controllers dr_mode while it should.
> 
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
>  Changes in v2: none
> 
>  arch/arm/configs/exynos_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
> index fc7d168..3664120 100644
> --- a/arch/arm/configs/exynos_defconfig
> +++ b/arch/arm/configs/exynos_defconfig
> @@ -54,6 +54,7 @@ CONFIG_SMSC911X=y
>  CONFIG_USB_USBNET=y
>  CONFIG_USB_NET_SMSC75XX=y
>  CONFIG_USB_NET_SMSC95XX=y
> +CONFIG_USB_GADGET=y

Do we also need CONFIG_USB_DWC3_DUAL_ROLE=y? The default seemed to be
CONFIG_USB_DWC3_HOST.

>  CONFIG_INPUT_EVDEV=y
>  CONFIG_KEYBOARD_GPIO=y
>  CONFIG_KEYBOARD_CROS_EC=y

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg

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

* [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support
  2014-08-26  7:30 [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Sjoerd Simons
  2014-08-26  7:30 ` [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi Sjoerd Simons
  2014-08-26  7:30 ` [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support Sjoerd Simons
@ 2014-08-27  2:08 ` Andreas Färber
  2014-08-27  7:44   ` Sjoerd Simons
  2 siblings, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2014-08-27  2:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Am 26.08.2014 09:30, schrieb Sjoerd Simons:
> I suspect other boards base using exynos5420/5800 might need the similar fixes
> (Arndale Octa and Samsung SMDK5420) to their dts files, so would be great if
> folks with those board could verify this.

usbdrd_dwc3_1 is indeed required for the Arndale Octa. Not sure about 0.

I tested my attaching a USB 3.0 disk - is there an easier way to tell?

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg

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

* [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support
  2014-08-27  1:38   ` Andreas Färber
@ 2014-08-27  7:28     ` Sjoerd Simons
  0 siblings, 0 replies; 8+ messages in thread
From: Sjoerd Simons @ 2014-08-27  7:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2014-08-27 at 03:38 +0200, Andreas F?rber wrote:
> Am 26.08.2014 09:30, schrieb Sjoerd Simons:
> > Enable USB gadget support without support for any specific gadgets to
> > more easily catch cases where a devices dts doesn't specify the usb
> > controllers dr_mode while it should.
> > 
> > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> > ---
> >  Changes in v2: none
> > 
> >  arch/arm/configs/exynos_defconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
> > index fc7d168..3664120 100644
> > --- a/arch/arm/configs/exynos_defconfig
> > +++ b/arch/arm/configs/exynos_defconfig
> > @@ -54,6 +54,7 @@ CONFIG_SMSC911X=y
> >  CONFIG_USB_USBNET=y
> >  CONFIG_USB_NET_SMSC75XX=y
> >  CONFIG_USB_NET_SMSC95XX=y
> > +CONFIG_USB_GADGET=y
> 
> Do we also need CONFIG_USB_DWC3_DUAL_ROLE=y? The default seemed to be
> CONFIG_USB_DWC3_HOST.

Nope that gets set by this Kconfig snippet:

choice
   bool "DWC3 Mode Selection"
   default USB_DWC3_DUAL_ROLE if (USB && USB_GADGET)
   default USB_DWC3_HOST if (USB && !USB_GADGET)
   default USB_DWC3_GADGET if (!USB && USB_GADGET)

Iotw by both enable USB and USB_GADGET the default will switch form
CONFIG_USB_DWC3_HOST to CONFIG_USB_DWC3_DUAL_ROLE=y

-- 
Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Collabora Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140827/ecf9bbfd/attachment.bin>

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

* [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support
  2014-08-27  2:08 ` [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Andreas Färber
@ 2014-08-27  7:44   ` Sjoerd Simons
  0 siblings, 0 replies; 8+ messages in thread
From: Sjoerd Simons @ 2014-08-27  7:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2014-08-27 at 04:08 +0200, Andreas F?rber wrote:
> Hi,
> 
> Am 26.08.2014 09:30, schrieb Sjoerd Simons:
> > I suspect other boards base using exynos5420/5800 might need the similar fixes
> > (Arndale Octa and Samsung SMDK5420) to their dts files, so would be great if
> > folks with those board could verify this.
> 
> usbdrd_dwc3_1 is indeed required for the Arndale Octa. Not sure about 0.
> 
> I tested my attaching a USB 3.0 disk - is there an easier way to tell?

That seems to be the easiest way to tell. In my testing when things
broke no USB host functionality would work, so USB 3 isn't a
requirement.  You can also build with USB_DWC3_DEBUG enabled and check
the mode file it generates in debugfs to see & set the controller mode
to see how it gets setup by default and change the mode without
rebuilding the dts.

>From looking at the board on the arndaleboard wiki[0], it looks like it
has one USB 3 host (which i guess is usbdrd_dwc3_1?) and a USB 2 OTG
port which might be usbdrd_dwc3_0 (in which case the default setting for
otg is correct). 


0: http://www.arndaleboard.org/wiki/index.php/O_WiKi#Detail_of_Arndale_Board

-- 
Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Collabora Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140827/e7fd14cd/attachment.bin>

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

end of thread, other threads:[~2014-08-27  7:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26  7:30 [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Sjoerd Simons
2014-08-26  7:30 ` [PATCH 1/2 v2] ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi Sjoerd Simons
2014-08-26 22:59   ` Andreas Färber
2014-08-26  7:30 ` [PATCH 2/2 v2] ARM: exynos_defconfig: enable USB gadget support Sjoerd Simons
2014-08-27  1:38   ` Andreas Färber
2014-08-27  7:28     ` Sjoerd Simons
2014-08-27  2:08 ` [PATCH 0/2 v2] Fix Exynos peach USB on kernels with USB Gadget support Andreas Färber
2014-08-27  7:44   ` Sjoerd Simons

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