* [PATCH v4 1/3] clk: renesas: cpg-mssr: mark clocks as critical only if on at boot
2020-06-16 16:26 [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks Ulrich Hecht
@ 2020-06-16 16:26 ` Ulrich Hecht
2020-06-18 11:46 ` Geert Uytterhoeven
2020-06-16 16:26 ` [PATCH v4 2/3] clk: renesas: rcar-gen3: mark RWDT clocks as critical Ulrich Hecht
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Ulrich Hecht @ 2020-06-16 16:26 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: linux-clk, wsa, geert, magnus.damm, Ulrich Hecht
This allows us to add the RWDT clock to the list of critical clocks without
keeping it enabled needlessly if not used.
Changing the semantics of crit_mod_clks in this way is safe for the current
user (INTC-AP) because it is never off at boot time.
Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
drivers/clk/renesas/renesas-cpg-mssr.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index dcb6e2706d37..4648a829db66 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -416,14 +416,6 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
init.name = mod->name;
init.ops = &cpg_mstp_clock_ops;
init.flags = CLK_SET_RATE_PARENT;
- for (i = 0; i < info->num_crit_mod_clks; i++)
- if (id == info->crit_mod_clks[i]) {
- dev_dbg(dev, "MSTP %s setting CLK_IS_CRITICAL\n",
- mod->name);
- init.flags |= CLK_IS_CRITICAL;
- break;
- }
-
parent_name = __clk_get_name(parent);
init.parent_names = &parent_name;
init.num_parents = 1;
@@ -432,6 +424,15 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
clock->priv = priv;
clock->hw.init = &init;
+ for (i = 0; i < info->num_crit_mod_clks; i++)
+ if (id == info->crit_mod_clks[i] &&
+ cpg_mstp_clock_is_enabled(&clock->hw)) {
+ dev_dbg(dev, "MSTP %s setting CLK_IS_CRITICAL\n",
+ mod->name);
+ init.flags |= CLK_IS_CRITICAL;
+ break;
+ }
+
clk = clk_register(NULL, &clock->hw);
if (IS_ERR(clk))
goto fail;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 1/3] clk: renesas: cpg-mssr: mark clocks as critical only if on at boot
2020-06-16 16:26 ` [PATCH v4 1/3] clk: renesas: cpg-mssr: mark clocks as critical only if on at boot Ulrich Hecht
@ 2020-06-18 11:46 ` Geert Uytterhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2020-06-18 11:46 UTC (permalink / raw)
To: Ulrich Hecht; +Cc: Linux-Renesas, linux-clk, Wolfram Sang, Magnus Damm
On Tue, Jun 16, 2020 at 6:26 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> This allows us to add the RWDT clock to the list of critical clocks without
> keeping it enabled needlessly if not used.
>
> Changing the semantics of crit_mod_clks in this way is safe for the current
> user (INTC-AP) because it is never off at boot time.
>
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in clk-renesas-for-v5.9.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 2/3] clk: renesas: rcar-gen3: mark RWDT clocks as critical
2020-06-16 16:26 [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks Ulrich Hecht
2020-06-16 16:26 ` [PATCH v4 1/3] clk: renesas: cpg-mssr: mark clocks as critical only if on at boot Ulrich Hecht
@ 2020-06-16 16:26 ` Ulrich Hecht
2020-06-18 11:49 ` Geert Uytterhoeven
2020-06-16 16:26 ` [PATCH v4 3/3] clk: renesas: rzg2: mark RWDT clock " Ulrich Hecht
2020-06-18 11:45 ` [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks Geert Uytterhoeven
3 siblings, 1 reply; 8+ messages in thread
From: Ulrich Hecht @ 2020-06-16 16:26 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: linux-clk, wsa, geert, magnus.damm, Ulrich Hecht
Ensures RWDT remains alert throughout the boot process if enabled.
This patch applies the change to the following SoCs: r8a7795,
r8a7796, r8a77965, r8a77970, r8a77980, r8a77990 and r8a77995.
Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
drivers/clk/renesas/r8a7795-cpg-mssr.c | 2 +-
drivers/clk/renesas/r8a7796-cpg-mssr.c | 2 +-
drivers/clk/renesas/r8a77965-cpg-mssr.c | 1 +
drivers/clk/renesas/r8a77970-cpg-mssr.c | 2 +-
drivers/clk/renesas/r8a77980-cpg-mssr.c | 2 +-
drivers/clk/renesas/r8a77990-cpg-mssr.c | 1 +
drivers/clk/renesas/r8a77995-cpg-mssr.c | 2 +-
7 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index ff5b3020cb03..068018ae3c6e 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -287,10 +287,10 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {
};
static const unsigned int r8a7795_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
-
/*
* CPG Clock Data
*/
diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index e8d466dbc7f9..2cd6e3876fbd 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -262,10 +262,10 @@ static struct mssr_mod_clk r8a7796_mod_clks[] __initdata = {
};
static const unsigned int r8a7796_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
-
/*
* CPG Clock Data
*/
diff --git a/drivers/clk/renesas/r8a77965-cpg-mssr.c b/drivers/clk/renesas/r8a77965-cpg-mssr.c
index 7a05a2fc1cc6..2b55a06ac5cf 100644
--- a/drivers/clk/renesas/r8a77965-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77965-cpg-mssr.c
@@ -263,6 +263,7 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
};
static const unsigned int r8a77965_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c
index cbed3769a100..0f59c84229a8 100644
--- a/drivers/clk/renesas/r8a77970-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c
@@ -165,10 +165,10 @@ static const struct mssr_mod_clk r8a77970_mod_clks[] __initconst = {
};
static const unsigned int r8a77970_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
-
/*
* CPG Clock Data
*/
diff --git a/drivers/clk/renesas/r8a77980-cpg-mssr.c b/drivers/clk/renesas/r8a77980-cpg-mssr.c
index 7227f675e61f..9fe372286c1e 100644
--- a/drivers/clk/renesas/r8a77980-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77980-cpg-mssr.c
@@ -180,10 +180,10 @@ static const struct mssr_mod_clk r8a77980_mod_clks[] __initconst = {
};
static const unsigned int r8a77980_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
-
/*
* CPG Clock Data
*/
diff --git a/drivers/clk/renesas/r8a77990-cpg-mssr.c b/drivers/clk/renesas/r8a77990-cpg-mssr.c
index 8eda2e3e2480..2b97ab61d044 100644
--- a/drivers/clk/renesas/r8a77990-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77990-cpg-mssr.c
@@ -245,6 +245,7 @@ static const struct mssr_mod_clk r8a77990_mod_clks[] __initconst = {
};
static const unsigned int r8a77990_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
diff --git a/drivers/clk/renesas/r8a77995-cpg-mssr.c b/drivers/clk/renesas/r8a77995-cpg-mssr.c
index 056ebf3e70e2..5b4691117b47 100644
--- a/drivers/clk/renesas/r8a77995-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77995-cpg-mssr.c
@@ -183,10 +183,10 @@ static const struct mssr_mod_clk r8a77995_mod_clks[] __initconst = {
};
static const unsigned int r8a77995_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
-
/*
* CPG Clock Data
*/
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/3] clk: renesas: rcar-gen3: mark RWDT clocks as critical
2020-06-16 16:26 ` [PATCH v4 2/3] clk: renesas: rcar-gen3: mark RWDT clocks as critical Ulrich Hecht
@ 2020-06-18 11:49 ` Geert Uytterhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2020-06-18 11:49 UTC (permalink / raw)
To: Ulrich Hecht; +Cc: Linux-Renesas, linux-clk, Wolfram Sang, Magnus Damm
Hi Uli,
On Tue, Jun 16, 2020 at 6:26 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> Ensures RWDT remains alert throughout the boot process if enabled.
>
> This patch applies the change to the following SoCs: r8a7795,
> r8a7796, r8a77965, r8a77970, r8a77980, r8a77990 and r8a77995.
As "r8a7795" and "r8a7796" are a bit vague, I hope you don't mind if I
expand them to "r8a77950, r8a77951" resp. "r8a77960, r8a77961" while
applying.
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in clk-renesas-for-v5.9.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 3/3] clk: renesas: rzg2: mark RWDT clock as critical
2020-06-16 16:26 [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks Ulrich Hecht
2020-06-16 16:26 ` [PATCH v4 1/3] clk: renesas: cpg-mssr: mark clocks as critical only if on at boot Ulrich Hecht
2020-06-16 16:26 ` [PATCH v4 2/3] clk: renesas: rcar-gen3: mark RWDT clocks as critical Ulrich Hecht
@ 2020-06-16 16:26 ` Ulrich Hecht
2020-06-18 11:50 ` Geert Uytterhoeven
2020-06-18 11:45 ` [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks Geert Uytterhoeven
3 siblings, 1 reply; 8+ messages in thread
From: Ulrich Hecht @ 2020-06-16 16:26 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: linux-clk, wsa, geert, magnus.damm, Ulrich Hecht
Ensures RWDT remains alert throughout the boot process if enabled.
This patch applies the change to the following SoCs: r8a774a1,
r8a774b1 and r8a774c0.
Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
drivers/clk/renesas/r8a774a1-cpg-mssr.c | 1 +
drivers/clk/renesas/r8a774b1-cpg-mssr.c | 1 +
drivers/clk/renesas/r8a774c0-cpg-mssr.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/drivers/clk/renesas/r8a774a1-cpg-mssr.c b/drivers/clk/renesas/r8a774a1-cpg-mssr.c
index e05bfa200480..fd54b9f625da 100644
--- a/drivers/clk/renesas/r8a774a1-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a774a1-cpg-mssr.c
@@ -237,6 +237,7 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = {
};
static const unsigned int r8a774a1_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
diff --git a/drivers/clk/renesas/r8a774b1-cpg-mssr.c b/drivers/clk/renesas/r8a774b1-cpg-mssr.c
index c9af70917312..f436691271ec 100644
--- a/drivers/clk/renesas/r8a774b1-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a774b1-cpg-mssr.c
@@ -233,6 +233,7 @@ static const struct mssr_mod_clk r8a774b1_mod_clks[] __initconst = {
};
static const unsigned int r8a774b1_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
diff --git a/drivers/clk/renesas/r8a774c0-cpg-mssr.c b/drivers/clk/renesas/r8a774c0-cpg-mssr.c
index f91e7a484753..9fc9fa9e531a 100644
--- a/drivers/clk/renesas/r8a774c0-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a774c0-cpg-mssr.c
@@ -238,6 +238,7 @@ static const struct mssr_mod_clk r8a774c0_mod_clks[] __initconst = {
};
static const unsigned int r8a774c0_crit_mod_clks[] __initconst = {
+ MOD_CLK_ID(402), /* RWDT */
MOD_CLK_ID(408), /* INTC-AP (GIC) */
};
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 3/3] clk: renesas: rzg2: mark RWDT clock as critical
2020-06-16 16:26 ` [PATCH v4 3/3] clk: renesas: rzg2: mark RWDT clock " Ulrich Hecht
@ 2020-06-18 11:50 ` Geert Uytterhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2020-06-18 11:50 UTC (permalink / raw)
To: Ulrich Hecht; +Cc: Linux-Renesas, linux-clk, Wolfram Sang, Magnus Damm
On Tue, Jun 16, 2020 at 6:26 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> Ensures RWDT remains alert throughout the boot process if enabled.
>
> This patch applies the change to the following SoCs: r8a774a1,
> r8a774b1 and r8a774c0.
>
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in clk-renesas-for-v5.9.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks
2020-06-16 16:26 [PATCH v4 0/3] clk: renesas: cpg-mssr: add RWDT to critical clocks Ulrich Hecht
` (2 preceding siblings ...)
2020-06-16 16:26 ` [PATCH v4 3/3] clk: renesas: rzg2: mark RWDT clock " Ulrich Hecht
@ 2020-06-18 11:45 ` Geert Uytterhoeven
3 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2020-06-18 11:45 UTC (permalink / raw)
To: Ulrich Hecht; +Cc: Linux-Renesas, linux-clk, Wolfram Sang, Magnus Damm
Hi Uli,
On Tue, Jun 16, 2020 at 6:26 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> The purpose of this series is to allow a WDT that has been enabled by the
> bootloader to survive these events:
>
> - deferred probing of the WDT device, which can lead the clock driver
> to disable the WDT clock until the WDT is re-probed, giving it a
> blind spot
> - probe failure in the WDT driver
>
> Following a suggestion by Geert, this revision, instead of adding another
> list of clocks with special handling, changes the semantics of the
> crit_mod_clks[] array slightly by only marking clocks critical that are
> enabled at boot time. That way it can be used for RWDT without forcing the
> clock on unnecessarily.
>
> The other existing user of crit_mod_clks[] (INTC-AP) is always on at boot time
> and should thus not be affected by this change.
>
> There are a number of Gen2 and RZ/G1 SoCs that have the RWDT clock declared
> as critical already in order to allow SMP bringup code to work. That should
> still work with this series applied, assuming that the WDT clock is on at
> boot time.
It must be, as initial secondary CPU bringup runs very early.
That does mean I will have to remove the RWDT clock from my debug code
to disable all unused clocks during boot[1].
Interestingly, the SMP bringup code still seems to work (on R-Car M2-W
ES1.0) if the RWDT clock is disabled, both for initial bringup and
manual CPU off/onlining later. And it keeps working if I move the debug
code earlier (currently it runs after initial bringup).
So we're all fine ;-)
[1] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/renesas-debug
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread