diff options
author | Tony Lindgren <tony@atomide.com> | 2018-08-08 04:07:04 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2018-08-17 10:22:39 -0400 |
commit | 1dbcb97c656eed1a244c960b8b3a469c3d20ce7b (patch) | |
tree | b4c89d8fd284d36f18afc99f849498cf01e1d8ab /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 4769c003e0fcff0ee001a9102e2605bdaa5880f0 (diff) |
ARM: OMAP2+: Fix module address for modules using mpu_rt_idx
If we use device tree data for a module interconnect target we want
to map the control registers from the module start. Legacy hwmod platform
data however is using child IP offsets for cpsw module with mpu_rt_idx.
In cases where we have the interconnect target module already using device
tree data with legacy hwmod platform data still around, the sysc register
area is not adjusted for mpu_rt_idx causing wrong registers being accessed.
Let's fix the issue for mixed dts and platform data mode by ioremapping
the module registers using child IP offset if mpu_rt_idx is set. For
device tree only data there's no reason to use mpu_rt_idx.
Fixes: 6c72b3550672 ("ARM: OMAP2+: Parse module IO range from dts for legacy
"ti,hwmods" support")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 7f759abcf49c..cd65ea4e9c54 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -2161,6 +2161,37 @@ static int of_dev_hwmod_lookup(struct device_node *np, | |||
2161 | } | 2161 | } |
2162 | 2162 | ||
2163 | /** | 2163 | /** |
2164 | * omap_hwmod_fix_mpu_rt_idx - fix up mpu_rt_idx register offsets | ||
2165 | * | ||
2166 | * @oh: struct omap_hwmod * | ||
2167 | * @np: struct device_node * | ||
2168 | * | ||
2169 | * Fix up module register offsets for modules with mpu_rt_idx. | ||
2170 | * Only needed for cpsw with interconnect target module defined | ||
2171 | * in device tree while still using legacy hwmod platform data | ||
2172 | * for rev, sysc and syss registers. | ||
2173 | * | ||
2174 | * Can be removed when all cpsw hwmod platform data has been | ||
2175 | * dropped. | ||
2176 | */ | ||
2177 | static void omap_hwmod_fix_mpu_rt_idx(struct omap_hwmod *oh, | ||
2178 | struct device_node *np, | ||
2179 | struct resource *res) | ||
2180 | { | ||
2181 | struct device_node *child = NULL; | ||
2182 | int error; | ||
2183 | |||
2184 | child = of_get_next_child(np, child); | ||
2185 | if (!child) | ||
2186 | return; | ||
2187 | |||
2188 | error = of_address_to_resource(child, oh->mpu_rt_idx, res); | ||
2189 | if (error) | ||
2190 | pr_err("%s: error mapping mpu_rt_idx: %i\n", | ||
2191 | __func__, error); | ||
2192 | } | ||
2193 | |||
2194 | /** | ||
2164 | * omap_hwmod_parse_module_range - map module IO range from device tree | 2195 | * omap_hwmod_parse_module_range - map module IO range from device tree |
2165 | * @oh: struct omap_hwmod * | 2196 | * @oh: struct omap_hwmod * |
2166 | * @np: struct device_node * | 2197 | * @np: struct device_node * |
@@ -2222,6 +2253,12 @@ int omap_hwmod_parse_module_range(struct omap_hwmod *oh, | |||
2222 | pr_debug("omap_hwmod: %s %s at 0x%llx size 0x%llx\n", | 2253 | pr_debug("omap_hwmod: %s %s at 0x%llx size 0x%llx\n", |
2223 | oh ? oh->name : "", np->name, base, size); | 2254 | oh ? oh->name : "", np->name, base, size); |
2224 | 2255 | ||
2256 | if (oh && oh->mpu_rt_idx) { | ||
2257 | omap_hwmod_fix_mpu_rt_idx(oh, np, res); | ||
2258 | |||
2259 | return 0; | ||
2260 | } | ||
2261 | |||
2225 | res->start = base; | 2262 | res->start = base; |
2226 | res->end = base + size - 1; | 2263 | res->end = base + size - 1; |
2227 | res->flags = IORESOURCE_MEM; | 2264 | res->flags = IORESOURCE_MEM; |