Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+60 -71
-46
drivers/clk/meson/clkc.c
··· 125 125 return clk; 126 126 } 127 127 128 - static struct clk * __init 129 - meson_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 - 170 128 void __init meson_clk_register_clks(const struct clk_conf *clk_confs, 171 129 unsigned int nr_confs, 172 130 void __iomem *clk_base) ··· 136 178 const struct clk_conf *clk_conf = &clk_confs[i]; 137 179 138 180 switch (clk_conf->clk_type) { 139 - case CLK_FIXED_FACTOR: 140 - clk = meson_clk_register_fixed_factor(clk_conf, 141 - clk_base); 142 - break; 143 181 case CLK_COMPOSITE: 144 182 clk = meson_clk_register_composite(clk_conf, 145 183 clk_base);
-19
drivers/clk/meson/clkc.h
··· 69 69 70 70 #define to_meson_clk_pll(_hw) container_of(_hw, struct meson_clk_pll, hw) 71 71 72 - struct fixed_fact_conf { 73 - unsigned int div; 74 - unsigned int mult; 75 - struct parm div_parm; 76 - struct parm mult_parm; 77 - }; 78 - 79 72 struct composite_conf { 80 73 struct parm mux_parm; 81 74 struct parm div_parm; ··· 83 90 #define PNAME(x) static const char *x[] 84 91 85 92 enum clk_type { 86 - CLK_FIXED_FACTOR, 87 93 CLK_COMPOSITE, 88 94 CLK_CPU, 89 95 }; ··· 96 104 int num_parents; 97 105 unsigned long flags; 98 106 union { 99 - struct fixed_fact_conf fixed_fact; 100 107 const struct composite_conf *composite; 101 108 const struct clk_div_table *div_table; 102 109 } conf; 103 110 }; 104 - 105 - #define FIXED_FACTOR_DIV(_ci, _cn, _cp, _f, _d) \ 106 - { \ 107 - .clk_type = CLK_FIXED_FACTOR, \ 108 - .clk_id = (_ci), \ 109 - .clk_name = (_cn), \ 110 - .clks_parent = (_cp), \ 111 - .num_parents = ARRAY_SIZE(_cp), \ 112 - .conf.fixed_fact.div = (_d), \ 113 - } \ 114 111 115 112 #define CPU(_ro, _ci, _cn, _cp, _dt) \ 116 113 { \
+60 -6
drivers/clk/meson/meson8b-clkc.c
··· 110 110 { /* sentinel */ }, 111 111 }; 112 112 113 - PNAME(p_fclk_div) = { "fixed_pll" }; 114 113 PNAME(p_cpu_clk) = { "sys_pll" }; 115 114 PNAME(p_clk81) = { "fclk_div3", "fclk_div4", "fclk_div5" }; 116 115 PNAME(p_mali) = { "fclk_div3", "fclk_div4", "fclk_div5", ··· 231 232 }, 232 233 }; 233 234 235 + static struct clk_fixed_factor meson8b_fclk_div2 = { 236 + .mult = 1, 237 + .div = 2, 238 + .hw.init = &(struct clk_init_data){ 239 + .name = "fclk_div2", 240 + .ops = &clk_fixed_factor_ops, 241 + .parent_names = (const char *[]){ "fixed_pll" }, 242 + .num_parents = 1, 243 + }, 244 + }; 245 + 246 + static struct clk_fixed_factor meson8b_fclk_div3 = { 247 + .mult = 1, 248 + .div = 3, 249 + .hw.init = &(struct clk_init_data){ 250 + .name = "fclk_div3", 251 + .ops = &clk_fixed_factor_ops, 252 + .parent_names = (const char *[]){ "fixed_pll" }, 253 + .num_parents = 1, 254 + }, 255 + }; 256 + 257 + static struct clk_fixed_factor meson8b_fclk_div4 = { 258 + .mult = 1, 259 + .div = 4, 260 + .hw.init = &(struct clk_init_data){ 261 + .name = "fclk_div4", 262 + .ops = &clk_fixed_factor_ops, 263 + .parent_names = (const char *[]){ "fixed_pll" }, 264 + .num_parents = 1, 265 + }, 266 + }; 267 + 268 + static struct clk_fixed_factor meson8b_fclk_div5 = { 269 + .mult = 1, 270 + .div = 5, 271 + .hw.init = &(struct clk_init_data){ 272 + .name = "fclk_div5", 273 + .ops = &clk_fixed_factor_ops, 274 + .parent_names = (const char *[]){ "fixed_pll" }, 275 + .num_parents = 1, 276 + }, 277 + }; 278 + 279 + static struct clk_fixed_factor meson8b_fclk_div7 = { 280 + .mult = 1, 281 + .div = 7, 282 + .hw.init = &(struct clk_init_data){ 283 + .name = "fclk_div7", 284 + .ops = &clk_fixed_factor_ops, 285 + .parent_names = (const char *[]){ "fixed_pll" }, 286 + .num_parents = 1, 287 + }, 288 + }; 289 + 234 290 static const struct clk_conf meson8b_clk_confs[] __initconst = { 235 - FIXED_FACTOR_DIV(CLKID_FCLK_DIV2, "fclk_div2", p_fclk_div, 0, 2), 236 - FIXED_FACTOR_DIV(CLKID_FCLK_DIV3, "fclk_div3", p_fclk_div, 0, 3), 237 - FIXED_FACTOR_DIV(CLKID_FCLK_DIV4, "fclk_div4", p_fclk_div, 0, 4), 238 - FIXED_FACTOR_DIV(CLKID_FCLK_DIV5, "fclk_div5", p_fclk_div, 0, 5), 239 - FIXED_FACTOR_DIV(CLKID_FCLK_DIV7, "fclk_div7", p_fclk_div, 0, 7), 240 291 CPU(MESON8B_REG_SYS_CPU_CNTL1, CLKID_CPUCLK, "a5_clk", p_cpu_clk, 241 292 cpu_div_table), 242 293 COMPOSITE(MESON8B_REG_HHI_MPEG, CLKID_CLK81, "clk81", p_clk81, ··· 309 260 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw, 310 261 [CLKID_PLL_VID] = &meson8b_vid_pll.hw, 311 262 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw, 263 + [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw, 264 + [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw, 265 + [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw, 266 + [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw, 267 + [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw, 312 268 }, 313 269 .num = CLK_NR_CLKS, 314 270 };