clk: renesas: Lock initialization cleanups
Subsystems (3)
Geert Uytterhoeven
maintainercover clk: renesas: Lock initialization cleanups
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(-)
Signature · 12 lines
2.34.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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 TorvaldsGeert Uytterhoeven
maintainerPATCH 1/3 clk: renesas: r8a77970: Use common cpg_lock
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.
--- drivers/clk/renesas/r8a77970-cpg-mssr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clk/renesas/r8a77970-cpg-mssr.c +1 -4
@@ -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);
Signature · 1 line
2.34.1
Re: [PATCH 1/3] clk: renesas: r8a77970: Use common cpg_lock
Quoting Geert Uytterhoeven (2024-05-29 02:35:08)
Quoted 6 lines
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 commoncpg_lockinstead of a driver-private lock.Signed-off-by Geert Uytterhoeven <[email protected]>---
Geert Uytterhoeven
maintainerPATCH 2/3 clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
In reply to Geert UytterhoevenA global spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
--- 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(-)
drivers/clk/renesas/rcar-cpg-lib.c +1 -1
@@ -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) {
drivers/clk/renesas/rcar-gen3-cpg.c +0 -2
@@ -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 ; }
drivers/clk/renesas/rcar-gen4-cpg.c +0 -2
@@ -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 ; }
Signature · 1 line
2.34.1
Stephen Boyd
maintainerRe: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
Quoting Geert Uytterhoeven (2024-05-29 02:35:09)
Quoted 6 lines
A global spinlock can be initialized automatically with
DEFINE_SPINLOCK()rather than explicitly callingspin_lock_init().Suggested-by Ye Bin <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>---
Shouldn't this be first so that the previous patch can use the initialized spinlock?
Re: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
Hi Stephen,
Quoted 10 lines · Stephen Boyd
Quoting Geert Uytterhoeven (2024-05-29 02:35:09)
Quoted 6 lines
A global spinlock can be initialized automatically with
DEFINE_SPINLOCK()rather than explicitly callingspin_lock_init().Suggested-by Ye Bin <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>---
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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 2/3] clk: renesas: cpg-lib: Use DEFINE_SPINLOCK() for global spinlock
In reply to Geert UytterhoevenQuoting Geert Uytterhoeven (2024-05-29 02:35:09)
Quoted 6 lines
A global spinlock can be initialized automatically with
DEFINE_SPINLOCK()rather than explicitly callingspin_lock_init().Suggested-by Ye Bin <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>---
Geert Uytterhoeven
maintainerPATCH 3/3 clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock
In reply to Geert UytterhoevenA static spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
--- drivers/clk/renesas/rcar-gen2-cpg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clk/renesas/rcar-gen2-cpg.c +1 -3
@@ -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 ; }
Signature · 1 line
2.34.1
Re: [PATCH 3/3] clk: renesas: rcar-gen2: Use DEFINE_SPINLOCK() for static spinlock
Quoting Geert Uytterhoeven (2024-05-29 02:35:10)
Quoted 6 lines
A static spinlock can be initialized automatically with
DEFINE_SPINLOCK()rather than explicitly callingspin_lock_init().Suggested-by Ye Bin <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>---