aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/cpu/clock.c9
-rw-r--r--arch/sh/kernel/cpu/hwblk.c5
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7343.c18
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7366.c18
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c130
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7723.c206
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c233
7 files changed, 431 insertions, 188 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 9ded1bc29260..a725c7feb747 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -415,7 +415,7 @@ struct clk *clk_get(struct device *dev, const char *id)
415 415
416 mutex_lock(&clock_list_sem); 416 mutex_lock(&clock_list_sem);
417 list_for_each_entry(p, &clock_list, node) { 417 list_for_each_entry(p, &clock_list, node) {
418 if (p->id == idno && 418 if (p->name && p->id == idno &&
419 strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 419 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
420 clk = p; 420 clk = p;
421 goto found; 421 goto found;
@@ -423,7 +423,8 @@ struct clk *clk_get(struct device *dev, const char *id)
423 } 423 }
424 424
425 list_for_each_entry(p, &clock_list, node) { 425 list_for_each_entry(p, &clock_list, node) {
426 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 426 if (p->name &&
427 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
427 clk = p; 428 clk = p;
428 break; 429 break;
429 } 430 }
@@ -594,7 +595,7 @@ static int clk_debugfs_register(struct clk *c)
594 return err; 595 return err;
595 } 596 }
596 597
597 if (!c->dentry) { 598 if (!c->dentry && c->name) {
598 err = clk_debugfs_register_one(c); 599 err = clk_debugfs_register_one(c);
599 if (err) 600 if (err)
600 return err; 601 return err;
@@ -620,7 +621,7 @@ static int __init clk_debugfs_init(void)
620 } 621 }
621 return 0; 622 return 0;
622err_out: 623err_out:
623 debugfs_remove(clk_debugfs_root); /* REVISIT: Cleanup correctly */ 624 debugfs_remove_recursive(clk_debugfs_root);
624 return err; 625 return err;
625} 626}
626late_initcall(clk_debugfs_init); 627late_initcall(clk_debugfs_init);
diff --git a/arch/sh/kernel/cpu/hwblk.c b/arch/sh/kernel/cpu/hwblk.c
index 67a1e811cfe8..3e985aae5d91 100644
--- a/arch/sh/kernel/cpu/hwblk.c
+++ b/arch/sh/kernel/cpu/hwblk.c
@@ -146,6 +146,11 @@ int __init sh_hwblk_clk_register(struct clk *clks, int nr)
146 146
147 for (k = 0; !ret && (k < nr); k++) { 147 for (k = 0; !ret && (k < nr); k++) {
148 clkp = clks + k; 148 clkp = clks + k;
149
150 /* skip over clocks using hwblk 0 (HWBLK_UNKNOWN) */
151 if (!clkp->arch_flags)
152 continue;
153
149 clkp->ops = &sh_hwblk_clk_ops; 154 clkp->ops = &sh_hwblk_clk_ops;
150 ret |= clk_register(clkp); 155 ret |= clk_register(clkp);
151 } 156 }
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
index a63cdcaee0b2..a066c438b404 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <asm/clkdev.h>
24#include <asm/clock.h> 25#include <asm/clock.h>
25 26
26/* SH7343 registers */ 27/* SH7343 registers */
@@ -135,8 +136,10 @@ struct clk div4_clks[DIV4_NR] = {
135 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0), 136 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0),
136}; 137};
137 138
138struct clk div6_clks[] = { 139enum { DIV6_V, DIV6_NR };
139 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), 140
141struct clk div6_clks[DIV6_NR] = {
142 [DIV6_V] = SH_CLK_DIV6(&pll_clk, VCLKCR, 0),
140}; 143};
141 144
142#define MSTP(_str, _parent, _reg, _bit, _flags) \ 145#define MSTP(_str, _parent, _reg, _bit, _flags) \
@@ -189,6 +192,13 @@ static struct clk mstp_clks[] = {
189 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0), 192 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0),
190}; 193};
191 194
195#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
196
197static struct clk_lookup lookups[] = {
198 /* DIV6 clocks */
199 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
200};
201
192int __init arch_clk_init(void) 202int __init arch_clk_init(void)
193{ 203{
194 int k, ret = 0; 204 int k, ret = 0;
@@ -202,11 +212,13 @@ int __init arch_clk_init(void)
202 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 212 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
203 ret = clk_register(main_clks[k]); 213 ret = clk_register(main_clks[k]);
204 214
215 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
216
205 if (!ret) 217 if (!ret)
206 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); 218 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
207 219
208 if (!ret) 220 if (!ret)
209 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 221 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
210 222
211 if (!ret) 223 if (!ret)
212 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 224 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks));
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
index f99db94cf8fb..44cc5a0965d9 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <asm/clkdev.h>
24#include <asm/clock.h> 25#include <asm/clock.h>
25 26
26/* SH7366 registers */ 27/* SH7366 registers */
@@ -138,8 +139,10 @@ struct clk div4_clks[DIV4_NR] = {
138 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0), 139 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0),
139}; 140};
140 141
141struct clk div6_clks[] = { 142enum { DIV6_V, DIV6_NR };
142 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), 143
144struct clk div6_clks[DIV6_NR] = {
145 [DIV6_V] = SH_CLK_DIV6(&pll_clk, VCLKCR, 0),
143}; 146};
144 147
145#define MSTP(_str, _parent, _reg, _bit, _flags) \ 148#define MSTP(_str, _parent, _reg, _bit, _flags) \
@@ -189,6 +192,13 @@ static struct clk mstp_clks[] = {
189 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0), 192 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0),
190}; 193};
191 194
195#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
196
197static struct clk_lookup lookups[] = {
198 /* DIV6 clocks */
199 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
200};
201
192int __init arch_clk_init(void) 202int __init arch_clk_init(void)
193{ 203{
194 int k, ret = 0; 204 int k, ret = 0;
@@ -202,11 +212,13 @@ int __init arch_clk_init(void)
202 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 212 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
203 ret = clk_register(main_clks[k]); 213 ret = clk_register(main_clks[k]);
204 214
215 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
216
205 if (!ret) 217 if (!ret)
206 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); 218 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
207 219
208 if (!ret) 220 if (!ret)
209 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 221 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
210 222
211 if (!ret) 223 if (!ret)
212 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 224 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks));
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 107b200e78bd..2798ceaa648f 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <asm/clkdev.h>
24#include <asm/clock.h> 25#include <asm/clock.h>
25#include <asm/hwblk.h> 26#include <asm/hwblk.h>
26#include <cpu/sh7722.h> 27#include <cpu/sh7722.h>
@@ -148,41 +149,98 @@ struct clk div4_reparent_clks[DIV4_REPARENT_NR] = {
148 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0), 149 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x1fff, 0),
149}; 150};
150 151
151struct clk div6_clks[] = { 152enum { DIV6_V, DIV6_NR };
152 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), 153
154struct clk div6_clks[DIV6_NR] = {
155 [DIV6_V] = SH_CLK_DIV6(&pll_clk, VCLKCR, 0),
156};
157
158static struct clk mstp_clks[HWBLK_NR] = {
159 SH_HWBLK_CLK(HWBLK_URAM, &div4_clks[DIV4_U], CLK_ENABLE_ON_INIT),
160 SH_HWBLK_CLK(HWBLK_XYMEM, &div4_clks[DIV4_B], CLK_ENABLE_ON_INIT),
161 SH_HWBLK_CLK(HWBLK_TMU, &div4_clks[DIV4_P], 0),
162 SH_HWBLK_CLK(HWBLK_CMT, &r_clk, 0),
163 SH_HWBLK_CLK(HWBLK_RWDT, &r_clk, 0),
164 SH_HWBLK_CLK(HWBLK_FLCTL, &div4_clks[DIV4_P], 0),
165 SH_HWBLK_CLK(HWBLK_SCIF0, &div4_clks[DIV4_P], 0),
166 SH_HWBLK_CLK(HWBLK_SCIF1, &div4_clks[DIV4_P], 0),
167 SH_HWBLK_CLK(HWBLK_SCIF2, &div4_clks[DIV4_P], 0),
168
169 SH_HWBLK_CLK(HWBLK_IIC, &div4_clks[DIV4_P], 0),
170 SH_HWBLK_CLK(HWBLK_RTC, &r_clk, 0),
171
172 SH_HWBLK_CLK(HWBLK_SDHI, &div4_clks[DIV4_P], 0),
173 SH_HWBLK_CLK(HWBLK_KEYSC, &r_clk, 0),
174 SH_HWBLK_CLK(HWBLK_USBF, &div4_clks[DIV4_P], 0),
175 SH_HWBLK_CLK(HWBLK_2DG, &div4_clks[DIV4_B], 0),
176 SH_HWBLK_CLK(HWBLK_SIU, &div4_clks[DIV4_B], 0),
177 SH_HWBLK_CLK(HWBLK_VOU, &div4_clks[DIV4_B], 0),
178 SH_HWBLK_CLK(HWBLK_JPU, &div4_clks[DIV4_B], 0),
179 SH_HWBLK_CLK(HWBLK_BEU, &div4_clks[DIV4_B], 0),
180 SH_HWBLK_CLK(HWBLK_CEU, &div4_clks[DIV4_B], 0),
181 SH_HWBLK_CLK(HWBLK_VEU, &div4_clks[DIV4_B], 0),
182 SH_HWBLK_CLK(HWBLK_VPU, &div4_clks[DIV4_B], 0),
183 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_P], 0),
153}; 184};
154 185
155#define R_CLK &r_clk 186#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
156#define P_CLK &div4_clks[DIV4_P] 187
157#define B_CLK &div4_clks[DIV4_B] 188static struct clk_lookup lookups[] = {
158#define U_CLK &div4_clks[DIV4_U] 189 /* DIV6 clocks */
159 190 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
160static struct clk mstp_clks[] = { 191
161 SH_HWBLK_CLK("uram0", -1, U_CLK, HWBLK_URAM, CLK_ENABLE_ON_INIT), 192 /* MSTP clocks */
162 SH_HWBLK_CLK("xymem0", -1, B_CLK, HWBLK_XYMEM, CLK_ENABLE_ON_INIT), 193 CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]),
163 SH_HWBLK_CLK("tmu_fck", -1, P_CLK, HWBLK_TMU, 0), 194 CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]),
164 SH_HWBLK_CLK("cmt_fck", -1, R_CLK, HWBLK_CMT, 0), 195 {
165 SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0), 196 /* TMU0 */
166 SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0), 197 .dev_id = "sh_tmu.0",
167 SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0), 198 .con_id = "tmu_fck",
168 SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0), 199 .clk = &mstp_clks[HWBLK_TMU],
169 SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0), 200 }, {
170 201 /* TMU1 */
171 SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0), 202 .dev_id = "sh_tmu.1",
172 SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0), 203 .con_id = "tmu_fck",
173 204 .clk = &mstp_clks[HWBLK_TMU],
174 SH_HWBLK_CLK("sdhi0", -1, P_CLK, HWBLK_SDHI, 0), 205 }, {
175 SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0), 206 /* TMU2 */
176 SH_HWBLK_CLK("usbf0", -1, P_CLK, HWBLK_USBF, 0), 207 .dev_id = "sh_tmu.2",
177 SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0), 208 .con_id = "tmu_fck",
178 SH_HWBLK_CLK("siu0", -1, B_CLK, HWBLK_SIU, 0), 209 .clk = &mstp_clks[HWBLK_TMU],
179 SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0), 210 },
180 SH_HWBLK_CLK("jpu0", -1, B_CLK, HWBLK_JPU, 0), 211 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
181 SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU, 0), 212 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]),
182 SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU, 0), 213 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
183 SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU, 0), 214 {
184 SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0), 215 /* SCIF0 */
185 SH_HWBLK_CLK("lcdc0", -1, P_CLK, HWBLK_LCDC, 0), 216 .dev_id = "sh-sci.0",
217 .con_id = "sci_fck",
218 .clk = &mstp_clks[HWBLK_SCIF0],
219 }, {
220 /* SCIF1 */
221 .dev_id = "sh-sci.1",
222 .con_id = "sci_fck",
223 .clk = &mstp_clks[HWBLK_SCIF1],
224 }, {
225 /* SCIF2 */
226 .dev_id = "sh-sci.2",
227 .con_id = "sci_fck",
228 .clk = &mstp_clks[HWBLK_SCIF2],
229 },
230 CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC]),
231 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]),
232 CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI]),
233 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]),
234 CLKDEV_CON_ID("usbf0", &mstp_clks[HWBLK_USBF]),
235 CLKDEV_CON_ID("2dg0", &mstp_clks[HWBLK_2DG]),
236 CLKDEV_CON_ID("siu0", &mstp_clks[HWBLK_SIU]),
237 CLKDEV_CON_ID("vou0", &mstp_clks[HWBLK_VOU]),
238 CLKDEV_CON_ID("jpu0", &mstp_clks[HWBLK_JPU]),
239 CLKDEV_CON_ID("beu0", &mstp_clks[HWBLK_BEU]),
240 CLKDEV_CON_ID("ceu0", &mstp_clks[HWBLK_CEU]),
241 CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU]),
242 CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]),
243 CLKDEV_CON_ID("lcdc0", &mstp_clks[HWBLK_LCDC]),
186}; 244};
187 245
188int __init arch_clk_init(void) 246int __init arch_clk_init(void)
@@ -198,6 +256,8 @@ int __init arch_clk_init(void)
198 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 256 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
199 ret = clk_register(main_clks[k]); 257 ret = clk_register(main_clks[k]);
200 258
259 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
260
201 if (!ret) 261 if (!ret)
202 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); 262 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
203 263
@@ -210,10 +270,10 @@ int __init arch_clk_init(void)
210 DIV4_REPARENT_NR, &div4_table); 270 DIV4_REPARENT_NR, &div4_table);
211 271
212 if (!ret) 272 if (!ret)
213 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 273 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
214 274
215 if (!ret) 275 if (!ret)
216 ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 276 ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR);
217 277
218 return ret; 278 return ret;
219} 279}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index fc86c88223f4..500715f78142 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -149,102 +149,174 @@ struct clk div4_reparent_clks[DIV4_REPARENT_NR] = {
149 [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x0dbf, 0), 149 [DIV4_SIUA] = DIV4("siua_clk", SCLKACR, 0, 0x0dbf, 0),
150 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x0dbf, 0), 150 [DIV4_SIUB] = DIV4("siub_clk", SCLKBCR, 0, 0x0dbf, 0),
151}; 151};
152struct clk div6_clks[] = { 152enum { DIV6_V, DIV6_NR };
153 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0),
154};
155 153
156#define R_CLK (&r_clk) 154struct clk div6_clks[DIV6_NR] = {
157#define P_CLK (&div4_clks[DIV4_P]) 155 [DIV6_V] = SH_CLK_DIV6(&pll_clk, VCLKCR, 0),
158#define B_CLK (&div4_clks[DIV4_B]) 156};
159#define U_CLK (&div4_clks[DIV4_U])
160#define I_CLK (&div4_clks[DIV4_I])
161#define SH_CLK (&div4_clks[DIV4_SH])
162 157
163static struct clk mstp_clks[] = { 158static struct clk mstp_clks[] = {
164 /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */ 159 /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */
165 SH_HWBLK_CLK("tlb0", -1, I_CLK, HWBLK_TLB, CLK_ENABLE_ON_INIT), 160 SH_HWBLK_CLK(HWBLK_TLB, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
166 SH_HWBLK_CLK("ic0", -1, I_CLK, HWBLK_IC, CLK_ENABLE_ON_INIT), 161 SH_HWBLK_CLK(HWBLK_IC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
167 SH_HWBLK_CLK("oc0", -1, I_CLK, HWBLK_OC, CLK_ENABLE_ON_INIT), 162 SH_HWBLK_CLK(HWBLK_OC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
168 SH_HWBLK_CLK("l2c0", -1, SH_CLK, HWBLK_L2C, CLK_ENABLE_ON_INIT), 163 SH_HWBLK_CLK(HWBLK_L2C, &div4_clks[DIV4_SH], CLK_ENABLE_ON_INIT),
169 SH_HWBLK_CLK("ilmem0", -1, I_CLK, HWBLK_ILMEM, CLK_ENABLE_ON_INIT), 164 SH_HWBLK_CLK(HWBLK_ILMEM, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
170 SH_HWBLK_CLK("fpu0", -1, I_CLK, HWBLK_FPU, CLK_ENABLE_ON_INIT), 165 SH_HWBLK_CLK(HWBLK_FPU, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
171 SH_HWBLK_CLK("intc0", -1, I_CLK, HWBLK_INTC, CLK_ENABLE_ON_INIT), 166 SH_HWBLK_CLK(HWBLK_INTC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
172 SH_HWBLK_CLK("dmac0", -1, B_CLK, HWBLK_DMAC0, 0), 167 SH_HWBLK_CLK(HWBLK_DMAC0, &div4_clks[DIV4_B], 0),
173 SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT), 168 SH_HWBLK_CLK(HWBLK_SHYWAY, &div4_clks[DIV4_SH], CLK_ENABLE_ON_INIT),
174 SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0), 169 SH_HWBLK_CLK(HWBLK_HUDI, &div4_clks[DIV4_P], 0),
175 SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0), 170 SH_HWBLK_CLK(HWBLK_UBC, &div4_clks[DIV4_I], 0),
176 SH_HWBLK_CLK("tmu012_fck", -1, P_CLK, HWBLK_TMU0, 0), 171 SH_HWBLK_CLK(HWBLK_TMU0, &div4_clks[DIV4_P], 0),
177 SH_HWBLK_CLK("cmt_fck", -1, R_CLK, HWBLK_CMT, 0), 172 SH_HWBLK_CLK(HWBLK_CMT, &r_clk, 0),
178 SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0), 173 SH_HWBLK_CLK(HWBLK_RWDT, &r_clk, 0),
179 SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0), 174 SH_HWBLK_CLK(HWBLK_DMAC1, &div4_clks[DIV4_B], 0),
180 SH_HWBLK_CLK("tmu345_fck", -1, P_CLK, HWBLK_TMU1, 0), 175 SH_HWBLK_CLK(HWBLK_TMU1, &div4_clks[DIV4_P], 0),
181 SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0), 176 SH_HWBLK_CLK(HWBLK_FLCTL, &div4_clks[DIV4_P], 0),
182 SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0), 177 SH_HWBLK_CLK(HWBLK_SCIF0, &div4_clks[DIV4_P], 0),
183 SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0), 178 SH_HWBLK_CLK(HWBLK_SCIF1, &div4_clks[DIV4_P], 0),
184 SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0), 179 SH_HWBLK_CLK(HWBLK_SCIF2, &div4_clks[DIV4_P], 0),
185 SH_HWBLK_CLK("sci_fck", 3, B_CLK, HWBLK_SCIF3, 0), 180 SH_HWBLK_CLK(HWBLK_SCIF3, &div4_clks[DIV4_B], 0),
186 SH_HWBLK_CLK("sci_fck", 4, B_CLK, HWBLK_SCIF4, 0), 181 SH_HWBLK_CLK(HWBLK_SCIF4, &div4_clks[DIV4_B], 0),
187 SH_HWBLK_CLK("sci_fck", 5, B_CLK, HWBLK_SCIF5, 0), 182 SH_HWBLK_CLK(HWBLK_SCIF5, &div4_clks[DIV4_B], 0),
188 SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0), 183 SH_HWBLK_CLK(HWBLK_MSIOF0, &div4_clks[DIV4_B], 0),
189 SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0), 184 SH_HWBLK_CLK(HWBLK_MSIOF1, &div4_clks[DIV4_B], 0),
190 SH_HWBLK_CLK("meram0", -1, SH_CLK, HWBLK_MERAM, 0), 185 SH_HWBLK_CLK(HWBLK_MERAM, &div4_clks[DIV4_SH], 0),
191 186
192 SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0), 187 SH_HWBLK_CLK(HWBLK_IIC, &div4_clks[DIV4_P], 0),
193 SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0), 188 SH_HWBLK_CLK(HWBLK_RTC, &r_clk, 0),
194 189
195 SH_HWBLK_CLK("atapi0", -1, SH_CLK, HWBLK_ATAPI, 0), 190 SH_HWBLK_CLK(HWBLK_ATAPI, &div4_clks[DIV4_SH], 0),
196 SH_HWBLK_CLK("adc0", -1, P_CLK, HWBLK_ADC, 0), 191 SH_HWBLK_CLK(HWBLK_ADC, &div4_clks[DIV4_P], 0),
197 SH_HWBLK_CLK("tpu0", -1, B_CLK, HWBLK_TPU, 0), 192 SH_HWBLK_CLK(HWBLK_TPU, &div4_clks[DIV4_B], 0),
198 SH_HWBLK_CLK("irda0", -1, P_CLK, HWBLK_IRDA, 0), 193 SH_HWBLK_CLK(HWBLK_IRDA, &div4_clks[DIV4_P], 0),
199 SH_HWBLK_CLK("tsif0", -1, B_CLK, HWBLK_TSIF, 0), 194 SH_HWBLK_CLK(HWBLK_TSIF, &div4_clks[DIV4_B], 0),
200 SH_HWBLK_CLK("icb0", -1, B_CLK, HWBLK_ICB, CLK_ENABLE_ON_INIT), 195 SH_HWBLK_CLK(HWBLK_ICB, &div4_clks[DIV4_B], CLK_ENABLE_ON_INIT),
201 SH_HWBLK_CLK("sdhi0", -1, B_CLK, HWBLK_SDHI0, 0), 196 SH_HWBLK_CLK(HWBLK_SDHI0, &div4_clks[DIV4_B], 0),
202 SH_HWBLK_CLK("sdhi1", -1, B_CLK, HWBLK_SDHI1, 0), 197 SH_HWBLK_CLK(HWBLK_SDHI1, &div4_clks[DIV4_B], 0),
203 SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0), 198 SH_HWBLK_CLK(HWBLK_KEYSC, &r_clk, 0),
204 SH_HWBLK_CLK("usb0", -1, B_CLK, HWBLK_USB, 0), 199 SH_HWBLK_CLK(HWBLK_USB, &div4_clks[DIV4_B], 0),
205 SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0), 200 SH_HWBLK_CLK(HWBLK_2DG, &div4_clks[DIV4_B], 0),
206 SH_HWBLK_CLK("siu0", -1, B_CLK, HWBLK_SIU, 0), 201 SH_HWBLK_CLK(HWBLK_SIU, &div4_clks[DIV4_B], 0),
207 SH_HWBLK_CLK("veu1", -1, B_CLK, HWBLK_VEU2H1, 0), 202 SH_HWBLK_CLK(HWBLK_VEU2H1, &div4_clks[DIV4_B], 0),
208 SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0), 203 SH_HWBLK_CLK(HWBLK_VOU, &div4_clks[DIV4_B], 0),
209 SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU, 0), 204 SH_HWBLK_CLK(HWBLK_BEU, &div4_clks[DIV4_B], 0),
210 SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU, 0), 205 SH_HWBLK_CLK(HWBLK_CEU, &div4_clks[DIV4_B], 0),
211 SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU2H0, 0), 206 SH_HWBLK_CLK(HWBLK_VEU2H0, &div4_clks[DIV4_B], 0),
212 SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0), 207 SH_HWBLK_CLK(HWBLK_VPU, &div4_clks[DIV4_B], 0),
213 SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0), 208 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0),
214}; 209};
215 210
211#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
212
216static struct clk_lookup lookups[] = { 213static struct clk_lookup lookups[] = {
214 /* DIV6 clocks */
215 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
216
217 /* MSTP clocks */
218 CLKDEV_CON_ID("tlb0", &mstp_clks[HWBLK_TLB]),
219 CLKDEV_CON_ID("ic0", &mstp_clks[HWBLK_IC]),
220 CLKDEV_CON_ID("oc0", &mstp_clks[HWBLK_OC]),
221 CLKDEV_CON_ID("l2c0", &mstp_clks[HWBLK_L2C]),
222 CLKDEV_CON_ID("ilmem0", &mstp_clks[HWBLK_ILMEM]),
223 CLKDEV_CON_ID("fpu0", &mstp_clks[HWBLK_FPU]),
224 CLKDEV_CON_ID("intc0", &mstp_clks[HWBLK_INTC]),
225 CLKDEV_CON_ID("dmac0", &mstp_clks[HWBLK_DMAC0]),
226 CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]),
227 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
228 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
217 { 229 {
218 /* TMU0 */ 230 /* TMU0 */
219 .dev_id = "sh_tmu.0", 231 .dev_id = "sh_tmu.0",
220 .con_id = "tmu_fck", 232 .con_id = "tmu_fck",
221 .clk = &mstp_clks[11], /* tmu012_fck */ 233 .clk = &mstp_clks[HWBLK_TMU0],
222 }, { 234 }, {
223 /* TMU1 */ 235 /* TMU1 */
224 .dev_id = "sh_tmu.1", 236 .dev_id = "sh_tmu.1",
225 .con_id = "tmu_fck", 237 .con_id = "tmu_fck",
226 .clk = &mstp_clks[11], 238 .clk = &mstp_clks[HWBLK_TMU0],
227 }, { 239 }, {
228 /* TMU2 */ 240 /* TMU2 */
229 .dev_id = "sh_tmu.2", 241 .dev_id = "sh_tmu.2",
230 .con_id = "tmu_fck", 242 .con_id = "tmu_fck",
231 .clk = &mstp_clks[11], 243 .clk = &mstp_clks[HWBLK_TMU0],
232 }, { 244 },
245 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
246 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]),
247 CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]),
248 {
233 /* TMU3 */ 249 /* TMU3 */
234 .dev_id = "sh_tmu.3", 250 .dev_id = "sh_tmu.3",
235 .con_id = "tmu_fck", 251 .con_id = "tmu_fck",
236 .clk = &mstp_clks[15], /* tmu345_fck */ 252 .clk = &mstp_clks[HWBLK_TMU1],
237 }, { 253 }, {
238 /* TMU4 */ 254 /* TMU4 */
239 .dev_id = "sh_tmu.4", 255 .dev_id = "sh_tmu.4",
240 .con_id = "tmu_fck", 256 .con_id = "tmu_fck",
241 .clk = &mstp_clks[15], 257 .clk = &mstp_clks[HWBLK_TMU1],
242 }, { 258 }, {
243 /* TMU5 */ 259 /* TMU5 */
244 .dev_id = "sh_tmu.5", 260 .dev_id = "sh_tmu.5",
245 .con_id = "tmu_fck", 261 .con_id = "tmu_fck",
246 .clk = &mstp_clks[15], 262 .clk = &mstp_clks[HWBLK_TMU1],
263 },
264 CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
265 {
266 /* SCIF0 */
267 .dev_id = "sh-sci.0",
268 .con_id = "sci_fck",
269 .clk = &mstp_clks[HWBLK_SCIF0],
270 }, {
271 /* SCIF1 */
272 .dev_id = "sh-sci.1",
273 .con_id = "sci_fck",
274 .clk = &mstp_clks[HWBLK_SCIF1],
275 }, {
276 /* SCIF2 */
277 .dev_id = "sh-sci.2",
278 .con_id = "sci_fck",
279 .clk = &mstp_clks[HWBLK_SCIF2],
280 }, {
281 /* SCIF3 */
282 .dev_id = "sh-sci.3",
283 .con_id = "sci_fck",
284 .clk = &mstp_clks[HWBLK_SCIF3],
285 }, {
286 /* SCIF4 */
287 .dev_id = "sh-sci.4",
288 .con_id = "sci_fck",
289 .clk = &mstp_clks[HWBLK_SCIF4],
290 }, {
291 /* SCIF5 */
292 .dev_id = "sh-sci.5",
293 .con_id = "sci_fck",
294 .clk = &mstp_clks[HWBLK_SCIF5],
247 }, 295 },
296 CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]),
297 CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]),
298 CLKDEV_CON_ID("meram0", &mstp_clks[HWBLK_MERAM]),
299 CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC]),
300 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]),
301 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]),
302 CLKDEV_CON_ID("adc0", &mstp_clks[HWBLK_ADC]),
303 CLKDEV_CON_ID("tpu0", &mstp_clks[HWBLK_TPU]),
304 CLKDEV_CON_ID("irda0", &mstp_clks[HWBLK_IRDA]),
305 CLKDEV_CON_ID("tsif0", &mstp_clks[HWBLK_TSIF]),
306 CLKDEV_CON_ID("icb0", &mstp_clks[HWBLK_ICB]),
307 CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI0]),
308 CLKDEV_CON_ID("sdhi1", &mstp_clks[HWBLK_SDHI1]),
309 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]),
310 CLKDEV_CON_ID("usb0", &mstp_clks[HWBLK_USB]),
311 CLKDEV_CON_ID("2dg0", &mstp_clks[HWBLK_2DG]),
312 CLKDEV_CON_ID("siu0", &mstp_clks[HWBLK_SIU]),
313 CLKDEV_CON_ID("veu1", &mstp_clks[HWBLK_VEU2H1]),
314 CLKDEV_CON_ID("vou0", &mstp_clks[HWBLK_VOU]),
315 CLKDEV_CON_ID("beu0", &mstp_clks[HWBLK_BEU]),
316 CLKDEV_CON_ID("ceu0", &mstp_clks[HWBLK_CEU]),
317 CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU2H0]),
318 CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]),
319 CLKDEV_CON_ID("lcdc0", &mstp_clks[HWBLK_LCDC]),
248}; 320};
249 321
250int __init arch_clk_init(void) 322int __init arch_clk_init(void)
@@ -274,10 +346,10 @@ int __init arch_clk_init(void)
274 DIV4_REPARENT_NR, &div4_table); 346 DIV4_REPARENT_NR, &div4_table);
275 347
276 if (!ret) 348 if (!ret)
277 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 349 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
278 350
279 if (!ret) 351 if (!ret)
280 ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 352 ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR);
281 353
282 return ret; 354 return ret;
283} 355}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index f1583a23b3a5..2bbff53fcd87 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -164,109 +164,190 @@ struct clk div4_clks[DIV4_NR] = {
164 [DIV4_M1] = DIV4("vpu_clk", FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT), 164 [DIV4_M1] = DIV4("vpu_clk", FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT),
165}; 165};
166 166
167struct clk div6_clks[] = { 167enum { DIV6_V, DIV6_FA, DIV6_FB, DIV6_I, DIV6_S, DIV6_NR };
168 SH_CLK_DIV6("video_clk", &div3_clk, VCLKCR, 0), 168
169 SH_CLK_DIV6("fsia_clk", &div3_clk, FCLKACR, 0), 169struct clk div6_clks[DIV6_NR] = {
170 SH_CLK_DIV6("fsib_clk", &div3_clk, FCLKBCR, 0), 170 [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0),
171 SH_CLK_DIV6("irda_clk", &div3_clk, IRDACLKCR, 0), 171 [DIV6_FA] = SH_CLK_DIV6(&div3_clk, FCLKACR, 0),
172 SH_CLK_DIV6("spu_clk", &div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT), 172 [DIV6_FB] = SH_CLK_DIV6(&div3_clk, FCLKBCR, 0),
173 [DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0),
174 [DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT),
173}; 175};
174 176
175#define R_CLK (&r_clk) 177static struct clk mstp_clks[HWBLK_NR] = {
176#define P_CLK (&div4_clks[DIV4_P]) 178 SH_HWBLK_CLK(HWBLK_TLB, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
177#define B_CLK (&div4_clks[DIV4_B]) 179 SH_HWBLK_CLK(HWBLK_IC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
178#define I_CLK (&div4_clks[DIV4_I]) 180 SH_HWBLK_CLK(HWBLK_OC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
179#define SH_CLK (&div4_clks[DIV4_SH]) 181 SH_HWBLK_CLK(HWBLK_RSMEM, &div4_clks[DIV4_B], CLK_ENABLE_ON_INIT),
180 182 SH_HWBLK_CLK(HWBLK_ILMEM, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
181static struct clk mstp_clks[] = { 183 SH_HWBLK_CLK(HWBLK_L2C, &div4_clks[DIV4_SH], CLK_ENABLE_ON_INIT),
182 SH_HWBLK_CLK("tlb0", -1, I_CLK, HWBLK_TLB, CLK_ENABLE_ON_INIT), 184 SH_HWBLK_CLK(HWBLK_FPU, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
183 SH_HWBLK_CLK("ic0", -1, I_CLK, HWBLK_IC, CLK_ENABLE_ON_INIT), 185 SH_HWBLK_CLK(HWBLK_INTC, &div4_clks[DIV4_P], CLK_ENABLE_ON_INIT),
184 SH_HWBLK_CLK("oc0", -1, I_CLK, HWBLK_OC, CLK_ENABLE_ON_INIT), 186 SH_HWBLK_CLK(HWBLK_DMAC0, &div4_clks[DIV4_B], 0),
185 SH_HWBLK_CLK("rs0", -1, B_CLK, HWBLK_RSMEM, CLK_ENABLE_ON_INIT), 187 SH_HWBLK_CLK(HWBLK_SHYWAY, &div4_clks[DIV4_SH], CLK_ENABLE_ON_INIT),
186 SH_HWBLK_CLK("ilmem0", -1, I_CLK, HWBLK_ILMEM, CLK_ENABLE_ON_INIT), 188 SH_HWBLK_CLK(HWBLK_HUDI, &div4_clks[DIV4_P], 0),
187 SH_HWBLK_CLK("l2c0", -1, SH_CLK, HWBLK_L2C, CLK_ENABLE_ON_INIT), 189 SH_HWBLK_CLK(HWBLK_UBC, &div4_clks[DIV4_I], 0),
188 SH_HWBLK_CLK("fpu0", -1, I_CLK, HWBLK_FPU, CLK_ENABLE_ON_INIT), 190 SH_HWBLK_CLK(HWBLK_TMU0, &div4_clks[DIV4_P], 0),
189 SH_HWBLK_CLK("intc0", -1, P_CLK, HWBLK_INTC, CLK_ENABLE_ON_INIT), 191 SH_HWBLK_CLK(HWBLK_CMT, &r_clk, 0),
190 SH_HWBLK_CLK("dmac0", -1, B_CLK, HWBLK_DMAC0, 0), 192 SH_HWBLK_CLK(HWBLK_RWDT, &r_clk, 0),
191 SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT), 193 SH_HWBLK_CLK(HWBLK_DMAC1, &div4_clks[DIV4_B], 0),
192 SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0), 194 SH_HWBLK_CLK(HWBLK_TMU1, &div4_clks[DIV4_P], 0),
193 SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0), 195 SH_HWBLK_CLK(HWBLK_SCIF0, &div4_clks[DIV4_P], 0),
194 SH_HWBLK_CLK("tmu012_fck", -1, P_CLK, HWBLK_TMU0, 0), 196 SH_HWBLK_CLK(HWBLK_SCIF1, &div4_clks[DIV4_P], 0),
195 SH_HWBLK_CLK("cmt_fck", -1, R_CLK, HWBLK_CMT, 0), 197 SH_HWBLK_CLK(HWBLK_SCIF2, &div4_clks[DIV4_P], 0),
196 SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0), 198 SH_HWBLK_CLK(HWBLK_SCIF3, &div4_clks[DIV4_B], 0),
197 SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0), 199 SH_HWBLK_CLK(HWBLK_SCIF4, &div4_clks[DIV4_B], 0),
198 SH_HWBLK_CLK("tmu345_fck", -1, P_CLK, HWBLK_TMU1, 0), 200 SH_HWBLK_CLK(HWBLK_SCIF5, &div4_clks[DIV4_B], 0),
199 SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0), 201 SH_HWBLK_CLK(HWBLK_MSIOF0, &div4_clks[DIV4_B], 0),
200 SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0), 202 SH_HWBLK_CLK(HWBLK_MSIOF1, &div4_clks[DIV4_B], 0),
201 SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0), 203
202 SH_HWBLK_CLK("sci_fck", 3, B_CLK, HWBLK_SCIF3, 0), 204 SH_HWBLK_CLK(HWBLK_KEYSC, &r_clk, 0),
203 SH_HWBLK_CLK("sci_fck", 4, B_CLK, HWBLK_SCIF4, 0), 205 SH_HWBLK_CLK(HWBLK_RTC, &r_clk, 0),
204 SH_HWBLK_CLK("sci_fck", 5, B_CLK, HWBLK_SCIF5, 0), 206 SH_HWBLK_CLK(HWBLK_IIC0, &div4_clks[DIV4_P], 0),
205 SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0), 207 SH_HWBLK_CLK(HWBLK_IIC1, &div4_clks[DIV4_P], 0),
206 SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0), 208
207 209 SH_HWBLK_CLK(HWBLK_MMC, &div4_clks[DIV4_B], 0),
208 SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0), 210 SH_HWBLK_CLK(HWBLK_ETHER, &div4_clks[DIV4_B], 0),
209 SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0), 211 SH_HWBLK_CLK(HWBLK_ATAPI, &div4_clks[DIV4_B], 0),
210 SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC0, 0), 212 SH_HWBLK_CLK(HWBLK_TPU, &div4_clks[DIV4_B], 0),
211 SH_HWBLK_CLK("i2c1", -1, P_CLK, HWBLK_IIC1, 0), 213 SH_HWBLK_CLK(HWBLK_IRDA, &div4_clks[DIV4_P], 0),
212 214 SH_HWBLK_CLK(HWBLK_TSIF, &div4_clks[DIV4_B], 0),
213 SH_HWBLK_CLK("mmc0", -1, B_CLK, HWBLK_MMC, 0), 215 SH_HWBLK_CLK(HWBLK_USB1, &div4_clks[DIV4_B], 0),
214 SH_HWBLK_CLK("eth0", -1, B_CLK, HWBLK_ETHER, 0), 216 SH_HWBLK_CLK(HWBLK_USB0, &div4_clks[DIV4_B], 0),
215 SH_HWBLK_CLK("atapi0", -1, B_CLK, HWBLK_ATAPI, 0), 217 SH_HWBLK_CLK(HWBLK_2DG, &div4_clks[DIV4_B], 0),
216 SH_HWBLK_CLK("tpu0", -1, B_CLK, HWBLK_TPU, 0), 218 SH_HWBLK_CLK(HWBLK_SDHI0, &div4_clks[DIV4_B], 0),
217 SH_HWBLK_CLK("irda0", -1, P_CLK, HWBLK_IRDA, 0), 219 SH_HWBLK_CLK(HWBLK_SDHI1, &div4_clks[DIV4_B], 0),
218 SH_HWBLK_CLK("tsif0", -1, B_CLK, HWBLK_TSIF, 0), 220 SH_HWBLK_CLK(HWBLK_VEU1, &div4_clks[DIV4_B], 0),
219 SH_HWBLK_CLK("usb1", -1, B_CLK, HWBLK_USB1, 0), 221 SH_HWBLK_CLK(HWBLK_CEU1, &div4_clks[DIV4_B], 0),
220 SH_HWBLK_CLK("usb0", -1, B_CLK, HWBLK_USB0, 0), 222 SH_HWBLK_CLK(HWBLK_BEU1, &div4_clks[DIV4_B], 0),
221 SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0), 223 SH_HWBLK_CLK(HWBLK_2DDMAC, &div4_clks[DIV4_SH], 0),
222 SH_HWBLK_CLK("sdhi0", -1, B_CLK, HWBLK_SDHI0, 0), 224 SH_HWBLK_CLK(HWBLK_SPU, &div4_clks[DIV4_B], 0),
223 SH_HWBLK_CLK("sdhi1", -1, B_CLK, HWBLK_SDHI1, 0), 225 SH_HWBLK_CLK(HWBLK_JPU, &div4_clks[DIV4_B], 0),
224 SH_HWBLK_CLK("veu1", -1, B_CLK, HWBLK_VEU1, 0), 226 SH_HWBLK_CLK(HWBLK_VOU, &div4_clks[DIV4_B], 0),
225 SH_HWBLK_CLK("ceu1", -1, B_CLK, HWBLK_CEU1, 0), 227 SH_HWBLK_CLK(HWBLK_BEU0, &div4_clks[DIV4_B], 0),
226 SH_HWBLK_CLK("beu1", -1, B_CLK, HWBLK_BEU1, 0), 228 SH_HWBLK_CLK(HWBLK_CEU0, &div4_clks[DIV4_B], 0),
227 SH_HWBLK_CLK("2ddmac0", -1, SH_CLK, HWBLK_2DDMAC, 0), 229 SH_HWBLK_CLK(HWBLK_VEU0, &div4_clks[DIV4_B], 0),
228 SH_HWBLK_CLK("spu0", -1, B_CLK, HWBLK_SPU, 0), 230 SH_HWBLK_CLK(HWBLK_VPU, &div4_clks[DIV4_B], 0),
229 SH_HWBLK_CLK("jpu0", -1, B_CLK, HWBLK_JPU, 0), 231 SH_HWBLK_CLK(HWBLK_LCDC, &div4_clks[DIV4_B], 0),
230 SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0),
231 SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU0, 0),
232 SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU0, 0),
233 SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU0, 0),
234 SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0),
235 SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0),
236}; 232};
237 233
234#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
235
238static struct clk_lookup lookups[] = { 236static struct clk_lookup lookups[] = {
237 /* DIV6 clocks */
238 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
239 CLKDEV_CON_ID("fsia_clk", &div6_clks[DIV6_FA]),
240 CLKDEV_CON_ID("fsib_clk", &div6_clks[DIV6_FB]),
241 CLKDEV_CON_ID("irda_clk", &div6_clks[DIV6_I]),
242 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_S]),
243
244 /* MSTP clocks */
245 CLKDEV_CON_ID("tlb0", &mstp_clks[HWBLK_TLB]),
246 CLKDEV_CON_ID("ic0", &mstp_clks[HWBLK_IC]),
247 CLKDEV_CON_ID("oc0", &mstp_clks[HWBLK_OC]),
248 CLKDEV_CON_ID("rs0", &mstp_clks[HWBLK_RSMEM]),
249 CLKDEV_CON_ID("ilmem0", &mstp_clks[HWBLK_ILMEM]),
250 CLKDEV_CON_ID("l2c0", &mstp_clks[HWBLK_L2C]),
251 CLKDEV_CON_ID("fpu0", &mstp_clks[HWBLK_FPU]),
252 CLKDEV_CON_ID("intc0", &mstp_clks[HWBLK_INTC]),
253 CLKDEV_CON_ID("dmac0", &mstp_clks[HWBLK_DMAC0]),
254 CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]),
255 CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
256 CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
239 { 257 {
240 /* TMU0 */ 258 /* TMU0 */
241 .dev_id = "sh_tmu.0", 259 .dev_id = "sh_tmu.0",
242 .con_id = "tmu_fck", 260 .con_id = "tmu_fck",
243 .clk = &mstp_clks[12], /* tmu012_fck */ 261 .clk = &mstp_clks[HWBLK_TMU0],
244 }, { 262 }, {
245 /* TMU1 */ 263 /* TMU1 */
246 .dev_id = "sh_tmu.1", 264 .dev_id = "sh_tmu.1",
247 .con_id = "tmu_fck", 265 .con_id = "tmu_fck",
248 .clk = &mstp_clks[12], 266 .clk = &mstp_clks[HWBLK_TMU0],
249 }, { 267 }, {
250 /* TMU2 */ 268 /* TMU2 */
251 .dev_id = "sh_tmu.2", 269 .dev_id = "sh_tmu.2",
252 .con_id = "tmu_fck", 270 .con_id = "tmu_fck",
253 .clk = &mstp_clks[12], 271 .clk = &mstp_clks[HWBLK_TMU0],
254 }, { 272 }, {
255 /* TMU3 */ 273 /* TMU3 */
256 .dev_id = "sh_tmu.3", 274 .dev_id = "sh_tmu.3",
257 .con_id = "tmu_fck", 275 .con_id = "tmu_fck",
258 .clk = &mstp_clks[16], /* tmu345_fck */ 276 .clk = &mstp_clks[HWBLK_TMU1],
259 }, { 277 },
278 CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
279 CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]),
280 CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]),
281 {
260 /* TMU4 */ 282 /* TMU4 */
261 .dev_id = "sh_tmu.4", 283 .dev_id = "sh_tmu.4",
262 .con_id = "tmu_fck", 284 .con_id = "tmu_fck",
263 .clk = &mstp_clks[16], 285 .clk = &mstp_clks[HWBLK_TMU1],
264 }, { 286 }, {
265 /* TMU5 */ 287 /* TMU5 */
266 .dev_id = "sh_tmu.5", 288 .dev_id = "sh_tmu.5",
267 .con_id = "tmu_fck", 289 .con_id = "tmu_fck",
268 .clk = &mstp_clks[16], 290 .clk = &mstp_clks[HWBLK_TMU1],
291 }, {
292 /* SCIF0 */
293 .dev_id = "sh-sci.0",
294 .con_id = "sci_fck",
295 .clk = &mstp_clks[HWBLK_SCIF0],
296 }, {
297 /* SCIF1 */
298 .dev_id = "sh-sci.1",
299 .con_id = "sci_fck",
300 .clk = &mstp_clks[HWBLK_SCIF1],
301 }, {
302 /* SCIF2 */
303 .dev_id = "sh-sci.2",
304 .con_id = "sci_fck",
305 .clk = &mstp_clks[HWBLK_SCIF2],
306 }, {
307 /* SCIF3 */
308 .dev_id = "sh-sci.3",
309 .con_id = "sci_fck",
310 .clk = &mstp_clks[HWBLK_SCIF3],
311 }, {
312 /* SCIF4 */
313 .dev_id = "sh-sci.4",
314 .con_id = "sci_fck",
315 .clk = &mstp_clks[HWBLK_SCIF4],
316 }, {
317 /* SCIF5 */
318 .dev_id = "sh-sci.5",
319 .con_id = "sci_fck",
320 .clk = &mstp_clks[HWBLK_SCIF5],
269 }, 321 },
322 CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]),
323 CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]),
324 CLKDEV_CON_ID("keysc0", &mstp_clks[HWBLK_KEYSC]),
325 CLKDEV_CON_ID("rtc0", &mstp_clks[HWBLK_RTC]),
326 CLKDEV_CON_ID("i2c0", &mstp_clks[HWBLK_IIC0]),
327 CLKDEV_CON_ID("i2c1", &mstp_clks[HWBLK_IIC1]),
328 CLKDEV_CON_ID("mmc0", &mstp_clks[HWBLK_MMC]),
329 CLKDEV_CON_ID("eth0", &mstp_clks[HWBLK_ETHER]),
330 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]),
331 CLKDEV_CON_ID("tpu0", &mstp_clks[HWBLK_TPU]),
332 CLKDEV_CON_ID("irda0", &mstp_clks[HWBLK_IRDA]),
333 CLKDEV_CON_ID("tsif0", &mstp_clks[HWBLK_TSIF]),
334 CLKDEV_CON_ID("usb1", &mstp_clks[HWBLK_USB1]),
335 CLKDEV_CON_ID("usb0", &mstp_clks[HWBLK_USB0]),
336 CLKDEV_CON_ID("2dg0", &mstp_clks[HWBLK_2DG]),
337 CLKDEV_CON_ID("sdhi0", &mstp_clks[HWBLK_SDHI0]),
338 CLKDEV_CON_ID("sdhi1", &mstp_clks[HWBLK_SDHI1]),
339 CLKDEV_CON_ID("veu1", &mstp_clks[HWBLK_VEU1]),
340 CLKDEV_CON_ID("ceu1", &mstp_clks[HWBLK_CEU1]),
341 CLKDEV_CON_ID("beu1", &mstp_clks[HWBLK_BEU1]),
342 CLKDEV_CON_ID("2ddmac0", &mstp_clks[HWBLK_2DDMAC]),
343 CLKDEV_CON_ID("spu0", &mstp_clks[HWBLK_SPU]),
344 CLKDEV_CON_ID("jpu0", &mstp_clks[HWBLK_JPU]),
345 CLKDEV_CON_ID("vou0", &mstp_clks[HWBLK_VOU]),
346 CLKDEV_CON_ID("beu0", &mstp_clks[HWBLK_BEU0]),
347 CLKDEV_CON_ID("ceu0", &mstp_clks[HWBLK_CEU0]),
348 CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU0]),
349 CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]),
350 CLKDEV_CON_ID("lcdc0", &mstp_clks[HWBLK_LCDC]),
270}; 351};
271 352
272int __init arch_clk_init(void) 353int __init arch_clk_init(void)
@@ -288,10 +369,10 @@ int __init arch_clk_init(void)
288 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); 369 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
289 370
290 if (!ret) 371 if (!ret)
291 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 372 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
292 373
293 if (!ret) 374 if (!ret)
294 ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 375 ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR);
295 376
296 return ret; 377 return ret;
297} 378}