Skip to contentSkip to conversation

arm64: dts: msm8996: Use dwc3-qcom glue driver for USB

PATCH In review Manu Gautam 5 participants 9 messages May 31, 2018 – Jul 10, 2018 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: dts: msm8996: Use dwc3-qcom glue driver for USB

Move from dwc3-of-simple to dwc3-qcom glue driver to support peripheral mode which requires qscratch wrapper programming on VBUS event.

Fixes a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")

---

Changes since v1:
- Update unit address of DT node as per Doug's comment

 arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |  6 ++++--
 arch/arm64/boot/dts/qcom/msm8996.dtsi        | 10 ++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +4 -2
index f45a0ab30d30..00be0d53891a 100644
@@ -106,8 +106,9 @@
 			status = "okay";
 		};
 
-		usb@6a00000 {
+		usb@6af8800 {
 			status = "okay";
+			extcon = <&usb3_id>;
 
 			dwc3@6a00000 {
 				extcon = <&usb3_id>;
@@ -122,8 +123,9 @@
 			pinctrl-0 = <&usb3_vbus_det_gpio>;
 		};
 
-		usb@7600000 {
+		usb@76f8800 {
 			status = "okay";
+			extcon = <&usb2_id>;
 
 			dwc3@7600000 {
 				extcon = <&usb2_id>;
arch/arm64/boot/dts/qcom/msm8996.dtsi +6 -4
index 26292027ba9b..8b6dd5443524 100644
@@ -776,8 +776,9 @@
 			status = "disabled";
 		};
 
-		usb2: usb@7600000 {
-			compatible = "qcom,dwc3";
+		usb2: usb@76f8800 {
+			compatible = "qcom,msm8996-dwc3", "qcom,dwc3";
+			reg = <0x76f8800 0x400>;
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
@@ -804,8 +805,9 @@
 			};
 		};
 
-		usb3: usb@6a00000 {
-			compatible = "qcom,dwc3";
+		usb3: usb@6af8800 {
+			compatible = "qcom,msm8996-dwc3", "qcom,dwc3";
+			reg = <0x6af8800 0x400>;
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
Tested-by on v2 1/1
#1 lore raw
Quoted 6 lines · Manu Gautam

Move from dwc3-of-simple to dwc3-qcom glue driver to support peripheral mode which requires qscratch wrapper programming on VBUS event.

Fixes a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Quoted 8 lines

---

Changes since v1:
- Update unit address of DT node as per Doug's comment

  arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |  6 ++++--
  arch/arm64/boot/dts/qcom/msm8996.dtsi        | 10 ++++++----
  2 files changed, 10 insertions(+), 6 deletions(-)

Tested on DB820c. Works fine.

BRs
Vivek

Quoted 45 lines
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +4 -2
index f45a0ab30d30..00be0d53891a 100644
@@ -106,8 +106,9 @@
  			status = "okay";
  		};
 
-		usb@6a00000 {
+		usb@6af8800 {
  			status = "okay";
+			extcon = <&usb3_id>;
 
  			dwc3@6a00000 {
  				extcon = <&usb3_id>;
@@ -122,8 +123,9 @@
  			pinctrl-0 = <&usb3_vbus_det_gpio>;
  		};
 
-		usb@7600000 {
+		usb@76f8800 {
  			status = "okay";
+			extcon = <&usb2_id>;
 
  			dwc3@7600000 {
  				extcon = <&usb2_id>;
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -2
index 26292027ba9b..8b6dd5443524 100644
@@ -776,8 +776,9 @@
  			status = "disabled";
  		};
 
-		usb2: usb@7600000 {
-			compatible = "qcom,dwc3";
+		usb2: usb@76f8800 {
+			compatible = "qcom,msm8996-dwc3", "qcom,dwc3";
+			reg = <0x76f8800 0x400>;
  			#address-cells = <1>;
  			#size-cells = <1>;
  			ranges;
@@ -804,8 +805,9 @@
  			};

arch/arm64/boot/dts/qcom/msm8996.dtsi line 813

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -2
  		};
 
-		usb3: usb@6a00000 {
-			compatible = "qcom,dwc3";
+		usb3: usb@6af8800 {
+			compatible = "qcom,msm8996-dwc3", "qcom,dwc3";
+			reg = <0x6af8800 0x400>;
  			#address-cells = <1>;
  			#size-cells = <1>;
  			ranges;

---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi,

Quoted 5 lines · Manu Gautam
Quoted 4 lines

Move from dwc3-of-simple to dwc3-qcom glue driver to support peripheral mode which requires qscratch wrapper programming on VBUS event.

I would like to test usb otg as peripheral role, but that's not clear for me which patches
are required on top of linux master branch or linaro qcom-lt integration branch, or a
custom branch which integrate dt-binding phy or usb related patch.

Can you point me the patches I need to apply, or a branch, to test peripheral feature ?

Thanks,
Julien

#3 lore raw

Hi,

Quoted 6 lines · Julien Massot

Hi,

Quoted 4 lines · Manu Gautam
Quoted 3 lines

Move from dwc3-of-simple to dwc3-qcom glue driver to support peripheral mode which requires qscratch wrapper programming on VBUS event.

Quoted 8 lines

I would like to test usb otg as peripheral role, but that's not clear for me which patches
are required on top of linux master branch or linaro qcom-lt integration branch, or a
custom branch which integrate dt-binding phy or usb related patch.

Can you point me the patches I need to apply, or a branch, to test peripheral feature ?

I have a branch that's based on 4.17. You can pick that.
https://github.com/vivekgautam1/linux/commits/v4.17/db820c

Thanks
Vivek

Quoted 4 lines

Thanks,
Julien

---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CADb+VZKtAspuvO64FVEBHUbcB0Nr57jWpBmpS5GfCE+QKD4CcA@mail.gmail.com

#6 lore raw

Hi,

Quoted 16 lines · Pierre LE MAGOUROU
Quoted 8 lines
Quoted 3 lines

I have a branch that's based on 4.17. You can pick that.
https://github.com/vivekgautam1/linux/commits/v4.17/db820c

Thanks a lot,
I will test this branch.

I just tested USB gadget with this branch on the db820c.

If I activate a USB composite gadget device with EEM function, I can see the 'usb0' Ethernet interfaces on the device and on the host and I can ping the db820c from the host.
When I create a USB composite gadget device with UAC2 function, I can see the audio cards on host and device but cannot play or record any sound.

Quoted 3 lines

While looking at dwc3 traces with Ftrace, I noticed that the dwc3 driver is stuck on wait_event_lock_irq() in dwc3_gadget_ep_dequeue() function when I use UAC2 gadget.

can you share tracepoint data?

Quoted 15 lines

*This email and any attachment thereto are confidential and intended solely for the use of the individual or entity to whom they are addressed.

If you are not the intended recipient, please be advised that disclosing, copying, distributing or taking any action in reliance on the contents of this email is strictly prohibited. In such case, please immediately advise the sender, and delete all copies and attachment from your system. This
email shall not be construed and is not tantamount to an offer, an acceptance of offer, or an agreement by SoftBank Robotics Europe on any discussion or contractual document whatsoever. No employee or agent is authorized to represent or bind SoftBank Robotics Europe to third parties by email, or act on behalf of SoftBank Robotics Europe by email, without express written confirmation by SoftBank Robotics Europe’ duly authorized representatives.

you need to talk to your company's IT about removing this footer. This makes the life of those maintaining mailing list archives rather difficult.

A message that is not in the archive (sent off-list or not yet received): CADb+VZJVtfgSDD+7F1J6p2YG0dguN7BhP=bzz3r8jO7FT7dk8w@mail.gmail.com

#8 lore raw

Hi,

Quoted 19 lines · Pierre LE MAGOUROU
Quoted 19 lines
Quoted 8 lines
Quoted 4 lines

Thanks a lot,
I will test this branch.

I just tested USB gadget with this branch on the db820c.

If I activate a USB composite gadget device with EEM function, I can see the 'usb0' Ethernet interfaces on the device and on the host and I can

ping

Quoted 5 lines

the db820c from the host.
When I create a USB composite gadget device with UAC2 function, I can see the audio cards on host and device but cannot play or record any sound.

While looking at dwc3 traces with Ftrace, I noticed that the dwc3 driver

is

Quoted 1 line

stuck on wait_event_lock_irq() in dwc3_gadget_ep_dequeue() function when

I

Quoted 1 line

use UAC2 gadget.

Quoted 8 lines
Quoted 3 lines

can you share tracepoint data?

Here are the trace results when I start the UAC2 gadget device (all dwc3 functions and events are activated) : https://pastebin.com/NBP3tM8N
The last line you see "before wait_event EP_END_TRANSFER_PENDING" is a trace_printk I added just before wait_event_lock_irq(). I also have a trace_printk after the wait_event_lock_irq() that is never called.

looks like we need to do away with the wait_event_lock_irq() call. usb_ep_dequeue() can be called from within the controller's interrupt handler, so we can't rely on wait_event_lock_irq(). I guess the best thing here would be to mark TRBs as dirty (and not increment dequeue pointer), so they aren't reused by accident, then let endpoint continue processing. Once command completion interrupt fires, we increment dequeue pointer.

This should work better, I suppose. Do you want a shot at implementing this?

#9 lore raw

Hi Felipe,

2018-06-27 14:30 GMT+02:00 Felipe Balbi <[email protected]>:

Quoted 11 lines

looks like we need to do away with the wait_event_lock_irq() call. usb_ep_dequeue() can be called from within the controller's interrupt handler, so we can't rely on wait_event_lock_irq(). I guess the best thing here would be to mark TRBs as dirty (and not increment dequeue pointer), so they aren't reused by accident, then let endpoint continue processing. Once command completion interrupt fires, we increment dequeue pointer.

This should work better, I suppose. Do you want a shot at implementing this?

I wrote a patch to implement this last week, and sent it to linux-arm-msm. Feel free to review it and tell me if this complies with what you suggested to me.

Regards,

Pierre Le Magourou
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to Vivek Gautam

Hi Andy,

Quoted 14 lines · Vivek Gautam
Quoted 11 lines · Manu Gautam

Move from dwc3-of-simple to dwc3-qcom glue driver to support peripheral mode which requires qscratch wrapper programming on VBUS event.

Fixes a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")

---

Changes since v1:
  - Update unit address of DT node as per Doug's comment

Quoted 7 lines
Quoted 3 lines

  arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |  6 ++++-- arch/arm64/boot/dts/qcom/msm8996.dtsi        | 10 ++++++----

  2 files changed, 10 insertions(+), 6 deletions(-)

Tested on DB820c. Works fine.

Andy, let me know if this looks good to you.
And it would be great to get this in 4.18 to fix USB regression on db820c.

Thanks,
Manu