@@ -138,6 +138,7 @@
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/bootmem.h>
+#include <linux/of.h>
#include "clock.h"
#include "omap_hwmod.h"
@@ -2336,6 +2337,11 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
{
struct omap_hwmod_addr_space *mem;
void __iomem *va_start;
+ struct device_node *np;
+ const void *reg_prop;
+ const char *p;
+ unsigned long start = 0, size = 0;
+
if (!oh)
return;
@@ -2349,10 +2355,33 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
if (!mem) {
pr_debug("omap_hwmod: %s: no MPU register target found\n",
oh->name);
+
+ /* Extract the IO space from device tree blob */
+ if (!of_have_populated_dt())
+ return;
+
+ for_each_child_of_node(of_find_node_by_name(NULL, "ocp"), np) {
+ if (of_find_property(np, "ti,hwmods", NULL)) {
+ p = of_get_property(np, "ti,hwmods", NULL);
+ if (!strcmp(p, oh->name)) {
+ reg_prop = of_get_property(np, "reg",
+ NULL);
+ start = of_read_number(reg_prop, 1);
+ size = of_read_number(reg_prop + 4, 1);
+ }
+ }
+ }
+ } else {
+ start = mem->pa_start;
+ size = mem->pa_end - mem->pa_start;
+ }
+
+ if (!start) {
+ pr_debug("omap_hwmod: %s: No address space found\n", oh->name);
return;
}
- va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
+ va_start = ioremap(start, size);
if (!va_start) {
pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
return;