aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms+renesas@verge.net.au>2016-04-22 03:22:21 -0400
committerSimon Horman <horms+renesas@verge.net.au>2016-04-22 03:22:21 -0400
commita93fed0956bef9e4df420aa181198d86d347895d (patch)
treec0527fea578f7ca2ee969f2f9094b529e671aa54
parent839a04d847f5871516f500091519c52dc40fe01d (diff)
parent2066390ad47b374f3d35075a32325b47d15bf735 (diff)
Merge tag 'clk-renesas-for-v4.7-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into rcar-sysc-for-v4.7
clk: renesas: R-Car SYSC PM Domain Preparation - Export the CPG/MSSR and CPG/MSTP attach/detach_dev callbacks, so they can be called by the R-Car SYSC PM Domain driver.
-rw-r--r--drivers/clk/Kconfig1
-rw-r--r--drivers/clk/renesas/Kconfig16
-rw-r--r--drivers/clk/renesas/Makefile26
-rw-r--r--drivers/clk/renesas/clk-mstp.c7
-rw-r--r--drivers/clk/renesas/r8a7795-cpg-mssr.c34
-rw-r--r--drivers/clk/renesas/renesas-cpg-mssr.c47
-rw-r--r--drivers/clk/renesas/renesas-cpg-mssr.h6
-rw-r--r--include/linux/clk/renesas.h16
8 files changed, 102 insertions, 51 deletions
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 16f7d33421d8..c45554957499 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -201,6 +201,7 @@ source "drivers/clk/bcm/Kconfig"
201source "drivers/clk/hisilicon/Kconfig" 201source "drivers/clk/hisilicon/Kconfig"
202source "drivers/clk/mvebu/Kconfig" 202source "drivers/clk/mvebu/Kconfig"
203source "drivers/clk/qcom/Kconfig" 203source "drivers/clk/qcom/Kconfig"
204source "drivers/clk/renesas/Kconfig"
204source "drivers/clk/samsung/Kconfig" 205source "drivers/clk/samsung/Kconfig"
205source "drivers/clk/tegra/Kconfig" 206source "drivers/clk/tegra/Kconfig"
206source "drivers/clk/ti/Kconfig" 207source "drivers/clk/ti/Kconfig"
diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig
new file mode 100644
index 000000000000..2115ce410cfb
--- /dev/null
+++ b/drivers/clk/renesas/Kconfig
@@ -0,0 +1,16 @@
1config CLK_RENESAS_CPG_MSSR
2 bool
3 default y if ARCH_R8A7795
4
5config CLK_RENESAS_CPG_MSTP
6 bool
7 default y if ARCH_R7S72100
8 default y if ARCH_R8A73A4
9 default y if ARCH_R8A7740
10 default y if ARCH_R8A7778
11 default y if ARCH_R8A7779
12 default y if ARCH_R8A7790
13 default y if ARCH_R8A7791
14 default y if ARCH_R8A7793
15 default y if ARCH_R8A7794
16 default y if ARCH_SH73A0
diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
index 7e2579b30326..ead8bb843524 100644
--- a/drivers/clk/renesas/Makefile
+++ b/drivers/clk/renesas/Makefile
@@ -1,13 +1,15 @@
1obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.o 1obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.o
2obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o clk-mstp.o 2obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o
3obj-$(CONFIG_ARCH_R8A73A4) += clk-r8a73a4.o clk-mstp.o clk-div6.o 3obj-$(CONFIG_ARCH_R8A73A4) += clk-r8a73a4.o clk-div6.o
4obj-$(CONFIG_ARCH_R8A7740) += clk-r8a7740.o clk-mstp.o clk-div6.o 4obj-$(CONFIG_ARCH_R8A7740) += clk-r8a7740.o clk-div6.o
5obj-$(CONFIG_ARCH_R8A7778) += clk-r8a7778.o clk-mstp.o 5obj-$(CONFIG_ARCH_R8A7778) += clk-r8a7778.o
6obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o clk-mstp.o 6obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o
7obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 7obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-div6.o
8obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 8obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-div6.o
9obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 9obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-div6.o
10obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-mstp.o clk-div6.o 10obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-div6.o
11obj-$(CONFIG_ARCH_R8A7795) += renesas-cpg-mssr.o \ 11obj-$(CONFIG_ARCH_R8A7795) += r8a7795-cpg-mssr.o
12 r8a7795-cpg-mssr.o clk-div6.o 12obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o clk-div6.o
13obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o clk-mstp.o clk-div6.o 13
14obj-$(CONFIG_CLK_RENESAS_CPG_MSSR) += renesas-cpg-mssr.o clk-div6.o
15obj-$(CONFIG_CLK_RENESAS_CPG_MSTP) += clk-mstp.o
diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 3d44e183aedd..8b597b9a3804 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -243,9 +243,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
243} 243}
244CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init); 244CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init);
245 245
246 246int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev)
247#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
248int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev)
249{ 247{
250 struct device_node *np = dev->of_node; 248 struct device_node *np = dev->of_node;
251 struct of_phandle_args clkspec; 249 struct of_phandle_args clkspec;
@@ -297,7 +295,7 @@ fail_put:
297 return error; 295 return error;
298} 296}
299 297
300void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev) 298void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev)
301{ 299{
302 if (!list_empty(&dev->power.subsys_data->clock_list)) 300 if (!list_empty(&dev->power.subsys_data->clock_list))
303 pm_clk_destroy(dev); 301 pm_clk_destroy(dev);
@@ -326,4 +324,3 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np)
326 324
327 of_genpd_add_provider_simple(np, pd); 325 of_genpd_add_provider_simple(np, pd);
328} 326}
329#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */
diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index b2198aef5ed4..6af7f5b6e824 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/bug.h> 15#include <linux/bug.h>
16#include <linux/clk.h>
16#include <linux/clk-provider.h> 17#include <linux/clk-provider.h>
17#include <linux/device.h> 18#include <linux/device.h>
18#include <linux/err.h> 19#include <linux/err.h>
@@ -26,6 +27,7 @@
26 27
27#include "renesas-cpg-mssr.h" 28#include "renesas-cpg-mssr.h"
28 29
30#define CPG_RCKCR 0x240
29 31
30enum clk_ids { 32enum clk_ids {
31 /* Core Clock Outputs exported to DT */ 33 /* Core Clock Outputs exported to DT */
@@ -50,6 +52,7 @@ enum clk_ids {
50 CLK_S3, 52 CLK_S3,
51 CLK_SDSRC, 53 CLK_SDSRC,
52 CLK_SSPSRC, 54 CLK_SSPSRC,
55 CLK_RINT,
53 56
54 /* Module Clocks */ 57 /* Module Clocks */
55 MOD_CLK_BASE 58 MOD_CLK_BASE
@@ -63,8 +66,12 @@ enum r8a7795_clk_types {
63 CLK_TYPE_GEN3_PLL3, 66 CLK_TYPE_GEN3_PLL3,
64 CLK_TYPE_GEN3_PLL4, 67 CLK_TYPE_GEN3_PLL4,
65 CLK_TYPE_GEN3_SD, 68 CLK_TYPE_GEN3_SD,
69 CLK_TYPE_GEN3_R,
66}; 70};
67 71
72#define DEF_GEN3_SD(_name, _id, _parent, _offset) \
73 DEF_BASE(_name, _id, CLK_TYPE_GEN3_SD, _parent, .offset = _offset)
74
68static const struct cpg_core_clk r8a7795_core_clks[] __initconst = { 75static const struct cpg_core_clk r8a7795_core_clks[] __initconst = {
69 /* External Clock Inputs */ 76 /* External Clock Inputs */
70 DEF_INPUT("extal", CLK_EXTAL), 77 DEF_INPUT("extal", CLK_EXTAL),
@@ -102,10 +109,10 @@ static const struct cpg_core_clk r8a7795_core_clks[] __initconst = {
102 DEF_FIXED("s3d2", R8A7795_CLK_S3D2, CLK_S3, 2, 1), 109 DEF_FIXED("s3d2", R8A7795_CLK_S3D2, CLK_S3, 2, 1),
103 DEF_FIXED("s3d4", R8A7795_CLK_S3D4, CLK_S3, 4, 1), 110 DEF_FIXED("s3d4", R8A7795_CLK_S3D4, CLK_S3, 4, 1),
104 111
105 DEF_SD("sd0", R8A7795_CLK_SD0, CLK_PLL1_DIV2, 0x0074), 112 DEF_GEN3_SD("sd0", R8A7795_CLK_SD0, CLK_PLL1_DIV2, 0x0074),
106 DEF_SD("sd1", R8A7795_CLK_SD1, CLK_PLL1_DIV2, 0x0078), 113 DEF_GEN3_SD("sd1", R8A7795_CLK_SD1, CLK_PLL1_DIV2, 0x0078),
107 DEF_SD("sd2", R8A7795_CLK_SD2, CLK_PLL1_DIV2, 0x0268), 114 DEF_GEN3_SD("sd2", R8A7795_CLK_SD2, CLK_PLL1_DIV2, 0x0268),
108 DEF_SD("sd3", R8A7795_CLK_SD3, CLK_PLL1_DIV2, 0x026c), 115 DEF_GEN3_SD("sd3", R8A7795_CLK_SD3, CLK_PLL1_DIV2, 0x026c),
109 116
110 DEF_FIXED("cl", R8A7795_CLK_CL, CLK_PLL1_DIV2, 48, 1), 117 DEF_FIXED("cl", R8A7795_CLK_CL, CLK_PLL1_DIV2, 48, 1),
111 DEF_FIXED("cp", R8A7795_CLK_CP, CLK_EXTAL, 2, 1), 118 DEF_FIXED("cp", R8A7795_CLK_CP, CLK_EXTAL, 2, 1),
@@ -113,6 +120,11 @@ static const struct cpg_core_clk r8a7795_core_clks[] __initconst = {
113 DEF_DIV6P1("mso", R8A7795_CLK_MSO, CLK_PLL1_DIV4, 0x014), 120 DEF_DIV6P1("mso", R8A7795_CLK_MSO, CLK_PLL1_DIV4, 0x014),
114 DEF_DIV6P1("hdmi", R8A7795_CLK_HDMI, CLK_PLL1_DIV2, 0x250), 121 DEF_DIV6P1("hdmi", R8A7795_CLK_HDMI, CLK_PLL1_DIV2, 0x250),
115 DEF_DIV6P1("canfd", R8A7795_CLK_CANFD, CLK_PLL1_DIV4, 0x244), 122 DEF_DIV6P1("canfd", R8A7795_CLK_CANFD, CLK_PLL1_DIV4, 0x244),
123
124 DEF_DIV6_RO("osc", R8A7795_CLK_OSC, CLK_EXTAL, CPG_RCKCR, 8),
125 DEF_DIV6_RO("r_int", CLK_RINT, CLK_EXTAL, CPG_RCKCR, 32),
126
127 DEF_BASE("r", R8A7795_CLK_R, CLK_TYPE_GEN3_R, CLK_RINT),
116}; 128};
117 129
118static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = { 130static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
@@ -139,6 +151,7 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
139 DEF_MOD("usb3-if0", 328, R8A7795_CLK_S3D1), 151 DEF_MOD("usb3-if0", 328, R8A7795_CLK_S3D1),
140 DEF_MOD("usb-dmac0", 330, R8A7795_CLK_S3D1), 152 DEF_MOD("usb-dmac0", 330, R8A7795_CLK_S3D1),
141 DEF_MOD("usb-dmac1", 331, R8A7795_CLK_S3D1), 153 DEF_MOD("usb-dmac1", 331, R8A7795_CLK_S3D1),
154 DEF_MOD("rwdt0", 402, R8A7795_CLK_R),
142 DEF_MOD("intc-ex", 407, R8A7795_CLK_CP), 155 DEF_MOD("intc-ex", 407, R8A7795_CLK_CP),
143 DEF_MOD("intc-ap", 408, R8A7795_CLK_S3D1), 156 DEF_MOD("intc-ap", 408, R8A7795_CLK_S3D1),
144 DEF_MOD("audmac0", 502, R8A7795_CLK_S3D4), 157 DEF_MOD("audmac0", 502, R8A7795_CLK_S3D4),
@@ -148,6 +161,7 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
148 DEF_MOD("hscif2", 518, R8A7795_CLK_S3D1), 161 DEF_MOD("hscif2", 518, R8A7795_CLK_S3D1),
149 DEF_MOD("hscif1", 519, R8A7795_CLK_S3D1), 162 DEF_MOD("hscif1", 519, R8A7795_CLK_S3D1),
150 DEF_MOD("hscif0", 520, R8A7795_CLK_S3D1), 163 DEF_MOD("hscif0", 520, R8A7795_CLK_S3D1),
164 DEF_MOD("pwm", 523, R8A7795_CLK_S3D4),
151 DEF_MOD("fcpvd3", 600, R8A7795_CLK_S2D1), 165 DEF_MOD("fcpvd3", 600, R8A7795_CLK_S2D1),
152 DEF_MOD("fcpvd2", 601, R8A7795_CLK_S2D1), 166 DEF_MOD("fcpvd2", 601, R8A7795_CLK_S2D1),
153 DEF_MOD("fcpvd1", 602, R8A7795_CLK_S2D1), 167 DEF_MOD("fcpvd1", 602, R8A7795_CLK_S2D1),
@@ -578,6 +592,18 @@ struct clk * __init r8a7795_cpg_clk_register(struct device *dev,
578 case CLK_TYPE_GEN3_SD: 592 case CLK_TYPE_GEN3_SD:
579 return cpg_sd_clk_register(core, base, __clk_get_name(parent)); 593 return cpg_sd_clk_register(core, base, __clk_get_name(parent));
580 594
595 case CLK_TYPE_GEN3_R:
596 /* RINT is default. Only if EXTALR is populated, we switch to it */
597 value = readl(base + CPG_RCKCR) & 0x3f;
598
599 if (clk_get_rate(clks[CLK_EXTALR])) {
600 parent = clks[CLK_EXTALR];
601 value |= BIT(15);
602 }
603
604 writel(value, base + CPG_RCKCR);
605 break;
606
581 default: 607 default:
582 return ERR_PTR(-EINVAL); 608 return ERR_PTR(-EINVAL);
583 } 609 }
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 58e24b326a48..1f2dc3629f0e 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/clk-provider.h> 17#include <linux/clk-provider.h>
18#include <linux/clk/renesas.h>
18#include <linux/device.h> 19#include <linux/device.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/mod_devicetable.h> 21#include <linux/mod_devicetable.h>
@@ -253,7 +254,7 @@ static void __init cpg_mssr_register_core_clk(const struct cpg_core_clk *core,
253{ 254{
254 struct clk *clk = NULL, *parent; 255 struct clk *clk = NULL, *parent;
255 struct device *dev = priv->dev; 256 struct device *dev = priv->dev;
256 unsigned int id = core->id; 257 unsigned int id = core->id, div = core->div;
257 const char *parent_name; 258 const char *parent_name;
258 259
259 WARN_DEBUG(id >= priv->num_core_clks); 260 WARN_DEBUG(id >= priv->num_core_clks);
@@ -266,6 +267,7 @@ static void __init cpg_mssr_register_core_clk(const struct cpg_core_clk *core,
266 267
267 case CLK_TYPE_FF: 268 case CLK_TYPE_FF:
268 case CLK_TYPE_DIV6P1: 269 case CLK_TYPE_DIV6P1:
270 case CLK_TYPE_DIV6_RO:
269 WARN_DEBUG(core->parent >= priv->num_core_clks); 271 WARN_DEBUG(core->parent >= priv->num_core_clks);
270 parent = priv->clks[core->parent]; 272 parent = priv->clks[core->parent];
271 if (IS_ERR(parent)) { 273 if (IS_ERR(parent)) {
@@ -274,13 +276,18 @@ static void __init cpg_mssr_register_core_clk(const struct cpg_core_clk *core,
274 } 276 }
275 277
276 parent_name = __clk_get_name(parent); 278 parent_name = __clk_get_name(parent);
277 if (core->type == CLK_TYPE_FF) { 279
278 clk = clk_register_fixed_factor(NULL, core->name, 280 if (core->type == CLK_TYPE_DIV6_RO)
279 parent_name, 0, 281 /* Multiply with the DIV6 register value */
280 core->mult, core->div); 282 div *= (readl(priv->base + core->offset) & 0x3f) + 1;
281 } else { 283
284 if (core->type == CLK_TYPE_DIV6P1) {
282 clk = cpg_div6_register(core->name, 1, &parent_name, 285 clk = cpg_div6_register(core->name, 1, &parent_name,
283 priv->base + core->offset); 286 priv->base + core->offset);
287 } else {
288 clk = clk_register_fixed_factor(NULL, core->name,
289 parent_name, 0,
290 core->mult, div);
284 } 291 }
285 break; 292 break;
286 293
@@ -375,8 +382,6 @@ fail:
375 kfree(clock); 382 kfree(clock);
376} 383}
377 384
378
379#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
380struct cpg_mssr_clk_domain { 385struct cpg_mssr_clk_domain {
381 struct generic_pm_domain genpd; 386 struct generic_pm_domain genpd;
382 struct device_node *np; 387 struct device_node *np;
@@ -384,6 +389,8 @@ struct cpg_mssr_clk_domain {
384 unsigned int core_pm_clks[0]; 389 unsigned int core_pm_clks[0];
385}; 390};
386 391
392static struct cpg_mssr_clk_domain *cpg_mssr_clk_domain;
393
387static bool cpg_mssr_is_pm_clk(const struct of_phandle_args *clkspec, 394static bool cpg_mssr_is_pm_clk(const struct of_phandle_args *clkspec,
388 struct cpg_mssr_clk_domain *pd) 395 struct cpg_mssr_clk_domain *pd)
389{ 396{
@@ -407,17 +414,20 @@ static bool cpg_mssr_is_pm_clk(const struct of_phandle_args *clkspec,
407 } 414 }
408} 415}
409 416
410static int cpg_mssr_attach_dev(struct generic_pm_domain *genpd, 417int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev)
411 struct device *dev)
412{ 418{
413 struct cpg_mssr_clk_domain *pd = 419 struct cpg_mssr_clk_domain *pd = cpg_mssr_clk_domain;
414 container_of(genpd, struct cpg_mssr_clk_domain, genpd);
415 struct device_node *np = dev->of_node; 420 struct device_node *np = dev->of_node;
416 struct of_phandle_args clkspec; 421 struct of_phandle_args clkspec;
417 struct clk *clk; 422 struct clk *clk;
418 int i = 0; 423 int i = 0;
419 int error; 424 int error;
420 425
426 if (!pd) {
427 dev_dbg(dev, "CPG/MSSR clock domain not yet available\n");
428 return -EPROBE_DEFER;
429 }
430
421 while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i, 431 while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
422 &clkspec)) { 432 &clkspec)) {
423 if (cpg_mssr_is_pm_clk(&clkspec, pd)) 433 if (cpg_mssr_is_pm_clk(&clkspec, pd))
@@ -457,8 +467,7 @@ fail_put:
457 return error; 467 return error;
458} 468}
459 469
460static void cpg_mssr_detach_dev(struct generic_pm_domain *genpd, 470void cpg_mssr_detach_dev(struct generic_pm_domain *unused, struct device *dev)
461 struct device *dev)
462{ 471{
463 if (!list_empty(&dev->power.subsys_data->clock_list)) 472 if (!list_empty(&dev->power.subsys_data->clock_list))
464 pm_clk_destroy(dev); 473 pm_clk_destroy(dev);
@@ -487,19 +496,11 @@ static int __init cpg_mssr_add_clk_domain(struct device *dev,
487 pm_genpd_init(genpd, &simple_qos_governor, false); 496 pm_genpd_init(genpd, &simple_qos_governor, false);
488 genpd->attach_dev = cpg_mssr_attach_dev; 497 genpd->attach_dev = cpg_mssr_attach_dev;
489 genpd->detach_dev = cpg_mssr_detach_dev; 498 genpd->detach_dev = cpg_mssr_detach_dev;
499 cpg_mssr_clk_domain = pd;
490 500
491 of_genpd_add_provider_simple(np, genpd); 501 of_genpd_add_provider_simple(np, genpd);
492 return 0; 502 return 0;
493} 503}
494#else
495static inline int cpg_mssr_add_clk_domain(struct device *dev,
496 const unsigned int *core_pm_clks,
497 unsigned int num_core_pm_clks)
498{
499 return 0;
500}
501#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */
502
503 504
504static const struct of_device_id cpg_mssr_match[] = { 505static const struct of_device_id cpg_mssr_match[] = {
505#ifdef CONFIG_ARCH_R8A7795 506#ifdef CONFIG_ARCH_R8A7795
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.h b/drivers/clk/renesas/renesas-cpg-mssr.h
index 952b6957233b..0d1e3e811e79 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.h
+++ b/drivers/clk/renesas/renesas-cpg-mssr.h
@@ -37,6 +37,7 @@ enum clk_types {
37 CLK_TYPE_IN, /* External Clock Input */ 37 CLK_TYPE_IN, /* External Clock Input */
38 CLK_TYPE_FF, /* Fixed Factor Clock */ 38 CLK_TYPE_FF, /* Fixed Factor Clock */
39 CLK_TYPE_DIV6P1, /* DIV6 Clock with 1 parent clock */ 39 CLK_TYPE_DIV6P1, /* DIV6 Clock with 1 parent clock */
40 CLK_TYPE_DIV6_RO, /* DIV6 Clock read only with extra divisor */
40 41
41 /* Custom definitions start here */ 42 /* Custom definitions start here */
42 CLK_TYPE_CUSTOM, 43 CLK_TYPE_CUSTOM,
@@ -53,9 +54,8 @@ enum clk_types {
53 DEF_BASE(_name, _id, CLK_TYPE_FF, _parent, .div = _div, .mult = _mult) 54 DEF_BASE(_name, _id, CLK_TYPE_FF, _parent, .div = _div, .mult = _mult)
54#define DEF_DIV6P1(_name, _id, _parent, _offset) \ 55#define DEF_DIV6P1(_name, _id, _parent, _offset) \
55 DEF_BASE(_name, _id, CLK_TYPE_DIV6P1, _parent, .offset = _offset) 56 DEF_BASE(_name, _id, CLK_TYPE_DIV6P1, _parent, .offset = _offset)
56#define DEF_SD(_name, _id, _parent, _offset) \ 57#define DEF_DIV6_RO(_name, _id, _parent, _offset, _div) \
57 DEF_BASE(_name, _id, CLK_TYPE_GEN3_SD, _parent, .offset = _offset) 58 DEF_BASE(_name, _id, CLK_TYPE_DIV6_RO, _parent, .offset = _offset, .div = _div, .mult = 1)
58
59 59
60 /* 60 /*
61 * Definitions of Module Clocks 61 * Definitions of Module Clocks
diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h
index 7adfd80fbf55..ba6fa4148515 100644
--- a/include/linux/clk/renesas.h
+++ b/include/linux/clk/renesas.h
@@ -24,12 +24,20 @@ void r8a7778_clocks_init(u32 mode);
24void r8a7779_clocks_init(u32 mode); 24void r8a7779_clocks_init(u32 mode);
25void rcar_gen2_clocks_init(u32 mode); 25void rcar_gen2_clocks_init(u32 mode);
26 26
27#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
28void cpg_mstp_add_clk_domain(struct device_node *np); 27void cpg_mstp_add_clk_domain(struct device_node *np);
29int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev); 28#ifdef CONFIG_CLK_RENESAS_CPG_MSTP
30void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev); 29int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev);
30void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev);
31#else 31#else
32static inline void cpg_mstp_add_clk_domain(struct device_node *np) {} 32#define cpg_mstp_attach_dev NULL
33#define cpg_mstp_detach_dev NULL
33#endif 34#endif
34 35
36#ifdef CONFIG_CLK_RENESAS_CPG_MSSR
37int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev);
38void cpg_mssr_detach_dev(struct generic_pm_domain *unused, struct device *dev);
39#else
40#define cpg_mssr_attach_dev NULL
41#define cpg_mssr_detach_dev NULL
42#endif
35#endif 43#endif