Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Emilio López |
| 3 | * |
| 4 | * Emilio López <emilio@elopez.com.ar> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/clk-provider.h> |
| 18 | #include <linux/clkdev.h> |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 19 | #include <linux/of.h> |
| 20 | #include <linux/of_address.h> |
| 21 | |
| 22 | #include "clk-factors.h" |
| 23 | |
| 24 | static DEFINE_SPINLOCK(clk_lock); |
| 25 | |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 26 | /* Maximum number of parents our clocks have */ |
| 27 | #define SUNXI_MAX_PARENTS 5 |
| 28 | |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 29 | /** |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 30 | * sun4i_osc_clk_setup() - Setup function for gatable oscillator |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #define SUNXI_OSC24M_GATE 0 |
| 34 | |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 35 | static void __init sun4i_osc_clk_setup(struct device_node *node) |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 36 | { |
| 37 | struct clk *clk; |
Emilio López | 38e4aa0 | 2013-04-10 15:02:57 -0700 | [diff] [blame] | 38 | struct clk_fixed_rate *fixed; |
| 39 | struct clk_gate *gate; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 40 | const char *clk_name = node->name; |
Emilio López | 38e4aa0 | 2013-04-10 15:02:57 -0700 | [diff] [blame] | 41 | u32 rate; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 42 | |
Victor N. Ramos Mello | e71c69f | 2013-10-18 20:27:51 -0300 | [diff] [blame] | 43 | if (of_property_read_u32(node, "clock-frequency", &rate)) |
| 44 | return; |
| 45 | |
Emilio López | 38e4aa0 | 2013-04-10 15:02:57 -0700 | [diff] [blame] | 46 | /* allocate fixed-rate and gate clock structs */ |
| 47 | fixed = kzalloc(sizeof(struct clk_fixed_rate), GFP_KERNEL); |
| 48 | if (!fixed) |
| 49 | return; |
| 50 | gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); |
Victor N. Ramos Mello | e71c69f | 2013-10-18 20:27:51 -0300 | [diff] [blame] | 51 | if (!gate) |
| 52 | goto err_free_fixed; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 53 | |
Emilio López | 38e4aa0 | 2013-04-10 15:02:57 -0700 | [diff] [blame] | 54 | /* set up gate and fixed rate properties */ |
| 55 | gate->reg = of_iomap(node, 0); |
| 56 | gate->bit_idx = SUNXI_OSC24M_GATE; |
| 57 | gate->lock = &clk_lock; |
| 58 | fixed->fixed_rate = rate; |
| 59 | |
| 60 | clk = clk_register_composite(NULL, clk_name, |
| 61 | NULL, 0, |
| 62 | NULL, NULL, |
| 63 | &fixed->hw, &clk_fixed_rate_ops, |
| 64 | &gate->hw, &clk_gate_ops, |
| 65 | CLK_IS_ROOT); |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 66 | |
Victor N. Ramos Mello | e71c69f | 2013-10-18 20:27:51 -0300 | [diff] [blame] | 67 | if (IS_ERR(clk)) |
| 68 | goto err_free_gate; |
| 69 | |
| 70 | of_clk_add_provider(node, of_clk_src_simple_get, clk); |
| 71 | clk_register_clkdev(clk, clk_name, NULL); |
| 72 | |
| 73 | return; |
| 74 | |
| 75 | err_free_gate: |
| 76 | kfree(gate); |
| 77 | err_free_fixed: |
| 78 | kfree(fixed); |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 79 | } |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 80 | CLK_OF_DECLARE(sun4i_osc, "allwinner,sun4i-osc-clk", sun4i_osc_clk_setup); |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 81 | |
| 82 | |
| 83 | |
| 84 | /** |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 85 | * sun4i_get_pll1_factors() - calculates n, k, m, p factors for PLL1 |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 86 | * PLL1 rate is calculated as follows |
| 87 | * rate = (parent_rate * n * (k + 1) >> p) / (m + 1); |
| 88 | * parent_rate is always 24Mhz |
| 89 | */ |
| 90 | |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 91 | static void sun4i_get_pll1_factors(u32 *freq, u32 parent_rate, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 92 | u8 *n, u8 *k, u8 *m, u8 *p) |
| 93 | { |
| 94 | u8 div; |
| 95 | |
| 96 | /* Normalize value to a 6M multiple */ |
| 97 | div = *freq / 6000000; |
| 98 | *freq = 6000000 * div; |
| 99 | |
| 100 | /* we were called to round the frequency, we can now return */ |
| 101 | if (n == NULL) |
| 102 | return; |
| 103 | |
| 104 | /* m is always zero for pll1 */ |
| 105 | *m = 0; |
| 106 | |
| 107 | /* k is 1 only on these cases */ |
| 108 | if (*freq >= 768000000 || *freq == 42000000 || *freq == 54000000) |
| 109 | *k = 1; |
| 110 | else |
| 111 | *k = 0; |
| 112 | |
| 113 | /* p will be 3 for divs under 10 */ |
| 114 | if (div < 10) |
| 115 | *p = 3; |
| 116 | |
| 117 | /* p will be 2 for divs between 10 - 20 and odd divs under 32 */ |
| 118 | else if (div < 20 || (div < 32 && (div & 1))) |
| 119 | *p = 2; |
| 120 | |
| 121 | /* p will be 1 for even divs under 32, divs under 40 and odd pairs |
| 122 | * of divs between 40-62 */ |
| 123 | else if (div < 40 || (div < 64 && (div & 2))) |
| 124 | *p = 1; |
| 125 | |
| 126 | /* any other entries have p = 0 */ |
| 127 | else |
| 128 | *p = 0; |
| 129 | |
| 130 | /* calculate a suitable n based on k and p */ |
| 131 | div <<= *p; |
| 132 | div /= (*k + 1); |
| 133 | *n = div / 4; |
| 134 | } |
| 135 | |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 136 | /** |
| 137 | * sun6i_a31_get_pll1_factors() - calculates n, k and m factors for PLL1 |
| 138 | * PLL1 rate is calculated as follows |
| 139 | * rate = parent_rate * (n + 1) * (k + 1) / (m + 1); |
| 140 | * parent_rate should always be 24MHz |
| 141 | */ |
| 142 | static void sun6i_a31_get_pll1_factors(u32 *freq, u32 parent_rate, |
| 143 | u8 *n, u8 *k, u8 *m, u8 *p) |
| 144 | { |
| 145 | /* |
| 146 | * We can operate only on MHz, this will make our life easier |
| 147 | * later. |
| 148 | */ |
| 149 | u32 freq_mhz = *freq / 1000000; |
| 150 | u32 parent_freq_mhz = parent_rate / 1000000; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 151 | |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 152 | /* |
| 153 | * Round down the frequency to the closest multiple of either |
| 154 | * 6 or 16 |
| 155 | */ |
| 156 | u32 round_freq_6 = round_down(freq_mhz, 6); |
| 157 | u32 round_freq_16 = round_down(freq_mhz, 16); |
| 158 | |
| 159 | if (round_freq_6 > round_freq_16) |
| 160 | freq_mhz = round_freq_6; |
| 161 | else |
| 162 | freq_mhz = round_freq_16; |
| 163 | |
| 164 | *freq = freq_mhz * 1000000; |
| 165 | |
| 166 | /* |
| 167 | * If the factors pointer are null, we were just called to |
| 168 | * round down the frequency. |
| 169 | * Exit. |
| 170 | */ |
| 171 | if (n == NULL) |
| 172 | return; |
| 173 | |
| 174 | /* If the frequency is a multiple of 32 MHz, k is always 3 */ |
| 175 | if (!(freq_mhz % 32)) |
| 176 | *k = 3; |
| 177 | /* If the frequency is a multiple of 9 MHz, k is always 2 */ |
| 178 | else if (!(freq_mhz % 9)) |
| 179 | *k = 2; |
| 180 | /* If the frequency is a multiple of 8 MHz, k is always 1 */ |
| 181 | else if (!(freq_mhz % 8)) |
| 182 | *k = 1; |
| 183 | /* Otherwise, we don't use the k factor */ |
| 184 | else |
| 185 | *k = 0; |
| 186 | |
| 187 | /* |
| 188 | * If the frequency is a multiple of 2 but not a multiple of |
| 189 | * 3, m is 3. This is the first time we use 6 here, yet we |
| 190 | * will use it on several other places. |
| 191 | * We use this number because it's the lowest frequency we can |
| 192 | * generate (with n = 0, k = 0, m = 3), so every other frequency |
| 193 | * somehow relates to this frequency. |
| 194 | */ |
| 195 | if ((freq_mhz % 6) == 2 || (freq_mhz % 6) == 4) |
| 196 | *m = 2; |
| 197 | /* |
| 198 | * If the frequency is a multiple of 6MHz, but the factor is |
| 199 | * odd, m will be 3 |
| 200 | */ |
| 201 | else if ((freq_mhz / 6) & 1) |
| 202 | *m = 3; |
| 203 | /* Otherwise, we end up with m = 1 */ |
| 204 | else |
| 205 | *m = 1; |
| 206 | |
| 207 | /* Calculate n thanks to the above factors we already got */ |
| 208 | *n = freq_mhz * (*m + 1) / ((*k + 1) * parent_freq_mhz) - 1; |
| 209 | |
| 210 | /* |
| 211 | * If n end up being outbound, and that we can still decrease |
| 212 | * m, do it. |
| 213 | */ |
| 214 | if ((*n + 1) > 31 && (*m + 1) > 1) { |
| 215 | *n = (*n + 1) / 2 - 1; |
| 216 | *m = (*m + 1) / 2 - 1; |
| 217 | } |
| 218 | } |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 219 | |
| 220 | /** |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 221 | * sun4i_get_apb1_factors() - calculates m, p factors for APB1 |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 222 | * APB1 rate is calculated as follows |
| 223 | * rate = (parent_rate >> p) / (m + 1); |
| 224 | */ |
| 225 | |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 226 | static void sun4i_get_apb1_factors(u32 *freq, u32 parent_rate, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 227 | u8 *n, u8 *k, u8 *m, u8 *p) |
| 228 | { |
| 229 | u8 calcm, calcp; |
| 230 | |
| 231 | if (parent_rate < *freq) |
| 232 | *freq = parent_rate; |
| 233 | |
| 234 | parent_rate = (parent_rate + (*freq - 1)) / *freq; |
| 235 | |
| 236 | /* Invalid rate! */ |
| 237 | if (parent_rate > 32) |
| 238 | return; |
| 239 | |
| 240 | if (parent_rate <= 4) |
| 241 | calcp = 0; |
| 242 | else if (parent_rate <= 8) |
| 243 | calcp = 1; |
| 244 | else if (parent_rate <= 16) |
| 245 | calcp = 2; |
| 246 | else |
| 247 | calcp = 3; |
| 248 | |
| 249 | calcm = (parent_rate >> calcp) - 1; |
| 250 | |
| 251 | *freq = (parent_rate >> calcp) / (calcm + 1); |
| 252 | |
| 253 | /* we were called to round the frequency, we can now return */ |
| 254 | if (n == NULL) |
| 255 | return; |
| 256 | |
| 257 | *m = calcm; |
| 258 | *p = calcp; |
| 259 | } |
| 260 | |
| 261 | |
| 262 | |
| 263 | /** |
| 264 | * sunxi_factors_clk_setup() - Setup function for factor clocks |
| 265 | */ |
| 266 | |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 267 | #define SUNXI_FACTORS_MUX_MASK 0x3 |
| 268 | |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 269 | struct factors_data { |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 270 | int enable; |
| 271 | int mux; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 272 | struct clk_factors_config *table; |
| 273 | void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p); |
| 274 | }; |
| 275 | |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 276 | static struct clk_factors_config sun4i_pll1_config = { |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 277 | .nshift = 8, |
| 278 | .nwidth = 5, |
| 279 | .kshift = 4, |
| 280 | .kwidth = 2, |
| 281 | .mshift = 0, |
| 282 | .mwidth = 2, |
| 283 | .pshift = 16, |
| 284 | .pwidth = 2, |
| 285 | }; |
| 286 | |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 287 | static struct clk_factors_config sun6i_a31_pll1_config = { |
| 288 | .nshift = 8, |
| 289 | .nwidth = 5, |
| 290 | .kshift = 4, |
| 291 | .kwidth = 2, |
| 292 | .mshift = 0, |
| 293 | .mwidth = 2, |
| 294 | }; |
| 295 | |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 296 | static struct clk_factors_config sun4i_apb1_config = { |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 297 | .mshift = 0, |
| 298 | .mwidth = 5, |
| 299 | .pshift = 16, |
| 300 | .pwidth = 2, |
| 301 | }; |
| 302 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 303 | static const struct factors_data sun4i_pll1_data __initconst = { |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 304 | .table = &sun4i_pll1_config, |
| 305 | .getter = sun4i_get_pll1_factors, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 306 | }; |
| 307 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 308 | static const struct factors_data sun6i_a31_pll1_data __initconst = { |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 309 | .table = &sun6i_a31_pll1_config, |
| 310 | .getter = sun6i_a31_get_pll1_factors, |
| 311 | }; |
| 312 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 313 | static const struct factors_data sun4i_apb1_data __initconst = { |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 314 | .table = &sun4i_apb1_config, |
| 315 | .getter = sun4i_get_apb1_factors, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 316 | }; |
| 317 | |
| 318 | static void __init sunxi_factors_clk_setup(struct device_node *node, |
| 319 | struct factors_data *data) |
| 320 | { |
| 321 | struct clk *clk; |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 322 | struct clk_factors *factors; |
| 323 | struct clk_gate *gate = NULL; |
| 324 | struct clk_mux *mux = NULL; |
| 325 | struct clk_hw *gate_hw = NULL; |
| 326 | struct clk_hw *mux_hw = NULL; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 327 | const char *clk_name = node->name; |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 328 | const char *parents[SUNXI_MAX_PARENTS]; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 329 | void *reg; |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 330 | int i = 0; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 331 | |
| 332 | reg = of_iomap(node, 0); |
| 333 | |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 334 | /* if we have a mux, we will have >1 parents */ |
| 335 | while (i < SUNXI_MAX_PARENTS && |
| 336 | (parents[i] = of_clk_get_parent_name(node, i)) != NULL) |
| 337 | i++; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 338 | |
Emilio López | 40a5dcb | 2013-12-23 00:32:32 -0300 | [diff] [blame] | 339 | factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL); |
| 340 | if (!factors) |
| 341 | return; |
| 342 | |
| 343 | /* Add a gate if this factor clock can be gated */ |
| 344 | if (data->enable) { |
| 345 | gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); |
| 346 | if (!gate) { |
| 347 | kfree(factors); |
| 348 | return; |
| 349 | } |
| 350 | |
| 351 | /* set up gate properties */ |
| 352 | gate->reg = reg; |
| 353 | gate->bit_idx = data->enable; |
| 354 | gate->lock = &clk_lock; |
| 355 | gate_hw = &gate->hw; |
| 356 | } |
| 357 | |
| 358 | /* Add a mux if this factor clock can be muxed */ |
| 359 | if (data->mux) { |
| 360 | mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL); |
| 361 | if (!mux) { |
| 362 | kfree(factors); |
| 363 | kfree(gate); |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | /* set up gate properties */ |
| 368 | mux->reg = reg; |
| 369 | mux->shift = data->mux; |
| 370 | mux->mask = SUNXI_FACTORS_MUX_MASK; |
| 371 | mux->lock = &clk_lock; |
| 372 | mux_hw = &mux->hw; |
| 373 | } |
| 374 | |
| 375 | /* set up factors properties */ |
| 376 | factors->reg = reg; |
| 377 | factors->config = data->table; |
| 378 | factors->get_factors = data->getter; |
| 379 | factors->lock = &clk_lock; |
| 380 | |
| 381 | clk = clk_register_composite(NULL, clk_name, |
| 382 | parents, i, |
| 383 | mux_hw, &clk_mux_ops, |
| 384 | &factors->hw, &clk_factors_ops, |
| 385 | gate_hw, &clk_gate_ops, |
| 386 | i ? 0 : CLK_IS_ROOT); |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 387 | |
Axel Lin | ee85e9b | 2013-07-12 16:15:15 +0800 | [diff] [blame] | 388 | if (!IS_ERR(clk)) { |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 389 | of_clk_add_provider(node, of_clk_src_simple_get, clk); |
| 390 | clk_register_clkdev(clk, clk_name, NULL); |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | |
| 395 | |
| 396 | /** |
| 397 | * sunxi_mux_clk_setup() - Setup function for muxes |
| 398 | */ |
| 399 | |
| 400 | #define SUNXI_MUX_GATE_WIDTH 2 |
| 401 | |
| 402 | struct mux_data { |
| 403 | u8 shift; |
| 404 | }; |
| 405 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 406 | static const struct mux_data sun4i_cpu_mux_data __initconst = { |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 407 | .shift = 16, |
| 408 | }; |
| 409 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 410 | static const struct mux_data sun6i_a31_ahb1_mux_data __initconst = { |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 411 | .shift = 12, |
| 412 | }; |
| 413 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 414 | static const struct mux_data sun4i_apb1_mux_data __initconst = { |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 415 | .shift = 24, |
| 416 | }; |
| 417 | |
| 418 | static void __init sunxi_mux_clk_setup(struct device_node *node, |
| 419 | struct mux_data *data) |
| 420 | { |
| 421 | struct clk *clk; |
| 422 | const char *clk_name = node->name; |
Emilio López | edaf3fb | 2013-12-23 00:32:33 -0300 | [diff] [blame^] | 423 | const char *parents[SUNXI_MAX_PARENTS]; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 424 | void *reg; |
| 425 | int i = 0; |
| 426 | |
| 427 | reg = of_iomap(node, 0); |
| 428 | |
Emilio López | edaf3fb | 2013-12-23 00:32:33 -0300 | [diff] [blame^] | 429 | while (i < SUNXI_MAX_PARENTS && |
| 430 | (parents[i] = of_clk_get_parent_name(node, i)) != NULL) |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 431 | i++; |
| 432 | |
James Hogan | 819c1de | 2013-07-29 12:25:01 +0100 | [diff] [blame] | 433 | clk = clk_register_mux(NULL, clk_name, parents, i, |
| 434 | CLK_SET_RATE_NO_REPARENT, reg, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 435 | data->shift, SUNXI_MUX_GATE_WIDTH, |
| 436 | 0, &clk_lock); |
| 437 | |
| 438 | if (clk) { |
| 439 | of_clk_add_provider(node, of_clk_src_simple_get, clk); |
| 440 | clk_register_clkdev(clk, clk_name, NULL); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | |
| 445 | |
| 446 | /** |
| 447 | * sunxi_divider_clk_setup() - Setup function for simple divider clocks |
| 448 | */ |
| 449 | |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 450 | struct div_data { |
Maxime Ripard | 70855bb | 2013-07-23 09:25:56 +0200 | [diff] [blame] | 451 | u8 shift; |
| 452 | u8 pow; |
| 453 | u8 width; |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 454 | }; |
| 455 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 456 | static const struct div_data sun4i_axi_data __initconst = { |
Maxime Ripard | 70855bb | 2013-07-23 09:25:56 +0200 | [diff] [blame] | 457 | .shift = 0, |
| 458 | .pow = 0, |
| 459 | .width = 2, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 460 | }; |
| 461 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 462 | static const struct div_data sun4i_ahb_data __initconst = { |
Maxime Ripard | 70855bb | 2013-07-23 09:25:56 +0200 | [diff] [blame] | 463 | .shift = 4, |
| 464 | .pow = 1, |
| 465 | .width = 2, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 466 | }; |
| 467 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 468 | static const struct div_data sun4i_apb0_data __initconst = { |
Maxime Ripard | 70855bb | 2013-07-23 09:25:56 +0200 | [diff] [blame] | 469 | .shift = 8, |
| 470 | .pow = 1, |
| 471 | .width = 2, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 472 | }; |
| 473 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 474 | static const struct div_data sun6i_a31_apb2_div_data __initconst = { |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 475 | .shift = 0, |
| 476 | .pow = 0, |
| 477 | .width = 4, |
| 478 | }; |
| 479 | |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 480 | static void __init sunxi_divider_clk_setup(struct device_node *node, |
| 481 | struct div_data *data) |
| 482 | { |
| 483 | struct clk *clk; |
| 484 | const char *clk_name = node->name; |
| 485 | const char *clk_parent; |
| 486 | void *reg; |
| 487 | |
| 488 | reg = of_iomap(node, 0); |
| 489 | |
| 490 | clk_parent = of_clk_get_parent_name(node, 0); |
| 491 | |
| 492 | clk = clk_register_divider(NULL, clk_name, clk_parent, 0, |
Maxime Ripard | 70855bb | 2013-07-23 09:25:56 +0200 | [diff] [blame] | 493 | reg, data->shift, data->width, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 494 | data->pow ? CLK_DIVIDER_POWER_OF_TWO : 0, |
| 495 | &clk_lock); |
| 496 | if (clk) { |
| 497 | of_clk_add_provider(node, of_clk_src_simple_get, clk); |
| 498 | clk_register_clkdev(clk, clk_name, NULL); |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 503 | |
| 504 | /** |
| 505 | * sunxi_gates_clk_setup() - Setup function for leaf gates on clocks |
| 506 | */ |
| 507 | |
| 508 | #define SUNXI_GATES_MAX_SIZE 64 |
| 509 | |
| 510 | struct gates_data { |
| 511 | DECLARE_BITMAP(mask, SUNXI_GATES_MAX_SIZE); |
| 512 | }; |
| 513 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 514 | static const struct gates_data sun4i_axi_gates_data __initconst = { |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 515 | .mask = {1}, |
| 516 | }; |
| 517 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 518 | static const struct gates_data sun4i_ahb_gates_data __initconst = { |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 519 | .mask = {0x7F77FFF, 0x14FB3F}, |
| 520 | }; |
| 521 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 522 | static const struct gates_data sun5i_a10s_ahb_gates_data __initconst = { |
Maxime Ripard | 2371dd8 | 2013-07-16 11:21:59 +0200 | [diff] [blame] | 523 | .mask = {0x147667e7, 0x185915}, |
| 524 | }; |
| 525 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 526 | static const struct gates_data sun5i_a13_ahb_gates_data __initconst = { |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 527 | .mask = {0x107067e7, 0x185111}, |
| 528 | }; |
| 529 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 530 | static const struct gates_data sun6i_a31_ahb1_gates_data __initconst = { |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 531 | .mask = {0xEDFE7F62, 0x794F931}, |
| 532 | }; |
| 533 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 534 | static const struct gates_data sun7i_a20_ahb_gates_data __initconst = { |
Maxime Ripard | 1fb2e4a | 2013-07-25 21:06:56 +0200 | [diff] [blame] | 535 | .mask = { 0x12f77fff, 0x16ff3f }, |
| 536 | }; |
| 537 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 538 | static const struct gates_data sun4i_apb0_gates_data __initconst = { |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 539 | .mask = {0x4EF}, |
| 540 | }; |
| 541 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 542 | static const struct gates_data sun5i_a10s_apb0_gates_data __initconst = { |
Maxime Ripard | 2371dd8 | 2013-07-16 11:21:59 +0200 | [diff] [blame] | 543 | .mask = {0x469}, |
| 544 | }; |
| 545 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 546 | static const struct gates_data sun5i_a13_apb0_gates_data __initconst = { |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 547 | .mask = {0x61}, |
| 548 | }; |
| 549 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 550 | static const struct gates_data sun7i_a20_apb0_gates_data __initconst = { |
Maxime Ripard | 1fb2e4a | 2013-07-25 21:06:56 +0200 | [diff] [blame] | 551 | .mask = { 0x4ff }, |
| 552 | }; |
| 553 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 554 | static const struct gates_data sun4i_apb1_gates_data __initconst = { |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 555 | .mask = {0xFF00F7}, |
| 556 | }; |
| 557 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 558 | static const struct gates_data sun5i_a10s_apb1_gates_data __initconst = { |
Maxime Ripard | 2371dd8 | 2013-07-16 11:21:59 +0200 | [diff] [blame] | 559 | .mask = {0xf0007}, |
| 560 | }; |
| 561 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 562 | static const struct gates_data sun5i_a13_apb1_gates_data __initconst = { |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 563 | .mask = {0xa0007}, |
| 564 | }; |
| 565 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 566 | static const struct gates_data sun6i_a31_apb1_gates_data __initconst = { |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 567 | .mask = {0x3031}, |
| 568 | }; |
| 569 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 570 | static const struct gates_data sun6i_a31_apb2_gates_data __initconst = { |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 571 | .mask = {0x3F000F}, |
| 572 | }; |
| 573 | |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 574 | static const struct gates_data sun7i_a20_apb1_gates_data __initconst = { |
Maxime Ripard | 1fb2e4a | 2013-07-25 21:06:56 +0200 | [diff] [blame] | 575 | .mask = { 0xff80ff }, |
| 576 | }; |
| 577 | |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 578 | static void __init sunxi_gates_clk_setup(struct device_node *node, |
| 579 | struct gates_data *data) |
| 580 | { |
| 581 | struct clk_onecell_data *clk_data; |
| 582 | const char *clk_parent; |
| 583 | const char *clk_name; |
| 584 | void *reg; |
| 585 | int qty; |
| 586 | int i = 0; |
| 587 | int j = 0; |
| 588 | int ignore; |
| 589 | |
| 590 | reg = of_iomap(node, 0); |
| 591 | |
| 592 | clk_parent = of_clk_get_parent_name(node, 0); |
| 593 | |
| 594 | /* Worst-case size approximation and memory allocation */ |
| 595 | qty = find_last_bit(data->mask, SUNXI_GATES_MAX_SIZE); |
| 596 | clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); |
| 597 | if (!clk_data) |
| 598 | return; |
| 599 | clk_data->clks = kzalloc((qty+1) * sizeof(struct clk *), GFP_KERNEL); |
| 600 | if (!clk_data->clks) { |
| 601 | kfree(clk_data); |
| 602 | return; |
| 603 | } |
| 604 | |
| 605 | for_each_set_bit(i, data->mask, SUNXI_GATES_MAX_SIZE) { |
| 606 | of_property_read_string_index(node, "clock-output-names", |
| 607 | j, &clk_name); |
| 608 | |
| 609 | /* No driver claims this clock, but it should remain gated */ |
| 610 | ignore = !strcmp("ahb_sdram", clk_name) ? CLK_IGNORE_UNUSED : 0; |
| 611 | |
| 612 | clk_data->clks[i] = clk_register_gate(NULL, clk_name, |
| 613 | clk_parent, ignore, |
| 614 | reg + 4 * (i/32), i % 32, |
| 615 | 0, &clk_lock); |
| 616 | WARN_ON(IS_ERR(clk_data->clks[i])); |
| 617 | |
| 618 | j++; |
| 619 | } |
| 620 | |
| 621 | /* Adjust to the real max */ |
| 622 | clk_data->clk_num = i; |
| 623 | |
| 624 | of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); |
| 625 | } |
| 626 | |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 627 | /* Matches for factors clocks */ |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 628 | static const struct of_device_id clk_factors_match[] __initconst = { |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 629 | {.compatible = "allwinner,sun4i-pll1-clk", .data = &sun4i_pll1_data,}, |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 630 | {.compatible = "allwinner,sun6i-a31-pll1-clk", .data = &sun6i_a31_pll1_data,}, |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 631 | {.compatible = "allwinner,sun4i-apb1-clk", .data = &sun4i_apb1_data,}, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 632 | {} |
| 633 | }; |
| 634 | |
| 635 | /* Matches for divider clocks */ |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 636 | static const struct of_device_id clk_div_match[] __initconst = { |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 637 | {.compatible = "allwinner,sun4i-axi-clk", .data = &sun4i_axi_data,}, |
| 638 | {.compatible = "allwinner,sun4i-ahb-clk", .data = &sun4i_ahb_data,}, |
| 639 | {.compatible = "allwinner,sun4i-apb0-clk", .data = &sun4i_apb0_data,}, |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 640 | {.compatible = "allwinner,sun6i-a31-apb2-div-clk", .data = &sun6i_a31_apb2_div_data,}, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 641 | {} |
| 642 | }; |
| 643 | |
| 644 | /* Matches for mux clocks */ |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 645 | static const struct of_device_id clk_mux_match[] __initconst = { |
Maxime Ripard | 81ba6c5 | 2013-07-22 18:21:32 +0200 | [diff] [blame] | 646 | {.compatible = "allwinner,sun4i-cpu-clk", .data = &sun4i_cpu_mux_data,}, |
| 647 | {.compatible = "allwinner,sun4i-apb1-mux-clk", .data = &sun4i_apb1_mux_data,}, |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 648 | {.compatible = "allwinner,sun6i-a31-ahb1-mux-clk", .data = &sun6i_a31_ahb1_mux_data,}, |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 649 | {} |
| 650 | }; |
| 651 | |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 652 | /* Matches for gate clocks */ |
Sachin Kamat | 52be7cc | 2013-08-12 14:44:06 +0530 | [diff] [blame] | 653 | static const struct of_device_id clk_gates_match[] __initconst = { |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 654 | {.compatible = "allwinner,sun4i-axi-gates-clk", .data = &sun4i_axi_gates_data,}, |
| 655 | {.compatible = "allwinner,sun4i-ahb-gates-clk", .data = &sun4i_ahb_gates_data,}, |
Maxime Ripard | 2371dd8 | 2013-07-16 11:21:59 +0200 | [diff] [blame] | 656 | {.compatible = "allwinner,sun5i-a10s-ahb-gates-clk", .data = &sun5i_a10s_ahb_gates_data,}, |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 657 | {.compatible = "allwinner,sun5i-a13-ahb-gates-clk", .data = &sun5i_a13_ahb_gates_data,}, |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 658 | {.compatible = "allwinner,sun6i-a31-ahb1-gates-clk", .data = &sun6i_a31_ahb1_gates_data,}, |
Maxime Ripard | 1fb2e4a | 2013-07-25 21:06:56 +0200 | [diff] [blame] | 659 | {.compatible = "allwinner,sun7i-a20-ahb-gates-clk", .data = &sun7i_a20_ahb_gates_data,}, |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 660 | {.compatible = "allwinner,sun4i-apb0-gates-clk", .data = &sun4i_apb0_gates_data,}, |
Maxime Ripard | 2371dd8 | 2013-07-16 11:21:59 +0200 | [diff] [blame] | 661 | {.compatible = "allwinner,sun5i-a10s-apb0-gates-clk", .data = &sun5i_a10s_apb0_gates_data,}, |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 662 | {.compatible = "allwinner,sun5i-a13-apb0-gates-clk", .data = &sun5i_a13_apb0_gates_data,}, |
Maxime Ripard | 1fb2e4a | 2013-07-25 21:06:56 +0200 | [diff] [blame] | 663 | {.compatible = "allwinner,sun7i-a20-apb0-gates-clk", .data = &sun7i_a20_apb0_gates_data,}, |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 664 | {.compatible = "allwinner,sun4i-apb1-gates-clk", .data = &sun4i_apb1_gates_data,}, |
Maxime Ripard | 2371dd8 | 2013-07-16 11:21:59 +0200 | [diff] [blame] | 665 | {.compatible = "allwinner,sun5i-a10s-apb1-gates-clk", .data = &sun5i_a10s_apb1_gates_data,}, |
Maxime Ripard | 4f985b4 | 2013-04-30 11:56:22 +0200 | [diff] [blame] | 666 | {.compatible = "allwinner,sun5i-a13-apb1-gates-clk", .data = &sun5i_a13_apb1_gates_data,}, |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 667 | {.compatible = "allwinner,sun6i-a31-apb1-gates-clk", .data = &sun6i_a31_apb1_gates_data,}, |
Maxime Ripard | 1fb2e4a | 2013-07-25 21:06:56 +0200 | [diff] [blame] | 668 | {.compatible = "allwinner,sun7i-a20-apb1-gates-clk", .data = &sun7i_a20_apb1_gates_data,}, |
Maxime Ripard | 6a721db | 2013-07-23 23:34:10 +0200 | [diff] [blame] | 669 | {.compatible = "allwinner,sun6i-a31-apb2-gates-clk", .data = &sun6i_a31_apb2_gates_data,}, |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 670 | {} |
| 671 | }; |
| 672 | |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 673 | static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_match, |
| 674 | void *function) |
| 675 | { |
| 676 | struct device_node *np; |
| 677 | const struct div_data *data; |
| 678 | const struct of_device_id *match; |
| 679 | void (*setup_function)(struct device_node *, const void *) = function; |
| 680 | |
| 681 | for_each_matching_node(np, clk_match) { |
| 682 | match = of_match_node(clk_match, np); |
| 683 | data = match->data; |
| 684 | setup_function(np, data); |
| 685 | } |
| 686 | } |
| 687 | |
Emilio López | 8e6a4c4 | 2013-09-20 22:03:12 -0300 | [diff] [blame] | 688 | /** |
| 689 | * System clock protection |
| 690 | * |
| 691 | * By enabling these critical clocks, we prevent their accidental gating |
| 692 | * by the framework |
| 693 | */ |
| 694 | static void __init sunxi_clock_protect(void) |
| 695 | { |
| 696 | struct clk *clk; |
| 697 | |
| 698 | /* memory bus clock - sun5i+ */ |
| 699 | clk = clk_get(NULL, "mbus"); |
| 700 | if (!IS_ERR(clk)) { |
| 701 | clk_prepare_enable(clk); |
| 702 | clk_put(clk); |
| 703 | } |
| 704 | |
| 705 | /* DDR clock - sun4i+ */ |
| 706 | clk = clk_get(NULL, "pll5_ddr"); |
| 707 | if (!IS_ERR(clk)) { |
| 708 | clk_prepare_enable(clk); |
| 709 | clk_put(clk); |
| 710 | } |
| 711 | } |
| 712 | |
Mike Turquette | 1d9438f | 2013-12-01 12:42:45 -0800 | [diff] [blame] | 713 | static void __init sunxi_init_clocks(void) |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 714 | { |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 715 | /* Register factor clocks */ |
| 716 | of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup); |
| 717 | |
| 718 | /* Register divider clocks */ |
| 719 | of_sunxi_table_clock_setup(clk_div_match, sunxi_divider_clk_setup); |
| 720 | |
| 721 | /* Register mux clocks */ |
| 722 | of_sunxi_table_clock_setup(clk_mux_match, sunxi_mux_clk_setup); |
Emilio López | 13569a7 | 2013-03-27 18:20:37 -0300 | [diff] [blame] | 723 | |
| 724 | /* Register gate clocks */ |
| 725 | of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup); |
Emilio López | 8e6a4c4 | 2013-09-20 22:03:12 -0300 | [diff] [blame] | 726 | |
| 727 | /* Enable core system clocks */ |
| 728 | sunxi_clock_protect(); |
Emilio López | e874a66 | 2013-02-25 11:44:26 -0300 | [diff] [blame] | 729 | } |
Sebastian Hesselbarth | be08045 | 2013-09-06 14:59:57 +0200 | [diff] [blame] | 730 | CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sunxi_init_clocks); |
| 731 | CLK_OF_DECLARE(sun5i_a10s_clk_init, "allwinner,sun5i-a10s", sunxi_init_clocks); |
| 732 | CLK_OF_DECLARE(sun5i_a13_clk_init, "allwinner,sun5i-a13", sunxi_init_clocks); |
| 733 | CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sunxi_init_clocks); |
| 734 | CLK_OF_DECLARE(sun7i_a20_clk_init, "allwinner,sun7i-a20", sunxi_init_clocks); |