aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/control.c')
-rw-r--r--arch/arm/mach-omap2/control.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index a8d20eef2306..1fa3294b6048 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -16,15 +16,18 @@
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <plat/common.h> 18#include <plat/common.h>
19#include <plat/control.h>
20#include <plat/sdrc.h> 19#include <plat/sdrc.h>
20
21#include "cm-regbits-34xx.h" 21#include "cm-regbits-34xx.h"
22#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
23#include "cm.h" 23#include "cm.h"
24#include "prm.h" 24#include "prm.h"
25#include "sdrc.h" 25#include "sdrc.h"
26#include "pm.h"
27#include "control.h"
26 28
27static void __iomem *omap2_ctrl_base; 29static void __iomem *omap2_ctrl_base;
30static void __iomem *omap4_ctrl_pad_base;
28 31
29#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 32#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
30struct omap3_scratchpad { 33struct omap3_scratchpad {
@@ -137,6 +140,7 @@ static struct omap3_control_regs control_context;
137#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ 140#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
138 141
139#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) 142#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
143#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg))
140 144
141void __init omap2_set_globals_control(struct omap_globals *omap2_globals) 145void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
142{ 146{
@@ -145,6 +149,12 @@ void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
145 omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K); 149 omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
146 WARN_ON(!omap2_ctrl_base); 150 WARN_ON(!omap2_ctrl_base);
147 } 151 }
152
153 /* Static mapping, never released */
154 if (omap2_globals->ctrl_pad) {
155 omap4_ctrl_pad_base = ioremap(omap2_globals->ctrl_pad, SZ_4K);
156 WARN_ON(!omap4_ctrl_pad_base);
157 }
148} 158}
149 159
150void __iomem *omap_ctrl_base_get(void) 160void __iomem *omap_ctrl_base_get(void)
@@ -182,6 +192,23 @@ void omap_ctrl_writel(u32 val, u16 offset)
182 __raw_writel(val, OMAP_CTRL_REGADDR(offset)); 192 __raw_writel(val, OMAP_CTRL_REGADDR(offset));
183} 193}
184 194
195/*
196 * On OMAP4 control pad are not addressable from control
197 * core base. So the common omap_ctrl_read/write APIs breaks
198 * Hence export separate APIs to manage the omap4 pad control
199 * registers. This APIs will work only for OMAP4
200 */
201
202u32 omap4_ctrl_pad_readl(u16 offset)
203{
204 return __raw_readl(OMAP4_CTRL_PAD_REGADDR(offset));
205}
206
207void omap4_ctrl_pad_writel(u32 val, u16 offset)
208{
209 __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset));
210}
211
185#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 212#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
186/* 213/*
187 * Clears the scratchpad contents in case of cold boot- 214 * Clears the scratchpad contents in case of cold boot-
@@ -190,7 +217,7 @@ void omap_ctrl_writel(u32 val, u16 offset)
190void omap3_clear_scratchpad_contents(void) 217void omap3_clear_scratchpad_contents(void)
191{ 218{
192 u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET; 219 u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET;
193 u32 *v_addr; 220 void __iomem *v_addr;
194 u32 offset = 0; 221 u32 offset = 0;
195 v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM); 222 v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM);
196 if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & 223 if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
@@ -206,7 +233,7 @@ void omap3_clear_scratchpad_contents(void)
206/* Populate the scratchpad structure with restore structure */ 233/* Populate the scratchpad structure with restore structure */
207void omap3_save_scratchpad_contents(void) 234void omap3_save_scratchpad_contents(void)
208{ 235{
209 void * __iomem scratchpad_address; 236 void __iomem *scratchpad_address;
210 u32 arm_context_addr; 237 u32 arm_context_addr;
211 struct omap3_scratchpad scratchpad_contents; 238 struct omap3_scratchpad scratchpad_contents;
212 struct omap3_scratchpad_prcm_block prcm_block_contents; 239 struct omap3_scratchpad_prcm_block prcm_block_contents;