Skip to content

Commit 6a44298

Browse files
committed
clk: samsung: exynos5433: do not define number of clocks in bindings
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: Alim Akhtar <alim.akhtar@samsung.com> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Link: https://lore.kernel.org/r/20230808082738.122804-8-krzysztof.kozlowski@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent 62eef44 commit 6a44298

File tree

1 file changed

+44
-21
lines changed

1 file changed

+44
-21
lines changed

drivers/clk/samsung/clk-exynos5433.c

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@
2121
#include "clk-exynos-arm64.h"
2222
#include "clk-pll.h"
2323

24+
/* NOTE: Must be equal to the last clock ID increased by one */
25+
#define CLKS_NR_TOP (CLK_SCLK_HDMI_SPDIF_DISP + 1)
26+
#define CLKS_NR_CPIF (CLK_SCLK_UFS_MPHY + 1)
27+
#define CLKS_NR_MIF (CLK_SCLK_BUS_PLL_ATLAS + 1)
28+
#define CLKS_NR_PERIC (CLK_DIV_SCLK_SC_IN + 1)
29+
#define CLKS_NR_PERIS (CLK_SCLK_OTP_CON + 1)
30+
#define CLKS_NR_FSYS (CLK_PCIE + 1)
31+
#define CLKS_NR_G2D (CLK_PCLK_SMMU_G2D + 1)
32+
#define CLKS_NR_DISP (CLK_PHYCLK_MIPIDPHY0_RXCLKESC0_PHY + 1)
33+
#define CLKS_NR_AUD (CLK_SCLK_AUD_I2S + 1)
34+
#define CLKS_NR_BUSX (CLK_ACLK_BUS2RTND_400 + 1)
35+
#define CLKS_NR_G3D (CLK_SCLK_HPM_G3D + 1)
36+
#define CLKS_NR_GSCL (CLK_PCLK_SMMU_GSCL2 + 1)
37+
#define CLKS_NR_APOLLO (CLK_SCLK_APOLLO + 1)
38+
#define CLKS_NR_ATLAS (CLK_SCLK_ATLAS + 1)
39+
#define CLKS_NR_MSCL (CLK_SCLK_JPEG + 1)
40+
#define CLKS_NR_MFC (CLK_PCLK_SMMU_MFC_0 + 1)
41+
#define CLKS_NR_HEVC (CLK_PCLK_SMMU_HEVC_0 + 1)
42+
#define CLKS_NR_ISP (CLK_SCLK_PIXELASYNCM_ISPC + 1)
43+
#define CLKS_NR_CAM0 (CLK_SCLK_PIXELASYNCS_LITE_C_INIT + 1)
44+
#define CLKS_NR_CAM1 (CLK_SCLK_ISP_CA5 + 1)
45+
#define CLKS_NR_IMEM (CLK_PCLK_SLIMSSS + 1)
46+
2447
/*
2548
* Register offset definitions for CMU_TOP
2649
*/
@@ -798,7 +821,7 @@ static const struct samsung_cmu_info top_cmu_info __initconst = {
798821
.nr_fixed_clks = ARRAY_SIZE(top_fixed_clks),
799822
.fixed_factor_clks = top_fixed_factor_clks,
800823
.nr_fixed_factor_clks = ARRAY_SIZE(top_fixed_factor_clks),
801-
.nr_clk_ids = TOP_NR_CLK,
824+
.nr_clk_ids = CLKS_NR_TOP,
802825
.clk_regs = top_clk_regs,
803826
.nr_clk_regs = ARRAY_SIZE(top_clk_regs),
804827
.suspend_regs = top_suspend_regs,
@@ -877,7 +900,7 @@ static const struct samsung_cmu_info cpif_cmu_info __initconst = {
877900
.nr_div_clks = ARRAY_SIZE(cpif_div_clks),
878901
.gate_clks = cpif_gate_clks,
879902
.nr_gate_clks = ARRAY_SIZE(cpif_gate_clks),
880-
.nr_clk_ids = CPIF_NR_CLK,
903+
.nr_clk_ids = CLKS_NR_CPIF,
881904
.clk_regs = cpif_clk_regs,
882905
.nr_clk_regs = ARRAY_SIZE(cpif_clk_regs),
883906
.suspend_regs = cpif_suspend_regs,
@@ -1531,7 +1554,7 @@ static const struct samsung_cmu_info mif_cmu_info __initconst = {
15311554
.nr_gate_clks = ARRAY_SIZE(mif_gate_clks),
15321555
.fixed_factor_clks = mif_fixed_factor_clks,
15331556
.nr_fixed_factor_clks = ARRAY_SIZE(mif_fixed_factor_clks),
1534-
.nr_clk_ids = MIF_NR_CLK,
1557+
.nr_clk_ids = CLKS_NR_MIF,
15351558
.clk_regs = mif_clk_regs,
15361559
.nr_clk_regs = ARRAY_SIZE(mif_clk_regs),
15371560
};
@@ -1730,7 +1753,7 @@ static const struct samsung_cmu_info peric_cmu_info __initconst = {
17301753
.nr_div_clks = ARRAY_SIZE(peric_div_clks),
17311754
.gate_clks = peric_gate_clks,
17321755
.nr_gate_clks = ARRAY_SIZE(peric_gate_clks),
1733-
.nr_clk_ids = PERIC_NR_CLK,
1756+
.nr_clk_ids = CLKS_NR_PERIC,
17341757
.clk_regs = peric_clk_regs,
17351758
.nr_clk_regs = ARRAY_SIZE(peric_clk_regs),
17361759
.suspend_regs = peric_suspend_regs,
@@ -1924,7 +1947,7 @@ static const struct samsung_gate_clock peris_gate_clks[] __initconst = {
19241947
static const struct samsung_cmu_info peris_cmu_info __initconst = {
19251948
.gate_clks = peris_gate_clks,
19261949
.nr_gate_clks = ARRAY_SIZE(peris_gate_clks),
1927-
.nr_clk_ids = PERIS_NR_CLK,
1950+
.nr_clk_ids = CLKS_NR_PERIS,
19281951
.clk_regs = peris_clk_regs,
19291952
.nr_clk_regs = ARRAY_SIZE(peris_clk_regs),
19301953
};
@@ -2336,7 +2359,7 @@ static const struct samsung_cmu_info fsys_cmu_info __initconst = {
23362359
.nr_gate_clks = ARRAY_SIZE(fsys_gate_clks),
23372360
.fixed_clks = fsys_fixed_clks,
23382361
.nr_fixed_clks = ARRAY_SIZE(fsys_fixed_clks),
2339-
.nr_clk_ids = FSYS_NR_CLK,
2362+
.nr_clk_ids = CLKS_NR_FSYS,
23402363
.clk_regs = fsys_clk_regs,
23412364
.nr_clk_regs = ARRAY_SIZE(fsys_clk_regs),
23422365
.suspend_regs = fsys_suspend_regs,
@@ -2459,7 +2482,7 @@ static const struct samsung_cmu_info g2d_cmu_info __initconst = {
24592482
.nr_div_clks = ARRAY_SIZE(g2d_div_clks),
24602483
.gate_clks = g2d_gate_clks,
24612484
.nr_gate_clks = ARRAY_SIZE(g2d_gate_clks),
2462-
.nr_clk_ids = G2D_NR_CLK,
2485+
.nr_clk_ids = CLKS_NR_G2D,
24632486
.clk_regs = g2d_clk_regs,
24642487
.nr_clk_regs = ARRAY_SIZE(g2d_clk_regs),
24652488
.suspend_regs = g2d_suspend_regs,
@@ -2887,7 +2910,7 @@ static const struct samsung_cmu_info disp_cmu_info __initconst = {
28872910
.nr_fixed_clks = ARRAY_SIZE(disp_fixed_clks),
28882911
.fixed_factor_clks = disp_fixed_factor_clks,
28892912
.nr_fixed_factor_clks = ARRAY_SIZE(disp_fixed_factor_clks),
2890-
.nr_clk_ids = DISP_NR_CLK,
2913+
.nr_clk_ids = CLKS_NR_DISP,
28912914
.clk_regs = disp_clk_regs,
28922915
.nr_clk_regs = ARRAY_SIZE(disp_clk_regs),
28932916
.suspend_regs = disp_suspend_regs,
@@ -3057,7 +3080,7 @@ static const struct samsung_cmu_info aud_cmu_info __initconst = {
30573080
.nr_gate_clks = ARRAY_SIZE(aud_gate_clks),
30583081
.fixed_clks = aud_fixed_clks,
30593082
.nr_fixed_clks = ARRAY_SIZE(aud_fixed_clks),
3060-
.nr_clk_ids = AUD_NR_CLK,
3083+
.nr_clk_ids = CLKS_NR_AUD,
30613084
.clk_regs = aud_clk_regs,
30623085
.nr_clk_regs = ARRAY_SIZE(aud_clk_regs),
30633086
.suspend_regs = aud_suspend_regs,
@@ -3189,7 +3212,7 @@ static const struct samsung_gate_clock bus2_gate_clks[] __initconst = {
31893212
.nr_div_clks = ARRAY_SIZE(bus##id##_div_clks), \
31903213
.gate_clks = bus##id##_gate_clks, \
31913214
.nr_gate_clks = ARRAY_SIZE(bus##id##_gate_clks), \
3192-
.nr_clk_ids = BUSx_NR_CLK
3215+
.nr_clk_ids = CLKS_NR_BUSX
31933216

31943217
static const struct samsung_cmu_info bus0_cmu_info __initconst = {
31953218
CMU_BUS_INFO_CLKS(0),
@@ -3340,7 +3363,7 @@ static const struct samsung_cmu_info g3d_cmu_info __initconst = {
33403363
.nr_div_clks = ARRAY_SIZE(g3d_div_clks),
33413364
.gate_clks = g3d_gate_clks,
33423365
.nr_gate_clks = ARRAY_SIZE(g3d_gate_clks),
3343-
.nr_clk_ids = G3D_NR_CLK,
3366+
.nr_clk_ids = CLKS_NR_G3D,
33443367
.clk_regs = g3d_clk_regs,
33453368
.nr_clk_regs = ARRAY_SIZE(g3d_clk_regs),
33463369
.suspend_regs = g3d_suspend_regs,
@@ -3483,7 +3506,7 @@ static const struct samsung_cmu_info gscl_cmu_info __initconst = {
34833506
.nr_mux_clks = ARRAY_SIZE(gscl_mux_clks),
34843507
.gate_clks = gscl_gate_clks,
34853508
.nr_gate_clks = ARRAY_SIZE(gscl_gate_clks),
3486-
.nr_clk_ids = GSCL_NR_CLK,
3509+
.nr_clk_ids = CLKS_NR_GSCL,
34873510
.clk_regs = gscl_clk_regs,
34883511
.nr_clk_regs = ARRAY_SIZE(gscl_clk_regs),
34893512
.suspend_regs = gscl_suspend_regs,
@@ -3693,7 +3716,7 @@ static const struct samsung_cmu_info apollo_cmu_info __initconst = {
36933716
.nr_gate_clks = ARRAY_SIZE(apollo_gate_clks),
36943717
.cpu_clks = apollo_cpu_clks,
36953718
.nr_cpu_clks = ARRAY_SIZE(apollo_cpu_clks),
3696-
.nr_clk_ids = APOLLO_NR_CLK,
3719+
.nr_clk_ids = CLKS_NR_APOLLO,
36973720
.clk_regs = apollo_clk_regs,
36983721
.nr_clk_regs = ARRAY_SIZE(apollo_clk_regs),
36993722
};
@@ -3938,7 +3961,7 @@ static const struct samsung_cmu_info atlas_cmu_info __initconst = {
39383961
.nr_gate_clks = ARRAY_SIZE(atlas_gate_clks),
39393962
.cpu_clks = atlas_cpu_clks,
39403963
.nr_cpu_clks = ARRAY_SIZE(atlas_cpu_clks),
3941-
.nr_clk_ids = ATLAS_NR_CLK,
3964+
.nr_clk_ids = CLKS_NR_ATLAS,
39423965
.clk_regs = atlas_clk_regs,
39433966
.nr_clk_regs = ARRAY_SIZE(atlas_clk_regs),
39443967
};
@@ -4112,7 +4135,7 @@ static const struct samsung_cmu_info mscl_cmu_info __initconst = {
41124135
.nr_div_clks = ARRAY_SIZE(mscl_div_clks),
41134136
.gate_clks = mscl_gate_clks,
41144137
.nr_gate_clks = ARRAY_SIZE(mscl_gate_clks),
4115-
.nr_clk_ids = MSCL_NR_CLK,
4138+
.nr_clk_ids = CLKS_NR_MSCL,
41164139
.clk_regs = mscl_clk_regs,
41174140
.nr_clk_regs = ARRAY_SIZE(mscl_clk_regs),
41184141
.suspend_regs = mscl_suspend_regs,
@@ -4220,7 +4243,7 @@ static const struct samsung_cmu_info mfc_cmu_info __initconst = {
42204243
.nr_div_clks = ARRAY_SIZE(mfc_div_clks),
42214244
.gate_clks = mfc_gate_clks,
42224245
.nr_gate_clks = ARRAY_SIZE(mfc_gate_clks),
4223-
.nr_clk_ids = MFC_NR_CLK,
4246+
.nr_clk_ids = CLKS_NR_MFC,
42244247
.clk_regs = mfc_clk_regs,
42254248
.nr_clk_regs = ARRAY_SIZE(mfc_clk_regs),
42264249
.suspend_regs = mfc_suspend_regs,
@@ -4330,7 +4353,7 @@ static const struct samsung_cmu_info hevc_cmu_info __initconst = {
43304353
.nr_div_clks = ARRAY_SIZE(hevc_div_clks),
43314354
.gate_clks = hevc_gate_clks,
43324355
.nr_gate_clks = ARRAY_SIZE(hevc_gate_clks),
4333-
.nr_clk_ids = HEVC_NR_CLK,
4356+
.nr_clk_ids = CLKS_NR_HEVC,
43344357
.clk_regs = hevc_clk_regs,
43354358
.nr_clk_regs = ARRAY_SIZE(hevc_clk_regs),
43364359
.suspend_regs = hevc_suspend_regs,
@@ -4583,7 +4606,7 @@ static const struct samsung_cmu_info isp_cmu_info __initconst = {
45834606
.nr_div_clks = ARRAY_SIZE(isp_div_clks),
45844607
.gate_clks = isp_gate_clks,
45854608
.nr_gate_clks = ARRAY_SIZE(isp_gate_clks),
4586-
.nr_clk_ids = ISP_NR_CLK,
4609+
.nr_clk_ids = CLKS_NR_ISP,
45874610
.clk_regs = isp_clk_regs,
45884611
.nr_clk_regs = ARRAY_SIZE(isp_clk_regs),
45894612
.suspend_regs = isp_suspend_regs,
@@ -5065,7 +5088,7 @@ static const struct samsung_cmu_info cam0_cmu_info __initconst = {
50655088
.nr_gate_clks = ARRAY_SIZE(cam0_gate_clks),
50665089
.fixed_clks = cam0_fixed_clks,
50675090
.nr_fixed_clks = ARRAY_SIZE(cam0_fixed_clks),
5068-
.nr_clk_ids = CAM0_NR_CLK,
5091+
.nr_clk_ids = CLKS_NR_CAM0,
50695092
.clk_regs = cam0_clk_regs,
50705093
.nr_clk_regs = ARRAY_SIZE(cam0_clk_regs),
50715094
.suspend_regs = cam0_suspend_regs,
@@ -5440,7 +5463,7 @@ static const struct samsung_cmu_info cam1_cmu_info __initconst = {
54405463
.nr_gate_clks = ARRAY_SIZE(cam1_gate_clks),
54415464
.fixed_clks = cam1_fixed_clks,
54425465
.nr_fixed_clks = ARRAY_SIZE(cam1_fixed_clks),
5443-
.nr_clk_ids = CAM1_NR_CLK,
5466+
.nr_clk_ids = CLKS_NR_CAM1,
54445467
.clk_regs = cam1_clk_regs,
54455468
.nr_clk_regs = ARRAY_SIZE(cam1_clk_regs),
54465469
.suspend_regs = cam1_suspend_regs,
@@ -5472,7 +5495,7 @@ static const struct samsung_gate_clock imem_gate_clks[] __initconst = {
54725495
static const struct samsung_cmu_info imem_cmu_info __initconst = {
54735496
.gate_clks = imem_gate_clks,
54745497
.nr_gate_clks = ARRAY_SIZE(imem_gate_clks),
5475-
.nr_clk_ids = IMEM_NR_CLK,
5498+
.nr_clk_ids = CLKS_NR_IMEM,
54765499
.clk_regs = imem_clk_regs,
54775500
.nr_clk_regs = ARRAY_SIZE(imem_clk_regs),
54785501
.clk_name = "aclk_imem_200",

0 commit comments

Comments
 (0)