diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 22:13:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 22:13:58 -0500 |
commit | 01539ba2a706ab7d35fc0667dff919ade7f87d63 (patch) | |
tree | 5a4bd0cf78007d06690fe4ac06bbd49a5a70bc47 /arch/arm/mach-omap2/control.c | |
parent | 9e9bc9736756f25d6c47b4eba0ebf25b20a6f153 (diff) | |
parent | dc69d1af9e8d9cbbabff88bb35a6782187a22229 (diff) |
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (243 commits)
omap2: Make OMAP2PLUS select OMAP_DM_TIMER
OMAP4: hwmod data: Fix alignment and end of line in structurefields
OMAP4: hwmod data: Move the DMA structures
OMAP4: hwmod data: Move the smartreflex structures
OMAP4: hwmod data: Fix missing SIDLE_SMART_WKUP in smartreflexsysc
arm: omap: tusb6010: add name for MUSB IRQ
arm: omap: craneboard: Add USB EHCI support
omap2+: Initialize serial port for dynamic remuxing for n8x0
omap2+: Add struct omap_board_data and use it for platform level serial init
omap2+: Allow hwmod state changes to mux pads based on the state changes
omap2+: Add support for hwmod specific muxing of devices
omap2+: Add omap_mux_get_by_name
OMAP2: PM: fix compile error when !CONFIG_SUSPEND
MAINTAINERS: OMAP: hwmod: update hwmod code, data maintainership
OMAP4: Smartreflex framework extensions
OMAP4: hwmod: Add inital data for smartreflex modules.
OMAP4: PM: Program correct init voltages for scalable VDDs
OMAP4: Adding voltage driver support
OMAP4: Register voltage PMIC parameters with the voltage layer
OMAP3: PM: Program correct init voltages for VDD1 and VDD2
...
Fix up trivial conflict in arch/arm/plat-omap/Kconfig
Diffstat (limited to 'arch/arm/mach-omap2/control.c')
-rw-r--r-- | arch/arm/mach-omap2/control.c | 133 |
1 files changed, 110 insertions, 23 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 1fa3294b6048..695279419020 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c | |||
@@ -20,12 +20,16 @@ | |||
20 | 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 "prm2xxx_3xxx.h" |
24 | #include "prm.h" | 24 | #include "cm2xxx_3xxx.h" |
25 | #include "sdrc.h" | 25 | #include "sdrc.h" |
26 | #include "pm.h" | 26 | #include "pm.h" |
27 | #include "control.h" | 27 | #include "control.h" |
28 | 28 | ||
29 | /* Used by omap3_ctrl_save_padconf() */ | ||
30 | #define START_PADCONF_SAVE 0x2 | ||
31 | #define PADCONF_SAVE_DONE 0x1 | ||
32 | |||
29 | static void __iomem *omap2_ctrl_base; | 33 | static void __iomem *omap2_ctrl_base; |
30 | static void __iomem *omap4_ctrl_pad_base; | 34 | static void __iomem *omap4_ctrl_pad_base; |
31 | 35 | ||
@@ -134,6 +138,7 @@ struct omap3_control_regs { | |||
134 | u32 sramldo4; | 138 | u32 sramldo4; |
135 | u32 sramldo5; | 139 | u32 sramldo5; |
136 | u32 csi; | 140 | u32 csi; |
141 | u32 padconf_sys_nirq; | ||
137 | }; | 142 | }; |
138 | 143 | ||
139 | static struct omap3_control_regs control_context; | 144 | static struct omap3_control_regs control_context; |
@@ -209,6 +214,37 @@ void omap4_ctrl_pad_writel(u32 val, u16 offset) | |||
209 | __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset)); | 214 | __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset)); |
210 | } | 215 | } |
211 | 216 | ||
217 | #ifdef CONFIG_ARCH_OMAP3 | ||
218 | |||
219 | /** | ||
220 | * omap3_ctrl_write_boot_mode - set scratchpad boot mode for the next boot | ||
221 | * @bootmode: 8-bit value to pass to some boot code | ||
222 | * | ||
223 | * Set the bootmode in the scratchpad RAM. This is used after the | ||
224 | * system restarts. Not sure what actually uses this - it may be the | ||
225 | * bootloader, rather than the boot ROM - contrary to the preserved | ||
226 | * comment below. No return value. | ||
227 | */ | ||
228 | void omap3_ctrl_write_boot_mode(u8 bootmode) | ||
229 | { | ||
230 | u32 l; | ||
231 | |||
232 | l = ('B' << 24) | ('M' << 16) | bootmode; | ||
233 | |||
234 | /* | ||
235 | * Reserve the first word in scratchpad for communicating | ||
236 | * with the boot ROM. A pointer to a data structure | ||
237 | * describing the boot process can be stored there, | ||
238 | * cf. OMAP34xx TRM, Initialization / Software Booting | ||
239 | * Configuration. | ||
240 | * | ||
241 | * XXX This should use some omap_ctrl_writel()-type function | ||
242 | */ | ||
243 | __raw_writel(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4)); | ||
244 | } | ||
245 | |||
246 | #endif | ||
247 | |||
212 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) | 248 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) |
213 | /* | 249 | /* |
214 | * Clears the scratchpad contents in case of cold boot- | 250 | * Clears the scratchpad contents in case of cold boot- |
@@ -220,13 +256,13 @@ void omap3_clear_scratchpad_contents(void) | |||
220 | void __iomem *v_addr; | 256 | void __iomem *v_addr; |
221 | u32 offset = 0; | 257 | u32 offset = 0; |
222 | v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM); | 258 | v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM); |
223 | if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & | 259 | if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & |
224 | OMAP3430_GLOBAL_COLD_RST_MASK) { | 260 | OMAP3430_GLOBAL_COLD_RST_MASK) { |
225 | for ( ; offset <= max_offset; offset += 0x4) | 261 | for ( ; offset <= max_offset; offset += 0x4) |
226 | __raw_writel(0x0, (v_addr + offset)); | 262 | __raw_writel(0x0, (v_addr + offset)); |
227 | prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK, | 263 | omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK, |
228 | OMAP3430_GR_MOD, | 264 | OMAP3430_GR_MOD, |
229 | OMAP3_PRM_RSTST_OFFSET); | 265 | OMAP3_PRM_RSTST_OFFSET); |
230 | } | 266 | } |
231 | } | 267 | } |
232 | 268 | ||
@@ -239,9 +275,19 @@ void omap3_save_scratchpad_contents(void) | |||
239 | struct omap3_scratchpad_prcm_block prcm_block_contents; | 275 | struct omap3_scratchpad_prcm_block prcm_block_contents; |
240 | struct omap3_scratchpad_sdrc_block sdrc_block_contents; | 276 | struct omap3_scratchpad_sdrc_block sdrc_block_contents; |
241 | 277 | ||
242 | /* Populate the Scratchpad contents */ | 278 | /* |
279 | * Populate the Scratchpad contents | ||
280 | * | ||
281 | * The "get_*restore_pointer" functions are used to provide a | ||
282 | * physical restore address where the ROM code jumps while waking | ||
283 | * up from MPU OFF/OSWR state. | ||
284 | * The restore pointer is stored into the scratchpad. | ||
285 | */ | ||
243 | scratchpad_contents.boot_config_ptr = 0x0; | 286 | scratchpad_contents.boot_config_ptr = 0x0; |
244 | if (omap_rev() != OMAP3430_REV_ES3_0 && | 287 | if (cpu_is_omap3630()) |
288 | scratchpad_contents.public_restore_ptr = | ||
289 | virt_to_phys(get_omap3630_restore_pointer()); | ||
290 | else if (omap_rev() != OMAP3430_REV_ES3_0 && | ||
245 | omap_rev() != OMAP3430_REV_ES3_1) | 291 | omap_rev() != OMAP3430_REV_ES3_1) |
246 | scratchpad_contents.public_restore_ptr = | 292 | scratchpad_contents.public_restore_ptr = |
247 | virt_to_phys(get_restore_pointer()); | 293 | virt_to_phys(get_restore_pointer()); |
@@ -258,32 +304,34 @@ void omap3_save_scratchpad_contents(void) | |||
258 | scratchpad_contents.sdrc_block_offset = 0x64; | 304 | scratchpad_contents.sdrc_block_offset = 0x64; |
259 | 305 | ||
260 | /* Populate the PRCM block contents */ | 306 | /* Populate the PRCM block contents */ |
261 | prcm_block_contents.prm_clksrc_ctrl = prm_read_mod_reg(OMAP3430_GR_MOD, | 307 | prcm_block_contents.prm_clksrc_ctrl = |
262 | OMAP3_PRM_CLKSRC_CTRL_OFFSET); | 308 | omap2_prm_read_mod_reg(OMAP3430_GR_MOD, |
263 | prcm_block_contents.prm_clksel = prm_read_mod_reg(OMAP3430_CCR_MOD, | 309 | OMAP3_PRM_CLKSRC_CTRL_OFFSET); |
264 | OMAP3_PRM_CLKSEL_OFFSET); | 310 | prcm_block_contents.prm_clksel = |
311 | omap2_prm_read_mod_reg(OMAP3430_CCR_MOD, | ||
312 | OMAP3_PRM_CLKSEL_OFFSET); | ||
265 | prcm_block_contents.cm_clksel_core = | 313 | prcm_block_contents.cm_clksel_core = |
266 | cm_read_mod_reg(CORE_MOD, CM_CLKSEL); | 314 | omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL); |
267 | prcm_block_contents.cm_clksel_wkup = | 315 | prcm_block_contents.cm_clksel_wkup = |
268 | cm_read_mod_reg(WKUP_MOD, CM_CLKSEL); | 316 | omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL); |
269 | prcm_block_contents.cm_clken_pll = | 317 | prcm_block_contents.cm_clken_pll = |
270 | cm_read_mod_reg(PLL_MOD, CM_CLKEN); | 318 | omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); |
271 | prcm_block_contents.cm_autoidle_pll = | 319 | prcm_block_contents.cm_autoidle_pll = |
272 | cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL); | 320 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL); |
273 | prcm_block_contents.cm_clksel1_pll = | 321 | prcm_block_contents.cm_clksel1_pll = |
274 | cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL); | 322 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL); |
275 | prcm_block_contents.cm_clksel2_pll = | 323 | prcm_block_contents.cm_clksel2_pll = |
276 | cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL); | 324 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL); |
277 | prcm_block_contents.cm_clksel3_pll = | 325 | prcm_block_contents.cm_clksel3_pll = |
278 | cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3); | 326 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3); |
279 | prcm_block_contents.cm_clken_pll_mpu = | 327 | prcm_block_contents.cm_clken_pll_mpu = |
280 | cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL); | 328 | omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL); |
281 | prcm_block_contents.cm_autoidle_pll_mpu = | 329 | prcm_block_contents.cm_autoidle_pll_mpu = |
282 | cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL); | 330 | omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL); |
283 | prcm_block_contents.cm_clksel1_pll_mpu = | 331 | prcm_block_contents.cm_clksel1_pll_mpu = |
284 | cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL); | 332 | omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL); |
285 | prcm_block_contents.cm_clksel2_pll_mpu = | 333 | prcm_block_contents.cm_clksel2_pll_mpu = |
286 | cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL); | 334 | omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL); |
287 | prcm_block_contents.prcm_block_size = 0x0; | 335 | prcm_block_contents.prcm_block_size = 0x0; |
288 | 336 | ||
289 | /* Populate the SDRC block contents */ | 337 | /* Populate the SDRC block contents */ |
@@ -416,6 +464,8 @@ void omap3_control_save_context(void) | |||
416 | control_context.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4); | 464 | control_context.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4); |
417 | control_context.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5); | 465 | control_context.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5); |
418 | control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI); | 466 | control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI); |
467 | control_context.padconf_sys_nirq = | ||
468 | omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_SYSNIRQ); | ||
419 | return; | 469 | return; |
420 | } | 470 | } |
421 | 471 | ||
@@ -472,6 +522,43 @@ void omap3_control_restore_context(void) | |||
472 | omap_ctrl_writel(control_context.sramldo4, OMAP343X_CONTROL_SRAMLDO4); | 522 | omap_ctrl_writel(control_context.sramldo4, OMAP343X_CONTROL_SRAMLDO4); |
473 | omap_ctrl_writel(control_context.sramldo5, OMAP343X_CONTROL_SRAMLDO5); | 523 | omap_ctrl_writel(control_context.sramldo5, OMAP343X_CONTROL_SRAMLDO5); |
474 | omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI); | 524 | omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI); |
525 | omap_ctrl_writel(control_context.padconf_sys_nirq, | ||
526 | OMAP343X_CONTROL_PADCONF_SYSNIRQ); | ||
475 | return; | 527 | return; |
476 | } | 528 | } |
529 | |||
530 | void omap3630_ctrl_disable_rta(void) | ||
531 | { | ||
532 | if (!cpu_is_omap3630()) | ||
533 | return; | ||
534 | omap_ctrl_writel(OMAP36XX_RTA_DISABLE, OMAP36XX_CONTROL_MEM_RTA_CTRL); | ||
535 | } | ||
536 | |||
537 | /** | ||
538 | * omap3_ctrl_save_padconf - save padconf registers to scratchpad RAM | ||
539 | * | ||
540 | * Tell the SCM to start saving the padconf registers, then wait for | ||
541 | * the process to complete. Returns 0 unconditionally, although it | ||
542 | * should also eventually be able to return -ETIMEDOUT, if the save | ||
543 | * does not complete. | ||
544 | * | ||
545 | * XXX This function is missing a timeout. What should it be? | ||
546 | */ | ||
547 | int omap3_ctrl_save_padconf(void) | ||
548 | { | ||
549 | u32 cpo; | ||
550 | |||
551 | /* Save the padconf registers */ | ||
552 | cpo = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF); | ||
553 | cpo |= START_PADCONF_SAVE; | ||
554 | omap_ctrl_writel(cpo, OMAP343X_CONTROL_PADCONF_OFF); | ||
555 | |||
556 | /* wait for the save to complete */ | ||
557 | while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS) | ||
558 | & PADCONF_SAVE_DONE)) | ||
559 | udelay(1); | ||
560 | |||
561 | return 0; | ||
562 | } | ||
563 | |||
477 | #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ | 564 | #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ |