From 1c7a3dd86f0f97e0802f8bcf0ee5499b084d99be Mon Sep 17 00:00:00 2001 From: William Wu Date: Fri, 15 Nov 2024 15:09:26 +0800 Subject: [PATCH] usb: dwc3: core: Add shutdown support The RK3576 platform doesn't use the dwc3 glue layer which supports to call dwc3_of_simple_shutdown and dwc3_remove on system shutdown. Therefore, the RK3576 dwc3 controller still keeps working on system shutdown, and it may cause pending usb irq if usb transmission happens when do reboot test. This patch adds shutdown support for RK3576 platform. Signed-off-by: William Wu Change-Id: I2cc0764402909fc8c168c0bad75909a8719fce80 --- drivers/usb/dwc3/core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 22a153a5985c..300fc0f40ff3 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -2143,6 +2143,14 @@ static int dwc3_remove(struct platform_device *pdev) return 0; } +static void dwc3_shutdown(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + + if (of_device_is_compatible(dev->of_node, "rockchip,rk3576-dwc3")) + dwc3_remove(pdev); +} + #ifdef CONFIG_PM static int dwc3_core_init_for_resume(struct dwc3 *dwc) { @@ -2455,6 +2463,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match); static struct platform_driver dwc3_driver = { .probe = dwc3_probe, .remove = dwc3_remove, + .shutdown = dwc3_shutdown, .driver = { .name = "dwc3", .of_match_table = of_match_ptr(of_dwc3_match),