Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: renesas: r8a7796: Add R8A77961 CPG/MSSR support

Add support for the R-Car M3-W+ (R8A77961) SoC to the Renesas Clock
Pulse Generator / Module Standby and Software Reset driver.

R-Car M3-W+ is very similar to R-Car M3-W (R8A77960), which allows for
both SoCs to share a driver. R-Car M3-W+ lacks a few modules, so their
clocks must be nullified.

Based on a patch in the BSP by Takeshi Kihara
<takeshi.kihara.df@renesas.com>.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20191023122941.12342-5-geert+renesas@glider.be

+32 -4
+5
drivers/clk/renesas/Kconfig
··· 22 22 select CLK_R8A7794 if ARCH_R8A7794 23 23 select CLK_R8A7795 if ARCH_R8A7795 24 24 select CLK_R8A77960 if ARCH_R8A77960 || ARCH_R8A7796 25 + select CLK_R8A77961 if ARCH_R8A77961 25 26 select CLK_R8A77965 if ARCH_R8A77965 26 27 select CLK_R8A77970 if ARCH_R8A77970 27 28 select CLK_R8A77980 if ARCH_R8A77980 ··· 112 111 113 112 config CLK_R8A77960 114 113 bool "R-Car M3-W clock support" if COMPILE_TEST 114 + select CLK_RCAR_GEN3_CPG 115 + 116 + config CLK_R8A77961 117 + bool "R-Car M3-W+ clock support" if COMPILE_TEST 115 118 select CLK_RCAR_GEN3_CPG 116 119 117 120 config CLK_R8A77965
+1
drivers/clk/renesas/Makefile
··· 19 19 obj-$(CONFIG_CLK_R8A7794) += r8a7794-cpg-mssr.o 20 20 obj-$(CONFIG_CLK_R8A7795) += r8a7795-cpg-mssr.o 21 21 obj-$(CONFIG_CLK_R8A77960) += r8a7796-cpg-mssr.o 22 + obj-$(CONFIG_CLK_R8A77961) += r8a7796-cpg-mssr.o 22 23 obj-$(CONFIG_CLK_R8A77965) += r8a77965-cpg-mssr.o 23 24 obj-$(CONFIG_CLK_R8A77970) += r8a77970-cpg-mssr.o 24 25 obj-$(CONFIG_CLK_R8A77980) += r8a77980-cpg-mssr.o
+20 -4
drivers/clk/renesas/r8a7796-cpg-mssr.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * r8a7796 Clock Pulse Generator / Module Standby and Software Reset 3 + * r8a7796 (R-Car M3-W/W+) Clock Pulse Generator / Module Standby and Software 4 + * Reset 4 5 * 5 - * Copyright (C) 2016 Glider bvba 6 - * Copyright (C) 2018 Renesas Electronics Corp. 6 + * Copyright (C) 2016-2019 Glider bvba 7 + * Copyright (C) 2018-2019 Renesas Electronics Corp. 7 8 * 8 9 * Based on r8a7795-cpg-mssr.c 9 10 * ··· 15 14 #include <linux/device.h> 16 15 #include <linux/init.h> 17 16 #include <linux/kernel.h> 17 + #include <linux/of.h> 18 18 #include <linux/soc/renesas/rcar-rst.h> 19 19 20 20 #include <dt-bindings/clock/r8a7796-cpg-mssr.h> ··· 118 116 DEF_BASE("r", R8A7796_CLK_R, CLK_TYPE_GEN3_R, CLK_RINT), 119 117 }; 120 118 121 - static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = { 119 + static struct mssr_mod_clk r8a7796_mod_clks[] __initdata = { 122 120 DEF_MOD("fdp1-0", 119, R8A7796_CLK_S0D1), 123 121 DEF_MOD("scif5", 202, R8A7796_CLK_S3D4), 124 122 DEF_MOD("scif4", 203, R8A7796_CLK_S3D4), ··· 306 304 { 2, 192, 1, 192, 1, 32, }, 307 305 }; 308 306 307 + /* 308 + * Fixups for R-Car M3-W+ 309 + */ 310 + 311 + static const unsigned int r8a77961_mod_nullify[] __initconst = { 312 + MOD_CLK_ID(617), /* FCPCI0 */ 313 + }; 314 + 309 315 static int __init r8a7796_cpg_mssr_init(struct device *dev) 310 316 { 311 317 const struct rcar_gen3_cpg_pll_config *cpg_pll_config; ··· 329 319 dev_err(dev, "Prohibited setting (cpg_mode=0x%x)\n", cpg_mode); 330 320 return -EINVAL; 331 321 } 322 + 323 + if (of_device_is_compatible(dev->of_node, "renesas,r8a77961-cpg-mssr")) 324 + mssr_mod_nullify(r8a7796_mod_clks, 325 + ARRAY_SIZE(r8a7796_mod_clks), 326 + r8a77961_mod_nullify, 327 + ARRAY_SIZE(r8a77961_mod_nullify)); 332 328 333 329 return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode); 334 330 }
+6
drivers/clk/renesas/renesas-cpg-mssr.c
··· 755 755 .data = &r8a7796_cpg_mssr_info, 756 756 }, 757 757 #endif 758 + #ifdef CONFIG_CLK_R8A77961 759 + { 760 + .compatible = "renesas,r8a77961-cpg-mssr", 761 + .data = &r8a7796_cpg_mssr_info, 762 + }, 763 + #endif 758 764 #ifdef CONFIG_CLK_R8A77965 759 765 { 760 766 .compatible = "renesas,r8a77965-cpg-mssr",