diff options
-rw-r--r-- | arch/arm/mach-imx/clk-imx25.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-imx/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx25-dt.c | 6 |
3 files changed, 20 insertions, 22 deletions
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index e759a6da9407..cab34c3e820b 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include "hardware.h" | 32 | #include "hardware.h" |
33 | #include "mx25.h" | 33 | #include "mx25.h" |
34 | 34 | ||
35 | #define CRM_BASE MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR) | ||
36 | |||
37 | #define CCM_MPCTL 0x00 | 35 | #define CCM_MPCTL 0x00 |
38 | #define CCM_UPCTL 0x04 | 36 | #define CCM_UPCTL 0x04 |
39 | #define CCM_CCTL 0x08 | 37 | #define CCM_CCTL 0x08 |
@@ -56,7 +54,7 @@ | |||
56 | #define CCM_LTR3 0x4c | 54 | #define CCM_LTR3 0x4c |
57 | #define CCM_MCR 0x64 | 55 | #define CCM_MCR 0x64 |
58 | 56 | ||
59 | #define ccm(x) (CRM_BASE + (x)) | 57 | #define ccm(x) (ccm_base + (x)) |
60 | 58 | ||
61 | static struct clk_onecell_data clk_data; | 59 | static struct clk_onecell_data clk_data; |
62 | 60 | ||
@@ -91,8 +89,11 @@ enum mx25_clks { | |||
91 | 89 | ||
92 | static struct clk *clk[clk_max]; | 90 | static struct clk *clk[clk_max]; |
93 | 91 | ||
94 | static int __init __mx25_clocks_init(unsigned long osc_rate) | 92 | static int __init __mx25_clocks_init(unsigned long osc_rate, |
93 | void __iomem *ccm_base) | ||
95 | { | 94 | { |
95 | BUG_ON(!ccm_base); | ||
96 | |||
96 | clk[dummy] = imx_clk_fixed("dummy", 0); | 97 | clk[dummy] = imx_clk_fixed("dummy", 0); |
97 | clk[osc] = imx_clk_fixed("osc", osc_rate); | 98 | clk[osc] = imx_clk_fixed("osc", osc_rate); |
98 | clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL)); | 99 | clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL)); |
@@ -240,7 +241,11 @@ static int __init __mx25_clocks_init(unsigned long osc_rate) | |||
240 | 241 | ||
241 | int __init mx25_clocks_init(void) | 242 | int __init mx25_clocks_init(void) |
242 | { | 243 | { |
243 | __mx25_clocks_init(24000000); | 244 | void __iomem *ccm; |
245 | |||
246 | ccm = ioremap(MX25_CRM_BASE_ADDR, SZ_16K); | ||
247 | |||
248 | __mx25_clocks_init(24000000, ccm); | ||
244 | 249 | ||
245 | clk_register_clkdev(clk[gpt1_ipg], "ipg", "imx-gpt.0"); | 250 | clk_register_clkdev(clk[gpt1_ipg], "ipg", "imx-gpt.0"); |
246 | clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); | 251 | clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); |
@@ -308,29 +313,29 @@ int __init mx25_clocks_init(void) | |||
308 | return 0; | 313 | return 0; |
309 | } | 314 | } |
310 | 315 | ||
311 | int __init mx25_clocks_init_dt(void) | 316 | static void __init mx25_clocks_init_dt(struct device_node *np) |
312 | { | 317 | { |
313 | struct device_node *np; | 318 | struct device_node *refnp; |
314 | unsigned long osc_rate = 24000000; | 319 | unsigned long osc_rate = 24000000; |
320 | void __iomem *ccm; | ||
315 | 321 | ||
316 | /* retrieve the freqency of fixed clocks from device tree */ | 322 | /* retrieve the freqency of fixed clocks from device tree */ |
317 | for_each_compatible_node(np, NULL, "fixed-clock") { | 323 | for_each_compatible_node(refnp, NULL, "fixed-clock") { |
318 | u32 rate; | 324 | u32 rate; |
319 | if (of_property_read_u32(np, "clock-frequency", &rate)) | 325 | if (of_property_read_u32(refnp, "clock-frequency", &rate)) |
320 | continue; | 326 | continue; |
321 | 327 | ||
322 | if (of_device_is_compatible(np, "fsl,imx-osc")) | 328 | if (of_device_is_compatible(refnp, "fsl,imx-osc")) |
323 | osc_rate = rate; | 329 | osc_rate = rate; |
324 | } | 330 | } |
325 | 331 | ||
326 | np = of_find_compatible_node(NULL, NULL, "fsl,imx25-ccm"); | 332 | ccm = of_iomap(np, 0); |
333 | __mx25_clocks_init(osc_rate, ccm); | ||
334 | |||
327 | clk_data.clks = clk; | 335 | clk_data.clks = clk; |
328 | clk_data.clk_num = ARRAY_SIZE(clk); | 336 | clk_data.clk_num = ARRAY_SIZE(clk); |
329 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 337 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
330 | 338 | ||
331 | __mx25_clocks_init(osc_rate); | ||
332 | |||
333 | mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt")); | 339 | mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt")); |
334 | |||
335 | return 0; | ||
336 | } | 340 | } |
341 | CLK_OF_DECLARE(imx25_ccm, "fsl,imx25-ccm", mx25_clocks_init_dt); | ||
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index d205f362cf29..e0632d1890ac 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h | |||
@@ -55,7 +55,6 @@ int mx25_clocks_init(void); | |||
55 | int mx27_clocks_init(unsigned long fref); | 55 | int mx27_clocks_init(unsigned long fref); |
56 | int mx31_clocks_init(unsigned long fref); | 56 | int mx31_clocks_init(unsigned long fref); |
57 | int mx35_clocks_init(void); | 57 | int mx35_clocks_init(void); |
58 | int mx25_clocks_init_dt(void); | ||
59 | int mx31_clocks_init_dt(void); | 58 | int mx31_clocks_init_dt(void); |
60 | struct platform_device *mxc_register_gpio(char *name, int id, | 59 | struct platform_device *mxc_register_gpio(char *name, int id, |
61 | resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); | 60 | resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); |
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c index 42a65e067443..cf8032bae277 100644 --- a/arch/arm/mach-imx/imx25-dt.c +++ b/arch/arm/mach-imx/imx25-dt.c | |||
@@ -29,16 +29,10 @@ static const char * const imx25_dt_board_compat[] __initconst = { | |||
29 | NULL | 29 | NULL |
30 | }; | 30 | }; |
31 | 31 | ||
32 | static void __init imx25_timer_init(void) | ||
33 | { | ||
34 | mx25_clocks_init_dt(); | ||
35 | } | ||
36 | |||
37 | DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") | 32 | DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") |
38 | .map_io = mx25_map_io, | 33 | .map_io = mx25_map_io, |
39 | .init_early = imx25_init_early, | 34 | .init_early = imx25_init_early, |
40 | .init_irq = mx25_init_irq, | 35 | .init_irq = mx25_init_irq, |
41 | .init_time = imx25_timer_init, | ||
42 | .init_machine = imx25_dt_init, | 36 | .init_machine = imx25_dt_init, |
43 | .dt_compat = imx25_dt_board_compat, | 37 | .dt_compat = imx25_dt_board_compat, |
44 | .restart = mxc_restart, | 38 | .restart = mxc_restart, |