Skip to contentSkip to conversation

usb: dwc3: meson-g12a: do post init to fix broken usb after resumption

PATCH In review Luke Lu 2 participants 2 messages Aug 9, 2023 – Aug 14, 2023

Subsystems (4)
lore
Share & tools
lore

Luke Lu

author
#0 lore raw

PATCH v2 1/1 usb: dwc3: meson-g12a: do post init to fix broken usb after resumption

Device connected to usb otg port of GXL-based boards can not be recognised after resumption, doesn't recover even if disconnect and reconnect the device. dmesg shows it disconnects during resumption.

[   41.492911] usb 1-2: USB disconnect, device number 3
[   41.499346] usb 1-2: unregistering device
[   41.511939] usb 1-2: unregistering interface 1-2:1.0

Calling usb_post_init() will fix this issue, and it's tested and verified on libretech's aml-s905x-cc board.

Fixes c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")

---
Note here, the commmit of Fixes tag is the first patch which bring suspend/resume function, so let's use it as the fix tag.

As commit 5b0ba0caaf3a: (usb: dwc3: meson-g12a: refactor usb init)" introduced the use_post_init() function, and this patch will explicitly depend on it, so let's set kernel version higher or equal to v5.8.

Changes since v1:
- add Fixes tag and Cc stable tree

---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/usb/dwc3/dwc3-meson-g12a.c +6 -0
index e99c7489dba0..2c07c038b584 100644
@@ -926,6 +926,12 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev)
 			return ret;
 	}
 
+	if (priv->drvdata->usb_post_init) {
+		ret = priv->drvdata->usb_post_init(priv);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.40.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 36 lines · Luke Lu

Device connected to usb otg port of GXL-based boards can not be recognised after resumption, doesn't recover even if disconnect and reconnect the device. dmesg shows it disconnects during resumption.

[   41.492911] usb 1-2: USB disconnect, device number 3
[   41.499346] usb 1-2: unregistering device
[   41.511939] usb 1-2: unregistering interface 1-2:1.0

Calling usb_post_init() will fix this issue, and it's tested and verified on libretech's aml-s905x-cc board.

Fixes c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")

---
Note here, the commmit of Fixes tag is the first patch which bring suspend/resume function, so let's use it as the fix tag.

As commit 5b0ba0caaf3a: (usb: dwc3: meson-g12a: refactor usb init)" introduced the use_post_init() function, and this patch will explicitly depend on it, so let's set kernel version higher or equal to v5.8.

Changes since v1:
- add Fixes tag and Cc stable tree

---
  drivers/usb/dwc3/dwc3-meson-g12a.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/usb/dwc3/dwc3-meson-g12a.c +0 -0
index e99c7489dba0..2c07c038b584 100644
@@ -926,6 +926,12 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev)
  			return ret;
  	}

drivers/usb/dwc3/dwc3-meson-g12a.c static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev) · line 937

Quoted 10 lines
drivers/usb/dwc3/dwc3-meson-g12a.c +6 -0
 
+	if (priv->drvdata->usb_post_init) {
+		ret = priv->drvdata->usb_post_init(priv);
+		if (ret)
+			return ret;
+	}
+
  	return 0;
  }
 

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic