* [PATCH v2 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling
@ 2019-10-28 6:07 Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties Yoshihiro Shimoda
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-28 6:07 UTC (permalink / raw)
To: mturquette, sboyd, robh+dt, mark.rutland, geert+renesas
Cc: linux-clk, devicetree, linux-renesas-soc, Yoshihiro Shimoda
This patch series is based on the latest renesas-drivers.git /
clk-renesas-for-v5.5 branch.
The hardware also needs multiple clocks/resets management like
renesas_usbhs driver [1], so this patch series fixes it.
[1]
3df0e24 usb: renesas_usbhs: Add multiple clocks management
f181dbb usb: renesas_usbhs: Add reset_control
Changes from v1:
- Add Reviewed-by into this series' patch 1/4.
- (new) Add resets and power-domains properties into the patch 2/4.
- Use clk_bulk_* APIs (except clk_bulk_get() because this driver has
4 clocks and used only 2 clocks).
- Add "select RESET_CONTROLLER" into Kconfig
- Use devm_reset_control_array_get() instead of optional API.
https://patchwork.kernel.org/project/linux-renesas-soc/list/?series=192869
Yoshihiro Shimoda (4):
dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s
properties
dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains
and resets properties
clk: renesas: rcar-usb2-clock-sel: Add multiple clocks management
clk: renesas: rcar-usb2-clock-sel: Add reset_control
.../bindings/clock/renesas,rcar-usb2-clock-sel.txt | 13 +++++--
drivers/clk/renesas/Kconfig | 1 +
drivers/clk/renesas/rcar-usb2-clock-sel.c | 43 +++++++++++++++++++++-
3 files changed, 52 insertions(+), 5 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties
2019-10-28 6:07 [PATCH v2 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling Yoshihiro Shimoda
@ 2019-10-28 6:07 ` Yoshihiro Shimoda
2019-10-30 14:33 ` Rob Herring
2019-10-28 6:07 ` [PATCH v2 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties Yoshihiro Shimoda
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-28 6:07 UTC (permalink / raw)
To: mturquette, sboyd, robh+dt, mark.rutland, geert+renesas
Cc: linux-clk, devicetree, linux-renesas-soc, Yoshihiro Shimoda
Since the hardware requires to enable both USB 2.0 host and peripheral
functional clock, this patch fixes the documentation.
Fortunately, no one has this device node for now, so that we don't
need to think of backward compatibility.
Fixes: 311accb64570 ("clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
.../devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
index 83f6c6a..5c1903f 100644
--- a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
+++ b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
@@ -38,7 +38,8 @@ Required properties:
- reg: offset and length of the USB 2.0 clock selector register block.
- clocks: A list of phandles and specifier pairs.
- clock-names: Name of the clocks.
- - The functional clock must be "ehci_ohci"
+ - The functional clock of USB 2.0 host side must be "ehci_ohci"
+ - The functional clock of HS-USB side must be "hs-usb-if"
- The USB_EXTAL clock pin must be "usb_extal"
- The USB_XTAL clock pin must be "usb_xtal"
- #clock-cells: Must be 0
@@ -49,7 +50,8 @@ Example (R-Car H3):
compatible = "renesas,r8a7795-rcar-usb2-clock-sel",
"renesas,rcar-gen3-usb2-clock-sel";
reg = <0 0xe6590630 0 0x02>;
- clocks = <&cpg CPG_MOD 703>, <&usb_extal>, <&usb_xtal>;
- clock-names = "ehci_ohci", "usb_extal", "usb_xtal";
+ clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>,
+ <&usb_extal>, <&usb_xtal>;
+ clock-names = "ehci_ohci", "hs-usb-if", "usb_extal", "usb_xtal";
#clock-cells = <0>;
};
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties
2019-10-28 6:07 [PATCH v2 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties Yoshihiro Shimoda
@ 2019-10-28 6:07 ` Yoshihiro Shimoda
2019-10-30 14:34 ` Rob Herring
2019-10-28 6:07 ` [PATCH v2 3/4] clk: renesas: rcar-usb2-clock-sel: Add multiple clocks management Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 4/4] clk: renesas: rcar-usb2-clock-sel: Add reset_control Yoshihiro Shimoda
3 siblings, 1 reply; 7+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-28 6:07 UTC (permalink / raw)
To: mturquette, sboyd, robh+dt, mark.rutland, geert+renesas
Cc: linux-clk, devicetree, linux-renesas-soc, Yoshihiro Shimoda
This patch adds missing required properties of power-domains and resets.
Fortunately, no one has this device node for now, so that we don't
need to think of backward compatibility.
Fixes: 311accb64570 ("clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
.../devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
index 5c1903f..bad876f 100644
--- a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
+++ b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
@@ -43,6 +43,9 @@ Required properties:
- The USB_EXTAL clock pin must be "usb_extal"
- The USB_XTAL clock pin must be "usb_xtal"
- #clock-cells: Must be 0
+- power-domains: A phandle and symbolic PM domain specifier.
+ See power/renesas,rcar-sysc.txt.
+- resets: A list of phandles and specifier pairs.
Example (R-Car H3):
@@ -54,4 +57,6 @@ Example (R-Car H3):
<&usb_extal>, <&usb_xtal>;
clock-names = "ehci_ohci", "hs-usb-if", "usb_extal", "usb_xtal";
#clock-cells = <0>;
+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>>;
+ resets = <&cpg 703>, <&cpg 704>;
};
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] clk: renesas: rcar-usb2-clock-sel: Add multiple clocks management
2019-10-28 6:07 [PATCH v2 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties Yoshihiro Shimoda
@ 2019-10-28 6:07 ` Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 4/4] clk: renesas: rcar-usb2-clock-sel: Add reset_control Yoshihiro Shimoda
3 siblings, 0 replies; 7+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-28 6:07 UTC (permalink / raw)
To: mturquette, sboyd, robh+dt, mark.rutland, geert+renesas
Cc: linux-clk, devicetree, linux-renesas-soc, Yoshihiro Shimoda
This hardware needs to enable clocks of both host and peripheral.
So, this patch adds multiple clocks management.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/clk/renesas/rcar-usb2-clock-sel.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/renesas/rcar-usb2-clock-sel.c b/drivers/clk/renesas/rcar-usb2-clock-sel.c
index b97f5f9..4096506 100644
--- a/drivers/clk/renesas/rcar-usb2-clock-sel.c
+++ b/drivers/clk/renesas/rcar-usb2-clock-sel.c
@@ -26,9 +26,16 @@
#define CLKSET0_PRIVATE BIT(0)
#define CLKSET0_EXTAL_ONLY (CLKSET0_INTCLK_EN | CLKSET0_PRIVATE)
+enum {
+ CLK_INDEX_EHCI_OHCI,
+ CLK_INDEX_HS_USB,
+ CLK_NUM
+};
+
struct usb2_clock_sel_priv {
void __iomem *base;
struct clk_hw hw;
+ struct clk_bulk_data clks[CLK_NUM];
bool extal;
bool xtal;
};
@@ -53,14 +60,25 @@ static void usb2_clock_sel_disable_extal_only(struct usb2_clock_sel_priv *priv)
static int usb2_clock_sel_enable(struct clk_hw *hw)
{
- usb2_clock_sel_enable_extal_only(to_priv(hw));
+ struct usb2_clock_sel_priv *priv = to_priv(hw);
+ int ret;
+
+ ret = clk_bulk_prepare_enable(CLK_NUM, priv->clks);
+ if (ret)
+ return ret;
+
+ usb2_clock_sel_enable_extal_only(priv);
return 0;
}
static void usb2_clock_sel_disable(struct clk_hw *hw)
{
- usb2_clock_sel_disable_extal_only(to_priv(hw));
+ struct usb2_clock_sel_priv *priv = to_priv(hw);
+
+ usb2_clock_sel_disable_extal_only(priv);
+
+ clk_bulk_disable_unprepare(CLK_NUM, priv->clks);
}
/*
@@ -128,6 +146,14 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
+ priv->clks[CLK_INDEX_EHCI_OHCI].clk = devm_clk_get(dev, "ehci_ohci");
+ if (IS_ERR(priv->clks[CLK_INDEX_EHCI_OHCI].clk))
+ return PTR_ERR(priv->clks[CLK_INDEX_EHCI_OHCI].clk);
+
+ priv->clks[CLK_INDEX_HS_USB].clk = devm_clk_get(dev, "hs-usb-if");
+ if (IS_ERR(priv->clks[CLK_INDEX_HS_USB].clk))
+ return PTR_ERR(priv->clks[CLK_INDEX_HS_USB].clk);
+
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/4] clk: renesas: rcar-usb2-clock-sel: Add reset_control
2019-10-28 6:07 [PATCH v2 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling Yoshihiro Shimoda
` (2 preceding siblings ...)
2019-10-28 6:07 ` [PATCH v2 3/4] clk: renesas: rcar-usb2-clock-sel: Add multiple clocks management Yoshihiro Shimoda
@ 2019-10-28 6:07 ` Yoshihiro Shimoda
3 siblings, 0 replies; 7+ messages in thread
From: Yoshihiro Shimoda @ 2019-10-28 6:07 UTC (permalink / raw)
To: mturquette, sboyd, robh+dt, mark.rutland, geert+renesas
Cc: linux-clk, devicetree, linux-renesas-soc, Yoshihiro Shimoda
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties
2019-10-28 6:07 ` [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties Yoshihiro Shimoda
@ 2019-10-30 14:33 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2019-10-30 14:33 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: mturquette, sboyd, robh+dt, mark.rutland, geert+renesas,
linux-clk, devicetree, linux-renesas-soc, Yoshihiro Shimoda
On Mon, 28 Oct 2019 15:07:27 +0900, Yoshihiro Shimoda wrote:
> Since the hardware requires to enable both USB 2.0 host and peripheral
> functional clock, this patch fixes the documentation.
> Fortunately, no one has this device node for now, so that we don't
> need to think of backward compatibility.
>
> Fixes: 311accb64570 ("clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> .../devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties
2019-10-28 6:07 ` [PATCH v2 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties Yoshihiro Shimoda
@ 2019-10-30 14:34 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2019-10-30 14:34 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: mturquette, sboyd, mark.rutland, geert+renesas, linux-clk,
devicetree, linux-renesas-soc
On Mon, Oct 28, 2019 at 03:07:28PM +0900, Yoshihiro Shimoda wrote:
> This patch adds missing required properties of power-domains and resets.
> Fortunately, no one has this device node for now, so that we don't
> need to think of backward compatibility.
>
> Fixes: 311accb64570 ("clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> .../devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
> index 5c1903f..bad876f 100644
> --- a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
> +++ b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt
> @@ -43,6 +43,9 @@ Required properties:
> - The USB_EXTAL clock pin must be "usb_extal"
> - The USB_XTAL clock pin must be "usb_xtal"
> - #clock-cells: Must be 0
> +- power-domains: A phandle and symbolic PM domain specifier.
> + See power/renesas,rcar-sysc.txt.
> +- resets: A list of phandles and specifier pairs.
>
> Example (R-Car H3):
>
> @@ -54,4 +57,6 @@ Example (R-Car H3):
> <&usb_extal>, <&usb_xtal>;
> clock-names = "ehci_ohci", "hs-usb-if", "usb_extal", "usb_xtal";
> #clock-cells = <0>;
> + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>>;
Typo in '>>'
With that,
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-30 14:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 6:07 [PATCH v2 0/4] clk: renesas: rcar-usb2-clock-sel: Fix clks/resets handling Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 1/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix clock[-name]s properties Yoshihiro Shimoda
2019-10-30 14:33 ` Rob Herring
2019-10-28 6:07 ` [PATCH v2 2/4] dt-bindings: clock: renesas: rcar-usb2-clock-sel: Add power-domains and resets properties Yoshihiro Shimoda
2019-10-30 14:34 ` Rob Herring
2019-10-28 6:07 ` [PATCH v2 3/4] clk: renesas: rcar-usb2-clock-sel: Add multiple clocks management Yoshihiro Shimoda
2019-10-28 6:07 ` [PATCH v2 4/4] clk: renesas: rcar-usb2-clock-sel: Add reset_control Yoshihiro Shimoda
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).