All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] clk: renesas: Lock initialization cleanups
@ 2024-05-29  9:35 Geert Uytterhoeven
  2024-05-29  9:35 ` [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2024-05-29  9:35 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

	Hi all,

This patch series contains a few spin lock initialization cleanups for
R-Car Gen2+ clock drivers. It has been tested on a variety of R-Car Gen2+
systems.

I plan to queued these in renesas-clk for v6.11.

Thanks for your comments!

Geert Uytterhoeven (3):
  clk: renesas: r8a77970: Use common cpg_lock
  clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
  clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock

 drivers/clk/renesas/r8a77970-cpg-mssr.c | 5 +----
 drivers/clk/renesas/rcar-cpg-lib.c      | 2 +-
 drivers/clk/renesas/rcar-gen2-cpg.c     | 4 +---
 drivers/clk/renesas/rcar-gen3-cpg.c     | 2 --
 drivers/clk/renesas/rcar-gen4-cpg.c     | 2 --
 5 files changed, 3 insertions(+), 12 deletions(-)

-- 
2.34.1

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

* [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock
  2024-05-29  9:35 [PATCH 0/3] clk: renesas: Lock initialization cleanups Geert Uytterhoeven
@ 2024-05-29  9:35 ` Geert Uytterhoeven
  2024-06-03 21:08   ` Stephen Boyd
  2024-05-29  9:35 ` [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock Geert Uytterhoeven
  2024-05-29  9:35 ` [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock Geert Uytterhoeven
  2 siblings, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2024-05-29  9:35 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

R-Car Gen3 Socs use the common CPG/MSSR library functions in
rcar-cpg-lib.c, so the R-Car V3M sub-driver can use the common cpg_lock
instead of a driver-private lock.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/r8a77970-cpg-mssr.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c
index 7e90e94c4b68821b..3cec0f501b947eae 100644
--- a/drivers/clk/renesas/r8a77970-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c
@@ -18,6 +18,7 @@
 #include <dt-bindings/clock/r8a77970-cpg-mssr.h>
 
 #include "renesas-cpg-mssr.h"
+#include "rcar-cpg-lib.h"
 #include "rcar-gen3-cpg.h"
 
 #define CPG_SD0CKCR		0x0074
@@ -47,8 +48,6 @@ enum clk_ids {
 	MOD_CLK_BASE
 };
 
-static spinlock_t cpg_lock;
-
 static const struct clk_div_table cpg_sd0h_div_table[] = {
 	{  0,  2 }, {  1,  3 }, {  2,  4 }, {  3,  6 },
 	{  4,  8 }, {  5, 12 }, {  6, 16 }, {  7, 18 },
@@ -213,8 +212,6 @@ static int __init r8a77970_cpg_mssr_init(struct device *dev)
 	if (error)
 		return error;
 
-	spin_lock_init(&cpg_lock);
-
 	cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
 
 	return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode);
-- 
2.34.1


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

* [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
  2024-05-29  9:35 [PATCH 0/3] clk: renesas: Lock initialization cleanups Geert Uytterhoeven
  2024-05-29  9:35 ` [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock Geert Uytterhoeven
@ 2024-05-29  9:35 ` Geert Uytterhoeven
  2024-05-29 19:56   ` Stephen Boyd
  2024-06-03 21:08   ` Stephen Boyd
  2024-05-29  9:35 ` [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock Geert Uytterhoeven
  2 siblings, 2 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2024-05-29  9:35 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

A global spinlock can be initialized automatically with
DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().

Suggested-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/rcar-cpg-lib.c  | 2 +-
 drivers/clk/renesas/rcar-gen3-cpg.c | 2 --
 drivers/clk/renesas/rcar-gen4-cpg.c | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/clk/renesas/rcar-cpg-lib.c b/drivers/clk/renesas/rcar-cpg-lib.c
index 5a15f8788b9227d9..42b126ea3e1337c1 100644
--- a/drivers/clk/renesas/rcar-cpg-lib.c
+++ b/drivers/clk/renesas/rcar-cpg-lib.c
@@ -22,7 +22,7 @@
 
 #include "rcar-cpg-lib.h"
 
-spinlock_t cpg_lock;
+DEFINE_SPINLOCK(cpg_lock);
 
 void cpg_reg_modify(void __iomem *reg, u32 clear, u32 set)
 {
diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c
index d0129a6509411662..20b89eb6c35c1f07 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.c
+++ b/drivers/clk/renesas/rcar-gen3-cpg.c
@@ -551,7 +551,5 @@ int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
 		cpg_quirks = (uintptr_t)attr->data;
 	pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
 
-	spin_lock_init(&cpg_lock);
-
 	return 0;
 }
diff --git a/drivers/clk/renesas/rcar-gen4-cpg.c b/drivers/clk/renesas/rcar-gen4-cpg.c
index 8e4559fbb0bc3352..0e2c27adcfe784a0 100644
--- a/drivers/clk/renesas/rcar-gen4-cpg.c
+++ b/drivers/clk/renesas/rcar-gen4-cpg.c
@@ -507,7 +507,5 @@ int __init rcar_gen4_cpg_init(const struct rcar_gen4_cpg_pll_config *config,
 	cpg_clk_extalr = clk_extalr;
 	cpg_mode = mode;
 
-	spin_lock_init(&cpg_lock);
-
 	return 0;
 }
-- 
2.34.1


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

* [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock
  2024-05-29  9:35 [PATCH 0/3] clk: renesas: Lock initialization cleanups Geert Uytterhoeven
  2024-05-29  9:35 ` [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock Geert Uytterhoeven
  2024-05-29  9:35 ` [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock Geert Uytterhoeven
@ 2024-05-29  9:35 ` Geert Uytterhoeven
  2024-05-29 19:56   ` Stephen Boyd
  2 siblings, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2024-05-29  9:35 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

A static spinlock can be initialized automatically with
DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().

Suggested-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/rcar-gen2-cpg.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/renesas/rcar-gen2-cpg.c b/drivers/clk/renesas/rcar-gen2-cpg.c
index edae874fa2b63369..4c3764972bad905f 100644
--- a/drivers/clk/renesas/rcar-gen2-cpg.c
+++ b/drivers/clk/renesas/rcar-gen2-cpg.c
@@ -30,7 +30,7 @@
 #define CPG_ADSPCKCR		0x025c
 #define CPG_RCANCKCR		0x0270
 
-static spinlock_t cpg_lock;
+static DEFINE_SPINLOCK(cpg_lock);
 
 /*
  * Z Clock
@@ -387,7 +387,5 @@ int __init rcar_gen2_cpg_init(const struct rcar_gen2_cpg_pll_config *config,
 		cpg_quirks = (uintptr_t)attr->data;
 	pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
 
-	spin_lock_init(&cpg_lock);
-
 	return 0;
 }
-- 
2.34.1


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

* Re: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
  2024-05-29  9:35 ` [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock Geert Uytterhoeven
@ 2024-05-29 19:56   ` Stephen Boyd
  2024-05-30  6:46     ` Geert Uytterhoeven
  2024-06-03 21:08   ` Stephen Boyd
  1 sibling, 1 reply; 9+ messages in thread
From: Stephen Boyd @ 2024-05-29 19:56 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2024-05-29 02:35:09)
> A global spinlock can be initialized automatically with
> DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
> 
> Suggested-by: Ye Bin <yebin10@huawei.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Shouldn't this be first so that the previous patch can use the
initialized spinlock?

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

* Re: [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock
  2024-05-29  9:35 ` [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock Geert Uytterhoeven
@ 2024-05-29 19:56   ` Stephen Boyd
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2024-05-29 19:56 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2024-05-29 02:35:10)
> A static spinlock can be initialized automatically with
> DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
> 
> Suggested-by: Ye Bin <yebin10@huawei.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

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

* Re: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
  2024-05-29 19:56   ` Stephen Boyd
@ 2024-05-30  6:46     ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2024-05-30  6:46 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Michael Turquette, Ye Bin, linux-renesas-soc, linux-clk

Hi Stephen,

On Wed, May 29, 2024 at 9:56 PM Stephen Boyd <sboyd@kernel.org> wrote:
> Quoting Geert Uytterhoeven (2024-05-29 02:35:09)
> > A global spinlock can be initialized automatically with
> > DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
> >
> > Suggested-by: Ye Bin <yebin10@huawei.com>
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
>
> Shouldn't this be first so that the previous patch can use the
> initialized spinlock?

Order of the patches doesn't matter.

r8a77970_cpg_mssr_init() in the R-Car V3M sub-driver calls into
rcar_gen3_cpg_init() in the Gen3 family sub-driver, which initialized
the spinlock.

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

* Re: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
  2024-05-29  9:35 ` [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock Geert Uytterhoeven
  2024-05-29 19:56   ` Stephen Boyd
@ 2024-06-03 21:08   ` Stephen Boyd
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2024-06-03 21:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2024-05-29 02:35:09)
> A global spinlock can be initialized automatically with
> DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
> 
> Suggested-by: Ye Bin <yebin10@huawei.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

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

* Re: [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock
  2024-05-29  9:35 ` [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock Geert Uytterhoeven
@ 2024-06-03 21:08   ` Stephen Boyd
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2024-06-03 21:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette
  Cc: Ye Bin, linux-renesas-soc, linux-clk, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2024-05-29 02:35:08)
> R-Car Gen3 Socs use the common CPG/MSSR library functions in
> rcar-cpg-lib.c, so the R-Car V3M sub-driver can use the common cpg_lock
> instead of a driver-private lock.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

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

end of thread, other threads:[~2024-06-03 21:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29  9:35 [PATCH 0/3] clk: renesas: Lock initialization cleanups Geert Uytterhoeven
2024-05-29  9:35 ` [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock Geert Uytterhoeven
2024-06-03 21:08   ` Stephen Boyd
2024-05-29  9:35 ` [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock Geert Uytterhoeven
2024-05-29 19:56   ` Stephen Boyd
2024-05-30  6:46     ` Geert Uytterhoeven
2024-06-03 21:08   ` Stephen Boyd
2024-05-29  9:35 ` [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock Geert Uytterhoeven
2024-05-29 19:56   ` Stephen Boyd

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.