Skip to content

Commit 1ab4f43

Browse files
shimodaygeertu
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/1583304137-28482-5-git-send-email-yoshihiro.shimoda.uh@renesas.com Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 80cf67d commit 1ab4f43

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

drivers/clk/renesas/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ config CLK_RCAR_GEN3_CPG
161161
config CLK_RCAR_USB2_CLOCK_SEL
162162
bool "Renesas R-Car USB2 clock selector support"
163163
depends on ARCH_RENESAS || COMPILE_TEST
164+
select RESET_CONTROLLER
164165
help
165166
This is a driver for R-Car USB2 clock selector
166167

drivers/clk/renesas/rcar-usb2-clock-sel.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/platform_device.h>
2020
#include <linux/pm.h>
2121
#include <linux/pm_runtime.h>
22+
#include <linux/reset.h>
2223
#include <linux/slab.h>
2324

2425
#define USB20_CLKSET0 0x00
@@ -35,6 +36,7 @@ struct usb2_clock_sel_priv {
3536
void __iomem *base;
3637
struct clk_hw hw;
3738
struct clk_bulk_data clks[ARRAY_SIZE(rcar_usb2_clocks)];
39+
struct reset_control *rsts;
3840
bool extal;
3941
bool xtal;
4042
};
@@ -62,10 +64,16 @@ static int usb2_clock_sel_enable(struct clk_hw *hw)
6264
struct usb2_clock_sel_priv *priv = to_priv(hw);
6365
int ret;
6466

65-
ret = clk_bulk_prepare_enable(ARRAY_SIZE(priv->clks), priv->clks);
67+
ret = reset_control_deassert(priv->rsts);
6668
if (ret)
6769
return ret;
6870

71+
ret = clk_bulk_prepare_enable(ARRAY_SIZE(priv->clks), priv->clks);
72+
if (ret) {
73+
reset_control_assert(priv->rsts);
74+
return ret;
75+
}
76+
6977
usb2_clock_sel_enable_extal_only(priv);
7078

7179
return 0;
@@ -78,6 +86,7 @@ static void usb2_clock_sel_disable(struct clk_hw *hw)
7886
usb2_clock_sel_disable_extal_only(priv);
7987

8088
clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clks), priv->clks);
89+
reset_control_assert(priv->rsts);
8190
}
8291

8392
/*
@@ -151,6 +160,10 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
151160
if (ret < 0)
152161
return ret;
153162

163+
priv->rsts = devm_reset_control_array_get(dev, true, false);
164+
if (IS_ERR(priv->rsts))
165+
return PTR_ERR(priv->rsts);
166+
154167
pm_runtime_enable(dev);
155168
pm_runtime_get_sync(dev);
156169

0 commit comments

Comments
 (0)