15 #include <linux/kernel.h>
32 #define START_PADCONF_SAVE 0x2
33 #define PADCONF_SAVE_DONE 0x1
35 static void __iomem *omap2_ctrl_base;
36 static void __iomem *omap4_ctrl_pad_base;
38 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
39 struct omap3_scratchpad {
41 u32 public_restore_ptr;
42 u32 secure_ram_restore_ptr;
43 u32 sdrc_module_semaphore;
44 u32 prcm_block_offset;
45 u32 sdrc_block_offset;
48 struct omap3_scratchpad_prcm_block {
59 u32 cm_autoidle_pll_mpu;
60 u32 cm_clksel1_pll_mpu;
61 u32 cm_clksel2_pll_mpu;
65 struct omap3_scratchpad_sdrc_block {
105 u32 omap3_arm_context[128];
107 struct omap3_control_regs {
134 u32 dss_dpll_spreading;
135 u32 core_dpll_spreading;
136 u32 per_dpll_spreading;
137 u32 usbhost_dpll_spreading;
143 u32 padconf_sys_nirq;
146 static struct omap3_control_regs control_context;
149 #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
150 #define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg))
154 if (omap2_globals->
ctrl)
155 omap2_ctrl_base = omap2_globals->
ctrl;
158 omap4_ctrl_pad_base = omap2_globals->
ctrl_pad;
163 return omap2_ctrl_base;
213 #ifdef CONFIG_ARCH_OMAP3
224 void omap3_ctrl_write_boot_mode(
u8 bootmode)
228 l = (
'B' << 24) | (
'M' << 16) | bootmode;
259 pr_err(
"%s: unsupported omap type\n", __func__);
280 pr_err(
"%s: unsupported omap type\n", __func__);
287 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
292 void omap3_clear_scratchpad_contents(
void)
300 for ( ; offset <= max_offset; offset += 0x4)
311 void __iomem *scratchpad_address;
312 u32 arm_context_addr;
313 struct omap3_scratchpad scratchpad_contents;
314 struct omap3_scratchpad_prcm_block prcm_block_contents;
315 struct omap3_scratchpad_sdrc_block sdrc_block_contents;
325 scratchpad_contents.boot_config_ptr = 0x0;
327 scratchpad_contents.public_restore_ptr =
331 scratchpad_contents.public_restore_ptr =
334 scratchpad_contents.public_restore_ptr =
338 scratchpad_contents.secure_ram_restore_ptr = 0x0;
340 scratchpad_contents.secure_ram_restore_ptr =
341 (
u32)
__pa(omap3_secure_ram_storage);
342 scratchpad_contents.sdrc_module_semaphore = 0x0;
343 scratchpad_contents.prcm_block_offset = 0x2C;
344 scratchpad_contents.sdrc_block_offset = 0x64;
347 prcm_block_contents.prm_clksrc_ctrl =
350 prcm_block_contents.prm_clksel =
353 prcm_block_contents.cm_clksel_core =
355 prcm_block_contents.cm_clksel_wkup =
357 prcm_block_contents.cm_clken_pll =
364 prcm_block_contents.cm_autoidle_pll =
367 prcm_block_contents.cm_clksel1_pll =
369 prcm_block_contents.cm_clksel2_pll =
371 prcm_block_contents.cm_clksel3_pll =
373 prcm_block_contents.cm_clken_pll_mpu =
375 prcm_block_contents.cm_autoidle_pll_mpu =
377 prcm_block_contents.cm_clksel1_pll_mpu =
379 prcm_block_contents.cm_clksel2_pll_mpu =
381 prcm_block_contents.prcm_block_size = 0x0;
384 sdrc_block_contents.sysconfig =
386 sdrc_block_contents.cs_cfg =
388 sdrc_block_contents.sharing =
390 sdrc_block_contents.err_type =
393 sdrc_block_contents.dll_b_ctrl = 0x0;
401 sdrc_block_contents.power = (sdrc_read_reg(
SDRC_POWER) &
407 sdrc_block_contents.power = sdrc_read_reg(
SDRC_POWER);
409 sdrc_block_contents.cs_0 = 0x0;
410 sdrc_block_contents.mcfg_0 = sdrc_read_reg(
SDRC_MCFG_0);
411 sdrc_block_contents.mr_0 = (sdrc_read_reg(
SDRC_MR_0) & 0xFFFF);
412 sdrc_block_contents.emr_1_0 = 0x0;
413 sdrc_block_contents.emr_2_0 = 0x0;
414 sdrc_block_contents.emr_3_0 = 0x0;
415 sdrc_block_contents.actim_ctrla_0 =
417 sdrc_block_contents.actim_ctrlb_0 =
419 sdrc_block_contents.rfr_ctrl_0 =
421 sdrc_block_contents.cs_1 = 0x0;
422 sdrc_block_contents.mcfg_1 = sdrc_read_reg(
SDRC_MCFG_1);
423 sdrc_block_contents.mr_1 = sdrc_read_reg(
SDRC_MR_1) & 0xFFFF;
424 sdrc_block_contents.emr_1_1 = 0x0;
425 sdrc_block_contents.emr_2_1 = 0x0;
426 sdrc_block_contents.emr_3_1 = 0x0;
427 sdrc_block_contents.actim_ctrla_1 =
429 sdrc_block_contents.actim_ctrlb_1 =
431 sdrc_block_contents.rfr_ctrl_1 =
433 sdrc_block_contents.dcdl_1_ctrl = 0x0;
434 sdrc_block_contents.dcdl_2_ctrl = 0x0;
435 sdrc_block_contents.flags = 0x0;
436 sdrc_block_contents.block_size = 0x0;
442 memcpy_toio(scratchpad_address, &scratchpad_contents,
443 sizeof(scratchpad_contents));
446 scratchpad_contents.prcm_block_offset,
447 &prcm_block_contents,
sizeof(prcm_block_contents));
449 scratchpad_contents.sdrc_block_offset,
450 &sdrc_block_contents,
sizeof(sdrc_block_contents));
456 scratchpad_contents.sdrc_block_offset +
457 sizeof(sdrc_block_contents), &arm_context_addr, 4);
460 void omap3_control_save_context(
void)
464 control_context.mem_dftrw0 =
466 control_context.mem_dftrw1 =
468 control_context.msuspendmux_0 =
470 control_context.msuspendmux_1 =
472 control_context.msuspendmux_2 =
474 control_context.msuspendmux_3 =
476 control_context.msuspendmux_4 =
478 control_context.msuspendmux_5 =
483 control_context.iva2_bootaddr =
485 control_context.iva2_bootmod =
498 control_context.dss_dpll_spreading =
500 control_context.core_dpll_spreading =
502 control_context.per_dpll_spreading =
504 control_context.usbhost_dpll_spreading =
506 control_context.pbias_lite =
508 control_context.temp_sensor =
513 control_context.padconf_sys_nirq =
518 void omap3_control_restore_context(
void)
576 void omap3630_ctrl_disable_rta(
void)
593 int omap3_ctrl_save_padconf(
void)