aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Turquette <mturquette@baylibre.com>2016-04-28 15:01:58 -0400
committerMichael Turquette <mturquette@baylibre.com>2016-06-22 21:02:32 -0400
commit6282a2da098b07763ac5d8a710b759f17d63d1b3 (patch)
treebfc10927b5205d5dc1d5f68e29d81f616c834280
parentec623f2a43ebe482abc925f8785f462c0fe3c08a (diff)
clk: meson8b: clean up fixed factor clocks
Remove the fixed factor registration function and helpers. Replace unnecessary configuration struct with static initialization of the desired clock type. Tested-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Michael Turquette <mturquette@baylibre.com>
-rw-r--r--drivers/clk/meson/clkc.c46
-rw-r--r--drivers/clk/meson/clkc.h19
-rw-r--r--drivers/clk/meson/meson8b-clkc.c66
3 files changed, 60 insertions, 71 deletions
diff --git a/drivers/clk/meson/clkc.c b/drivers/clk/meson/clkc.c
index 2161ea38272e..275da2790063 100644
--- a/drivers/clk/meson/clkc.c
+++ b/drivers/clk/meson/clkc.c
@@ -125,48 +125,6 @@ error:
125 return clk; 125 return clk;
126} 126}
127 127
128static struct clk * __init
129meson_clk_register_fixed_factor(const struct clk_conf *clk_conf,
130 void __iomem *clk_base)
131{
132 struct clk *clk;
133 const struct fixed_fact_conf *fixed_fact_conf;
134 const struct parm *p;
135 unsigned int mult, div;
136 u32 reg;
137
138 fixed_fact_conf = &clk_conf->conf.fixed_fact;
139
140 mult = clk_conf->conf.fixed_fact.mult;
141 div = clk_conf->conf.fixed_fact.div;
142
143 if (!mult) {
144 mult = 1;
145 p = &fixed_fact_conf->mult_parm;
146 if (MESON_PARM_APPLICABLE(p)) {
147 reg = readl(clk_base + clk_conf->reg_off + p->reg_off);
148 mult = PARM_GET(p->width, p->shift, reg);
149 }
150 }
151
152 if (!div) {
153 div = 1;
154 p = &fixed_fact_conf->div_parm;
155 if (MESON_PARM_APPLICABLE(p)) {
156 reg = readl(clk_base + clk_conf->reg_off + p->reg_off);
157 mult = PARM_GET(p->width, p->shift, reg);
158 }
159 }
160
161 clk = clk_register_fixed_factor(NULL,
162 clk_conf->clk_name,
163 clk_conf->clks_parent[0],
164 clk_conf->flags,
165 mult, div);
166
167 return clk;
168}
169
170void __init meson_clk_register_clks(const struct clk_conf *clk_confs, 128void __init meson_clk_register_clks(const struct clk_conf *clk_confs,
171 unsigned int nr_confs, 129 unsigned int nr_confs,
172 void __iomem *clk_base) 130 void __iomem *clk_base)
@@ -178,10 +136,6 @@ void __init meson_clk_register_clks(const struct clk_conf *clk_confs,
178 const struct clk_conf *clk_conf = &clk_confs[i]; 136 const struct clk_conf *clk_conf = &clk_confs[i];
179 137
180 switch (clk_conf->clk_type) { 138 switch (clk_conf->clk_type) {
181 case CLK_FIXED_FACTOR:
182 clk = meson_clk_register_fixed_factor(clk_conf,
183 clk_base);
184 break;
185 case CLK_COMPOSITE: 139 case CLK_COMPOSITE:
186 clk = meson_clk_register_composite(clk_conf, 140 clk = meson_clk_register_composite(clk_conf,
187 clk_base); 141 clk_base);
diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h
index 0bb4fb88a1a9..97dd4d719a84 100644
--- a/drivers/clk/meson/clkc.h
+++ b/drivers/clk/meson/clkc.h
@@ -69,13 +69,6 @@ struct meson_clk_pll {
69 69
70#define to_meson_clk_pll(_hw) container_of(_hw, struct meson_clk_pll, hw) 70#define to_meson_clk_pll(_hw) container_of(_hw, struct meson_clk_pll, hw)
71 71
72struct fixed_fact_conf {
73 unsigned int div;
74 unsigned int mult;
75 struct parm div_parm;
76 struct parm mult_parm;
77};
78
79struct composite_conf { 72struct composite_conf {
80 struct parm mux_parm; 73 struct parm mux_parm;
81 struct parm div_parm; 74 struct parm div_parm;
@@ -90,7 +83,6 @@ struct composite_conf {
90#define PNAME(x) static const char *x[] 83#define PNAME(x) static const char *x[]
91 84
92enum clk_type { 85enum clk_type {
93 CLK_FIXED_FACTOR,
94 CLK_COMPOSITE, 86 CLK_COMPOSITE,
95 CLK_CPU, 87 CLK_CPU,
96}; 88};
@@ -104,22 +96,11 @@ struct clk_conf {
104 int num_parents; 96 int num_parents;
105 unsigned long flags; 97 unsigned long flags;
106 union { 98 union {
107 struct fixed_fact_conf fixed_fact;
108 const struct composite_conf *composite; 99 const struct composite_conf *composite;
109 const struct clk_div_table *div_table; 100 const struct clk_div_table *div_table;
110 } conf; 101 } conf;
111}; 102};
112 103
113#define FIXED_FACTOR_DIV(_ci, _cn, _cp, _f, _d) \
114 { \
115 .clk_type = CLK_FIXED_FACTOR, \
116 .clk_id = (_ci), \
117 .clk_name = (_cn), \
118 .clks_parent = (_cp), \
119 .num_parents = ARRAY_SIZE(_cp), \
120 .conf.fixed_fact.div = (_d), \
121 } \
122
123#define CPU(_ro, _ci, _cn, _cp, _dt) \ 104#define CPU(_ro, _ci, _cn, _cp, _dt) \
124 { \ 105 { \
125 .reg_off = (_ro), \ 106 .reg_off = (_ro), \
diff --git a/drivers/clk/meson/meson8b-clkc.c b/drivers/clk/meson/meson8b-clkc.c
index a3d8e6618043..6571e66ecc4e 100644
--- a/drivers/clk/meson/meson8b-clkc.c
+++ b/drivers/clk/meson/meson8b-clkc.c
@@ -110,7 +110,6 @@ static const struct clk_div_table cpu_div_table[] = {
110 { /* sentinel */ }, 110 { /* sentinel */ },
111}; 111};
112 112
113PNAME(p_fclk_div) = { "fixed_pll" };
114PNAME(p_cpu_clk) = { "sys_pll" }; 113PNAME(p_cpu_clk) = { "sys_pll" };
115PNAME(p_clk81) = { "fclk_div3", "fclk_div4", "fclk_div5" }; 114PNAME(p_clk81) = { "fclk_div3", "fclk_div4", "fclk_div5" };
116PNAME(p_mali) = { "fclk_div3", "fclk_div4", "fclk_div5", 115PNAME(p_mali) = { "fclk_div3", "fclk_div4", "fclk_div5",
@@ -232,12 +231,62 @@ static struct meson_clk_pll meson8b_sys_pll = {
232 }, 231 },
233}; 232};
234 233
234static struct clk_fixed_factor meson8b_fclk_div2 = {
235 .mult = 1,
236 .div = 2,
237 .hw.init = &(struct clk_init_data){
238 .name = "fclk_div2",
239 .ops = &clk_fixed_factor_ops,
240 .parent_names = (const char *[]){ "fixed_pll" },
241 .num_parents = 1,
242 },
243};
244
245static struct clk_fixed_factor meson8b_fclk_div3 = {
246 .mult = 1,
247 .div = 3,
248 .hw.init = &(struct clk_init_data){
249 .name = "fclk_div3",
250 .ops = &clk_fixed_factor_ops,
251 .parent_names = (const char *[]){ "fixed_pll" },
252 .num_parents = 1,
253 },
254};
255
256static struct clk_fixed_factor meson8b_fclk_div4 = {
257 .mult = 1,
258 .div = 4,
259 .hw.init = &(struct clk_init_data){
260 .name = "fclk_div4",
261 .ops = &clk_fixed_factor_ops,
262 .parent_names = (const char *[]){ "fixed_pll" },
263 .num_parents = 1,
264 },
265};
266
267static struct clk_fixed_factor meson8b_fclk_div5 = {
268 .mult = 1,
269 .div = 5,
270 .hw.init = &(struct clk_init_data){
271 .name = "fclk_div5",
272 .ops = &clk_fixed_factor_ops,
273 .parent_names = (const char *[]){ "fixed_pll" },
274 .num_parents = 1,
275 },
276};
277
278static struct clk_fixed_factor meson8b_fclk_div7 = {
279 .mult = 1,
280 .div = 7,
281 .hw.init = &(struct clk_init_data){
282 .name = "fclk_div7",
283 .ops = &clk_fixed_factor_ops,
284 .parent_names = (const char *[]){ "fixed_pll" },
285 .num_parents = 1,
286 },
287};
288
235static const struct clk_conf meson8b_clk_confs[] __initconst = { 289static const struct clk_conf meson8b_clk_confs[] __initconst = {
236 FIXED_FACTOR_DIV(CLKID_FCLK_DIV2, "fclk_div2", p_fclk_div, 0, 2),
237 FIXED_FACTOR_DIV(CLKID_FCLK_DIV3, "fclk_div3", p_fclk_div, 0, 3),
238 FIXED_FACTOR_DIV(CLKID_FCLK_DIV4, "fclk_div4", p_fclk_div, 0, 4),
239 FIXED_FACTOR_DIV(CLKID_FCLK_DIV5, "fclk_div5", p_fclk_div, 0, 5),
240 FIXED_FACTOR_DIV(CLKID_FCLK_DIV7, "fclk_div7", p_fclk_div, 0, 7),
241 CPU(MESON8B_REG_SYS_CPU_CNTL1, CLKID_CPUCLK, "a5_clk", p_cpu_clk, 290 CPU(MESON8B_REG_SYS_CPU_CNTL1, CLKID_CPUCLK, "a5_clk", p_cpu_clk,
242 cpu_div_table), 291 cpu_div_table),
243 COMPOSITE(MESON8B_REG_HHI_MPEG, CLKID_CLK81, "clk81", p_clk81, 292 COMPOSITE(MESON8B_REG_HHI_MPEG, CLKID_CLK81, "clk81", p_clk81,
@@ -260,6 +309,11 @@ static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
260 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw, 309 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
261 [CLKID_PLL_VID] = &meson8b_vid_pll.hw, 310 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
262 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw, 311 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
312 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
313 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
314 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
315 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
316 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
263 }, 317 },
264 .num = CLK_NR_CLKS, 318 .num = CLK_NR_CLKS,
265}; 319};