Hi,
This series fixes errors during module removal. It also implements PHY core voltage selection as per TI recommendation and workaround for Errata i2409 [1].
The workaround needs PHY2 region to be present in device node. The device tree patch will be sent later after the DT binding doc is merged.
[1] - https://www.ti.com/lit/er/sprz487d/sprz487d.pdf
Signed-off-by: Roger Quadros rogerq@kernel.org --- Changes in v4: - re-arranged patches into first 2 bug-fixes and added Cc stable for them - Added Acked-by - Link to v3: https://lore.kernel.org/r/20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5e...
--- Roger Quadros (4): usb: dwc3-am62: fix module unload/reload behavior usb: dwc3-am62: Disable wakeup at remove usb: dwc3-am62: Fix PHY core voltage selection usb: dwc3-am62: add workaround for Errata i2409
drivers/usb/dwc3/dwc3-am62.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) --- base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d change-id: 20240206-for-v6-9-am62-usb-errata-3-0-233024ea8e9d
Best regards,
As runtime PM is enabled, the module can be runtime suspended when .remove() is called.
Do a pm_runtime_get_sync() to make sure module is active before doing any register operations.
Doing a pm_runtime_put_sync() should disable the refclk so no need to disable it again.
Fixes the below warning at module removel.
[ 39.705310] ------------[ cut here ]------------ [ 39.710004] clk:162:3 already disabled [ 39.713941] WARNING: CPU: 0 PID: 921 at drivers/clk/clk.c:1090 clk_core_disable+0xb0/0xb8
We called of_platform_populate() in .probe() so call the cleanup function of_platform_depopulate() in .remove(). Get rid of the now unnnecessary dwc3_ti_remove_core(). Without this, module re-load doesn't work properly.
Fixes: e8784c0aec03 ("drivers: usb: dwc3: Add AM62 USB wrapper driver") Cc: stable@vger.kernel.org # v5.19+ Signed-off-by: Roger Quadros rogerq@kernel.org --- Changelog: v4: - added Fixes and Cc stable. - added of_platform_depopulate() changes here. - drop wakeup disable code. v3: no change v2: no change --- drivers/usb/dwc3/dwc3-am62.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 90a587bc29b7..f85603b7f7c5 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -267,21 +267,14 @@ static int dwc3_ti_probe(struct platform_device *pdev) return ret; }
-static int dwc3_ti_remove_core(struct device *dev, void *c) -{ - struct platform_device *pdev = to_platform_device(dev); - - platform_device_unregister(pdev); - return 0; -} - static void dwc3_ti_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct dwc3_am62 *am62 = platform_get_drvdata(pdev); u32 reg;
- device_for_each_child(dev, NULL, dwc3_ti_remove_core); + pm_runtime_get_sync(dev); + of_platform_depopulate(dev);
/* Clear mode valid bit */ reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL); @@ -289,7 +282,6 @@ static void dwc3_ti_remove(struct platform_device *pdev) dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg);
pm_runtime_put_sync(dev); - clk_disable_unprepare(am62->usb2_refclk); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); }
Disable wakeup at remove. Fixes the below warnings on module unload and reload.
dwc3-am62 f900000.dwc3-usb: couldn't enable device as a wakeup source: -17 dwc3-am62 f910000.dwc3-usb: couldn't enable device as a wakeup source: -17
Fixes: 4e3972b589da ("usb: dwc3-am62: Enable as a wakeup source by default") Cc: stable@vger.kernel.org # v6.4+ Signed-off-by: Roger Quadros rogerq@kernel.org --- Changelog: v4 - new patch. split out from v3 patch 2. --- drivers/usb/dwc3/dwc3-am62.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index f85603b7f7c5..ea6e29091c0c 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -274,6 +274,7 @@ static void dwc3_ti_remove(struct platform_device *pdev) u32 reg;
pm_runtime_get_sync(dev); + device_init_wakeup(dev, false); of_platform_depopulate(dev);
/* Clear mode valid bit */
linux-stable-mirror@lists.linaro.org