Skip to contentSkip to conversation

Fix Exynos peach USB on kernels with USB Gadget support

PATCH Superseded Sjoerd Simons 2 participants 8 messages Aug 26, 2014 – Aug 27, 2014

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fix Exynos peach USB on kernels with USB Gadget support

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(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH v2 1/2 ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi

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

---
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(-)
arch/arm/boot/dts/exynos5420-peach-pit.dts +8 -0
index 228a6b1..29d3a59 100644
@@ -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>;
 };
arch/arm/boot/dts/exynos5420.dtsi +2 -2
index bfe056d..8617a03 100644
@@ -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>;
arch/arm/boot/dts/exynos5800-peach-pi.dts +8 -0
index f3ee48b..2064550 100644
@@ -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>;
 };
Signature · 1 line
2.1.0
#2 lore raw

PATCH v2 1/2 ARM: dts: exynos: Explicitly set dr_mode on peach-pit and peach-pi

Am 26.08.2014 09:30, schrieb Sjoerd Simons:

Quoted 6 lines

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"

Quoted 61 lines

mode as host

---
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(-)
arch/arm/boot/dts/exynos5420-peach-pit.dts +8 -0
index 228a6b1..29d3a59 100644
@@ -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>;
 };
arch/arm/boot/dts/exynos5420.dtsi +2 -2
index bfe056d..8617a03 100644
@@ -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>;
arch/arm/boot/dts/exynos5800-peach-pi.dts +1 -0
index f3ee48b..2064550 100644
@@ -425,6 +425,14 @@
 	status = "okay";
 };
 
+&usbdrd_dwc3_0 {

arch/arm/boot/dts/exynos5800-peach-pi.dts line 438

Quoted 10 lines
arch/arm/boot/dts/exynos5800-peach-pi.dts +7 -0
+	dr_mode = "host";
+};
+
+&usbdrd_dwc3_1 {
+	dr_mode = "host";
+};
+
 &usbdrd_phy0 {
 	vbus-supply = <&usb300_vbus_reg>;
 };

Thanks,

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg
#3 lore raw

PATCH v2 2/2 ARM: exynos_defconfig: enable USB gadget support

In reply to 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.

---
Changes in v2: none

 arch/arm/configs/exynos_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/exynos_defconfig +1 -0
index fc7d168..3664120 100644
@@ -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
Signature · 1 line
2.1.0
#4 lore raw

PATCH v2 2/2 ARM: exynos_defconfig: enable USB gadget support

Am 26.08.2014 09:30, schrieb Sjoerd Simons:

Quoted 16 lines

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.

---
Changes in v2: none

 arch/arm/configs/exynos_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/exynos_defconfig +0 -0
index fc7d168..3664120 100644

arch/arm/configs/exynos_defconfig CONFIG_SMSC911X=y · line 57

Quoted 4 lines
arch/arm/configs/exynos_defconfig +1 -0
@@ -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.

arch/arm/configs/exynos_defconfig CONFIG_SMSC911X=y · line 60

Quoted 3 lines
arch/arm/configs/exynos_defconfig +0 -0
 CONFIG_INPUT_EVDEV=y
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_CROS_EC=y

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg
#5 lore raw

PATCH v2 2/2 ARM: exynos_defconfig: enable USB gadget support

Quoted 12 lines · Andreas F?rber

Am 26.08.2014 09:30, schrieb Sjoerd Simons:

Quoted 11 lines

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.

---
Changes in v2: none

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

arch/arm/configs/exynos_defconfig CONFIG_SMSC911X=y · line 57

Quoted 9 lines
arch/arm/configs/exynos_defconfig +1 -0
index fc7d168..3664120 100644
@@ -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

Signature · 9 lines
Sjoerd Simons <[email protected]>
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>
#6 lore raw

v2 cover Fix Exynos peach USB on kernels with USB Gadget support

In reply to Sjoerd Simons

Hi,

Am 26.08.2014 09:30, schrieb Sjoerd Simons:

Quoted 3 lines

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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 16746 AG N?rnberg
#7 lore raw

v2 cover Fix Exynos peach USB on kernels with USB Gadget support

Quoted 10 lines · Andreas F?rber

Hi,

Am 26.08.2014 09:30, schrieb Sjoerd Simons:

Quoted 3 lines

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.

Quoted 1 line

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

Signature · 9 lines
Sjoerd Simons <[email protected]>
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>