Skip to content

Commit 59636ec

Browse files
Shin Sonkrzk
authored andcommitted
clk: samsung: exynosautov920: add cpucl0 clock support
Register compatible and cmu_info data to support clock CPUCL0(CPU Cluster 0), this provides clock for CPUCL0_SWTICH/DBG/CLUSTER. These clocks are required early during boot for the CPUs, so they are declared using CLK_OF_DECLARE instead of being registered through a platform driver. Signed-off-by: Shin Son <shin.son@samsung.com> Link: https://lore.kernel.org/r/20250423044153.1288077-3-shin.son@samsung.com Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent ab525e7 commit 59636ec

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

drivers/clk/samsung/clk-exynosautov920.c

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
/* NOTE: Must be equal to the last clock ID increased by one */
2020
#define CLKS_NR_TOP (DOUT_CLKCMU_TAA_NOC + 1)
21+
#define CLKS_NR_CPUCL0 (CLK_DOUT_CLUSTER0_PERIPHCLK + 1)
2122
#define CLKS_NR_PERIC0 (CLK_DOUT_PERIC0_I3C + 1)
2223
#define CLKS_NR_PERIC1 (CLK_DOUT_PERIC1_I3C + 1)
2324
#define CLKS_NR_MISC (CLK_DOUT_MISC_OSC_DIV2 + 1)
@@ -1005,6 +1006,135 @@ static void __init exynosautov920_cmu_top_init(struct device_node *np)
10051006
CLK_OF_DECLARE(exynosautov920_cmu_top, "samsung,exynosautov920-cmu-top",
10061007
exynosautov920_cmu_top_init);
10071008

1009+
/* ---- CMU_CPUCL0 --------------------------------------------------------- */
1010+
1011+
/* Register Offset definitions for CMU_CPUCL0 (0x1EC00000) */
1012+
#define PLL_LOCKTIME_PLL_CPUCL0 0x0000
1013+
#define PLL_CON0_PLL_CPUCL0 0x0100
1014+
#define PLL_CON1_PLL_CPUCL0 0x0104
1015+
#define PLL_CON3_PLL_CPUCL0 0x010c
1016+
#define PLL_CON0_MUX_CLKCMU_CPUCL0_CLUSTER_USER 0x0600
1017+
#define PLL_CON0_MUX_CLKCMU_CPUCL0_DBG_USER 0x0610
1018+
#define PLL_CON0_MUX_CLKCMU_CPUCL0_SWITCH_USER 0x0620
1019+
1020+
#define CLK_CON_MUX_MUX_CLK_CPUCL0_CLUSTER 0x1000
1021+
#define CLK_CON_MUX_MUX_CLK_CPUCL0_CORE 0x1004
1022+
1023+
#define CLK_CON_DIV_DIV_CLK_CLUSTER0_ACLK 0x1800
1024+
#define CLK_CON_DIV_DIV_CLK_CLUSTER0_ATCLK 0x1804
1025+
#define CLK_CON_DIV_DIV_CLK_CLUSTER0_MPCLK 0x1808
1026+
#define CLK_CON_DIV_DIV_CLK_CLUSTER0_PCLK 0x180c
1027+
#define CLK_CON_DIV_DIV_CLK_CLUSTER0_PERIPHCLK 0x1810
1028+
#define CLK_CON_DIV_DIV_CLK_CPUCL0_DBG_NOC 0x181c
1029+
#define CLK_CON_DIV_DIV_CLK_CPUCL0_DBG_PCLKDBG 0x1820
1030+
#define CLK_CON_DIV_DIV_CLK_CPUCL0_NOCP 0x1824
1031+
1032+
static const unsigned long cpucl0_clk_regs[] __initconst = {
1033+
PLL_LOCKTIME_PLL_CPUCL0,
1034+
PLL_CON0_PLL_CPUCL0,
1035+
PLL_CON1_PLL_CPUCL0,
1036+
PLL_CON3_PLL_CPUCL0,
1037+
PLL_CON0_MUX_CLKCMU_CPUCL0_CLUSTER_USER,
1038+
PLL_CON0_MUX_CLKCMU_CPUCL0_DBG_USER,
1039+
PLL_CON0_MUX_CLKCMU_CPUCL0_SWITCH_USER,
1040+
CLK_CON_MUX_MUX_CLK_CPUCL0_CLUSTER,
1041+
CLK_CON_MUX_MUX_CLK_CPUCL0_CORE,
1042+
CLK_CON_DIV_DIV_CLK_CLUSTER0_ACLK,
1043+
CLK_CON_DIV_DIV_CLK_CLUSTER0_ATCLK,
1044+
CLK_CON_DIV_DIV_CLK_CLUSTER0_MPCLK,
1045+
CLK_CON_DIV_DIV_CLK_CLUSTER0_PCLK,
1046+
CLK_CON_DIV_DIV_CLK_CLUSTER0_PERIPHCLK,
1047+
CLK_CON_DIV_DIV_CLK_CPUCL0_DBG_NOC,
1048+
CLK_CON_DIV_DIV_CLK_CPUCL0_DBG_PCLKDBG,
1049+
CLK_CON_DIV_DIV_CLK_CPUCL0_NOCP,
1050+
};
1051+
1052+
/* List of parent clocks for Muxes in CMU_CPUCL0 */
1053+
PNAME(mout_pll_cpucl0_p) = { "oscclk", "fout_cpucl0_pll" };
1054+
PNAME(mout_cpucl0_cluster_user_p) = { "oscclk", "dout_clkcmu_cpucl0_cluster" };
1055+
PNAME(mout_cpucl0_dbg_user_p) = { "oscclk", "dout_clkcmu_cpucl0_dbg" };
1056+
PNAME(mout_cpucl0_switch_user_p) = { "oscclk", "dout_clkcmu_cpucl0_switch" };
1057+
PNAME(mout_cpucl0_cluster_p) = { "oscclk", "mout_cpucl0_cluster_user",
1058+
"mout_cpucl0_switch_user"};
1059+
PNAME(mout_cpucl0_core_p) = { "oscclk", "mout_pll_cpucl0",
1060+
"mout_cpucl0_switch_user"};
1061+
1062+
static const struct samsung_pll_rate_table cpu_pll_rates[] __initconst = {
1063+
PLL_35XX_RATE(38400000U, 2400000000U, 250, 4, 0),
1064+
PLL_35XX_RATE(38400000U, 2304000000U, 240, 4, 0),
1065+
PLL_35XX_RATE(38400000U, 2208000000U, 230, 4, 0),
1066+
PLL_35XX_RATE(38400000U, 2112000000U, 220, 4, 0),
1067+
PLL_35XX_RATE(38400000U, 2016000000U, 210, 4, 0),
1068+
PLL_35XX_RATE(38400000U, 1824000000U, 190, 4, 0),
1069+
PLL_35XX_RATE(38400000U, 1680000000U, 175, 4, 0),
1070+
PLL_35XX_RATE(38400000U, 1344000000U, 140, 4, 0),
1071+
PLL_35XX_RATE(38400000U, 1152000000U, 120, 4, 0),
1072+
PLL_35XX_RATE(38400000U, 576000000U, 120, 4, 1),
1073+
PLL_35XX_RATE(38400000U, 288000000U, 120, 4, 2),
1074+
};
1075+
1076+
static const struct samsung_pll_clock cpucl0_pll_clks[] __initconst = {
1077+
/* CMU_CPUCL0_PURECLKCOMP */
1078+
PLL(pll_531x, CLK_FOUT_CPUCL0_PLL, "fout_cpucl0_pll", "oscclk",
1079+
PLL_LOCKTIME_PLL_CPUCL0, PLL_CON3_PLL_CPUCL0, cpu_pll_rates),
1080+
};
1081+
1082+
static const struct samsung_mux_clock cpucl0_mux_clks[] __initconst = {
1083+
MUX(CLK_MOUT_PLL_CPUCL0, "mout_pll_cpucl0", mout_pll_cpucl0_p,
1084+
PLL_CON0_PLL_CPUCL0, 4, 1),
1085+
MUX(CLK_MOUT_CPUCL0_CLUSTER_USER, "mout_cpucl0_cluster_user", mout_cpucl0_cluster_user_p,
1086+
PLL_CON0_MUX_CLKCMU_CPUCL0_CLUSTER_USER, 4, 1),
1087+
MUX(CLK_MOUT_CPUCL0_DBG_USER, "mout_cpucl0_dbg_user", mout_cpucl0_dbg_user_p,
1088+
PLL_CON0_MUX_CLKCMU_CPUCL0_DBG_USER, 4, 1),
1089+
MUX(CLK_MOUT_CPUCL0_SWITCH_USER, "mout_cpucl0_switch_user", mout_cpucl0_switch_user_p,
1090+
PLL_CON0_MUX_CLKCMU_CPUCL0_SWITCH_USER, 4, 1),
1091+
MUX(CLK_MOUT_CPUCL0_CLUSTER, "mout_cpucl0_cluster", mout_cpucl0_cluster_p,
1092+
CLK_CON_MUX_MUX_CLK_CPUCL0_CLUSTER, 0, 2),
1093+
MUX(CLK_MOUT_CPUCL0_CORE, "mout_cpucl0_core", mout_cpucl0_core_p,
1094+
CLK_CON_MUX_MUX_CLK_CPUCL0_CORE, 0, 2),
1095+
};
1096+
1097+
static const struct samsung_div_clock cpucl0_div_clks[] __initconst = {
1098+
DIV(CLK_DOUT_CLUSTER0_ACLK, "dout_cluster0_aclk",
1099+
"mout_cpucl0_cluster", CLK_CON_DIV_DIV_CLK_CLUSTER0_ACLK, 0, 4),
1100+
DIV(CLK_DOUT_CLUSTER0_ATCLK, "dout_cluster0_atclk",
1101+
"mout_cpucl0_cluster", CLK_CON_DIV_DIV_CLK_CLUSTER0_ATCLK, 0, 4),
1102+
DIV(CLK_DOUT_CLUSTER0_MPCLK, "dout_cluster0_mpclk",
1103+
"mout_cpucl0_cluster", CLK_CON_DIV_DIV_CLK_CLUSTER0_MPCLK, 0, 4),
1104+
DIV(CLK_DOUT_CLUSTER0_PCLK, "dout_cluster0_pclk",
1105+
"mout_cpucl0_cluster", CLK_CON_DIV_DIV_CLK_CLUSTER0_PCLK, 0, 4),
1106+
DIV(CLK_DOUT_CLUSTER0_PERIPHCLK, "dout_cluster0_periphclk",
1107+
"mout_cpucl0_cluster", CLK_CON_DIV_DIV_CLK_CLUSTER0_PERIPHCLK, 0, 4),
1108+
DIV(CLK_DOUT_CPUCL0_DBG_NOC, "dout_cpucl0_dbg_noc",
1109+
"mout_cpucl0_dbg_user", CLK_CON_DIV_DIV_CLK_CPUCL0_DBG_NOC, 0, 3),
1110+
DIV(CLK_DOUT_CPUCL0_DBG_PCLKDBG, "dout_cpucl0_dbg_pclkdbg",
1111+
"mout_cpucl0_dbg_user", CLK_CON_DIV_DIV_CLK_CPUCL0_DBG_PCLKDBG, 0, 3),
1112+
DIV(CLK_DOUT_CPUCL0_NOCP, "dout_cpucl0_nocp",
1113+
"mout_cpucl0_cluster", CLK_CON_DIV_DIV_CLK_CPUCL0_NOCP, 0, 4),
1114+
};
1115+
1116+
static const struct samsung_cmu_info cpucl0_cmu_info __initconst = {
1117+
.pll_clks = cpucl0_pll_clks,
1118+
.nr_pll_clks = ARRAY_SIZE(cpucl0_pll_clks),
1119+
.mux_clks = cpucl0_mux_clks,
1120+
.nr_mux_clks = ARRAY_SIZE(cpucl0_mux_clks),
1121+
.div_clks = cpucl0_div_clks,
1122+
.nr_div_clks = ARRAY_SIZE(cpucl0_div_clks),
1123+
.nr_clk_ids = CLKS_NR_CPUCL0,
1124+
.clk_regs = cpucl0_clk_regs,
1125+
.nr_clk_regs = ARRAY_SIZE(cpucl0_clk_regs),
1126+
.clk_name = "cpucl0",
1127+
};
1128+
1129+
static void __init exynosautov920_cmu_cpucl0_init(struct device_node *np)
1130+
{
1131+
exynos_arm64_register_cmu(NULL, np, &cpucl0_cmu_info);
1132+
}
1133+
1134+
/* Register CMU_CPUCL0 early, as CPU clocks should be available ASAP */
1135+
CLK_OF_DECLARE(exynosautov920_cmu_cpucl0, "samsung,exynosautov920-cmu-cpucl0",
1136+
exynosautov920_cmu_cpucl0_init);
1137+
10081138
/* ---- CMU_PERIC0 --------------------------------------------------------- */
10091139

10101140
/* Register Offset definitions for CMU_PERIC0 (0x10800000) */

0 commit comments

Comments
 (0)