Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: renesas: rcar-usb2-clock-sel: Add reset_control

This hardware needs to deassert resets of both host and peripheral.
So, this patch adds reset control.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/1583304137-28482-5-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

authored by

Yoshihiro Shimoda and committed by
Geert Uytterhoeven
1ab4f439 80cf67dd

+15 -1
+1
drivers/clk/renesas/Kconfig
··· 161 161 config CLK_RCAR_USB2_CLOCK_SEL 162 162 bool "Renesas R-Car USB2 clock selector support" 163 163 depends on ARCH_RENESAS || COMPILE_TEST 164 + select RESET_CONTROLLER 164 165 help 165 166 This is a driver for R-Car USB2 clock selector 166 167
+14 -1
drivers/clk/renesas/rcar-usb2-clock-sel.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/pm.h> 21 21 #include <linux/pm_runtime.h> 22 + #include <linux/reset.h> 22 23 #include <linux/slab.h> 23 24 24 25 #define USB20_CLKSET0 0x00 ··· 36 35 void __iomem *base; 37 36 struct clk_hw hw; 38 37 struct clk_bulk_data clks[ARRAY_SIZE(rcar_usb2_clocks)]; 38 + struct reset_control *rsts; 39 39 bool extal; 40 40 bool xtal; 41 41 }; ··· 64 62 struct usb2_clock_sel_priv *priv = to_priv(hw); 65 63 int ret; 66 64 67 - ret = clk_bulk_prepare_enable(ARRAY_SIZE(priv->clks), priv->clks); 65 + ret = reset_control_deassert(priv->rsts); 68 66 if (ret) 69 67 return ret; 68 + 69 + ret = clk_bulk_prepare_enable(ARRAY_SIZE(priv->clks), priv->clks); 70 + if (ret) { 71 + reset_control_assert(priv->rsts); 72 + return ret; 73 + } 70 74 71 75 usb2_clock_sel_enable_extal_only(priv); 72 76 ··· 86 78 usb2_clock_sel_disable_extal_only(priv); 87 79 88 80 clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clks), priv->clks); 81 + reset_control_assert(priv->rsts); 89 82 } 90 83 91 84 /* ··· 159 150 ret = devm_clk_bulk_get(dev, ARRAY_SIZE(priv->clks), priv->clks); 160 151 if (ret < 0) 161 152 return ret; 153 + 154 + priv->rsts = devm_reset_control_array_get(dev, true, false); 155 + if (IS_ERR(priv->rsts)) 156 + return PTR_ERR(priv->rsts); 162 157 163 158 pm_runtime_enable(dev); 164 159 pm_runtime_get_sync(dev);