diff options
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index c2c798c08c2b..63b774fb8089 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -138,6 +138,8 @@ | |||
138 | #include <linux/spinlock.h> | 138 | #include <linux/spinlock.h> |
139 | #include <linux/slab.h> | 139 | #include <linux/slab.h> |
140 | #include <linux/bootmem.h> | 140 | #include <linux/bootmem.h> |
141 | #include <linux/of.h> | ||
142 | #include <linux/of_address.h> | ||
141 | 143 | ||
142 | #include <asm/system_misc.h> | 144 | #include <asm/system_misc.h> |
143 | 145 | ||
@@ -610,8 +612,6 @@ static int _enable_wakeup(struct omap_hwmod *oh, u32 *v) | |||
610 | 612 | ||
611 | /* XXX test pwrdm_get_wken for this hwmod's subsystem */ | 613 | /* XXX test pwrdm_get_wken for this hwmod's subsystem */ |
612 | 614 | ||
613 | oh->_int_flags |= _HWMOD_WAKEUP_ENABLED; | ||
614 | |||
615 | return 0; | 615 | return 0; |
616 | } | 616 | } |
617 | 617 | ||
@@ -645,8 +645,6 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) | |||
645 | 645 | ||
646 | /* XXX test pwrdm_get_wken for this hwmod's subsystem */ | 646 | /* XXX test pwrdm_get_wken for this hwmod's subsystem */ |
647 | 647 | ||
648 | oh->_int_flags &= ~_HWMOD_WAKEUP_ENABLED; | ||
649 | |||
650 | return 0; | 648 | return 0; |
651 | } | 649 | } |
652 | 650 | ||
@@ -2350,6 +2348,34 @@ static int _shutdown(struct omap_hwmod *oh) | |||
2350 | } | 2348 | } |
2351 | 2349 | ||
2352 | /** | 2350 | /** |
2351 | * of_dev_hwmod_lookup - look up needed hwmod from dt blob | ||
2352 | * @np: struct device_node * | ||
2353 | * @oh: struct omap_hwmod * | ||
2354 | * | ||
2355 | * Parse the dt blob and find out needed hwmod. Recursive function is | ||
2356 | * implemented to take care hierarchical dt blob parsing. | ||
2357 | * Return: The device node on success or NULL on failure. | ||
2358 | */ | ||
2359 | static struct device_node *of_dev_hwmod_lookup(struct device_node *np, | ||
2360 | struct omap_hwmod *oh) | ||
2361 | { | ||
2362 | struct device_node *np0 = NULL, *np1 = NULL; | ||
2363 | const char *p; | ||
2364 | |||
2365 | for_each_child_of_node(np, np0) { | ||
2366 | if (of_find_property(np0, "ti,hwmods", NULL)) { | ||
2367 | p = of_get_property(np0, "ti,hwmods", NULL); | ||
2368 | if (!strcmp(p, oh->name)) | ||
2369 | return np0; | ||
2370 | np1 = of_dev_hwmod_lookup(np0, oh); | ||
2371 | if (np1) | ||
2372 | return np1; | ||
2373 | } | ||
2374 | } | ||
2375 | return NULL; | ||
2376 | } | ||
2377 | |||
2378 | /** | ||
2353 | * _init_mpu_rt_base - populate the virtual address for a hwmod | 2379 | * _init_mpu_rt_base - populate the virtual address for a hwmod |
2354 | * @oh: struct omap_hwmod * to locate the virtual address | 2380 | * @oh: struct omap_hwmod * to locate the virtual address |
2355 | * | 2381 | * |
@@ -2361,7 +2387,8 @@ static int _shutdown(struct omap_hwmod *oh) | |||
2361 | static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | 2387 | static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) |
2362 | { | 2388 | { |
2363 | struct omap_hwmod_addr_space *mem; | 2389 | struct omap_hwmod_addr_space *mem; |
2364 | void __iomem *va_start; | 2390 | void __iomem *va_start = NULL; |
2391 | struct device_node *np; | ||
2365 | 2392 | ||
2366 | if (!oh) | 2393 | if (!oh) |
2367 | return; | 2394 | return; |
@@ -2375,10 +2402,18 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | |||
2375 | if (!mem) { | 2402 | if (!mem) { |
2376 | pr_debug("omap_hwmod: %s: no MPU register target found\n", | 2403 | pr_debug("omap_hwmod: %s: no MPU register target found\n", |
2377 | oh->name); | 2404 | oh->name); |
2378 | return; | 2405 | |
2406 | /* Extract the IO space from device tree blob */ | ||
2407 | if (!of_have_populated_dt()) | ||
2408 | return; | ||
2409 | |||
2410 | np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); | ||
2411 | if (np) | ||
2412 | va_start = of_iomap(np, 0); | ||
2413 | } else { | ||
2414 | va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); | ||
2379 | } | 2415 | } |
2380 | 2416 | ||
2381 | va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); | ||
2382 | if (!va_start) { | 2417 | if (!va_start) { |
2383 | pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); | 2418 | pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); |
2384 | return; | 2419 | return; |
@@ -2410,7 +2445,8 @@ static int __init _init(struct omap_hwmod *oh, void *data) | |||
2410 | if (oh->_state != _HWMOD_STATE_REGISTERED) | 2445 | if (oh->_state != _HWMOD_STATE_REGISTERED) |
2411 | return 0; | 2446 | return 0; |
2412 | 2447 | ||
2413 | _init_mpu_rt_base(oh, NULL); | 2448 | if (oh->class->sysc) |
2449 | _init_mpu_rt_base(oh, NULL); | ||
2414 | 2450 | ||
2415 | r = _init_clocks(oh, NULL); | 2451 | r = _init_clocks(oh, NULL); |
2416 | if (IS_ERR_VALUE(r)) { | 2452 | if (IS_ERR_VALUE(r)) { |