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

clk: renesas: Add RZ/V2H(P) CPG driver

Add RZ/V2H(P) CPG driver.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240729202645.263525-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

authored by

Lad Prabhakar and committed by
Geert Uytterhoeven
36932cbc dd22e562

+94
+5
drivers/clk/renesas/Kconfig
··· 40 40 select CLK_R9A07G054 if ARCH_R9A07G054 41 41 select CLK_R9A08G045 if ARCH_R9A08G045 42 42 select CLK_R9A09G011 if ARCH_R9A09G011 43 + select CLK_R9A09G057 if ARCH_R9A09G057 43 44 select CLK_SH73A0 if ARCH_SH73A0 44 45 45 46 if CLK_RENESAS ··· 193 192 config CLK_R9A09G011 194 193 bool "RZ/V2M clock support" if COMPILE_TEST 195 194 select CLK_RZG2L 195 + 196 + config CLK_R9A09G057 197 + bool "RZ/V2H(P) clock support" if COMPILE_TEST 198 + select CLK_RZV2H 196 199 197 200 config CLK_SH73A0 198 201 bool "SH-Mobile AG5 clock support" if COMPILE_TEST
+1
drivers/clk/renesas/Makefile
··· 37 37 obj-$(CONFIG_CLK_R9A07G054) += r9a07g044-cpg.o 38 38 obj-$(CONFIG_CLK_R9A08G045) += r9a08g045-cpg.o 39 39 obj-$(CONFIG_CLK_R9A09G011) += r9a09g011-cpg.o 40 + obj-$(CONFIG_CLK_R9A09G057) += r9a09g057-cpg.o 40 41 obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o 41 42 42 43 # Family
+80
drivers/clk/renesas/r9a09g057-cpg.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Renesas RZ/V2H(P) CPG driver 4 + * 5 + * Copyright (C) 2024 Renesas Electronics Corp. 6 + */ 7 + 8 + #include <linux/clk-provider.h> 9 + #include <linux/device.h> 10 + #include <linux/init.h> 11 + #include <linux/kernel.h> 12 + 13 + #include <dt-bindings/clock/renesas,r9a09g057-cpg.h> 14 + 15 + #include "rzv2h-cpg.h" 16 + 17 + enum clk_ids { 18 + /* Core Clock Outputs exported to DT */ 19 + LAST_DT_CORE_CLK = R9A09G057_IOTOP_0_SHCLK, 20 + 21 + /* External Input Clocks */ 22 + CLK_AUDIO_EXTAL, 23 + CLK_RTXIN, 24 + CLK_QEXTAL, 25 + 26 + /* PLL Clocks */ 27 + CLK_PLLCM33, 28 + CLK_PLLDTY, 29 + CLK_PLLCA55, 30 + 31 + /* Internal Core Clocks */ 32 + CLK_PLLCM33_DIV16, 33 + 34 + /* Module Clocks */ 35 + MOD_CLK_BASE, 36 + }; 37 + 38 + static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = { 39 + /* External Clock Inputs */ 40 + DEF_INPUT("audio_extal", CLK_AUDIO_EXTAL), 41 + DEF_INPUT("rtxin", CLK_RTXIN), 42 + DEF_INPUT("qextal", CLK_QEXTAL), 43 + 44 + /* PLL Clocks */ 45 + DEF_FIXED(".pllcm33", CLK_PLLCM33, CLK_QEXTAL, 200, 3), 46 + DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3), 47 + DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLL_CONF(0x64)), 48 + 49 + /* Internal Core Clocks */ 50 + DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16), 51 + 52 + /* Core Clocks */ 53 + DEF_FIXED("sys_0_pclk", R9A09G057_SYS_0_PCLK, CLK_QEXTAL, 1, 1), 54 + DEF_FIXED("iotop_0_shclk", R9A09G057_IOTOP_0_SHCLK, CLK_PLLCM33_DIV16, 1, 1), 55 + }; 56 + 57 + static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { 58 + DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15), 59 + }; 60 + 61 + static const struct rzv2h_reset r9a09g057_resets[] __initconst = { 62 + DEF_RST(9, 5, 4, 6), /* SCIF_0_RST_SYSTEM_N */ 63 + }; 64 + 65 + const struct rzv2h_cpg_info r9a09g057_cpg_info __initconst = { 66 + /* Core Clocks */ 67 + .core_clks = r9a09g057_core_clks, 68 + .num_core_clks = ARRAY_SIZE(r9a09g057_core_clks), 69 + .last_dt_core_clk = LAST_DT_CORE_CLK, 70 + .num_total_core_clks = MOD_CLK_BASE, 71 + 72 + /* Module Clocks */ 73 + .mod_clks = r9a09g057_mod_clks, 74 + .num_mod_clks = ARRAY_SIZE(r9a09g057_mod_clks), 75 + .num_hw_mod_clks = 25 * 16, 76 + 77 + /* Resets */ 78 + .resets = r9a09g057_resets, 79 + .num_resets = ARRAY_SIZE(r9a09g057_resets), 80 + };
+6
drivers/clk/renesas/rzv2h-cpg.c
··· 664 664 } 665 665 666 666 static const struct of_device_id rzv2h_cpg_match[] = { 667 + #ifdef CONFIG_CLK_R9A09G057 668 + { 669 + .compatible = "renesas,r9a09g057-cpg", 670 + .data = &r9a09g057_cpg_info, 671 + }, 672 + #endif 667 673 { /* sentinel */ } 668 674 }; 669 675
+2
drivers/clk/renesas/rzv2h-cpg.h
··· 146 146 unsigned int num_resets; 147 147 }; 148 148 149 + extern const struct rzv2h_cpg_info r9a09g057_cpg_info; 150 + 149 151 #endif /* __RENESAS_RZV2H_CPG_H__ */