aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cm_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/cm_common.c')
-rw-r--r--arch/arm/mach-omap2/cm_common.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index bbe41f4c9dc8..d555791cf349 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -32,10 +32,10 @@ static struct cm_ll_data null_cm_ll_data;
32static struct cm_ll_data *cm_ll_data = &null_cm_ll_data; 32static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
33 33
34/* cm_base: base virtual address of the CM IP block */ 34/* cm_base: base virtual address of the CM IP block */
35void __iomem *cm_base; 35struct omap_domain_base cm_base;
36 36
37/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */ 37/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
38void __iomem *cm2_base; 38struct omap_domain_base cm2_base;
39 39
40#define CM_NO_CLOCKS 0x1 40#define CM_NO_CLOCKS 0x1
41#define CM_SINGLE_INSTANCE 0x2 41#define CM_SINGLE_INSTANCE 0x2
@@ -49,8 +49,8 @@ void __iomem *cm2_base;
49 */ 49 */
50void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2) 50void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
51{ 51{
52 cm_base = cm; 52 cm_base.va = cm;
53 cm2_base = cm2; 53 cm2_base.va = cm2;
54} 54}
55 55
56/** 56/**
@@ -315,27 +315,34 @@ int __init omap2_cm_base_init(void)
315 struct device_node *np; 315 struct device_node *np;
316 const struct of_device_id *match; 316 const struct of_device_id *match;
317 struct omap_prcm_init_data *data; 317 struct omap_prcm_init_data *data;
318 void __iomem *mem; 318 struct resource res;
319 int ret;
320 struct omap_domain_base *mem = NULL;
319 321
320 for_each_matching_node_and_match(np, omap_cm_dt_match_table, &match) { 322 for_each_matching_node_and_match(np, omap_cm_dt_match_table, &match) {
321 data = (struct omap_prcm_init_data *)match->data; 323 data = (struct omap_prcm_init_data *)match->data;
322 324
323 mem = of_iomap(np, 0); 325 ret = of_address_to_resource(np, 0, &res);
324 if (!mem) 326 if (ret)
325 return -ENOMEM; 327 return ret;
326 328
327 if (data->index == TI_CLKM_CM) 329 if (data->index == TI_CLKM_CM)
328 cm_base = mem + data->offset; 330 mem = &cm_base;
329 331
330 if (data->index == TI_CLKM_CM2) 332 if (data->index == TI_CLKM_CM2)
331 cm2_base = mem + data->offset; 333 mem = &cm2_base;
334
335 data->mem = ioremap(res.start, resource_size(&res));
332 336
333 data->mem = mem; 337 if (mem) {
338 mem->pa = res.start + data->offset;
339 mem->va = data->mem + data->offset;
340 }
334 341
335 data->np = np; 342 data->np = np;
336 343
337 if (data->init && (data->flags & CM_SINGLE_INSTANCE || 344 if (data->init && (data->flags & CM_SINGLE_INSTANCE ||
338 (cm_base && cm2_base))) 345 (cm_base.va && cm2_base.va)))
339 data->init(data); 346 data->init(data);
340 } 347 }
341 348