Skip to contentSkip to conversation

linux-next: manual merge of the usb tree with the usb.current tree

DISCUSSION Stephen Rothwell 4 participants 8 messages May 15, 2023 – May 28, 2023

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

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 34 lines
Cheers,
Stephen Rothwell

diff --cc drivers/usb/dwc3/gadget.c
index d831f5acf7b5,5965796bc5d5..000000000000
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@@ -2700,21 -2699,6 +2700,26 @@@ static int dwc3_gadget_soft_disconnect(
  	return ret;
  }
  
 +static int dwc3_gadget_soft_connect(struct dwc3 *dwc)
 +{
++	int	ret;
++
 +	/*
 +	 * In the Synopsys DWC_usb31 1.90a programming guide section
 +	 * 4.1.9, it specifies that for a reconnect after a
 +	 * device-initiated disconnect requires a core soft reset
 +	 * (DCTL.CSftRst) before enabling the run/stop bit.
 +	 */
 +	dwc3_core_soft_reset(dwc);
++	ret = dwc3_core_soft_reset(dwc);
++	if (ret)
++		return ret;
 +
 +	dwc3_event_buffers_setup(dwc);
 +	__dwc3_gadget_start(dwc);
 +	return dwc3_gadget_run_stop(dwc, true);
 +}
 +
  static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
  {
  	struct dwc3		*dwc = gadget_to_dwc(g);
#1 lore raw
Quoted 14 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

Quoted 8 lines

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Thanks for the 2 merge fixups, I'll apply them to my tree when the usb fixes get merged by Linus.

greg k-h

#2 lore raw
In reply to Stephen Rothwell
Quoted 14 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

   c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

Quoted 9 lines

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Hi Stephen,

I think the core soft reset has been called two times in the patch
present in this mail. Anything on my end I can do to help.

Regards,
Krishna,

#3 lore raw
In reply to Stephen Rothwell

Hi Stephen,

Quoted 33 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

drivers/usb/dwc3/gadget.c +0 -0
diff --cc drivers/usb/dwc3/gadget.c
index d831f5acf7b5,5965796bc5d5..000000000000
@@@ -2700,21 -2699,6 +2700,26 @@@ static int dwc3_gadget_soft_disconnect(
  	return ret;
  }
 
 +static int dwc3_gadget_soft_connect(struct dwc3 *dwc)

drivers/usb/dwc3/gadget.c

Quoted 10 lines
drivers/usb/dwc3/gadget.c +2 -0
 +{
++	int	ret;
++
 +	/*
 +	 * In the Synopsys DWC_usb31 1.90a programming guide section
 +	 * 4.1.9, it specifies that for a reconnect after a
 +	 * device-initiated disconnect requires a core soft reset
 +	 * (DCTL.CSftRst) before enabling the run/stop bit.
 +	 */
 +	dwc3_core_soft_reset(dwc);

Please drop above call to dwc3_core_soft_reset().

Quoted 12 lines

++ ret = dwc3_core_soft_reset(dwc);
++ if (ret)
++ return ret;
+
+ dwc3_event_buffers_setup(dwc);
+ __dwc3_gadget_start(dwc);
+ return dwc3_gadget_run_stop(dwc, true);
+}
+
static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) {
struct dwc3 *dwc = gadget_to_dwc(g);

Signature · 2 lines
cheers,
-roger
#4 lore raw

Hi Roger,

Quoted 8 lines · On Mon, 15 May 2023 14:01:08 +0300 Roger Quadros <[email protected]> wrote:
Quoted 2 lines

+ dwc3_core_soft_reset(dwc);

Please drop above call to dwc3_core_soft_reset().

Quoted 3 lines

++ ret = dwc3_core_soft_reset(dwc);
++ if (ret)
++ return ret;

Thanks, fixed for tomorrow.

Signature · 2 lines
Cheers,
Stephen Rothwell
#5 lore raw
In reply to Roger Quadros
Quoted 35 lines · Roger Quadros

Hi Stephen,

Quoted 32 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

drivers/usb/dwc3/gadget.c +0 -0
diff --cc drivers/usb/dwc3/gadget.c
index d831f5acf7b5,5965796bc5d5..000000000000
@@@ -2700,21 -2699,6 +2700,26 @@@ static int dwc3_gadget_soft_disconnect(
  	return ret;
  }
Quoted 27 lines
Quoted 11 lines

+static int dwc3_gadget_soft_connect(struct dwc3 *dwc) +{
++ int ret;
++
+ /*
+ * In the Synopsys DWC_usb31 1.90a programming guide section
+ * 4.1.9, it specifies that for a reconnect after a
+ * device-initiated disconnect requires a core soft reset
+ * (DCTL.CSftRst) before enabling the run/stop bit.
+ */
+ dwc3_core_soft_reset(dwc);

Please drop above call to dwc3_core_soft_reset().

Quoted 12 lines

++ ret = dwc3_core_soft_reset(dwc);
++ if (ret)
++ return ret;
+
+ dwc3_event_buffers_setup(dwc);
+ __dwc3_gadget_start(dwc);
+ return dwc3_gadget_run_stop(dwc, true);
+}
+
static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) {
struct dwc3 *dwc = gadget_to_dwc(g);

Can you verify I got this right in my usb-next branch now?

thanks,

greg k-h

#6 lore raw

Hi Greg,

Quoted 64 lines · Greg KH
Quoted 35 lines · Roger Quadros

Hi Stephen,

Quoted 32 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

drivers/usb/dwc3/gadget.c +0 -0
diff --cc drivers/usb/dwc3/gadget.c
index d831f5acf7b5,5965796bc5d5..000000000000
@@@ -2700,21 -2699,6 +2700,26 @@@ static int dwc3_gadget_soft_disconnect(
  	return ret;
  }
Quoted 27 lines
Quoted 11 lines

+static int dwc3_gadget_soft_connect(struct dwc3 *dwc) +{
++ int ret;
++
+ /*
+ * In the Synopsys DWC_usb31 1.90a programming guide section
+ * 4.1.9, it specifies that for a reconnect after a
+ * device-initiated disconnect requires a core soft reset
+ * (DCTL.CSftRst) before enabling the run/stop bit.
+ */
+ dwc3_core_soft_reset(dwc);

Please drop above call to dwc3_core_soft_reset().

Quoted 12 lines

++ ret = dwc3_core_soft_reset(dwc);
++ if (ret)
++ return ret;
+
+ dwc3_event_buffers_setup(dwc);
+ __dwc3_gadget_start(dwc);
+ return dwc3_gadget_run_stop(dwc, true);
+}
+
static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) {
struct dwc3 *dwc = gadget_to_dwc(g);

Quoted 1 line

Can you verify I got this right in my usb-next branch now?

No, the end result is not correct.

Please apply the below patch to fix it. Thanks.

Signature · 2 lines
cheers,
-roger
drivers/usb/dwc3/gadget.c +8 -18
index 7d59e0f43fda..578804dc29ca 100644
@@ -2702,13 +2702,17 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc)
 
 static int dwc3_gadget_soft_connect(struct dwc3 *dwc)
 {
+	int ret;
+
 	/*
 	 * In the Synopsys DWC_usb31 1.90a programming guide section
 	 * 4.1.9, it specifies that for a reconnect after a
 	 * device-initiated disconnect requires a core soft reset
 	 * (DCTL.CSftRst) before enabling the run/stop bit.
 	 */
-	dwc3_core_soft_reset(dwc);
+	ret = dwc3_core_soft_reset(dwc);
+	if (ret)
+		return ret;
 
 	dwc3_event_buffers_setup(dwc);
 	__dwc3_gadget_start(dwc);
@@ -2753,25 +2757,11 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
 
 	synchronize_irq(dwc->irq_gadget);
 
-	if (!is_on) {
+	if (!is_on)
 		ret = dwc3_gadget_soft_disconnect(dwc);
-	} else {
-		/*
-		 * In the Synopsys DWC_usb31 1.90a programming guide section
-		 * 4.1.9, it specifies that for a reconnect after a
-		 * device-initiated disconnect requires a core soft reset
-		 * (DCTL.CSftRst) before enabling the run/stop bit.
-		 */
-		ret = dwc3_core_soft_reset(dwc);
-		if (ret)
-			goto done;
-
-		dwc3_event_buffers_setup(dwc);
-		__dwc3_gadget_start(dwc);
-		ret = dwc3_gadget_run_stop(dwc, true);
-	}
+	else
+		ret = dwc3_gadget_soft_connect(dwc);
 
-done:
 	pm_runtime_put(dwc->dev);
 
 	return ret;
#7 lore raw
Quoted 67 lines · Roger Quadros

Hi Greg,

Quoted 64 lines · Greg KH
Quoted 62 lines · Roger Quadros

Hi Stephen,

Quoted 33 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

drivers/usb/dwc3/gadget.c

between commit:

c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")

from the usb.current tree and commit:

813f44d57e19 ("usb: dwc3: gadget: Bail out in pullup if soft reset timeout happens")

from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

drivers/usb/dwc3/gadget.c +0 -0
diff --cc drivers/usb/dwc3/gadget.c
index d831f5acf7b5,5965796bc5d5..000000000000
@@@ -2700,21 -2699,6 +2700,26 @@@ static int dwc3_gadget_soft_disconnect(
  	return ret;
  }
 
 +static int dwc3_gadget_soft_connect(struct dwc3 *dwc)

drivers/usb/dwc3/gadget.c

Quoted 10 lines
drivers/usb/dwc3/gadget.c +2 -0
 +{
++	int	ret;
++
 +	/*
 +	 * In the Synopsys DWC_usb31 1.90a programming guide section
 +	 * 4.1.9, it specifies that for a reconnect after a
 +	 * device-initiated disconnect requires a core soft reset
 +	 * (DCTL.CSftRst) before enabling the run/stop bit.
 +	 */
 +	dwc3_core_soft_reset(dwc);

Please drop above call to dwc3_core_soft_reset().

Quoted 12 lines

++ ret = dwc3_core_soft_reset(dwc);
++ if (ret)
++ return ret;
+
+ dwc3_event_buffers_setup(dwc);
+ __dwc3_gadget_start(dwc);
+ return dwc3_gadget_run_stop(dwc, true);
+}
+
static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) {
struct dwc3 *dwc = gadget_to_dwc(g);

Quoted 5 lines
Quoted 1 line

Can you verify I got this right in my usb-next branch now?

No, the end result is not correct.

Please apply the below patch to fix it. Thanks.

Many thanks, I got that totally wrong :(

Now fixed up with your commit.

greg k-h