This switches to the clk bulk API for the dwc2 driver. With this additional clocks can be supported. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/platform.c | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 7161344c6522..4c9e2c75f3dd 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1075,6 +1075,8 @@ struct dwc2_hsotg { spinlock_t lock; void *priv; int irq; + struct clk_bulk_data *clocks; + int num_clocks; struct clk *clk; struct reset_control *reset; struct reset_control *reset_ecc; diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 5f18acac7406..d4a1a26103da 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -143,11 +143,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) if (ret) return ret; - if (hsotg->clk) { - ret = clk_prepare_enable(hsotg->clk); - if (ret) - return ret; - } + ret = clk_bulk_prepare_enable(hsotg->num_clocks, hsotg->clocks); + if (ret) + return ret; if (hsotg->uphy) { ret = usb_phy_init(hsotg->uphy); @@ -195,8 +193,7 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) if (ret) return ret; - if (hsotg->clk) - clk_disable_unprepare(hsotg->clk); + clk_bulk_disable_unprepare(hsotg->num_clocks, hsotg->clocks); return 0; } @@ -281,11 +278,12 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) hsotg->plat = dev_get_platdata(hsotg->dev); /* Clock */ - hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg"); - if (IS_ERR(hsotg->clk)) { + ret = devm_clk_bulk_get_all(hsotg->dev, &hsotg->clocks); + if (ret < 0) { dev_err(hsotg->dev, "cannot get otg clock\n"); - return PTR_ERR(hsotg->clk); + return ret; } + hsotg->num_clocks = ret; /* Regulators */ for (i = 0; i < ARRAY_SIZE(hsotg->supplies); i++) -- 2.20.1