diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh4a/clock-sh7724.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7724.c | 124 |
1 files changed, 63 insertions, 61 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c index 5d5c9b952883..dfe9192be63e 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <asm/clock.h> | 24 | #include <asm/clock.h> |
25 | #include <asm/hwblk.h> | ||
26 | #include <cpu/sh7724.h> | ||
25 | 27 | ||
26 | /* SH7724 registers */ | 28 | /* SH7724 registers */ |
27 | #define FRQCRA 0xa4150000 | 29 | #define FRQCRA 0xa4150000 |
@@ -31,9 +33,6 @@ | |||
31 | #define FCLKBCR 0xa415000c | 33 | #define FCLKBCR 0xa415000c |
32 | #define IRDACLKCR 0xa4150018 | 34 | #define IRDACLKCR 0xa4150018 |
33 | #define PLLCR 0xa4150024 | 35 | #define PLLCR 0xa4150024 |
34 | #define MSTPCR0 0xa4150030 | ||
35 | #define MSTPCR1 0xa4150034 | ||
36 | #define MSTPCR2 0xa4150038 | ||
37 | #define SPUCLKCR 0xa415003c | 36 | #define SPUCLKCR 0xa415003c |
38 | #define FLLFRQ 0xa4150050 | 37 | #define FLLFRQ 0xa4150050 |
39 | #define LSTATS 0xa4150060 | 38 | #define LSTATS 0xa4150060 |
@@ -128,7 +127,7 @@ struct clk *main_clks[] = { | |||
128 | &div3_clk, | 127 | &div3_clk, |
129 | }; | 128 | }; |
130 | 129 | ||
131 | static int divisors[] = { 2, 0, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 }; | 130 | static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 }; |
132 | 131 | ||
133 | static struct clk_div_mult_table div4_table = { | 132 | static struct clk_div_mult_table div4_table = { |
134 | .divisors = divisors, | 133 | .divisors = divisors, |
@@ -156,64 +155,67 @@ struct clk div6_clks[] = { | |||
156 | SH_CLK_DIV6("spu_clk", &div3_clk, SPUCLKCR, 0), | 155 | SH_CLK_DIV6("spu_clk", &div3_clk, SPUCLKCR, 0), |
157 | }; | 156 | }; |
158 | 157 | ||
159 | #define MSTP(_str, _parent, _reg, _bit, _force_on, _need_cpg, _need_ram) \ | 158 | #define R_CLK (&r_clk) |
160 | SH_CLK_MSTP32(_str, -1, _parent, _reg, _bit, _force_on * CLK_ENABLE_ON_INIT) | 159 | #define P_CLK (&div4_clks[DIV4_P]) |
160 | #define B_CLK (&div4_clks[DIV4_B]) | ||
161 | #define I_CLK (&div4_clks[DIV4_I]) | ||
162 | #define SH_CLK (&div4_clks[DIV4_SH]) | ||
161 | 163 | ||
162 | static struct clk mstp_clks[] = { | 164 | static struct clk mstp_clks[] = { |
163 | MSTP("tlb0", &div4_clks[DIV4_I], MSTPCR0, 31, 1, 1, 0), | 165 | SH_HWBLK_CLK("tlb0", -1, I_CLK, HWBLK_TLB, CLK_ENABLE_ON_INIT), |
164 | MSTP("ic0", &div4_clks[DIV4_I], MSTPCR0, 30, 1, 1, 0), | 166 | SH_HWBLK_CLK("ic0", -1, I_CLK, HWBLK_IC, CLK_ENABLE_ON_INIT), |
165 | MSTP("oc0", &div4_clks[DIV4_I], MSTPCR0, 29, 1, 1, 0), | 167 | SH_HWBLK_CLK("oc0", -1, I_CLK, HWBLK_OC, CLK_ENABLE_ON_INIT), |
166 | MSTP("rs0", &div4_clks[DIV4_B], MSTPCR0, 28, 1, 1, 0), | 168 | SH_HWBLK_CLK("rs0", -1, B_CLK, HWBLK_RSMEM, CLK_ENABLE_ON_INIT), |
167 | MSTP("ilmem0", &div4_clks[DIV4_I], MSTPCR0, 27, 1, 1, 0), | 169 | SH_HWBLK_CLK("ilmem0", -1, I_CLK, HWBLK_ILMEM, CLK_ENABLE_ON_INIT), |
168 | MSTP("l2c0", &div4_clks[DIV4_SH], MSTPCR0, 26, 1, 1, 0), | 170 | SH_HWBLK_CLK("l2c0", -1, SH_CLK, HWBLK_L2C, CLK_ENABLE_ON_INIT), |
169 | MSTP("fpu0", &div4_clks[DIV4_I], MSTPCR0, 24, 1, 1, 0), | 171 | SH_HWBLK_CLK("fpu0", -1, I_CLK, HWBLK_FPU, CLK_ENABLE_ON_INIT), |
170 | MSTP("intc0", &div4_clks[DIV4_P], MSTPCR0, 22, 1, 1, 0), | 172 | SH_HWBLK_CLK("intc0", -1, P_CLK, HWBLK_INTC, CLK_ENABLE_ON_INIT), |
171 | MSTP("dmac0", &div4_clks[DIV4_B], MSTPCR0, 21, 0, 1, 1), | 173 | SH_HWBLK_CLK("dmac0", -1, B_CLK, HWBLK_DMAC0, 0), |
172 | MSTP("sh0", &div4_clks[DIV4_SH], MSTPCR0, 20, 0, 1, 0), | 174 | SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT), |
173 | MSTP("hudi0", &div4_clks[DIV4_P], MSTPCR0, 19, 0, 1, 0), | 175 | SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0), |
174 | MSTP("ubc0", &div4_clks[DIV4_I], MSTPCR0, 17, 0, 1, 0), | 176 | SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0), |
175 | MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0, 1, 0), | 177 | SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU0, 0), |
176 | MSTP("cmt0", &r_clk, MSTPCR0, 14, 0, 0, 0), | 178 | SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0), |
177 | MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0, 0, 0), | 179 | SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0), |
178 | MSTP("dmac1", &div4_clks[DIV4_B], MSTPCR0, 12, 0, 1, 1), | 180 | SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0), |
179 | MSTP("tmu1", &div4_clks[DIV4_P], MSTPCR0, 10, 0, 1, 0), | 181 | SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0), |
180 | MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 9, 0, 1, 0), | 182 | SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0), |
181 | MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 8, 0, 1, 0), | 183 | SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0), |
182 | MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 7, 0, 1, 0), | 184 | SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0), |
183 | MSTP("scif3", &div4_clks[DIV4_B], MSTPCR0, 6, 0, 1, 0), | 185 | SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0), |
184 | MSTP("scif4", &div4_clks[DIV4_B], MSTPCR0, 5, 0, 1, 0), | 186 | SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0), |
185 | MSTP("scif5", &div4_clks[DIV4_B], MSTPCR0, 4, 0, 1, 0), | 187 | SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0), |
186 | MSTP("msiof0", &div4_clks[DIV4_B], MSTPCR0, 2, 0, 1, 0), | 188 | SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0), |
187 | MSTP("msiof1", &div4_clks[DIV4_B], MSTPCR0, 1, 0, 1, 0), | 189 | SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0), |
188 | 190 | ||
189 | MSTP("keysc0", &r_clk, MSTPCR1, 12, 0, 0, 0), | 191 | SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0), |
190 | MSTP("rtc0", &r_clk, MSTPCR1, 11, 0, 0, 0), | 192 | SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0), |
191 | MSTP("i2c0", &div4_clks[DIV4_P], MSTPCR1, 9, 0, 1, 0), | 193 | SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC0, 0), |
192 | MSTP("i2c1", &div4_clks[DIV4_P], MSTPCR1, 8, 0, 1, 0), | 194 | SH_HWBLK_CLK("i2c1", -1, P_CLK, HWBLK_IIC1, 0), |
193 | 195 | ||
194 | MSTP("mmc0", &div4_clks[DIV4_B], MSTPCR2, 29, 0, 1, 0), | 196 | SH_HWBLK_CLK("mmc0", -1, B_CLK, HWBLK_MMC, 0), |
195 | MSTP("eth0", &div4_clks[DIV4_B], MSTPCR2, 28, 0, 1, 0), | 197 | SH_HWBLK_CLK("eth0", -1, B_CLK, HWBLK_ETHER, 0), |
196 | MSTP("atapi0", &div4_clks[DIV4_B], MSTPCR2, 26, 0, 1, 0), | 198 | SH_HWBLK_CLK("atapi0", -1, B_CLK, HWBLK_ATAPI, 0), |
197 | MSTP("tpu0", &div4_clks[DIV4_B], MSTPCR2, 25, 0, 1, 0), | 199 | SH_HWBLK_CLK("tpu0", -1, B_CLK, HWBLK_TPU, 0), |
198 | MSTP("irda0", &div4_clks[DIV4_P], MSTPCR2, 24, 0, 1, 0), | 200 | SH_HWBLK_CLK("irda0", -1, P_CLK, HWBLK_IRDA, 0), |
199 | MSTP("tsif0", &div4_clks[DIV4_B], MSTPCR2, 22, 0, 1, 0), | 201 | SH_HWBLK_CLK("tsif0", -1, B_CLK, HWBLK_TSIF, 0), |
200 | MSTP("usb1", &div4_clks[DIV4_B], MSTPCR2, 21, 0, 1, 1), | 202 | SH_HWBLK_CLK("usb1", -1, B_CLK, HWBLK_USB1, 0), |
201 | MSTP("usb0", &div4_clks[DIV4_B], MSTPCR2, 20, 0, 1, 1), | 203 | SH_HWBLK_CLK("usb0", -1, B_CLK, HWBLK_USB0, 0), |
202 | MSTP("2dg0", &div4_clks[DIV4_B], MSTPCR2, 19, 0, 1, 1), | 204 | SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0), |
203 | MSTP("sdhi0", &div4_clks[DIV4_B], MSTPCR2, 18, 0, 1, 0), | 205 | SH_HWBLK_CLK("sdhi0", -1, B_CLK, HWBLK_SDHI0, 0), |
204 | MSTP("sdhi1", &div4_clks[DIV4_B], MSTPCR2, 17, 0, 1, 0), | 206 | SH_HWBLK_CLK("sdhi1", -1, B_CLK, HWBLK_SDHI1, 0), |
205 | MSTP("veu1", &div4_clks[DIV4_B], MSTPCR2, 15, 1, 1, 1), | 207 | SH_HWBLK_CLK("veu1", -1, B_CLK, HWBLK_VEU1, 0), |
206 | MSTP("ceu1", &div4_clks[DIV4_B], MSTPCR2, 13, 0, 1, 1), | 208 | SH_HWBLK_CLK("ceu1", -1, B_CLK, HWBLK_CEU1, 0), |
207 | MSTP("beu1", &div4_clks[DIV4_B], MSTPCR2, 12, 0, 1, 1), | 209 | SH_HWBLK_CLK("beu1", -1, B_CLK, HWBLK_BEU1, 0), |
208 | MSTP("2ddmac0", &div4_clks[DIV4_SH], MSTPCR2, 10, 0, 1, 1), | 210 | SH_HWBLK_CLK("2ddmac0", -1, SH_CLK, HWBLK_2DDMAC, 0), |
209 | MSTP("spu0", &div4_clks[DIV4_B], MSTPCR2, 9, 0, 1, 0), | 211 | SH_HWBLK_CLK("spu0", -1, B_CLK, HWBLK_SPU, 0), |
210 | MSTP("jpu0", &div4_clks[DIV4_B], MSTPCR2, 6, 1, 1, 1), | 212 | SH_HWBLK_CLK("jpu0", -1, B_CLK, HWBLK_JPU, 0), |
211 | MSTP("vou0", &div4_clks[DIV4_B], MSTPCR2, 5, 0, 1, 1), | 213 | SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0), |
212 | MSTP("beu0", &div4_clks[DIV4_B], MSTPCR2, 4, 0, 1, 1), | 214 | SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU0, 0), |
213 | MSTP("ceu0", &div4_clks[DIV4_B], MSTPCR2, 3, 0, 1, 1), | 215 | SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU0, 0), |
214 | MSTP("veu0", &div4_clks[DIV4_B], MSTPCR2, 2, 1, 1, 1), | 216 | SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU0, 0), |
215 | MSTP("vpu0", &div4_clks[DIV4_B], MSTPCR2, 1, 1, 1, 1), | 217 | SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0), |
216 | MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0, 1, 1), | 218 | SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0), |
217 | }; | 219 | }; |
218 | 220 | ||
219 | int __init arch_clk_init(void) | 221 | int __init arch_clk_init(void) |
@@ -236,7 +238,7 @@ int __init arch_clk_init(void) | |||
236 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); | 238 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); |
237 | 239 | ||
238 | if (!ret) | 240 | if (!ret) |
239 | ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); | 241 | ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks)); |
240 | 242 | ||
241 | return ret; | 243 | return ret; |
242 | } | 244 | } |