diff mbox series

[v6,5/5] usb: cdns3: host: transmit lost_power signal from wrapper to XHCI

Message ID 20241210-s2r-cdns-v6-5-28a17f9715a2@bootlin.com
State New
Headers show
Series Fix USB suspend on TI J7200 (cdns3-ti, cdns3, xhci) | expand

Commit Message

Théo Lebrun Dec. 10, 2024, 5:13 p.m. UTC
cdns_role_driver->resume() receives the information if power was lost
across suspend (ie if a reset occurred). Transmit that to the XHCI core
using the newly introduced lost_power flag.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
 drivers/usb/cdns3/host.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
index 7ba760ee62e3310e9c678d269d7675c9cb952ec6..01a3d6aad12886096ab2833a7bc276467f08cb1a 100644
--- a/drivers/usb/cdns3/host.c
+++ b/drivers/usb/cdns3/host.c
@@ -138,6 +138,15 @@  static void cdns_host_exit(struct cdns *cdns)
 	cdns_drd_host_off(cdns);
 }
 
+static int cdns_host_resume(struct cdns *cdns, bool lost_power)
+{
+	struct usb_hcd *hcd = platform_get_drvdata(cdns->host_dev);
+	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+	xhci->lost_power = lost_power;
+	return 0;
+}
+
 int cdns_host_init(struct cdns *cdns)
 {
 	struct cdns_role_driver *rdrv;
@@ -148,6 +157,7 @@  int cdns_host_init(struct cdns *cdns)
 
 	rdrv->start	= __cdns_host_init;
 	rdrv->stop	= cdns_host_exit;
+	rdrv->resume	= cdns_host_resume;
 	rdrv->state	= CDNS_ROLE_STATE_INACTIVE;
 	rdrv->name	= "host";