aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/mxs/clk-imx23.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk/mxs/clk-imx23.c')
-rw-r--r--drivers/clk/mxs/clk-imx23.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index b5c06f9766f6..f6a74872f14e 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -15,12 +15,15 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <mach/common.h> 18#include <linux/of_address.h>
19#include <mach/mx23.h>
20#include "clk.h" 19#include "clk.h"
21 20
22#define DIGCTRL MX23_IO_ADDRESS(MX23_DIGCTL_BASE_ADDR) 21static void __iomem *clkctrl;
23#define CLKCTRL MX23_IO_ADDRESS(MX23_CLKCTRL_BASE_ADDR) 22static void __iomem *digctrl;
23
24#define CLKCTRL clkctrl
25#define DIGCTRL digctrl
26
24#define PLLCTRL0 (CLKCTRL + 0x0000) 27#define PLLCTRL0 (CLKCTRL + 0x0000)
25#define CPU (CLKCTRL + 0x0020) 28#define CPU (CLKCTRL + 0x0020)
26#define HBUS (CLKCTRL + 0x0030) 29#define HBUS (CLKCTRL + 0x0030)
@@ -48,10 +51,10 @@ static void __init clk_misc_init(void)
48 u32 val; 51 u32 val;
49 52
50 /* Gate off cpu clock in WFI for power saving */ 53 /* Gate off cpu clock in WFI for power saving */
51 __mxs_setl(1 << BP_CPU_INTERRUPT_WAIT, CPU); 54 writel_relaxed(1 << BP_CPU_INTERRUPT_WAIT, CPU + SET);
52 55
53 /* Clear BYPASS for SAIF */ 56 /* Clear BYPASS for SAIF */
54 __mxs_clrl(1 << BP_CLKSEQ_BYPASS_SAIF, CLKSEQ); 57 writel_relaxed(1 << BP_CLKSEQ_BYPASS_SAIF, CLKSEQ + CLR);
55 58
56 /* SAIF has to use frac div for functional operation */ 59 /* SAIF has to use frac div for functional operation */
57 val = readl_relaxed(SAIF); 60 val = readl_relaxed(SAIF);
@@ -62,14 +65,14 @@ static void __init clk_misc_init(void)
62 * Source ssp clock from ref_io than ref_xtal, 65 * Source ssp clock from ref_io than ref_xtal,
63 * as ref_xtal only provides 24 MHz as maximum. 66 * as ref_xtal only provides 24 MHz as maximum.
64 */ 67 */
65 __mxs_clrl(1 << BP_CLKSEQ_BYPASS_SSP, CLKSEQ); 68 writel_relaxed(1 << BP_CLKSEQ_BYPASS_SSP, CLKSEQ + CLR);
66 69
67 /* 70 /*
68 * 480 MHz seems too high to be ssp clock source directly, 71 * 480 MHz seems too high to be ssp clock source directly,
69 * so set frac to get a 288 MHz ref_io. 72 * so set frac to get a 288 MHz ref_io.
70 */ 73 */
71 __mxs_clrl(0x3f << BP_FRAC_IOFRAC, FRAC); 74 writel_relaxed(0x3f << BP_FRAC_IOFRAC, FRAC + CLR);
72 __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); 75 writel_relaxed(30 << BP_FRAC_IOFRAC, FRAC + SET);
73} 76}
74 77
75static const char *sel_pll[] __initconst = { "pll", "ref_xtal", }; 78static const char *sel_pll[] __initconst = { "pll", "ref_xtal", };
@@ -101,6 +104,14 @@ int __init mx23_clocks_init(void)
101 struct device_node *np; 104 struct device_node *np;
102 u32 i; 105 u32 i;
103 106
107 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
108 digctrl = of_iomap(np, 0);
109 WARN_ON(!digctrl);
110
111 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
112 clkctrl = of_iomap(np, 0);
113 WARN_ON(!clkctrl);
114
104 clk_misc_init(); 115 clk_misc_init();
105 116
106 clks[ref_xtal] = mxs_clk_fixed("ref_xtal", 24000000); 117 clks[ref_xtal] = mxs_clk_fixed("ref_xtal", 24000000);
@@ -153,19 +164,12 @@ int __init mx23_clocks_init(void)
153 return PTR_ERR(clks[i]); 164 return PTR_ERR(clks[i]);
154 } 165 }
155 166
156 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl"); 167 clk_data.clks = clks;
157 if (np) { 168 clk_data.clk_num = ARRAY_SIZE(clks);
158 clk_data.clks = clks; 169 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
159 clk_data.clk_num = ARRAY_SIZE(clks);
160 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
161 }
162
163 clk_register_clkdev(clks[clk32k], NULL, "timrot");
164 170
165 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 171 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
166 clk_prepare_enable(clks[clks_init_on[i]]); 172 clk_prepare_enable(clks[clks_init_on[i]]);
167 173
168 mxs_timer_init();
169
170 return 0; 174 return 0;
171} 175}