diff options
author | viresh kumar <viresh.kumar@st.com> | 2011-02-16 01:40:31 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-03-09 04:49:45 -0500 |
commit | cf285434ac0880f94bf4afdd90b06a4655f56570 (patch) | |
tree | 6b7b0f6716c17147e45cca39d01f88570d368eb5 /arch/arm/mach-spear6xx | |
parent | 5c881d9ae9480171f01921585e1893863d7ab421 (diff) |
ARM: 6679/1: SPEAr: make clk API functions more generic
- Add a dummy clk_set_rate() function. This is required for compilation
of a few drivers.
- Make functions in plat-spear/clock.c more generic over all SPEAr
platforms.
- Add div_factor in struct clk for clks with .recalc = follow_parent
- Change type of register pointers to void __iomem *
Reviewed-by: Stanley Miao <stanley.miao@windriver.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-spear6xx')
-rw-r--r-- | arch/arm/mach-spear6xx/clock.c | 67 |
1 files changed, 59 insertions, 8 deletions
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c index 36ff056b7321..ef88922986e0 100644 --- a/arch/arm/mach-spear6xx/clock.c +++ b/arch/arm/mach-spear6xx/clock.c | |||
@@ -39,10 +39,25 @@ static struct clk rtc_clk = { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* clock derived from 30 MHz osc clk */ | 41 | /* clock derived from 30 MHz osc clk */ |
42 | /* pll masks structure */ | ||
43 | static struct pll_clk_masks pll1_masks = { | ||
44 | .mode_mask = PLL_MODE_MASK, | ||
45 | .mode_shift = PLL_MODE_SHIFT, | ||
46 | .norm_fdbk_m_mask = PLL_NORM_FDBK_M_MASK, | ||
47 | .norm_fdbk_m_shift = PLL_NORM_FDBK_M_SHIFT, | ||
48 | .dith_fdbk_m_mask = PLL_DITH_FDBK_M_MASK, | ||
49 | .dith_fdbk_m_shift = PLL_DITH_FDBK_M_SHIFT, | ||
50 | .div_p_mask = PLL_DIV_P_MASK, | ||
51 | .div_p_shift = PLL_DIV_P_SHIFT, | ||
52 | .div_n_mask = PLL_DIV_N_MASK, | ||
53 | .div_n_shift = PLL_DIV_N_SHIFT, | ||
54 | }; | ||
55 | |||
42 | /* pll1 configuration structure */ | 56 | /* pll1 configuration structure */ |
43 | static struct pll_clk_config pll1_config = { | 57 | static struct pll_clk_config pll1_config = { |
44 | .mode_reg = PLL1_CTR, | 58 | .mode_reg = PLL1_CTR, |
45 | .cfg_reg = PLL1_FRQ, | 59 | .cfg_reg = PLL1_FRQ, |
60 | .masks = &pll1_masks, | ||
46 | }; | 61 | }; |
47 | 62 | ||
48 | /* PLL1 clock */ | 63 | /* PLL1 clock */ |
@@ -50,7 +65,7 @@ static struct clk pll1_clk = { | |||
50 | .pclk = &osc_30m_clk, | 65 | .pclk = &osc_30m_clk, |
51 | .en_reg = PLL1_CTR, | 66 | .en_reg = PLL1_CTR, |
52 | .en_reg_bit = PLL_ENABLE, | 67 | .en_reg_bit = PLL_ENABLE, |
53 | .recalc = &pll1_clk_recalc, | 68 | .recalc = &pll_clk_recalc, |
54 | .private_data = &pll1_config, | 69 | .private_data = &pll1_config, |
55 | }; | 70 | }; |
56 | 71 | ||
@@ -76,11 +91,16 @@ static struct clk cpu_clk = { | |||
76 | .recalc = &follow_parent, | 91 | .recalc = &follow_parent, |
77 | }; | 92 | }; |
78 | 93 | ||
94 | /* ahb masks structure */ | ||
95 | static struct bus_clk_masks ahb_masks = { | ||
96 | .mask = PLL_HCLK_RATIO_MASK, | ||
97 | .shift = PLL_HCLK_RATIO_SHIFT, | ||
98 | }; | ||
99 | |||
79 | /* ahb configuration structure */ | 100 | /* ahb configuration structure */ |
80 | static struct bus_clk_config ahb_config = { | 101 | static struct bus_clk_config ahb_config = { |
81 | .reg = CORE_CLK_CFG, | 102 | .reg = CORE_CLK_CFG, |
82 | .mask = PLL_HCLK_RATIO_MASK, | 103 | .masks = &ahb_masks, |
83 | .shift = PLL_HCLK_RATIO_SHIFT, | ||
84 | }; | 104 | }; |
85 | 105 | ||
86 | /* ahb clock */ | 106 | /* ahb clock */ |
@@ -112,9 +132,22 @@ static struct pclk_sel uart_pclk_sel = { | |||
112 | .pclk_sel_mask = UART_CLK_MASK, | 132 | .pclk_sel_mask = UART_CLK_MASK, |
113 | }; | 133 | }; |
114 | 134 | ||
135 | /* auxiliary synthesizers masks */ | ||
136 | static struct aux_clk_masks aux_masks = { | ||
137 | .eq_sel_mask = AUX_EQ_SEL_MASK, | ||
138 | .eq_sel_shift = AUX_EQ_SEL_SHIFT, | ||
139 | .eq1_mask = AUX_EQ1_SEL, | ||
140 | .eq2_mask = AUX_EQ2_SEL, | ||
141 | .xscale_sel_mask = AUX_XSCALE_MASK, | ||
142 | .xscale_sel_shift = AUX_XSCALE_SHIFT, | ||
143 | .yscale_sel_mask = AUX_YSCALE_MASK, | ||
144 | .yscale_sel_shift = AUX_YSCALE_SHIFT, | ||
145 | }; | ||
146 | |||
115 | /* uart configurations */ | 147 | /* uart configurations */ |
116 | static struct aux_clk_config uart_config = { | 148 | static struct aux_clk_config uart_config = { |
117 | .synth_reg = UART_CLK_SYNT, | 149 | .synth_reg = UART_CLK_SYNT, |
150 | .masks = &aux_masks, | ||
118 | }; | 151 | }; |
119 | 152 | ||
120 | /* uart0 clock */ | 153 | /* uart0 clock */ |
@@ -140,6 +173,7 @@ static struct clk uart1_clk = { | |||
140 | /* firda configurations */ | 173 | /* firda configurations */ |
141 | static struct aux_clk_config firda_config = { | 174 | static struct aux_clk_config firda_config = { |
142 | .synth_reg = FIRDA_CLK_SYNT, | 175 | .synth_reg = FIRDA_CLK_SYNT, |
176 | .masks = &aux_masks, | ||
143 | }; | 177 | }; |
144 | 178 | ||
145 | /* firda parents */ | 179 | /* firda parents */ |
@@ -176,6 +210,7 @@ static struct clk firda_clk = { | |||
176 | /* clcd configurations */ | 210 | /* clcd configurations */ |
177 | static struct aux_clk_config clcd_config = { | 211 | static struct aux_clk_config clcd_config = { |
178 | .synth_reg = CLCD_CLK_SYNT, | 212 | .synth_reg = CLCD_CLK_SYNT, |
213 | .masks = &aux_masks, | ||
179 | }; | 214 | }; |
180 | 215 | ||
181 | /* clcd parents */ | 216 | /* clcd parents */ |
@@ -230,9 +265,18 @@ static struct pclk_sel gpt_pclk_sel = { | |||
230 | .pclk_sel_mask = GPT_CLK_MASK, | 265 | .pclk_sel_mask = GPT_CLK_MASK, |
231 | }; | 266 | }; |
232 | 267 | ||
268 | /* gpt synthesizer masks */ | ||
269 | static struct gpt_clk_masks gpt_masks = { | ||
270 | .mscale_sel_mask = GPT_MSCALE_MASK, | ||
271 | .mscale_sel_shift = GPT_MSCALE_SHIFT, | ||
272 | .nscale_sel_mask = GPT_NSCALE_MASK, | ||
273 | .nscale_sel_shift = GPT_NSCALE_SHIFT, | ||
274 | }; | ||
275 | |||
233 | /* gpt0_1 configurations */ | 276 | /* gpt0_1 configurations */ |
234 | static struct aux_clk_config gpt0_1_config = { | 277 | static struct gpt_clk_config gpt0_1_config = { |
235 | .synth_reg = PRSC1_CLK_CFG, | 278 | .synth_reg = PRSC1_CLK_CFG, |
279 | .masks = &gpt_masks, | ||
236 | }; | 280 | }; |
237 | 281 | ||
238 | /* gpt0 ARM1 subsystem timer clock */ | 282 | /* gpt0 ARM1 subsystem timer clock */ |
@@ -254,8 +298,9 @@ static struct clk gpt1_clk = { | |||
254 | }; | 298 | }; |
255 | 299 | ||
256 | /* gpt2 configurations */ | 300 | /* gpt2 configurations */ |
257 | static struct aux_clk_config gpt2_config = { | 301 | static struct gpt_clk_config gpt2_config = { |
258 | .synth_reg = PRSC2_CLK_CFG, | 302 | .synth_reg = PRSC2_CLK_CFG, |
303 | .masks = &gpt_masks, | ||
259 | }; | 304 | }; |
260 | 305 | ||
261 | /* gpt2 timer clock */ | 306 | /* gpt2 timer clock */ |
@@ -269,8 +314,9 @@ static struct clk gpt2_clk = { | |||
269 | }; | 314 | }; |
270 | 315 | ||
271 | /* gpt3 configurations */ | 316 | /* gpt3 configurations */ |
272 | static struct aux_clk_config gpt3_config = { | 317 | static struct gpt_clk_config gpt3_config = { |
273 | .synth_reg = PRSC3_CLK_CFG, | 318 | .synth_reg = PRSC3_CLK_CFG, |
319 | .masks = &gpt_masks, | ||
274 | }; | 320 | }; |
275 | 321 | ||
276 | /* gpt3 timer clock */ | 322 | /* gpt3 timer clock */ |
@@ -309,11 +355,16 @@ static struct clk usbd_clk = { | |||
309 | }; | 355 | }; |
310 | 356 | ||
311 | /* clock derived from ahb clk */ | 357 | /* clock derived from ahb clk */ |
358 | /* apb masks structure */ | ||
359 | static struct bus_clk_masks apb_masks = { | ||
360 | .mask = HCLK_PCLK_RATIO_MASK, | ||
361 | .shift = HCLK_PCLK_RATIO_SHIFT, | ||
362 | }; | ||
363 | |||
312 | /* apb configuration structure */ | 364 | /* apb configuration structure */ |
313 | static struct bus_clk_config apb_config = { | 365 | static struct bus_clk_config apb_config = { |
314 | .reg = CORE_CLK_CFG, | 366 | .reg = CORE_CLK_CFG, |
315 | .mask = HCLK_PCLK_RATIO_MASK, | 367 | .masks = &apb_masks, |
316 | .shift = HCLK_PCLK_RATIO_SHIFT, | ||
317 | }; | 368 | }; |
318 | 369 | ||
319 | /* apb clock */ | 370 | /* apb clock */ |