18 #include <mach/common.h>
22 #define CLKCTRL MX28_IO_ADDRESS(MX28_CLKCTRL_BASE_ADDR)
23 #define PLL0CTRL0 (CLKCTRL + 0x0000)
24 #define PLL1CTRL0 (CLKCTRL + 0x0020)
25 #define PLL2CTRL0 (CLKCTRL + 0x0040)
26 #define CPU (CLKCTRL + 0x0050)
27 #define HBUS (CLKCTRL + 0x0060)
28 #define XBUS (CLKCTRL + 0x0070)
29 #define XTAL (CLKCTRL + 0x0080)
30 #define SSP0 (CLKCTRL + 0x0090)
31 #define SSP1 (CLKCTRL + 0x00a0)
32 #define SSP2 (CLKCTRL + 0x00b0)
33 #define SSP3 (CLKCTRL + 0x00c0)
34 #define GPMI (CLKCTRL + 0x00d0)
35 #define SPDIF (CLKCTRL + 0x00e0)
36 #define EMI (CLKCTRL + 0x00f0)
37 #define SAIF0 (CLKCTRL + 0x0100)
38 #define SAIF1 (CLKCTRL + 0x0110)
39 #define LCDIF (CLKCTRL + 0x0120)
40 #define ETM (CLKCTRL + 0x0130)
41 #define ENET (CLKCTRL + 0x0140)
42 #define FLEXCAN (CLKCTRL + 0x0160)
43 #define FRAC0 (CLKCTRL + 0x01b0)
44 #define FRAC1 (CLKCTRL + 0x01c0)
45 #define CLKSEQ (CLKCTRL + 0x01d0)
47 #define BP_CPU_INTERRUPT_WAIT 12
48 #define BP_SAIF_DIV_FRAC_EN 16
49 #define BP_ENET_DIV_TIME 21
50 #define BP_ENET_SLEEP 31
51 #define BP_CLKSEQ_BYPASS_SAIF0 0
52 #define BP_CLKSEQ_BYPASS_SSP0 3
53 #define BP_FRAC0_IO1FRAC 16
54 #define BP_FRAC0_IO0FRAC 24
56 #define DIGCTRL MX28_IO_ADDRESS(MX28_DIGCTL_BASE_ADDR)
57 #define BP_SAIF_CLKMUX 10
81 static void __init clk_misc_init(
void)
97 writel_relaxed(val,
SAIF0);
101 writel_relaxed(val,
SAIF1);
106 writel_relaxed(val,
ENET);
121 writel_relaxed(val,
FRAC0);
124 static const char *sel_cpu[]
__initconst = {
"ref_cpu",
"ref_xtal", };
125 static const char *sel_io0[] __initconst = {
"ref_io0",
"ref_xtal", };
126 static const char *sel_io1[] __initconst = {
"ref_io1",
"ref_xtal", };
127 static const char *sel_pix[] __initconst = {
"ref_pix",
"ref_xtal", };
128 static const char *sel_gpmi[] __initconst = {
"ref_gpmi",
"ref_xtal", };
129 static const char *sel_pll0[] __initconst = {
"pll0",
"ref_xtal", };
130 static const char *cpu_sels[] __initconst = {
"cpu_pll",
"cpu_xtal", };
131 static const char *emi_sels[] __initconst = {
"emi_pll",
"emi_xtal", };
132 static const char *ptp_sels[] __initconst = {
"ref_xtal",
"pll0", };
142 ssp1,
ssp2,
ssp3,
gpmi,
spdif,
emi,
saif0,
saif1,
lcdif,
etm,
148 static struct clk_onecell_data clk_data;
161 clks[
ref_xtal] = mxs_clk_fixed(
"ref_xtal", 24000000);
200 clks[
clk32k_div] = mxs_clk_fixed_factor(
"clk32k_div",
"ref_xtal", 1, 750);
201 clks[
rtc] = mxs_clk_fixed_factor(
"rtc",
"ref_xtal", 1, 768);
202 clks[
lradc] = mxs_clk_fixed_factor(
"lradc",
"clk32k", 1, 16);
203 clks[
spdif_div] = mxs_clk_fixed_factor(
"spdif_div",
"pll0", 1, 4);
204 clks[
clk32k] = mxs_clk_gate(
"clk32k",
"clk32k_div",
XTAL, 26);
205 clks[
pwm] = mxs_clk_gate(
"pwm",
"ref_xtal",
XTAL, 29);
206 clks[
uart] = mxs_clk_gate(
"uart",
"ref_xtal",
XTAL, 31);
207 clks[
ssp0] = mxs_clk_gate(
"ssp0",
"ssp0_div",
SSP0, 31);
208 clks[
ssp1] = mxs_clk_gate(
"ssp1",
"ssp1_div",
SSP1, 31);
209 clks[
ssp2] = mxs_clk_gate(
"ssp2",
"ssp2_div",
SSP2, 31);
210 clks[
ssp3] = mxs_clk_gate(
"ssp3",
"ssp3_div",
SSP3, 31);
211 clks[
gpmi] = mxs_clk_gate(
"gpmi",
"gpmi_div",
GPMI, 31);
212 clks[
spdif] = mxs_clk_gate(
"spdif",
"spdif_div",
SPDIF, 31);
213 clks[
emi] = mxs_clk_gate(
"emi",
"emi_sel",
EMI, 31);
214 clks[
saif0] = mxs_clk_gate(
"saif0",
"saif0_div",
SAIF0, 31);
215 clks[
saif1] = mxs_clk_gate(
"saif1",
"saif1_div",
SAIF1, 31);
216 clks[
lcdif] = mxs_clk_gate(
"lcdif",
"lcdif_div",
LCDIF, 31);
217 clks[
etm] = mxs_clk_gate(
"etm",
"etm_div",
ETM, 31);
218 clks[
fec] = mxs_clk_gate(
"fec",
"hbus",
ENET, 30);
219 clks[
can0] = mxs_clk_gate(
"can0",
"ref_xtal",
FLEXCAN, 30);
220 clks[
can1] = mxs_clk_gate(
"can1",
"ref_xtal",
FLEXCAN, 28);
221 clks[
usb0] = mxs_clk_gate(
"usb0",
"usb0_pwr",
DIGCTRL, 2);
222 clks[
usb1] = mxs_clk_gate(
"usb1",
"usb1_pwr",
DIGCTRL, 16);
228 if (IS_ERR(clks[i])) {
229 pr_err(
"i.MX28 clk %d: register failed with %ld\n",
230 i, PTR_ERR(clks[i]));
231 return PTR_ERR(clks[i]);
236 clk_data.clks = clks;
238 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
244 for (i = 0; i <
ARRAY_SIZE(clks_init_on); i++)
245 clk_prepare_enable(clks[clks_init_on[i]]);