clk: samsung: exynos850: do not define number of clocks in bindings
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 8 Aug 2023 08:27:36 +0000 (10:27 +0200)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 15 Aug 2023 05:49:43 +0000 (07:49 +0200)
Number of clocks supported by Linux drivers might vary - sometimes we
add new clocks, not exposed previously.  Therefore these numbers of
clocks should not be in the bindings, as that prevents changing them.

Define number of clocks per each clock controller inside the driver
directly.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/r/20230808082738.122804-10-krzysztof.kozlowski@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/clk/samsung/clk-exynos850.c

index 98b23af..a6b12ce 100644 (file)
 #include "clk.h"
 #include "clk-exynos-arm64.h"
 
+/* NOTE: Must be equal to the last clock ID increased by one */
+#define CLKS_NR_TOP                    (CLK_DOUT_G3D_SWITCH + 1)
+#define CLKS_NR_APM                    (CLK_GOUT_SYSREG_APM_PCLK + 1)
+#define CLKS_NR_AUD                    (CLK_GOUT_AUD_CMU_AUD_PCLK + 1)
+#define CLKS_NR_CMGP                   (CLK_GOUT_SYSREG_CMGP_PCLK + 1)
+#define CLKS_NR_G3D                    (CLK_GOUT_G3D_SYSREG_PCLK + 1)
+#define CLKS_NR_HSI                    (CLK_GOUT_HSI_CMU_HSI_PCLK + 1)
+#define CLKS_NR_IS                     (CLK_GOUT_IS_SYSREG_PCLK + 1)
+#define CLKS_NR_MFCMSCL                        (CLK_GOUT_MFCMSCL_SYSREG_PCLK + 1)
+#define CLKS_NR_PERI                   (CLK_GOUT_WDT1_PCLK + 1)
+#define CLKS_NR_CORE                   (CLK_GOUT_SYSREG_CORE_PCLK + 1)
+#define CLKS_NR_DPU                    (CLK_GOUT_DPU_SYSREG_PCLK + 1)
+
 /* ---- CMU_TOP ------------------------------------------------------------- */
 
 /* Register Offset definitions for CMU_TOP (0x120e0000) */
@@ -486,7 +499,7 @@ static const struct samsung_cmu_info top_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(top_div_clks),
        .gate_clks              = top_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(top_gate_clks),
-       .nr_clk_ids             = TOP_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_TOP,
        .clk_regs               = top_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(top_clk_regs),
 };
@@ -626,7 +639,7 @@ static const struct samsung_cmu_info apm_cmu_info __initconst = {
        .nr_gate_clks           = ARRAY_SIZE(apm_gate_clks),
        .fixed_clks             = apm_fixed_clks,
        .nr_fixed_clks          = ARRAY_SIZE(apm_fixed_clks),
-       .nr_clk_ids             = APM_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_APM,
        .clk_regs               = apm_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(apm_clk_regs),
        .clk_name               = "dout_clkcmu_apm_bus",
@@ -909,7 +922,7 @@ static const struct samsung_cmu_info aud_cmu_info __initconst = {
        .nr_gate_clks           = ARRAY_SIZE(aud_gate_clks),
        .fixed_clks             = aud_fixed_clks,
        .nr_fixed_clks          = ARRAY_SIZE(aud_fixed_clks),
-       .nr_clk_ids             = AUD_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_AUD,
        .clk_regs               = aud_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(aud_clk_regs),
        .clk_name               = "dout_aud",
@@ -1012,7 +1025,7 @@ static const struct samsung_cmu_info cmgp_cmu_info __initconst = {
        .nr_gate_clks           = ARRAY_SIZE(cmgp_gate_clks),
        .fixed_clks             = cmgp_fixed_clks,
        .nr_fixed_clks          = ARRAY_SIZE(cmgp_fixed_clks),
-       .nr_clk_ids             = CMGP_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_CMGP,
        .clk_regs               = cmgp_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(cmgp_clk_regs),
        .clk_name               = "gout_clkcmu_cmgp_bus",
@@ -1108,7 +1121,7 @@ static const struct samsung_cmu_info g3d_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(g3d_div_clks),
        .gate_clks              = g3d_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(g3d_gate_clks),
-       .nr_clk_ids             = G3D_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_G3D,
        .clk_regs               = g3d_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(g3d_clk_regs),
        .clk_name               = "dout_g3d_switch",
@@ -1210,7 +1223,7 @@ static const struct samsung_cmu_info hsi_cmu_info __initconst = {
        .nr_mux_clks            = ARRAY_SIZE(hsi_mux_clks),
        .gate_clks              = hsi_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(hsi_gate_clks),
-       .nr_clk_ids             = HSI_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_HSI,
        .clk_regs               = hsi_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(hsi_clk_regs),
        .clk_name               = "dout_hsi_bus",
@@ -1342,7 +1355,7 @@ static const struct samsung_cmu_info is_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(is_div_clks),
        .gate_clks              = is_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(is_gate_clks),
-       .nr_clk_ids             = IS_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_IS,
        .clk_regs               = is_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(is_clk_regs),
        .clk_name               = "dout_is_bus",
@@ -1451,7 +1464,7 @@ static const struct samsung_cmu_info mfcmscl_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(mfcmscl_div_clks),
        .gate_clks              = mfcmscl_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(mfcmscl_gate_clks),
-       .nr_clk_ids             = MFCMSCL_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_MFCMSCL,
        .clk_regs               = mfcmscl_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(mfcmscl_clk_regs),
        .clk_name               = "dout_mfcmscl_mfc",
@@ -1626,7 +1639,7 @@ static const struct samsung_cmu_info peri_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(peri_div_clks),
        .gate_clks              = peri_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(peri_gate_clks),
-       .nr_clk_ids             = PERI_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_PERI,
        .clk_regs               = peri_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(peri_clk_regs),
        .clk_name               = "dout_peri_bus",
@@ -1733,7 +1746,7 @@ static const struct samsung_cmu_info core_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(core_div_clks),
        .gate_clks              = core_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(core_gate_clks),
-       .nr_clk_ids             = CORE_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_CORE,
        .clk_regs               = core_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(core_clk_regs),
        .clk_name               = "dout_core_bus",
@@ -1807,7 +1820,7 @@ static const struct samsung_cmu_info dpu_cmu_info __initconst = {
        .nr_div_clks            = ARRAY_SIZE(dpu_div_clks),
        .gate_clks              = dpu_gate_clks,
        .nr_gate_clks           = ARRAY_SIZE(dpu_gate_clks),
-       .nr_clk_ids             = DPU_NR_CLK,
+       .nr_clk_ids             = CLKS_NR_DPU,
        .clk_regs               = dpu_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(dpu_clk_regs),
        .clk_name               = "dout_dpu",