summaryrefslogtreecommitdiff
path: root/drivers/usb/fotg210/fotg210-core.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2023-01-18 08:09:18 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-19 14:10:44 +0100
commitfaaca436699603355c5c9711942c6441eec38b0e (patch)
treee1579f70a2358ef3c9cf33c02fac5f405de2d6a2 /drivers/usb/fotg210/fotg210-core.c
parentbaef5330d35b477056c0304ce1283f0aed4d5d20 (diff)
usb: fotg210: Move clock handling to core
Grab the optional silicon block clock, prepare and enable it in the core before proceeding to prepare the host or peripheral driver. This saves duplicate code and also uses the simple devm_clk_get_optional_enabled() to do everything we really want to do. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-4-100388af9810@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/fotg210/fotg210-core.c')
-rw-r--r--drivers/usb/fotg210/fotg210-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/fotg210/fotg210-core.c b/drivers/usb/fotg210/fotg210-core.c
index 0dd4957ad70a..f90b2ae9ed9d 100644
--- a/drivers/usb/fotg210/fotg210-core.c
+++ b/drivers/usb/fotg210/fotg210-core.c
@@ -6,6 +6,7 @@
* driver.
*/
#include <linux/bitops.h>
+#include <linux/clk.h>
#include <linux/device.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
@@ -109,6 +110,10 @@ static int fotg210_probe(struct platform_device *pdev)
if (!fotg->base)
return -ENOMEM;
+ fotg->pclk = devm_clk_get_optional_enabled(dev, "PCLK");
+ if (IS_ERR(fotg->pclk))
+ return PTR_ERR(fotg->pclk);
+
mode = usb_get_dr_mode(dev);
if (of_device_is_compatible(dev->of_node, "cortina,gemini-usb")) {