|
| 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 | +}; |
0 commit comments