ARM: OMAP2+: Fix out of range register access with syscon_config.max_register
authorTony Lindgren <tony@atomide.com>
Mon, 22 Feb 2016 17:22:38 +0000 (09:22 -0800)
committerTony Lindgren <tony@atomide.com>
Mon, 22 Feb 2016 17:22:38 +0000 (09:22 -0800)
If syscon_config.max_register is initialized like it should be, we have
omap_ctrl_read/write() fail with out of range register access at least
for omap3.

We have omap3.dtsi setting up a regmap range for scm_conf, but we now
have omap_ctrl_read/write() also attempt to use the regmap. However,
omap_ctrl_read/write() is also used for other register ranges in the
system control module (SCM).

Let's fix the issue by just removing the regmap_read/write() usage for
control module as suggested by Tero Kristo <t-kristo@ti.com>.

Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/control.c

index cf5855174c93cbb57d3b0ccb9f2a5e417a59c7eb..1662071bb2cc8361023aa3a066ab963bbd411540 100644 (file)
@@ -36,7 +36,6 @@
 
 static void __iomem *omap2_ctrl_base;
 static s16 omap2_ctrl_offset;
-static struct regmap *omap2_ctrl_syscon;
 
 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
 struct omap3_scratchpad {
@@ -166,16 +165,9 @@ u16 omap_ctrl_readw(u16 offset)
 
 u32 omap_ctrl_readl(u16 offset)
 {
-       u32 val;
-
        offset &= 0xfffc;
-       if (!omap2_ctrl_syscon)
-               val = readl_relaxed(omap2_ctrl_base + offset);
-       else
-               regmap_read(omap2_ctrl_syscon, omap2_ctrl_offset + offset,
-                           &val);
 
-       return val;
+       return readl_relaxed(omap2_ctrl_base + offset);
 }
 
 void omap_ctrl_writeb(u8 val, u16 offset)
@@ -207,11 +199,7 @@ void omap_ctrl_writew(u16 val, u16 offset)
 void omap_ctrl_writel(u32 val, u16 offset)
 {
        offset &= 0xfffc;
-       if (!omap2_ctrl_syscon)
-               writel_relaxed(val, omap2_ctrl_base + offset);
-       else
-               regmap_write(omap2_ctrl_syscon, omap2_ctrl_offset + offset,
-                            val);
+       writel_relaxed(val, omap2_ctrl_base + offset);
 }
 
 #ifdef CONFIG_ARCH_OMAP3
@@ -715,8 +703,6 @@ int __init omap_control_init(void)
                        if (IS_ERR(syscon))
                                return PTR_ERR(syscon);
 
-                       omap2_ctrl_syscon = syscon;
-
                        if (of_get_child_by_name(scm_conf, "clocks")) {
                                ret = omap2_clk_provider_init(scm_conf,
                                                              data->index,
@@ -724,9 +710,6 @@ int __init omap_control_init(void)
                                if (ret)
                                        return ret;
                        }
-
-                       iounmap(omap2_ctrl_base);
-                       omap2_ctrl_base = NULL;
                } else {
                        /* No scm_conf found, direct access */
                        ret = omap2_clk_provider_init(np, data->index, NULL,