All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups
@ 2017-03-13 16:19 Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs Geert Uytterhoeven
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven

	Hi Mike, Stephen,

This patch series contains miscellaneous fixes and cleanups for the
Renesas R-Car Gen3 (H3 and M3-W) clock drivers:
  - Correct parent clock for Audio DMACs,
  - Correct names of watchdog clocks,
  - Reformat core clock tables for easier comparisons between drivers,
  - Add workaround for PLL0/2/4 errata on R-Car H3 ES1.0.

I plan to queue these up in clk-renesas-for-v4.12.

Thanks for your comments!

Geert Uytterhoeven (7):
  clk: renesas: r8a7795: Correct parent clock and sort order for Audio
    DMACs
  clk: renesas: r8a7795: Correct name of watchdog clock
  clk: renesas: r8a7796: Correct name of watchdog clock
  clk: renesas: r8a7795: Reformat core clock table
  clk: renesas: r8a7796: Reformat core clock table
  clk: renesas: rcar-gen3-cpg: Pass mode pins to rcar_gen3_cpg_init()
  clk: renesas: rcar-gen3: Add workaround for PLL0/2/4 errata on H3
    ES1.0

 drivers/clk/renesas/r8a7795-cpg-mssr.c | 28 ++++++++++++++--------------
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 16 ++++++++--------
 drivers/clk/renesas/rcar-gen3-cpg.c    | 28 +++++++++++++++++++++++++++-
 drivers/clk/renesas/rcar-gen3-cpg.h    |  2 +-
 4 files changed, 50 insertions(+), 24 deletions(-)

-- 
2.7.4

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

* [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-14  0:20   ` Kuninori Morimoto
  2017-03-13 16:19 ` [PATCH 2/7] clk: renesas: r8a7795: Correct name of watchdog clock Geert Uytterhoeven
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven, Kuninori Morimoto

The parent clock of the Audio DMACs is the "ZS" AXI bus clock, which
maps to S3D1 or R-Car H3 ES1.x.
All module clocks must be sorted by clock ID.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/clk/renesas/r8a7795-cpg-mssr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index 2add8218e0f7a6c0..cde470ce81e449cf 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -142,8 +142,8 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
 	DEF_MOD("rwdt0",		 402,	R8A7795_CLK_R),
 	DEF_MOD("intc-ex",		 407,	R8A7795_CLK_CP),
 	DEF_MOD("intc-ap",		 408,	R8A7795_CLK_S3D1),
-	DEF_MOD("audmac0",		 502,	R8A7795_CLK_S3D4),
-	DEF_MOD("audmac1",		 501,	R8A7795_CLK_S3D4),
+	DEF_MOD("audmac1",		 501,	R8A7795_CLK_S3D1),
+	DEF_MOD("audmac0",		 502,	R8A7795_CLK_S3D1),
 	DEF_MOD("drif7",		 508,	R8A7795_CLK_S3D2),
 	DEF_MOD("drif6",		 509,	R8A7795_CLK_S3D2),
 	DEF_MOD("drif5",		 510,	R8A7795_CLK_S3D2),
-- 
2.7.4

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

* [PATCH 2/7] clk: renesas: r8a7795: Correct name of watchdog clock
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 3/7] clk: renesas: r8a7796: " Geert Uytterhoeven
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven

There's only a single watchdog clock, and it's named "rwdt".

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

diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index cde470ce81e449cf..4e176e7f958b133d 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -139,7 +139,7 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
 	DEF_MOD("usb3-if0",		 328,	R8A7795_CLK_S3D1),
 	DEF_MOD("usb-dmac0",		 330,	R8A7795_CLK_S3D1),
 	DEF_MOD("usb-dmac1",		 331,	R8A7795_CLK_S3D1),
-	DEF_MOD("rwdt0",		 402,	R8A7795_CLK_R),
+	DEF_MOD("rwdt",			 402,	R8A7795_CLK_R),
 	DEF_MOD("intc-ex",		 407,	R8A7795_CLK_CP),
 	DEF_MOD("intc-ap",		 408,	R8A7795_CLK_S3D1),
 	DEF_MOD("audmac1",		 501,	R8A7795_CLK_S3D1),
-- 
2.7.4

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

* [PATCH 3/7] clk: renesas: r8a7796: Correct name of watchdog clock
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 2/7] clk: renesas: r8a7795: Correct name of watchdog clock Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 4/7] clk: renesas: r8a7795: Reformat core clock table Geert Uytterhoeven
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven

There's only a single watchdog clock, and it's named "rwdt".

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

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index 12a23c18bc1e7eb5..55003194a2561c95 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -135,7 +135,7 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
 	DEF_MOD("sdif2",		 312,	R8A7796_CLK_SD2),
 	DEF_MOD("sdif1",		 313,	R8A7796_CLK_SD1),
 	DEF_MOD("sdif0",		 314,	R8A7796_CLK_SD0),
-	DEF_MOD("rwdt0",		 402,	R8A7796_CLK_R),
+	DEF_MOD("rwdt",			 402,	R8A7796_CLK_R),
 	DEF_MOD("intc-ap",		 408,	R8A7796_CLK_S3D1),
 	DEF_MOD("drif7",		 508,	R8A7796_CLK_S3D2),
 	DEF_MOD("drif6",		 509,	R8A7796_CLK_S3D2),
-- 
2.7.4

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

* [PATCH 4/7] clk: renesas: r8a7795: Reformat core clock table
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2017-03-13 16:19 ` [PATCH 3/7] clk: renesas: r8a7796: " Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 5/7] clk: renesas: r8a7796: " Geert Uytterhoeven
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven

For easier comparison with other clock drivers.
No functional changes.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/r8a7795-cpg-mssr.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index 4e176e7f958b133d..608178618da87bef 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -53,8 +53,8 @@ enum clk_ids {
 
 static const struct cpg_core_clk r8a7795_core_clks[] __initconst = {
 	/* External Clock Inputs */
-	DEF_INPUT("extal",  CLK_EXTAL),
-	DEF_INPUT("extalr", CLK_EXTALR),
+	DEF_INPUT("extal",      CLK_EXTAL),
+	DEF_INPUT("extalr",     CLK_EXTALR),
 
 	/* Internal Core Clocks */
 	DEF_BASE(".main",       CLK_MAIN, CLK_TYPE_GEN3_MAIN, CLK_EXTAL),
@@ -89,23 +89,23 @@ static const struct cpg_core_clk r8a7795_core_clks[] __initconst = {
 	DEF_FIXED("s3d2",       R8A7795_CLK_S3D2,  CLK_S3,         2, 1),
 	DEF_FIXED("s3d4",       R8A7795_CLK_S3D4,  CLK_S3,         4, 1),
 
-	DEF_GEN3_SD("sd0",      R8A7795_CLK_SD0,   CLK_SDSRC,     0x0074),
-	DEF_GEN3_SD("sd1",      R8A7795_CLK_SD1,   CLK_SDSRC,     0x0078),
-	DEF_GEN3_SD("sd2",      R8A7795_CLK_SD2,   CLK_SDSRC,     0x0268),
-	DEF_GEN3_SD("sd3",      R8A7795_CLK_SD3,   CLK_SDSRC,     0x026c),
+	DEF_GEN3_SD("sd0",      R8A7795_CLK_SD0,   CLK_SDSRC,     0x074),
+	DEF_GEN3_SD("sd1",      R8A7795_CLK_SD1,   CLK_SDSRC,     0x078),
+	DEF_GEN3_SD("sd2",      R8A7795_CLK_SD2,   CLK_SDSRC,     0x268),
+	DEF_GEN3_SD("sd3",      R8A7795_CLK_SD3,   CLK_SDSRC,     0x26c),
 
 	DEF_FIXED("cl",         R8A7795_CLK_CL,    CLK_PLL1_DIV2, 48, 1),
 	DEF_FIXED("cp",         R8A7795_CLK_CP,    CLK_EXTAL,      2, 1),
 
-	DEF_DIV6P1("mso",       R8A7795_CLK_MSO,   CLK_PLL1_DIV4, 0x014),
-	DEF_DIV6P1("hdmi",      R8A7795_CLK_HDMI,  CLK_PLL1_DIV4, 0x250),
 	DEF_DIV6P1("canfd",     R8A7795_CLK_CANFD, CLK_PLL1_DIV4, 0x244),
 	DEF_DIV6P1("csi0",      R8A7795_CLK_CSI0,  CLK_PLL1_DIV4, 0x00c),
+	DEF_DIV6P1("mso",       R8A7795_CLK_MSO,   CLK_PLL1_DIV4, 0x014),
+	DEF_DIV6P1("hdmi",      R8A7795_CLK_HDMI,  CLK_PLL1_DIV4, 0x250),
 
-	DEF_DIV6_RO("osc",      R8A7795_CLK_OSC,   CLK_EXTAL, CPG_RCKCR, 8),
+	DEF_DIV6_RO("osc",      R8A7795_CLK_OSC,   CLK_EXTAL, CPG_RCKCR,  8),
 	DEF_DIV6_RO("r_int",    CLK_RINT,          CLK_EXTAL, CPG_RCKCR, 32),
 
-	DEF_BASE("r",           R8A7795_CLK_R, CLK_TYPE_GEN3_R, CLK_RINT),
+	DEF_BASE("r",           R8A7795_CLK_R,     CLK_TYPE_GEN3_R, CLK_RINT),
 };
 
 static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
-- 
2.7.4

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

* [PATCH 5/7] clk: renesas: r8a7796: Reformat core clock table
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2017-03-13 16:19 ` [PATCH 4/7] clk: renesas: r8a7795: Reformat core clock table Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 6/7] clk: renesas: rcar-gen3-cpg: Pass mode pins to rcar_gen3_cpg_init() Geert Uytterhoeven
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven

For easier comparison with other clock drivers.
No functional changes.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index 55003194a2561c95..f7787101b8d0406c 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -54,8 +54,8 @@ enum clk_ids {
 
 static const struct cpg_core_clk r8a7796_core_clks[] __initconst = {
 	/* External Clock Inputs */
-	DEF_INPUT("extal",  CLK_EXTAL),
-	DEF_INPUT("extalr", CLK_EXTALR),
+	DEF_INPUT("extal",      CLK_EXTAL),
+	DEF_INPUT("extalr",     CLK_EXTALR),
 
 	/* Internal Core Clocks */
 	DEF_BASE(".main",       CLK_MAIN, CLK_TYPE_GEN3_MAIN, CLK_EXTAL),
@@ -95,10 +95,10 @@ static const struct cpg_core_clk r8a7796_core_clks[] __initconst = {
 	DEF_FIXED("s3d2",       R8A7796_CLK_S3D2,  CLK_S3,         2, 1),
 	DEF_FIXED("s3d4",       R8A7796_CLK_S3D4,  CLK_S3,         4, 1),
 
-	DEF_GEN3_SD("sd0",      R8A7796_CLK_SD0,   CLK_SDSRC,    0x0074),
-	DEF_GEN3_SD("sd1",      R8A7796_CLK_SD1,   CLK_SDSRC,    0x0078),
-	DEF_GEN3_SD("sd2",      R8A7796_CLK_SD2,   CLK_SDSRC,    0x0268),
-	DEF_GEN3_SD("sd3",      R8A7796_CLK_SD3,   CLK_SDSRC,    0x026c),
+	DEF_GEN3_SD("sd0",      R8A7796_CLK_SD0,   CLK_SDSRC,     0x074),
+	DEF_GEN3_SD("sd1",      R8A7796_CLK_SD1,   CLK_SDSRC,     0x078),
+	DEF_GEN3_SD("sd2",      R8A7796_CLK_SD2,   CLK_SDSRC,     0x268),
+	DEF_GEN3_SD("sd3",      R8A7796_CLK_SD3,   CLK_SDSRC,     0x26c),
 
 	DEF_FIXED("cl",         R8A7796_CLK_CL,    CLK_PLL1_DIV2, 48, 1),
 	DEF_FIXED("cp",         R8A7796_CLK_CP,    CLK_EXTAL,      2, 1),
-- 
2.7.4

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

* [PATCH 6/7] clk: renesas: rcar-gen3-cpg: Pass mode pins to rcar_gen3_cpg_init()
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2017-03-13 16:19 ` [PATCH 5/7] clk: renesas: r8a7796: " Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-13 16:19 ` [PATCH 7/7] clk: renesas: rcar-gen3: Add workaround for PLL0/2/4 errata on H3 ES1.0 Geert Uytterhoeven
  2017-03-22 13:25 ` [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven

Pass the mode pin states from the SoC-specific CPG/MSSR driver to the
R-Car Gen3 CPG driver core, as their state will be needed to make some
core clock configuration decisions.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/r8a7795-cpg-mssr.c | 2 +-
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 2 +-
 drivers/clk/renesas/rcar-gen3-cpg.c    | 4 +++-
 drivers/clk/renesas/rcar-gen3-cpg.h    | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index 608178618da87bef..4699f416e275d924 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -330,7 +330,7 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev)
 		return -EINVAL;
 	}
 
-	return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR);
+	return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode);
 }
 
 const struct cpg_mssr_info r8a7795_cpg_mssr_info __initconst = {
diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index f7787101b8d0406c..9d114b31b0731b5e 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -273,7 +273,7 @@ static int __init r8a7796_cpg_mssr_init(struct device *dev)
 		return -EINVAL;
 	}
 
-	return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR);
+	return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode);
 }
 
 const struct cpg_mssr_info r8a7796_cpg_mssr_info __initconst = {
diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c
index 742f6dc7c15653ef..d395bb8c22f575cf 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.c
+++ b/drivers/clk/renesas/rcar-gen3-cpg.c
@@ -247,6 +247,7 @@ static struct clk * __init cpg_sd_clk_register(const struct cpg_core_clk *core,
 
 static const struct rcar_gen3_cpg_pll_config *cpg_pll_config __initdata;
 static unsigned int cpg_clk_extalr __initdata;
+static u32 cpg_mode __initdata;
 
 struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 	const struct cpg_core_clk *core, const struct cpg_mssr_info *info,
@@ -334,9 +335,10 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 }
 
 int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
-			      unsigned int clk_extalr)
+			      unsigned int clk_extalr, u32 mode)
 {
 	cpg_pll_config = config;
 	cpg_clk_extalr = clk_extalr;
+	cpg_mode = mode;
 	return 0;
 }
diff --git a/drivers/clk/renesas/rcar-gen3-cpg.h b/drivers/clk/renesas/rcar-gen3-cpg.h
index f788f481dd42cdf6..073be54b5d038ae3 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.h
+++ b/drivers/clk/renesas/rcar-gen3-cpg.h
@@ -37,6 +37,6 @@ struct clk *rcar_gen3_cpg_clk_register(struct device *dev,
 	const struct cpg_core_clk *core, const struct cpg_mssr_info *info,
 	struct clk **clks, void __iomem *base);
 int rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
-		       unsigned int clk_extalr);
+		       unsigned int clk_extalr, u32 mode);
 
 #endif
-- 
2.7.4

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

* [PATCH 7/7] clk: renesas: rcar-gen3: Add workaround for PLL0/2/4 errata on H3 ES1.0
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2017-03-13 16:19 ` [PATCH 6/7] clk: renesas: rcar-gen3-cpg: Pass mode pins to rcar_gen3_cpg_init() Geert Uytterhoeven
@ 2017-03-13 16:19 ` Geert Uytterhoeven
  2017-03-22 13:25 ` [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, Geert Uytterhoeven, Dien Pham

Add a workaround for errata on R-Car H3 ES1.0, where the PLL0, PLL2, and
PLL4 clock frequencies are off by a factor of two.

Inspired by a patch by Dien Pham in the BSP.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Dien Pham <dien.pham.ry@renesas.com>
---
 drivers/clk/renesas/rcar-gen3-cpg.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c
index d395bb8c22f575cf..e5247e3dc897f9f4 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.c
+++ b/drivers/clk/renesas/rcar-gen3-cpg.c
@@ -20,6 +20,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/sys_soc.h>
 
 #include "renesas-cpg-mssr.h"
 #include "rcar-gen3-cpg.h"
@@ -248,6 +249,17 @@ static struct clk * __init cpg_sd_clk_register(const struct cpg_core_clk *core,
 static const struct rcar_gen3_cpg_pll_config *cpg_pll_config __initdata;
 static unsigned int cpg_clk_extalr __initdata;
 static u32 cpg_mode __initdata;
+static u32 cpg_quirks __initdata;
+
+#define PLL_ERRATA	BIT(0)		/* Missing PLL0/2/4 post-divider */
+
+static const struct soc_device_attribute cpg_quirks_match[] __initconst = {
+	{
+		.soc_id = "r8a7795", .revision = "ES1.0",
+		.data = (void *)PLL_ERRATA,
+	},
+	{ /* sentinel */ }
+};
 
 struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 	const struct cpg_core_clk *core, const struct cpg_mssr_info *info,
@@ -276,6 +288,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 		 */
 		value = readl(base + CPG_PLL0CR);
 		mult = (((value >> 24) & 0x7f) + 1) * 2;
+		if (cpg_quirks & PLL_ERRATA)
+			mult *= 2;
 		break;
 
 	case CLK_TYPE_GEN3_PLL1:
@@ -291,6 +305,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 		 */
 		value = readl(base + CPG_PLL2CR);
 		mult = (((value >> 24) & 0x7f) + 1) * 2;
+		if (cpg_quirks & PLL_ERRATA)
+			mult *= 2;
 		break;
 
 	case CLK_TYPE_GEN3_PLL3:
@@ -306,6 +322,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 		 */
 		value = readl(base + CPG_PLL4CR);
 		mult = (((value >> 24) & 0x7f) + 1) * 2;
+		if (cpg_quirks & PLL_ERRATA)
+			mult *= 2;
 		break;
 
 	case CLK_TYPE_GEN3_SD:
@@ -337,8 +355,14 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
 			      unsigned int clk_extalr, u32 mode)
 {
+	const struct soc_device_attribute *attr;
+
 	cpg_pll_config = config;
 	cpg_clk_extalr = clk_extalr;
 	cpg_mode = mode;
+	attr = soc_device_match(cpg_quirks_match);
+	if (attr)
+		cpg_quirks = (uintptr_t)attr->data;
+	pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
 	return 0;
 }
-- 
2.7.4

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

* Re: [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs
  2017-03-13 16:19 ` [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs Geert Uytterhoeven
@ 2017-03-14  0:20   ` Kuninori Morimoto
  0 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-03-14  0:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Stephen Boyd, linux-renesas-soc, linux-clk


Hi Geert

> The parent clock of the Audio DMACs is the "ZS" AXI bus clock, which
> maps to S3D1 or R-Car H3 ES1.x.
> All module clocks must be sorted by clock ID.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

If my English skill was OK, 

	- maps to S3D1 or R-Car H3 ES1.x.
	+ maps to S3D1 on R-Car H3 ES1.x.

except it

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

>  drivers/clk/renesas/r8a7795-cpg-mssr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> index 2add8218e0f7a6c0..cde470ce81e449cf 100644
> --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
> +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> @@ -142,8 +142,8 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
>  	DEF_MOD("rwdt0",		 402,	R8A7795_CLK_R),
>  	DEF_MOD("intc-ex",		 407,	R8A7795_CLK_CP),
>  	DEF_MOD("intc-ap",		 408,	R8A7795_CLK_S3D1),
> -	DEF_MOD("audmac0",		 502,	R8A7795_CLK_S3D4),
> -	DEF_MOD("audmac1",		 501,	R8A7795_CLK_S3D4),
> +	DEF_MOD("audmac1",		 501,	R8A7795_CLK_S3D1),
> +	DEF_MOD("audmac0",		 502,	R8A7795_CLK_S3D1),
>  	DEF_MOD("drif7",		 508,	R8A7795_CLK_S3D2),
>  	DEF_MOD("drif6",		 509,	R8A7795_CLK_S3D2),
>  	DEF_MOD("drif5",		 510,	R8A7795_CLK_S3D2),
> -- 
> 2.7.4
> 

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

* Re: [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups
  2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2017-03-13 16:19 ` [PATCH 7/7] clk: renesas: rcar-gen3: Add workaround for PLL0/2/4 errata on H3 ES1.0 Geert Uytterhoeven
@ 2017-03-22 13:25 ` Geert Uytterhoeven
  7 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-03-22 13:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk

On Mon, Mar 13, 2017 at 5:19 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> This patch series contains miscellaneous fixes and cleanups for the
> Renesas R-Car Gen3 (H3 and M3-W) clock drivers:
>   - Correct parent clock for Audio DMACs,
>   - Correct names of watchdog clocks,
>   - Reformat core clock tables for easier comparisons between drivers,
>   - Add workaround for PLL0/2/4 errata on R-Car H3 ES1.0.
>
> I plan to queue these up in clk-renesas-for-v4.12.

Queued up with Morimoto-san's grammar fix and Acked-by.

> Geert Uytterhoeven (7):
>   clk: renesas: r8a7795: Correct parent clock and sort order for Audio
>     DMACs
>   clk: renesas: r8a7795: Correct name of watchdog clock
>   clk: renesas: r8a7796: Correct name of watchdog clock
>   clk: renesas: r8a7795: Reformat core clock table
>   clk: renesas: r8a7796: Reformat core clock table
>   clk: renesas: rcar-gen3-cpg: Pass mode pins to rcar_gen3_cpg_init()
>   clk: renesas: rcar-gen3: Add workaround for PLL0/2/4 errata on H3
>     ES1.0

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

end of thread, other threads:[~2017-03-22 13:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 16:19 [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven
2017-03-13 16:19 ` [PATCH 1/7] clk: renesas: r8a7795: Correct parent clock and sort order for Audio DMACs Geert Uytterhoeven
2017-03-14  0:20   ` Kuninori Morimoto
2017-03-13 16:19 ` [PATCH 2/7] clk: renesas: r8a7795: Correct name of watchdog clock Geert Uytterhoeven
2017-03-13 16:19 ` [PATCH 3/7] clk: renesas: r8a7796: " Geert Uytterhoeven
2017-03-13 16:19 ` [PATCH 4/7] clk: renesas: r8a7795: Reformat core clock table Geert Uytterhoeven
2017-03-13 16:19 ` [PATCH 5/7] clk: renesas: r8a7796: " Geert Uytterhoeven
2017-03-13 16:19 ` [PATCH 6/7] clk: renesas: rcar-gen3-cpg: Pass mode pins to rcar_gen3_cpg_init() Geert Uytterhoeven
2017-03-13 16:19 ` [PATCH 7/7] clk: renesas: rcar-gen3: Add workaround for PLL0/2/4 errata on H3 ES1.0 Geert Uytterhoeven
2017-03-22 13:25 ` [PATCH 0/7] clk: renesas: rcar-gen3: Misc fixes and cleanups Geert Uytterhoeven

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.