From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org,
mark.rutland@arm.com, geert+renesas@glider.be
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH v3 4/4] clk: renesas: rcar-usb2-clock-sel: Add reset_control
Date: Fri, 1 Nov 2019 16:03:11 +0900 [thread overview]
Message-ID: <1572591791-11280-5-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <1572591791-11280-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>
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>
---
drivers/clk/renesas/Kconfig | 1 +
drivers/clk/renesas/rcar-usb2-clock-sel.c | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig
index be03bb7..a76d05af 100644
--- a/drivers/clk/renesas/Kconfig
+++ b/drivers/clk/renesas/Kconfig
@@ -156,6 +156,7 @@ config CLK_RCAR_GEN3_CPG
config CLK_RCAR_USB2_CLOCK_SEL
bool "Renesas R-Car USB2 clock selector support"
depends on ARCH_RENESAS || COMPILE_TEST
+ select RESET_CONTROLLER
help
This is a driver for R-Car USB2 clock selector
diff --git a/drivers/clk/renesas/rcar-usb2-clock-sel.c b/drivers/clk/renesas/rcar-usb2-clock-sel.c
index 4096506..1cdcc8f 100644
--- a/drivers/clk/renesas/rcar-usb2-clock-sel.c
+++ b/drivers/clk/renesas/rcar-usb2-clock-sel.c
@@ -19,6 +19,7 @@
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#define USB20_CLKSET0 0x00
@@ -36,6 +37,7 @@ struct usb2_clock_sel_priv {
void __iomem *base;
struct clk_hw hw;
struct clk_bulk_data clks[CLK_NUM];
+ struct reset_control *rsts;
bool extal;
bool xtal;
};
@@ -63,10 +65,16 @@ static int usb2_clock_sel_enable(struct clk_hw *hw)
struct usb2_clock_sel_priv *priv = to_priv(hw);
int ret;
- ret = clk_bulk_prepare_enable(CLK_NUM, priv->clks);
+ ret = reset_control_deassert(priv->rsts);
if (ret)
return ret;
+ ret = clk_bulk_prepare_enable(CLK_NUM, priv->clks);
+ if (ret) {
+ reset_control_assert(priv->rsts);
+ return ret;
+ }
+
usb2_clock_sel_enable_extal_only(priv);
return 0;
@@ -79,6 +87,7 @@ static void usb2_clock_sel_disable(struct clk_hw *hw)
usb2_clock_sel_disable_extal_only(priv);
clk_bulk_disable_unprepare(CLK_NUM, priv->clks);
+ reset_control_assert(priv->rsts);
}
/*
@@ -154,6 +163,10 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
if (IS_ERR(priv->clks[CLK_INDEX_HS_USB].clk))
return PTR_ERR(priv->clks[CLK_INDEX_HS_USB].clk);
+ priv->rsts = devm_reset_control_array_get(dev, true, false);
+ if (IS_ERR(priv->rsts))
+ return PTR_ERR(priv->rsts);
+
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
--
2.7.4
next prev parent reply other threads:[~2019-11-01 7:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-01 7:03 [PATCH v3 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling Yoshihiro Shimoda
2019-11-01 7:03 ` [PATCH v3 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties Yoshihiro Shimoda
2019-11-01 7:03 ` [PATCH v3 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties Yoshihiro Shimoda
2019-11-18 10:12 ` Geert Uytterhoeven
2020-03-04 6:29 ` Yoshihiro Shimoda
2019-11-01 7:03 ` [PATCH v3 3/4] clk: renesas: rcar-usb2-clock-sel: Add multiple clocks management Yoshihiro Shimoda
2019-11-18 10:24 ` Geert Uytterhoeven
2020-03-04 6:32 ` Yoshihiro Shimoda
2019-11-01 7:03 ` Yoshihiro Shimoda [this message]
2019-11-18 10:27 ` [PATCH v3 4/4] clk: renesas: rcar-usb2-clock-sel: Add reset_control Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1572591791-11280-5-git-send-email-yoshihiro.shimoda.uh@renesas.com \
--to=yoshihiro.shimoda.uh@renesas.com \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=linux-clk@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).