Skip to content

Commit 17f7dc4

Browse files
cometzeroSylwester Nawrocki
authored andcommitted
clk: samsung: exynosautov9: add cmu_core clock support
Add CMU_CORE clock which represents Core BUS clocks. The source clocks of this CMU block are oscclk or dout_clkcmu_core_bus. Thus, two source clocks should be provided via device tree. All the gate clocks are defined as CLK_IS_CRITICAL because they control(gate/ungate) core bus clocks but not been assigned to any drivers. Signed-off-by: Chanho Park <chanho61.park@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Link: https://lore.kernel.org/r/20220504075154.58819-5-chanho61.park@samsung.com
1 parent 6587c62 commit 17f7dc4

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

drivers/clk/samsung/clk-exynosautov9.c

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,3 +956,95 @@ static void __init exynosautov9_cmu_top_init(struct device_node *np)
956956
/* Register CMU_TOP early, as it's a dependency for other early domains */
957957
CLK_OF_DECLARE(exynosautov9_cmu_top, "samsung,exynosautov9-cmu-top",
958958
exynosautov9_cmu_top_init);
959+
960+
/* ---- CMU_CORE ----------------------------------------------------------- */
961+
962+
/* Register Offset definitions for CMU_CORE (0x1b030000) */
963+
#define PLL_CON0_MUX_CLKCMU_CORE_BUS_USER 0x0600
964+
#define CLK_CON_MUX_MUX_CORE_CMUREF 0x1000
965+
#define CLK_CON_DIV_DIV_CLK_CORE_BUSP 0x1800
966+
#define CLK_CON_GAT_CLK_BLK_CORE_UID_CCI_IPCLKPORT_CLK 0x2000
967+
#define CLK_CON_GAT_CLK_BLK_CORE_UID_CCI_IPCLKPORT_PCLK 0x2004
968+
#define CLK_CON_GAT_CLK_BLK_CORE_UID_CORE_CMU_CORE_IPCLKPORT_PCLK 0x2008
969+
970+
static const unsigned long core_clk_regs[] __initconst = {
971+
PLL_CON0_MUX_CLKCMU_CORE_BUS_USER,
972+
CLK_CON_MUX_MUX_CORE_CMUREF,
973+
CLK_CON_DIV_DIV_CLK_CORE_BUSP,
974+
CLK_CON_GAT_CLK_BLK_CORE_UID_CCI_IPCLKPORT_CLK,
975+
CLK_CON_GAT_CLK_BLK_CORE_UID_CCI_IPCLKPORT_PCLK,
976+
CLK_CON_GAT_CLK_BLK_CORE_UID_CORE_CMU_CORE_IPCLKPORT_PCLK,
977+
};
978+
979+
/* List of parent clocks for Muxes in CMU_CORE */
980+
PNAME(mout_core_bus_user_p) = { "oscclk", "dout_clkcmu_core_bus" };
981+
982+
static const struct samsung_mux_clock core_mux_clks[] __initconst = {
983+
MUX(CLK_MOUT_CORE_BUS_USER, "mout_core_bus_user", mout_core_bus_user_p,
984+
PLL_CON0_MUX_CLKCMU_CORE_BUS_USER, 4, 1),
985+
};
986+
987+
static const struct samsung_div_clock core_div_clks[] __initconst = {
988+
DIV(CLK_DOUT_CORE_BUSP, "dout_core_busp", "mout_core_bus_user",
989+
CLK_CON_DIV_DIV_CLK_CORE_BUSP, 0, 3),
990+
};
991+
992+
static const struct samsung_gate_clock core_gate_clks[] __initconst = {
993+
GATE(CLK_GOUT_CORE_CCI_CLK, "gout_core_cci_clk", "mout_core_bus_user",
994+
CLK_CON_GAT_CLK_BLK_CORE_UID_CCI_IPCLKPORT_CLK, 21,
995+
CLK_IS_CRITICAL, 0),
996+
GATE(CLK_GOUT_CORE_CCI_PCLK, "gout_core_cci_pclk", "dout_core_busp",
997+
CLK_CON_GAT_CLK_BLK_CORE_UID_CCI_IPCLKPORT_PCLK, 21,
998+
CLK_IS_CRITICAL, 0),
999+
GATE(CLK_GOUT_CORE_CMU_CORE_PCLK, "gout_core_cmu_core_pclk",
1000+
"dout_core_busp",
1001+
CLK_CON_GAT_CLK_BLK_CORE_UID_CORE_CMU_CORE_IPCLKPORT_PCLK, 21,
1002+
CLK_IS_CRITICAL, 0),
1003+
};
1004+
1005+
static const struct samsung_cmu_info core_cmu_info __initconst = {
1006+
.mux_clks = core_mux_clks,
1007+
.nr_mux_clks = ARRAY_SIZE(core_mux_clks),
1008+
.div_clks = core_div_clks,
1009+
.nr_div_clks = ARRAY_SIZE(core_div_clks),
1010+
.gate_clks = core_gate_clks,
1011+
.nr_gate_clks = ARRAY_SIZE(core_gate_clks),
1012+
.nr_clk_ids = CORE_NR_CLK,
1013+
.clk_regs = core_clk_regs,
1014+
.nr_clk_regs = ARRAY_SIZE(core_clk_regs),
1015+
.clk_name = "dout_clkcmu_core_bus",
1016+
};
1017+
1018+
static int __init exynosautov9_cmu_probe(struct platform_device *pdev)
1019+
{
1020+
const struct samsung_cmu_info *info;
1021+
struct device *dev = &pdev->dev;
1022+
1023+
info = of_device_get_match_data(dev);
1024+
exynos_arm64_register_cmu(dev, dev->of_node, info);
1025+
1026+
return 0;
1027+
}
1028+
1029+
static const struct of_device_id exynosautov9_cmu_of_match[] = {
1030+
{
1031+
.compatible = "samsung,exynosautov9-cmu-core",
1032+
.data = &core_cmu_info,
1033+
}, {
1034+
},
1035+
};
1036+
1037+
static struct platform_driver exynosautov9_cmu_driver __refdata = {
1038+
.driver = {
1039+
.name = "exynosautov9-cmu",
1040+
.of_match_table = exynosautov9_cmu_of_match,
1041+
.suppress_bind_attrs = true,
1042+
},
1043+
.probe = exynosautov9_cmu_probe,
1044+
};
1045+
1046+
static int __init exynosautov9_cmu_init(void)
1047+
{
1048+
return platform_driver_register(&exynosautov9_cmu_driver);
1049+
}
1050+
core_initcall(exynosautov9_cmu_init);

0 commit comments

Comments
 (0)