aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2013-07-22 12:21:32 -0400
committerMaxime Ripard <maxime.ripard@free-electrons.com>2013-08-26 04:48:44 -0400
commit81ba6c5e7b1c995083ccaab1c74ac9e0be6ef4d1 (patch)
treef21dc60ffe5f81092ee70072a7433fef671647b6
parent431807f0bff97bbfddc7a2497038369ed2b4e508 (diff)
clk: sunxi: Rename the structure to prepare the addition of sun6i
Rename all the generic-named structure to sun4i to avoid confusion when we will introduce the sun6i (A31) clocks. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Emilio López <emilio@elopez.com.ar>
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 12c8dc7fa394..5fac1aa87bdb 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -25,12 +25,12 @@
25static DEFINE_SPINLOCK(clk_lock); 25static DEFINE_SPINLOCK(clk_lock);
26 26
27/** 27/**
28 * sunxi_osc_clk_setup() - Setup function for gatable oscillator 28 * sun4i_osc_clk_setup() - Setup function for gatable oscillator
29 */ 29 */
30 30
31#define SUNXI_OSC24M_GATE 0 31#define SUNXI_OSC24M_GATE 0
32 32
33static void __init sunxi_osc_clk_setup(struct device_node *node) 33static void __init sun4i_osc_clk_setup(struct device_node *node)
34{ 34{
35 struct clk *clk; 35 struct clk *clk;
36 struct clk_fixed_rate *fixed; 36 struct clk_fixed_rate *fixed;
@@ -69,18 +69,18 @@ static void __init sunxi_osc_clk_setup(struct device_node *node)
69 clk_register_clkdev(clk, clk_name, NULL); 69 clk_register_clkdev(clk, clk_name, NULL);
70 } 70 }
71} 71}
72CLK_OF_DECLARE(sunxi_osc, "allwinner,sun4i-osc-clk", sunxi_osc_clk_setup); 72CLK_OF_DECLARE(sun4i_osc, "allwinner,sun4i-osc-clk", sun4i_osc_clk_setup);
73 73
74 74
75 75
76/** 76/**
77 * sunxi_get_pll1_factors() - calculates n, k, m, p factors for PLL1 77 * sun4i_get_pll1_factors() - calculates n, k, m, p factors for PLL1
78 * PLL1 rate is calculated as follows 78 * PLL1 rate is calculated as follows
79 * rate = (parent_rate * n * (k + 1) >> p) / (m + 1); 79 * rate = (parent_rate * n * (k + 1) >> p) / (m + 1);
80 * parent_rate is always 24Mhz 80 * parent_rate is always 24Mhz
81 */ 81 */
82 82
83static void sunxi_get_pll1_factors(u32 *freq, u32 parent_rate, 83static void sun4i_get_pll1_factors(u32 *freq, u32 parent_rate,
84 u8 *n, u8 *k, u8 *m, u8 *p) 84 u8 *n, u8 *k, u8 *m, u8 *p)
85{ 85{
86 u8 div; 86 u8 div;
@@ -128,12 +128,12 @@ static void sunxi_get_pll1_factors(u32 *freq, u32 parent_rate,
128 128
129 129
130/** 130/**
131 * sunxi_get_apb1_factors() - calculates m, p factors for APB1 131 * sun4i_get_apb1_factors() - calculates m, p factors for APB1
132 * APB1 rate is calculated as follows 132 * APB1 rate is calculated as follows
133 * rate = (parent_rate >> p) / (m + 1); 133 * rate = (parent_rate >> p) / (m + 1);
134 */ 134 */
135 135
136static void sunxi_get_apb1_factors(u32 *freq, u32 parent_rate, 136static void sun4i_get_apb1_factors(u32 *freq, u32 parent_rate,
137 u8 *n, u8 *k, u8 *m, u8 *p) 137 u8 *n, u8 *k, u8 *m, u8 *p)
138{ 138{
139 u8 calcm, calcp; 139 u8 calcm, calcp;
@@ -179,7 +179,7 @@ struct factors_data {
179 void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p); 179 void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
180}; 180};
181 181
182static struct clk_factors_config pll1_config = { 182static struct clk_factors_config sun4i_pll1_config = {
183 .nshift = 8, 183 .nshift = 8,
184 .nwidth = 5, 184 .nwidth = 5,
185 .kshift = 4, 185 .kshift = 4,
@@ -190,21 +190,21 @@ static struct clk_factors_config pll1_config = {
190 .pwidth = 2, 190 .pwidth = 2,
191}; 191};
192 192
193static struct clk_factors_config apb1_config = { 193static struct clk_factors_config sun4i_apb1_config = {
194 .mshift = 0, 194 .mshift = 0,
195 .mwidth = 5, 195 .mwidth = 5,
196 .pshift = 16, 196 .pshift = 16,
197 .pwidth = 2, 197 .pwidth = 2,
198}; 198};
199 199
200static const __initconst struct factors_data pll1_data = { 200static const __initconst struct factors_data sun4i_pll1_data = {
201 .table = &pll1_config, 201 .table = &sun4i_pll1_config,
202 .getter = sunxi_get_pll1_factors, 202 .getter = sun4i_get_pll1_factors,
203}; 203};
204 204
205static const __initconst struct factors_data apb1_data = { 205static const __initconst struct factors_data sun4i_apb1_data = {
206 .table = &apb1_config, 206 .table = &sun4i_apb1_config,
207 .getter = sunxi_get_apb1_factors, 207 .getter = sun4i_get_apb1_factors,
208}; 208};
209 209
210static void __init sunxi_factors_clk_setup(struct device_node *node, 210static void __init sunxi_factors_clk_setup(struct device_node *node,
@@ -240,11 +240,11 @@ struct mux_data {
240 u8 shift; 240 u8 shift;
241}; 241};
242 242
243static const __initconst struct mux_data cpu_mux_data = { 243static const __initconst struct mux_data sun4i_cpu_mux_data = {
244 .shift = 16, 244 .shift = 16,
245}; 245};
246 246
247static const __initconst struct mux_data apb1_mux_data = { 247static const __initconst struct mux_data sun4i_apb1_mux_data = {
248 .shift = 24, 248 .shift = 24,
249}; 249};
250 250
@@ -286,17 +286,17 @@ struct div_data {
286 u8 pow; 286 u8 pow;
287}; 287};
288 288
289static const __initconst struct div_data axi_data = { 289static const __initconst struct div_data sun4i_axi_data = {
290 .shift = 0, 290 .shift = 0,
291 .pow = 0, 291 .pow = 0,
292}; 292};
293 293
294static const __initconst struct div_data ahb_data = { 294static const __initconst struct div_data sun4i_ahb_data = {
295 .shift = 4, 295 .shift = 4,
296 .pow = 1, 296 .pow = 1,
297}; 297};
298 298
299static const __initconst struct div_data apb0_data = { 299static const __initconst struct div_data sun4i_apb0_data = {
300 .shift = 8, 300 .shift = 8,
301 .pow = 1, 301 .pow = 1,
302}; 302};
@@ -426,23 +426,23 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,
426 426
427/* Matches for factors clocks */ 427/* Matches for factors clocks */
428static const __initconst struct of_device_id clk_factors_match[] = { 428static const __initconst struct of_device_id clk_factors_match[] = {
429 {.compatible = "allwinner,sun4i-pll1-clk", .data = &pll1_data,}, 429 {.compatible = "allwinner,sun4i-pll1-clk", .data = &sun4i_pll1_data,},
430 {.compatible = "allwinner,sun4i-apb1-clk", .data = &apb1_data,}, 430 {.compatible = "allwinner,sun4i-apb1-clk", .data = &sun4i_apb1_data,},
431 {} 431 {}
432}; 432};
433 433
434/* Matches for divider clocks */ 434/* Matches for divider clocks */
435static const __initconst struct of_device_id clk_div_match[] = { 435static const __initconst struct of_device_id clk_div_match[] = {
436 {.compatible = "allwinner,sun4i-axi-clk", .data = &axi_data,}, 436 {.compatible = "allwinner,sun4i-axi-clk", .data = &sun4i_axi_data,},
437 {.compatible = "allwinner,sun4i-ahb-clk", .data = &ahb_data,}, 437 {.compatible = "allwinner,sun4i-ahb-clk", .data = &sun4i_ahb_data,},
438 {.compatible = "allwinner,sun4i-apb0-clk", .data = &apb0_data,}, 438 {.compatible = "allwinner,sun4i-apb0-clk", .data = &sun4i_apb0_data,},
439 {} 439 {}
440}; 440};
441 441
442/* Matches for mux clocks */ 442/* Matches for mux clocks */
443static const __initconst struct of_device_id clk_mux_match[] = { 443static const __initconst struct of_device_id clk_mux_match[] = {
444 {.compatible = "allwinner,sun4i-cpu-clk", .data = &cpu_mux_data,}, 444 {.compatible = "allwinner,sun4i-cpu-clk", .data = &sun4i_cpu_mux_data,},
445 {.compatible = "allwinner,sun4i-apb1-mux-clk", .data = &apb1_mux_data,}, 445 {.compatible = "allwinner,sun4i-apb1-mux-clk", .data = &sun4i_apb1_mux_data,},
446 {} 446 {}
447}; 447};
448 448