All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option
@ 2020-02-26 20:28 Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks Ulrich Hecht
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Hi!

This series adds the option for declaring clocks as "ignore-unused", i.e. 
clocks that will not be turned on if not used, but also not turned off if
unused. It also enables this option for the RWDT clocks in (almost) all
SoCs.

The point of this 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

There are a number of SoCs that have the RWDT clock already declared as
critical (i.e. turn it on even if it is off _and_ unused). I don't know if
that is because there was no option for ignore-unused before, or if the
behavior of turning the clock on even if neither the bootloader nor anything
in the kernel has asked for it is actually desired. If it's the former,
these SoCs also have to be converted to the new mechanism.

CU
Uli


Ulrich Hecht (11):
  clk: renesas: cpg-mssr: add support for ignore-unused clocks
  clk: renesas: r8a7796: mark RWDT clock as ignore-unused
  clk: renesas: r8a7795: mark RWDT clock as ignore-unused
  clk: renesas: r8a77970: mark RWDT clock as ignore-unused
  clk: renesas: r8a77980: mark RWDT clock as ignore-unused
  clk: renesas: r8a77995: mark RWDT clock as ignore-unused
  clk: renesas: r8a774a1: mark RWDT clock as ignore-unused
  clk: renesas: r8a774b1: mark RWDT clock as ignore-unused
  clk: renesas: r8a774c0: mark RWDT clock as ignore-unused
  clk: renesas: r8a77965: mark RWDT clock as ignore-unused
  clk: renesas: r8a77990: mark RWDT clock as ignore-unused

 drivers/clk/renesas/r8a774a1-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a774b1-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a774c0-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a7795-cpg-mssr.c  | 6 +++++-
 drivers/clk/renesas/r8a7796-cpg-mssr.c  | 6 +++++-
 drivers/clk/renesas/r8a77965-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a77970-cpg-mssr.c | 6 +++++-
 drivers/clk/renesas/r8a77980-cpg-mssr.c | 6 +++++-
 drivers/clk/renesas/r8a77990-cpg-mssr.c | 5 +++++
 drivers/clk/renesas/r8a77995-cpg-mssr.c | 6 +++++-
 drivers/clk/renesas/renesas-cpg-mssr.c  | 7 +++++++
 drivers/clk/renesas/renesas-cpg-mssr.h  | 7 +++++++
 12 files changed, 64 insertions(+), 5 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-03-03 16:13   ` Wolfram Sang
  2020-02-26 20:28 ` [PATCH 02/11] clk: renesas: r8a7796: mark RWDT clock as ignore-unused Ulrich Hecht
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

This adds facilities to mark clocks as "ignore used", i.e. never to be
turned off. The primary application is the RWDT clock, which needs to
remain on throughout the boot process if enabled by the bootloader.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/renesas-cpg-mssr.c | 7 +++++++
 drivers/clk/renesas/renesas-cpg-mssr.h | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index a2663fb..31115c7 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -423,6 +423,13 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
 			init.flags |= CLK_IS_CRITICAL;
 			break;
 		}
+	for (i = 0; i < info->num_used_mod_clks; i++)
+		if (id == info->used_mod_clks[i]) {
+			dev_dbg(dev, "MSTP %s setting CLK_IGNORE_UNUSED\n",
+				mod->name);
+			init.flags |= CLK_IGNORE_UNUSED;
+			break;
+		}
 
 	parent_name = __clk_get_name(parent);
 	init.parent_names = &parent_name;
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.h b/drivers/clk/renesas/renesas-cpg-mssr.h
index 3b852ba..c76335c 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.h
+++ b/drivers/clk/renesas/renesas-cpg-mssr.h
@@ -105,6 +105,9 @@ struct device_node;
      * @crit_mod_clks: Array with Module Clock IDs of critical clocks that
      *                 should not be disabled without a knowledgeable driver
      * @num_crit_mod_clks: Number of entries in crit_mod_clks[]
+     * @used_mod_clks: Array with Module Clock IDs of clocks that should not
+     *                 be disabled even if they seem to be unused
+     * @num_used_mod_clks: Number of entries in used_mod_clks[]
      *
      * @core_pm_clks: Array with IDs of Core Clocks that are suitable for Power
      *                Management, in addition to Module Clocks
@@ -141,6 +144,10 @@ struct cpg_mssr_info {
 	const unsigned int *crit_mod_clks;
 	unsigned int num_crit_mod_clks;
 
+	/* Module Clocks that should not be disabled even if unused */
+	const unsigned int *used_mod_clks;
+	unsigned int num_used_mod_clks;
+
 	/* Core Clocks suitable for PM, in addition to the Module Clocks */
 	const unsigned int *core_pm_clks;
 	unsigned int num_core_pm_clks;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/11] clk: renesas: r8a7796: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 03/11] clk: renesas: r8a7795: " Ulrich Hecht
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index e8420d3..3368495 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -254,7 +254,9 @@ static struct mssr_mod_clk r8a7796_mod_clks[] __initdata = {
 static const unsigned int r8a7796_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
-
+static const unsigned int r8a7796_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -354,6 +356,8 @@ const struct cpg_mssr_info r8a7796_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a7796_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a7796_crit_mod_clks),
+	.used_mod_clks = r8a7796_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a7796_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a7796_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/11] clk: renesas: r8a7795: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 02/11] clk: renesas: r8a7796: mark RWDT clock as ignore-unused Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 04/11] clk: renesas: r8a77970: " Ulrich Hecht
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a7795-cpg-mssr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index fbc8c75..e83bdcc 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -281,7 +281,9 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {
 static const unsigned int r8a7795_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
-
+static const unsigned int r8a7795_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -476,6 +478,8 @@ const struct cpg_mssr_info r8a7795_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a7795_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a7795_crit_mod_clks),
+	.used_mod_clks = r8a7795_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a7795_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a7795_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/11] clk: renesas: r8a77970: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (2 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 03/11] clk: renesas: r8a7795: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 05/11] clk: renesas: r8a77980: " Ulrich Hecht
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a77970-cpg-mssr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c
index cbed376..fda842b 100644
--- a/drivers/clk/renesas/r8a77970-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c
@@ -167,7 +167,9 @@ static const struct mssr_mod_clk r8a77970_mod_clks[] __initconst = {
 static const unsigned int r8a77970_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
-
+static const unsigned int r8a77970_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -267,6 +269,8 @@ const struct cpg_mssr_info r8a77970_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a77970_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a77970_crit_mod_clks),
+	.used_mod_clks = r8a77970_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a77970_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a77970_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/11] clk: renesas: r8a77980: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (3 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 04/11] clk: renesas: r8a77970: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 06/11] clk: renesas: r8a77995: " Ulrich Hecht
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a77980-cpg-mssr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r8a77980-cpg-mssr.c b/drivers/clk/renesas/r8a77980-cpg-mssr.c
index 7227f67..e678974 100644
--- a/drivers/clk/renesas/r8a77980-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77980-cpg-mssr.c
@@ -182,7 +182,9 @@ static const struct mssr_mod_clk r8a77980_mod_clks[] __initconst = {
 static const unsigned int r8a77980_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
-
+static const unsigned int r8a77980_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -238,6 +240,8 @@ const struct cpg_mssr_info r8a77980_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a77980_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a77980_crit_mod_clks),
+	.used_mod_clks = r8a77980_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a77980_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a77980_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/11] clk: renesas: r8a77995: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (4 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 05/11] clk: renesas: r8a77980: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 07/11] clk: renesas: r8a774a1: " Ulrich Hecht
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a77995-cpg-mssr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r8a77995-cpg-mssr.c b/drivers/clk/renesas/r8a77995-cpg-mssr.c
index 962bb33..f221d00 100644
--- a/drivers/clk/renesas/r8a77995-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77995-cpg-mssr.c
@@ -183,7 +183,9 @@ static const struct mssr_mod_clk r8a77995_mod_clks[] __initconst = {
 static const unsigned int r8a77995_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
-
+static const unsigned int r8a77995_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -233,6 +235,8 @@ const struct cpg_mssr_info r8a77995_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a77995_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a77995_crit_mod_clks),
+	.used_mod_clks = r8a77995_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a77995_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a77995_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/11] clk: renesas: r8a774a1: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (5 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 06/11] clk: renesas: r8a77995: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 08/11] clk: renesas: r8a774b1: " Ulrich Hecht
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a774a1-cpg-mssr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a774a1-cpg-mssr.c b/drivers/clk/renesas/r8a774a1-cpg-mssr.c
index e05bfa2..ec48727 100644
--- a/drivers/clk/renesas/r8a774a1-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a774a1-cpg-mssr.c
@@ -239,6 +239,9 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = {
 static const unsigned int r8a774a1_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
+static const unsigned int r8a774a1_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -324,6 +327,8 @@ const struct cpg_mssr_info r8a774a1_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a774a1_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a774a1_crit_mod_clks),
+	.used_mod_clks = r8a774a1_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a774a1_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a774a1_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/11] clk: renesas: r8a774b1: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (6 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 07/11] clk: renesas: r8a774a1: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 09/11] clk: renesas: r8a774c0: " Ulrich Hecht
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a774b1-cpg-mssr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a774b1-cpg-mssr.c b/drivers/clk/renesas/r8a774b1-cpg-mssr.c
index c9af7091..1c0951c 100644
--- a/drivers/clk/renesas/r8a774b1-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a774b1-cpg-mssr.c
@@ -235,6 +235,9 @@ static const struct mssr_mod_clk r8a774b1_mod_clks[] __initconst = {
 static const unsigned int r8a774b1_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
+static const unsigned int r8a774b1_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -320,6 +323,8 @@ const struct cpg_mssr_info r8a774b1_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a774b1_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a774b1_crit_mod_clks),
+	.used_mod_clks = r8a774b1_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a774b1_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a774b1_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/11] clk: renesas: r8a774c0: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (7 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 08/11] clk: renesas: r8a774b1: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 10/11] clk: renesas: r8a77965: " Ulrich Hecht
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a774c0-cpg-mssr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a774c0-cpg-mssr.c b/drivers/clk/renesas/r8a774c0-cpg-mssr.c
index f91e7a4..5d27578 100644
--- a/drivers/clk/renesas/r8a774c0-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a774c0-cpg-mssr.c
@@ -240,6 +240,9 @@ static const struct mssr_mod_clk r8a774c0_mod_clks[] __initconst = {
 static const unsigned int r8a774c0_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
+static const unsigned int r8a774c0_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -289,6 +292,8 @@ const struct cpg_mssr_info r8a774c0_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a774c0_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a774c0_crit_mod_clks),
+	.used_mod_clks = r8a774c0_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a774c0_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a774c0_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/11] clk: renesas: r8a77965: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (8 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 09/11] clk: renesas: r8a774c0: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-26 20:28 ` [PATCH 11/11] clk: renesas: r8a77990: " Ulrich Hecht
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a77965-cpg-mssr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a77965-cpg-mssr.c b/drivers/clk/renesas/r8a77965-cpg-mssr.c
index b3af4da..d77174b 100644
--- a/drivers/clk/renesas/r8a77965-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77965-cpg-mssr.c
@@ -255,6 +255,9 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
 static const unsigned int r8a77965_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
+static const unsigned int r8a77965_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -340,6 +343,8 @@ const struct cpg_mssr_info r8a77965_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks		= r8a77965_crit_mod_clks,
 	.num_crit_mod_clks	= ARRAY_SIZE(r8a77965_crit_mod_clks),
+	.used_mod_clks		= r8a77965_used_mod_clks,
+	.num_used_mod_clks	= ARRAY_SIZE(r8a77965_used_mod_clks),
 
 	/* Callbacks */
 	.init			= r8a77965_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 11/11] clk: renesas: r8a77990: mark RWDT clock as ignore-unused
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (9 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 10/11] clk: renesas: r8a77965: " Ulrich Hecht
@ 2020-02-26 20:28 ` Ulrich Hecht
  2020-02-27 14:29 ` [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Geert Uytterhoeven
  2020-03-03 16:05 ` Wolfram Sang
  12 siblings, 0 replies; 15+ messages in thread
From: Ulrich Hecht @ 2020-02-26 20:28 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: wsa, geert, fabrizio.castro, ramesh.shanmugasundaram,
	magnus.damm, Ulrich Hecht

Ensures RWDT remains alert throughout the boot process if enabled.

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/clk/renesas/r8a77990-cpg-mssr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a77990-cpg-mssr.c b/drivers/clk/renesas/r8a77990-cpg-mssr.c
index ceabf55c..c1cd1eb 100644
--- a/drivers/clk/renesas/r8a77990-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77990-cpg-mssr.c
@@ -245,6 +245,9 @@ static const struct mssr_mod_clk r8a77990_mod_clks[] __initconst = {
 static const unsigned int r8a77990_crit_mod_clks[] __initconst = {
 	MOD_CLK_ID(408),	/* INTC-AP (GIC) */
 };
+static const unsigned int r8a77990_used_mod_clks[] __initconst = {
+	MOD_CLK_ID(402),	/* RWDT */
+};
 
 /*
  * CPG Clock Data
@@ -294,6 +297,8 @@ const struct cpg_mssr_info r8a77990_cpg_mssr_info __initconst = {
 	/* Critical Module Clocks */
 	.crit_mod_clks = r8a77990_crit_mod_clks,
 	.num_crit_mod_clks = ARRAY_SIZE(r8a77990_crit_mod_clks),
+	.used_mod_clks = r8a77990_used_mod_clks,
+	.num_used_mod_clks = ARRAY_SIZE(r8a77990_used_mod_clks),
 
 	/* Callbacks */
 	.init = r8a77990_cpg_mssr_init,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (10 preceding siblings ...)
  2020-02-26 20:28 ` [PATCH 11/11] clk: renesas: r8a77990: " Ulrich Hecht
@ 2020-02-27 14:29 ` Geert Uytterhoeven
  2020-03-03 16:05 ` Wolfram Sang
  12 siblings, 0 replies; 15+ messages in thread
From: Geert Uytterhoeven @ 2020-02-27 14:29 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: Linux-Renesas, Wolfram Sang, Fabrizio Castro,
	Ramesh Shanmugasundaram, Magnus Damm

Hi Uli,

On Wed, Feb 26, 2020 at 9:28 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> This series adds the option for declaring clocks as "ignore-unused", i.e.
> clocks that will not be turned on if not used, but also not turned off if
> unused. It also enables this option for the RWDT clocks in (almost) all
> SoCs.

Thanks for your series!

> The point of this 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
>
> There are a number of SoCs that have the RWDT clock already declared as
> critical (i.e. turn it on even if it is off _and_ unused). I don't know if
> that is because there was no option for ignore-unused before, or if the
> behavior of turning the clock on even if neither the bootloader nor anything
> in the kernel has asked for it is actually desired. If it's the former,
> these SoCs also have to be converted to the new mechanism.

That was done on all of R-Car Gen2 and RZ/G1, as the SMP bringup code
needs to check the watchdog registers, which can happen at any time, cfr.
commit 58adf1ba0d227754 ("ARM: shmobile: Add watchdog support").

Presumable that was fixed on R-Car Gen3 and RZ/G2, so the watchdog registers
don't have to be checked, and the watchdog doesn't have to run all the
time (holding wood, rabbit legs, and whatever ;-)

> Ulrich Hecht (11):
>   clk: renesas: cpg-mssr: add support for ignore-unused clocks
>   clk: renesas: r8a7796: mark RWDT clock as ignore-unused
>   clk: renesas: r8a7795: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77970: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77980: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77995: mark RWDT clock as ignore-unused
>   clk: renesas: r8a774a1: mark RWDT clock as ignore-unused
>   clk: renesas: r8a774b1: mark RWDT clock as ignore-unused
>   clk: renesas: r8a774c0: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77965: mark RWDT clock as ignore-unused
>   clk: renesas: r8a77990: mark RWDT clock as ignore-unused

I think the SoC-specific parts can be merged safely into two patches,
one for R-Car Gen3, and one for RZ/G2?

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] 15+ messages in thread

* Re: [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option
  2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
                   ` (11 preceding siblings ...)
  2020-02-27 14:29 ` [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Geert Uytterhoeven
@ 2020-03-03 16:05 ` Wolfram Sang
  12 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2020-03-03 16:05 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: linux-renesas-soc, geert, fabrizio.castro,
	ramesh.shanmugasundaram, magnus.damm

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

On Wed, Feb 26, 2020 at 09:28:06PM +0100, Ulrich Hecht wrote:
> Hi!
> 
> This series adds the option for declaring clocks as "ignore-unused", i.e. 
> clocks that will not be turned on if not used, but also not turned off if
> unused. It also enables this option for the RWDT clocks in (almost) all
> SoCs.
> 
> The point of this 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

I like the approach in general. Seems to solve both issues nicely. Minor
comments for patch 1 follow. I also agree with Geert about the squashing
of patches, yet in general, I look forward if this could be added.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks
  2020-02-26 20:28 ` [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks Ulrich Hecht
@ 2020-03-03 16:13   ` Wolfram Sang
  0 siblings, 0 replies; 15+ messages in thread
From: Wolfram Sang @ 2020-03-03 16:13 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: linux-renesas-soc, geert, fabrizio.castro,
	ramesh.shanmugasundaram, magnus.damm

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]


> +	for (i = 0; i < info->num_used_mod_clks; i++)

I think the naming of 'used' is a bit unfortunate because the flag is
'unused'. The most readable would be 'ignore_unused_mod_clks' probably?
But this is kinda long. 'kept_mod_clks'? I really don't want to
bikeshed over this, but maybe we can lower the potential confusion here?

> +		if (id == info->used_mod_clks[i]) {
> +			dev_dbg(dev, "MSTP %s setting CLK_IGNORE_UNUSED\n",
> +				mod->name);

Can we remove this? We can check this easily in debugfs/clk. Yes, I know
CLK_CRITICAL has it, too. Maybe we can remove it there, too. Or just
move it to the final dev_dbg before the function leaves?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-03-03 16:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 20:28 [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Ulrich Hecht
2020-02-26 20:28 ` [PATCH 01/11] clk: renesas: cpg-mssr: add support for ignore-unused clocks Ulrich Hecht
2020-03-03 16:13   ` Wolfram Sang
2020-02-26 20:28 ` [PATCH 02/11] clk: renesas: r8a7796: mark RWDT clock as ignore-unused Ulrich Hecht
2020-02-26 20:28 ` [PATCH 03/11] clk: renesas: r8a7795: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 04/11] clk: renesas: r8a77970: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 05/11] clk: renesas: r8a77980: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 06/11] clk: renesas: r8a77995: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 07/11] clk: renesas: r8a774a1: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 08/11] clk: renesas: r8a774b1: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 09/11] clk: renesas: r8a774c0: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 10/11] clk: renesas: r8a77965: " Ulrich Hecht
2020-02-26 20:28 ` [PATCH 11/11] clk: renesas: r8a77990: " Ulrich Hecht
2020-02-27 14:29 ` [PATCH 00/11] clk: renesas: cpg-mssr: add ignore-unused option Geert Uytterhoeven
2020-03-03 16:05 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.