Commit 726b4fba authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: of-simple: add a shutdown

In case we're loading a new kernel via kexec, let's make sure to
cleanup the dwc3 address space correctly. This means that we should
run the same steps from driver remove, so just extract a reusable
function for both cases.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 387c359b
...@@ -110,12 +110,9 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) ...@@ -110,12 +110,9 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int dwc3_of_simple_remove(struct platform_device *pdev) static void __dwc3_of_simple_teardown(struct dwc3_of_simple *simple)
{ {
struct dwc3_of_simple *simple = platform_get_drvdata(pdev); of_platform_depopulate(simple->dev);
struct device *dev = &pdev->dev;
of_platform_depopulate(dev);
clk_bulk_disable_unprepare(simple->num_clocks, simple->clks); clk_bulk_disable_unprepare(simple->num_clocks, simple->clks);
clk_bulk_put_all(simple->num_clocks, simple->clks); clk_bulk_put_all(simple->num_clocks, simple->clks);
...@@ -126,13 +123,27 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) ...@@ -126,13 +123,27 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
reset_control_put(simple->resets); reset_control_put(simple->resets);
pm_runtime_disable(dev); pm_runtime_disable(simple->dev);
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(simple->dev);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(simple->dev);
}
static int dwc3_of_simple_remove(struct platform_device *pdev)
{
struct dwc3_of_simple *simple = platform_get_drvdata(pdev);
__dwc3_of_simple_teardown(simple);
return 0; return 0;
} }
static void dwc3_of_simple_shutdown(struct platform_device *pdev)
{
struct dwc3_of_simple *simple = platform_get_drvdata(pdev);
__dwc3_of_simple_teardown(simple);
}
static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev) static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev)
{ {
struct dwc3_of_simple *simple = dev_get_drvdata(dev); struct dwc3_of_simple *simple = dev_get_drvdata(dev);
...@@ -190,6 +201,7 @@ MODULE_DEVICE_TABLE(of, of_dwc3_simple_match); ...@@ -190,6 +201,7 @@ MODULE_DEVICE_TABLE(of, of_dwc3_simple_match);
static struct platform_driver dwc3_of_simple_driver = { static struct platform_driver dwc3_of_simple_driver = {
.probe = dwc3_of_simple_probe, .probe = dwc3_of_simple_probe,
.remove = dwc3_of_simple_remove, .remove = dwc3_of_simple_remove,
.shutdown = dwc3_of_simple_shutdown,
.driver = { .driver = {
.name = "dwc3-of-simple", .name = "dwc3-of-simple",
.of_match_table = of_dwc3_simple_match, .of_match_table = of_dwc3_simple_match,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment