summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/dwc3-am62.c
AgeCommit message (Collapse)AuthorFilesLines
2024-03-05usb: dwc3-am62: add workaround for Errata i2409Roger Quadros1-1/+18
All AM62 devices have Errata i2409 [1] due to which USB2 PHY may lock up due to short suspend. Workaround involves setting bit 5 and 4 PLL_REG12 in PHY2 register space after USB controller is brought out of LPSC reset but before controller initialization. Handle this workaround. [1] - https://www.ti.com/lit/er/sprz487d/sprz487d.pdf Signed-off-by: Roger Quadros <rogerq@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20240227-for-v6-9-am62-usb-errata-3-0-v4-4-0ada8ddb0767@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-05usb: dwc3-am62: Fix PHY core voltage selectionRoger Quadros1-1/+9
TRM information is outdated and design team has confirmed that PHY_CORE_VOLTAGE should be 0 irrespective of VDD_CORE voltage. Signed-off-by: Roger Quadros <rogerq@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20240227-for-v6-9-am62-usb-errata-3-0-v4-3-0ada8ddb0767@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-05usb: dwc3-am62: Disable wakeup at removeRoger Quadros1-0/+1
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> Link: https://lore.kernel.org/r/20240227-for-v6-9-am62-usb-errata-3-0-v4-2-0ada8ddb0767@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-05usb: dwc3-am62: fix module unload/reload behaviorRoger Quadros1-10/+2
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> Link: https://lore.kernel.org/r/20240227-for-v6-9-am62-usb-errata-3-0-v4-1-0ada8ddb0767@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-22usb: dwc3: remove unnecessary platform_set_drvdata()Yang Yingliang1-2/+0
Remove unnecessary platform_set_drvdata(..., NULL) in ->remove(), the driver_data will be cleared in device_unbind_cleanup() after calling ->remove() in driver call code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20230810134710.114356-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-25usb: dwc3-am62: Rename private dataLadislav Michl1-47/+47
Rename dwc3_data to dwc3_am62 to make it consistent with other glue drivers, it's clearer that this is am62's specific. While there, do the same for data variable. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Link: https://lore.kernel.org/r/ZLKoHhJvT+Y6aM+C@lenoch Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-28usb: dwc3-am62: Convert to platform remove callback returning voidUwe Kleine-König1-3/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20230517230239.187727-14-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20usb: Add explicit of.h of_platform.h includeRob Herring1-1/+1
Several USB drivers use of_platform_* functions which are declared in of_platform.h. of_platform.h gets implicitly included by of_device.h, but that is going to be removed soon. Nothing else depends on of_device.h so it can be dropped. Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230410232639.1561152-1-robh@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-29usb: dwc3-am62: Fix up wake-up configuration and spurious wake upRoger Quadros1-10/+18
Explicitly set and clear wakeup config so we don't leave anything to chance. Clear wakeup status on suspend so we know what caused wake up. The LINESTATE wake up should not be enabled in device mode if we are not connected to a USB host and in USB suspend (U2/L3) else it will cause spurious wake up. For now, don't enable LINESTATE. This means wake up from USB resume will not work but at least we won't have any spurious wake ups. Signed-off-by: Roger Quadros <rogerq@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20230324114429.21838-1-rogerq@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-23usb: dwc3-am62: Enable as a wakeup source by defaultRoger Quadros1-0/+3
USB module can wakeup system. Enable it as a wakeup source by default. Finer grain wakeup enable/disable can be done from the power/wakeup system control file of the respective USB device. Signed-off-by: Roger Quadros <rogerq@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20230316131226.89540-3-rogerq@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-23usb: dwc3-am62: Add support for system wakeup based on USB eventsAswath Govindraju1-0/+39
The USB2SS IP in TI's AM62 SoC is capable of supporting wakeup from deep sleep based on the following events, 1) VBUS state change 2) Overcurrent detection 3) Line state change Wakeup from these events can enabled by setting their corresponding bits in the WAKEUP_CONFIG register. The events to be enabled are decided based on the current role of the controller. When the role of the controller is host, the comparators for detecting VBUS state change are disabled while entering low power mode. This is done as VBUS state is not used in host mode and disabling the comparators helps in reducing the power consumption. So, wakeup from VBUS state change should be disabled in host mode. While operating in peripheral mode all the wakeup events can be enabled. Therefore, add support for the same in the suspend/resume hooks. Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Signed-off-by: Roger Quadros <rogerq@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20230316131226.89540-2-rogerq@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29usb: dwc3-am62: remove unnecesary clk_put()Yang Yingliang1-6/+2
The clk get by devm_clk_get() will be released in devres_release_all(), so there is no need explicitly call clk_put(), or it will cause UAF. Fixes: e8784c0aec03 ("drivers: usb: dwc3: Add AM62 USB wrapper driver") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220629094635.3116961-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-21drivers: usb: dwc3: Add AM62 USB wrapper driverAswath Govindraju1-0/+332
In AM62 SoC, the Designware Core USB3 IP is progammed to operate in USB2.0 only mode. Add driver for AM62 USB DWC3 Wrapper. Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Link: https://lore.kernel.org/r/20220414103211.16202-3-a-govindraju@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>