xref: /openbmc/linux/arch/arm/mach-omap2/control.c (revision 0795a75a369b931150074a14473f024359b7f25c)
169d88a00SPaul Walmsley /*
269d88a00SPaul Walmsley  * OMAP2/3 System Control Module register access
369d88a00SPaul Walmsley  *
469d88a00SPaul Walmsley  * Copyright (C) 2007 Texas Instruments, Inc.
569d88a00SPaul Walmsley  * Copyright (C) 2007 Nokia Corporation
669d88a00SPaul Walmsley  *
769d88a00SPaul Walmsley  * Written by Paul Walmsley
869d88a00SPaul Walmsley  *
969d88a00SPaul Walmsley  * This program is free software; you can redistribute it and/or modify
1069d88a00SPaul Walmsley  * it under the terms of the GNU General Public License version 2 as
1169d88a00SPaul Walmsley  * published by the Free Software Foundation.
1269d88a00SPaul Walmsley  */
1369d88a00SPaul Walmsley #undef DEBUG
1469d88a00SPaul Walmsley 
1569d88a00SPaul Walmsley #include <linux/kernel.h>
16a58caad1STony Lindgren #include <linux/io.h>
1769d88a00SPaul Walmsley 
18ce491cf8STony Lindgren #include <plat/common.h>
19ce491cf8STony Lindgren #include <plat/control.h>
2080140786SRajendra Nayak #include <plat/sdrc.h>
2180140786SRajendra Nayak #include "cm-regbits-34xx.h"
2280140786SRajendra Nayak #include "prm-regbits-34xx.h"
2380140786SRajendra Nayak #include "cm.h"
2480140786SRajendra Nayak #include "prm.h"
2580140786SRajendra Nayak #include "sdrc.h"
2669d88a00SPaul Walmsley 
27a58caad1STony Lindgren static void __iomem *omap2_ctrl_base;
2869d88a00SPaul Walmsley 
29c96631e1SRajendra Nayak #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
3080140786SRajendra Nayak struct omap3_scratchpad {
3180140786SRajendra Nayak 	u32 boot_config_ptr;
3280140786SRajendra Nayak 	u32 public_restore_ptr;
3380140786SRajendra Nayak 	u32 secure_ram_restore_ptr;
3480140786SRajendra Nayak 	u32 sdrc_module_semaphore;
3580140786SRajendra Nayak 	u32 prcm_block_offset;
3680140786SRajendra Nayak 	u32 sdrc_block_offset;
3780140786SRajendra Nayak };
3880140786SRajendra Nayak 
3980140786SRajendra Nayak struct omap3_scratchpad_prcm_block {
4080140786SRajendra Nayak 	u32 prm_clksrc_ctrl;
4180140786SRajendra Nayak 	u32 prm_clksel;
4280140786SRajendra Nayak 	u32 cm_clksel_core;
4380140786SRajendra Nayak 	u32 cm_clksel_wkup;
4480140786SRajendra Nayak 	u32 cm_clken_pll;
4580140786SRajendra Nayak 	u32 cm_autoidle_pll;
4680140786SRajendra Nayak 	u32 cm_clksel1_pll;
4780140786SRajendra Nayak 	u32 cm_clksel2_pll;
4880140786SRajendra Nayak 	u32 cm_clksel3_pll;
4980140786SRajendra Nayak 	u32 cm_clken_pll_mpu;
5080140786SRajendra Nayak 	u32 cm_autoidle_pll_mpu;
5180140786SRajendra Nayak 	u32 cm_clksel1_pll_mpu;
5280140786SRajendra Nayak 	u32 cm_clksel2_pll_mpu;
5380140786SRajendra Nayak 	u32 prcm_block_size;
5480140786SRajendra Nayak };
5580140786SRajendra Nayak 
5680140786SRajendra Nayak struct omap3_scratchpad_sdrc_block {
5780140786SRajendra Nayak 	u16 sysconfig;
5880140786SRajendra Nayak 	u16 cs_cfg;
5980140786SRajendra Nayak 	u16 sharing;
6080140786SRajendra Nayak 	u16 err_type;
6180140786SRajendra Nayak 	u32 dll_a_ctrl;
6280140786SRajendra Nayak 	u32 dll_b_ctrl;
6380140786SRajendra Nayak 	u32 power;
6480140786SRajendra Nayak 	u32 cs_0;
6580140786SRajendra Nayak 	u32 mcfg_0;
6680140786SRajendra Nayak 	u16 mr_0;
6780140786SRajendra Nayak 	u16 emr_1_0;
6880140786SRajendra Nayak 	u16 emr_2_0;
6980140786SRajendra Nayak 	u16 emr_3_0;
7080140786SRajendra Nayak 	u32 actim_ctrla_0;
7180140786SRajendra Nayak 	u32 actim_ctrlb_0;
7280140786SRajendra Nayak 	u32 rfr_ctrl_0;
7380140786SRajendra Nayak 	u32 cs_1;
7480140786SRajendra Nayak 	u32 mcfg_1;
7580140786SRajendra Nayak 	u16 mr_1;
7680140786SRajendra Nayak 	u16 emr_1_1;
7780140786SRajendra Nayak 	u16 emr_2_1;
7880140786SRajendra Nayak 	u16 emr_3_1;
7980140786SRajendra Nayak 	u32 actim_ctrla_1;
8080140786SRajendra Nayak 	u32 actim_ctrlb_1;
8180140786SRajendra Nayak 	u32 rfr_ctrl_1;
8280140786SRajendra Nayak 	u16 dcdl_1_ctrl;
8380140786SRajendra Nayak 	u16 dcdl_2_ctrl;
8480140786SRajendra Nayak 	u32 flags;
8580140786SRajendra Nayak 	u32 block_size;
8680140786SRajendra Nayak };
8780140786SRajendra Nayak 
8827d59a4aSTero Kristo void *omap3_secure_ram_storage;
8927d59a4aSTero Kristo 
9080140786SRajendra Nayak /*
9180140786SRajendra Nayak  * This is used to store ARM registers in SDRAM before attempting
9280140786SRajendra Nayak  * an MPU OFF. The save and restore happens from the SRAM sleep code.
9380140786SRajendra Nayak  * The address is stored in scratchpad, so that it can be used
9480140786SRajendra Nayak  * during the restore path.
9580140786SRajendra Nayak  */
9680140786SRajendra Nayak u32 omap3_arm_context[128];
9780140786SRajendra Nayak 
98c96631e1SRajendra Nayak struct omap3_control_regs {
99c96631e1SRajendra Nayak 	u32 sysconfig;
100c96631e1SRajendra Nayak 	u32 devconf0;
101c96631e1SRajendra Nayak 	u32 mem_dftrw0;
102c96631e1SRajendra Nayak 	u32 mem_dftrw1;
103c96631e1SRajendra Nayak 	u32 msuspendmux_0;
104c96631e1SRajendra Nayak 	u32 msuspendmux_1;
105c96631e1SRajendra Nayak 	u32 msuspendmux_2;
106c96631e1SRajendra Nayak 	u32 msuspendmux_3;
107c96631e1SRajendra Nayak 	u32 msuspendmux_4;
108c96631e1SRajendra Nayak 	u32 msuspendmux_5;
109c96631e1SRajendra Nayak 	u32 sec_ctrl;
110c96631e1SRajendra Nayak 	u32 devconf1;
111c96631e1SRajendra Nayak 	u32 csirxfe;
112c96631e1SRajendra Nayak 	u32 iva2_bootaddr;
113c96631e1SRajendra Nayak 	u32 iva2_bootmod;
114c96631e1SRajendra Nayak 	u32 debobs_0;
115c96631e1SRajendra Nayak 	u32 debobs_1;
116c96631e1SRajendra Nayak 	u32 debobs_2;
117c96631e1SRajendra Nayak 	u32 debobs_3;
118c96631e1SRajendra Nayak 	u32 debobs_4;
119c96631e1SRajendra Nayak 	u32 debobs_5;
120c96631e1SRajendra Nayak 	u32 debobs_6;
121c96631e1SRajendra Nayak 	u32 debobs_7;
122c96631e1SRajendra Nayak 	u32 debobs_8;
123c96631e1SRajendra Nayak 	u32 prog_io0;
124c96631e1SRajendra Nayak 	u32 prog_io1;
125c96631e1SRajendra Nayak 	u32 dss_dpll_spreading;
126c96631e1SRajendra Nayak 	u32 core_dpll_spreading;
127c96631e1SRajendra Nayak 	u32 per_dpll_spreading;
128c96631e1SRajendra Nayak 	u32 usbhost_dpll_spreading;
129c96631e1SRajendra Nayak 	u32 pbias_lite;
130c96631e1SRajendra Nayak 	u32 temp_sensor;
131c96631e1SRajendra Nayak 	u32 sramldo4;
132c96631e1SRajendra Nayak 	u32 sramldo5;
133c96631e1SRajendra Nayak 	u32 csi;
134c96631e1SRajendra Nayak };
135c96631e1SRajendra Nayak 
136c96631e1SRajendra Nayak static struct omap3_control_regs control_context;
137c96631e1SRajendra Nayak #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
138c96631e1SRajendra Nayak 
139a58caad1STony Lindgren #define OMAP_CTRL_REGADDR(reg)		(omap2_ctrl_base + (reg))
14069d88a00SPaul Walmsley 
141a58caad1STony Lindgren void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
14269d88a00SPaul Walmsley {
143a58caad1STony Lindgren 	omap2_ctrl_base = omap2_globals->ctrl;
14469d88a00SPaul Walmsley }
14569d88a00SPaul Walmsley 
146a58caad1STony Lindgren void __iomem *omap_ctrl_base_get(void)
14769d88a00SPaul Walmsley {
14869d88a00SPaul Walmsley 	return omap2_ctrl_base;
14969d88a00SPaul Walmsley }
15069d88a00SPaul Walmsley 
15169d88a00SPaul Walmsley u8 omap_ctrl_readb(u16 offset)
15269d88a00SPaul Walmsley {
15369d88a00SPaul Walmsley 	return __raw_readb(OMAP_CTRL_REGADDR(offset));
15469d88a00SPaul Walmsley }
15569d88a00SPaul Walmsley 
15669d88a00SPaul Walmsley u16 omap_ctrl_readw(u16 offset)
15769d88a00SPaul Walmsley {
15869d88a00SPaul Walmsley 	return __raw_readw(OMAP_CTRL_REGADDR(offset));
15969d88a00SPaul Walmsley }
16069d88a00SPaul Walmsley 
16169d88a00SPaul Walmsley u32 omap_ctrl_readl(u16 offset)
16269d88a00SPaul Walmsley {
16369d88a00SPaul Walmsley 	return __raw_readl(OMAP_CTRL_REGADDR(offset));
16469d88a00SPaul Walmsley }
16569d88a00SPaul Walmsley 
16669d88a00SPaul Walmsley void omap_ctrl_writeb(u8 val, u16 offset)
16769d88a00SPaul Walmsley {
16869d88a00SPaul Walmsley 	__raw_writeb(val, OMAP_CTRL_REGADDR(offset));
16969d88a00SPaul Walmsley }
17069d88a00SPaul Walmsley 
17169d88a00SPaul Walmsley void omap_ctrl_writew(u16 val, u16 offset)
17269d88a00SPaul Walmsley {
17369d88a00SPaul Walmsley 	__raw_writew(val, OMAP_CTRL_REGADDR(offset));
17469d88a00SPaul Walmsley }
17569d88a00SPaul Walmsley 
17669d88a00SPaul Walmsley void omap_ctrl_writel(u32 val, u16 offset)
17769d88a00SPaul Walmsley {
17869d88a00SPaul Walmsley 	__raw_writel(val, OMAP_CTRL_REGADDR(offset));
17969d88a00SPaul Walmsley }
18069d88a00SPaul Walmsley 
181c96631e1SRajendra Nayak #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
18280140786SRajendra Nayak /*
18380140786SRajendra Nayak  * Clears the scratchpad contents in case of cold boot-
18480140786SRajendra Nayak  * called during bootup
18580140786SRajendra Nayak  */
18680140786SRajendra Nayak void omap3_clear_scratchpad_contents(void)
18780140786SRajendra Nayak {
18880140786SRajendra Nayak 	u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET;
18980140786SRajendra Nayak 	u32 *v_addr;
19080140786SRajendra Nayak 	u32 offset = 0;
19180140786SRajendra Nayak 	v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM);
19280140786SRajendra Nayak 	if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
19380140786SRajendra Nayak 		OMAP3430_GLOBAL_COLD_RST) {
19480140786SRajendra Nayak 		for ( ; offset <= max_offset; offset += 0x4)
19580140786SRajendra Nayak 			__raw_writel(0x0, (v_addr + offset));
19680140786SRajendra Nayak 		prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST, OMAP3430_GR_MOD,
19780140786SRajendra Nayak 			OMAP3_PRM_RSTST_OFFSET);
19880140786SRajendra Nayak 	}
19980140786SRajendra Nayak }
20080140786SRajendra Nayak 
20180140786SRajendra Nayak /* Populate the scratchpad structure with restore structure */
20280140786SRajendra Nayak void omap3_save_scratchpad_contents(void)
20380140786SRajendra Nayak {
20480140786SRajendra Nayak 	void * __iomem scratchpad_address;
20580140786SRajendra Nayak 	u32 arm_context_addr;
20680140786SRajendra Nayak 	struct omap3_scratchpad scratchpad_contents;
20780140786SRajendra Nayak 	struct omap3_scratchpad_prcm_block prcm_block_contents;
20880140786SRajendra Nayak 	struct omap3_scratchpad_sdrc_block sdrc_block_contents;
20980140786SRajendra Nayak 
21080140786SRajendra Nayak 	/* Populate the Scratchpad contents */
21180140786SRajendra Nayak 	scratchpad_contents.boot_config_ptr = 0x0;
212*0795a75aSTero Kristo 	if (omap_rev() != OMAP3430_REV_ES3_0 &&
213*0795a75aSTero Kristo 					omap_rev() != OMAP3430_REV_ES3_1)
21480140786SRajendra Nayak 		scratchpad_contents.public_restore_ptr =
21580140786SRajendra Nayak 			virt_to_phys(get_restore_pointer());
216*0795a75aSTero Kristo 	else
217*0795a75aSTero Kristo 		scratchpad_contents.public_restore_ptr =
218*0795a75aSTero Kristo 			virt_to_phys(get_es3_restore_pointer());
21927d59a4aSTero Kristo 	if (omap_type() == OMAP2_DEVICE_TYPE_GP)
22080140786SRajendra Nayak 		scratchpad_contents.secure_ram_restore_ptr = 0x0;
22127d59a4aSTero Kristo 	else
22227d59a4aSTero Kristo 		scratchpad_contents.secure_ram_restore_ptr =
22327d59a4aSTero Kristo 			(u32) __pa(omap3_secure_ram_storage);
22480140786SRajendra Nayak 	scratchpad_contents.sdrc_module_semaphore = 0x0;
22580140786SRajendra Nayak 	scratchpad_contents.prcm_block_offset = 0x2C;
22680140786SRajendra Nayak 	scratchpad_contents.sdrc_block_offset = 0x64;
22780140786SRajendra Nayak 
22880140786SRajendra Nayak 	/* Populate the PRCM block contents */
22980140786SRajendra Nayak 	prcm_block_contents.prm_clksrc_ctrl = prm_read_mod_reg(OMAP3430_GR_MOD,
23080140786SRajendra Nayak 			OMAP3_PRM_CLKSRC_CTRL_OFFSET);
23180140786SRajendra Nayak 	prcm_block_contents.prm_clksel = prm_read_mod_reg(OMAP3430_CCR_MOD,
23280140786SRajendra Nayak 			OMAP3_PRM_CLKSEL_OFFSET);
23380140786SRajendra Nayak 	prcm_block_contents.cm_clksel_core =
23480140786SRajendra Nayak 			cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
23580140786SRajendra Nayak 	prcm_block_contents.cm_clksel_wkup =
23680140786SRajendra Nayak 			cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
23780140786SRajendra Nayak 	prcm_block_contents.cm_clken_pll =
238cb0cb2b8SKalle Jokiniemi 			cm_read_mod_reg(PLL_MOD, CM_CLKEN);
23980140786SRajendra Nayak 	prcm_block_contents.cm_autoidle_pll =
24080140786SRajendra Nayak 			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL);
24180140786SRajendra Nayak 	prcm_block_contents.cm_clksel1_pll =
24280140786SRajendra Nayak 			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
24380140786SRajendra Nayak 	prcm_block_contents.cm_clksel2_pll =
24480140786SRajendra Nayak 			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL);
24580140786SRajendra Nayak 	prcm_block_contents.cm_clksel3_pll =
24680140786SRajendra Nayak 			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3);
24780140786SRajendra Nayak 	prcm_block_contents.cm_clken_pll_mpu =
24880140786SRajendra Nayak 			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL);
24980140786SRajendra Nayak 	prcm_block_contents.cm_autoidle_pll_mpu =
25080140786SRajendra Nayak 			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL);
25180140786SRajendra Nayak 	prcm_block_contents.cm_clksel1_pll_mpu =
25280140786SRajendra Nayak 			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL);
25380140786SRajendra Nayak 	prcm_block_contents.cm_clksel2_pll_mpu =
25480140786SRajendra Nayak 			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL);
25580140786SRajendra Nayak 	prcm_block_contents.prcm_block_size = 0x0;
25680140786SRajendra Nayak 
25780140786SRajendra Nayak 	/* Populate the SDRC block contents */
25880140786SRajendra Nayak 	sdrc_block_contents.sysconfig =
25980140786SRajendra Nayak 			(sdrc_read_reg(SDRC_SYSCONFIG) & 0xFFFF);
26080140786SRajendra Nayak 	sdrc_block_contents.cs_cfg =
26180140786SRajendra Nayak 			(sdrc_read_reg(SDRC_CS_CFG) & 0xFFFF);
26280140786SRajendra Nayak 	sdrc_block_contents.sharing =
26380140786SRajendra Nayak 			(sdrc_read_reg(SDRC_SHARING) & 0xFFFF);
26480140786SRajendra Nayak 	sdrc_block_contents.err_type =
26580140786SRajendra Nayak 			(sdrc_read_reg(SDRC_ERR_TYPE) & 0xFFFF);
26680140786SRajendra Nayak 	sdrc_block_contents.dll_a_ctrl = sdrc_read_reg(SDRC_DLLA_CTRL);
26780140786SRajendra Nayak 	sdrc_block_contents.dll_b_ctrl = 0x0;
26880140786SRajendra Nayak 	sdrc_block_contents.power = sdrc_read_reg(SDRC_POWER);
26980140786SRajendra Nayak 	sdrc_block_contents.cs_0 = 0x0;
27080140786SRajendra Nayak 	sdrc_block_contents.mcfg_0 = sdrc_read_reg(SDRC_MCFG_0);
27180140786SRajendra Nayak 	sdrc_block_contents.mr_0 = (sdrc_read_reg(SDRC_MR_0) & 0xFFFF);
27280140786SRajendra Nayak 	sdrc_block_contents.emr_1_0 = 0x0;
27380140786SRajendra Nayak 	sdrc_block_contents.emr_2_0 = 0x0;
27480140786SRajendra Nayak 	sdrc_block_contents.emr_3_0 = 0x0;
27580140786SRajendra Nayak 	sdrc_block_contents.actim_ctrla_0 =
27680140786SRajendra Nayak 			sdrc_read_reg(SDRC_ACTIM_CTRL_A_0);
27780140786SRajendra Nayak 	sdrc_block_contents.actim_ctrlb_0 =
27880140786SRajendra Nayak 			sdrc_read_reg(SDRC_ACTIM_CTRL_B_0);
27980140786SRajendra Nayak 	sdrc_block_contents.rfr_ctrl_0 =
28080140786SRajendra Nayak 			sdrc_read_reg(SDRC_RFR_CTRL_0);
28180140786SRajendra Nayak 	sdrc_block_contents.cs_1 = 0x0;
28280140786SRajendra Nayak 	sdrc_block_contents.mcfg_1 = sdrc_read_reg(SDRC_MCFG_1);
28380140786SRajendra Nayak 	sdrc_block_contents.mr_1 = sdrc_read_reg(SDRC_MR_1) & 0xFFFF;
28480140786SRajendra Nayak 	sdrc_block_contents.emr_1_1 = 0x0;
28580140786SRajendra Nayak 	sdrc_block_contents.emr_2_1 = 0x0;
28680140786SRajendra Nayak 	sdrc_block_contents.emr_3_1 = 0x0;
28780140786SRajendra Nayak 	sdrc_block_contents.actim_ctrla_1 =
28880140786SRajendra Nayak 			sdrc_read_reg(SDRC_ACTIM_CTRL_A_1);
28980140786SRajendra Nayak 	sdrc_block_contents.actim_ctrlb_1 =
29080140786SRajendra Nayak 			sdrc_read_reg(SDRC_ACTIM_CTRL_B_1);
29180140786SRajendra Nayak 	sdrc_block_contents.rfr_ctrl_1 =
29280140786SRajendra Nayak 			sdrc_read_reg(SDRC_RFR_CTRL_1);
29380140786SRajendra Nayak 	sdrc_block_contents.dcdl_1_ctrl = 0x0;
29480140786SRajendra Nayak 	sdrc_block_contents.dcdl_2_ctrl = 0x0;
29580140786SRajendra Nayak 	sdrc_block_contents.flags = 0x0;
29680140786SRajendra Nayak 	sdrc_block_contents.block_size = 0x0;
29780140786SRajendra Nayak 
29880140786SRajendra Nayak 	arm_context_addr = virt_to_phys(omap3_arm_context);
29980140786SRajendra Nayak 
30080140786SRajendra Nayak 	/* Copy all the contents to the scratchpad location */
30180140786SRajendra Nayak 	scratchpad_address = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD);
30280140786SRajendra Nayak 	memcpy_toio(scratchpad_address, &scratchpad_contents,
30380140786SRajendra Nayak 		 sizeof(scratchpad_contents));
30480140786SRajendra Nayak 	/* Scratchpad contents being 32 bits, a divide by 4 done here */
30580140786SRajendra Nayak 	memcpy_toio(scratchpad_address +
30680140786SRajendra Nayak 		scratchpad_contents.prcm_block_offset,
30780140786SRajendra Nayak 		&prcm_block_contents, sizeof(prcm_block_contents));
30880140786SRajendra Nayak 	memcpy_toio(scratchpad_address +
30980140786SRajendra Nayak 		scratchpad_contents.sdrc_block_offset,
31080140786SRajendra Nayak 		&sdrc_block_contents, sizeof(sdrc_block_contents));
31180140786SRajendra Nayak 	/*
31280140786SRajendra Nayak 	 * Copies the address of the location in SDRAM where ARM
31380140786SRajendra Nayak 	 * registers get saved during a MPU OFF transition.
31480140786SRajendra Nayak 	 */
31580140786SRajendra Nayak 	memcpy_toio(scratchpad_address +
31680140786SRajendra Nayak 		scratchpad_contents.sdrc_block_offset +
31780140786SRajendra Nayak 		sizeof(sdrc_block_contents), &arm_context_addr, 4);
31880140786SRajendra Nayak }
31980140786SRajendra Nayak 
320c96631e1SRajendra Nayak void omap3_control_save_context(void)
321c96631e1SRajendra Nayak {
322c96631e1SRajendra Nayak 	control_context.sysconfig = omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);
323c96631e1SRajendra Nayak 	control_context.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
324c96631e1SRajendra Nayak 	control_context.mem_dftrw0 =
325c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);
326c96631e1SRajendra Nayak 	control_context.mem_dftrw1 =
327c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);
328c96631e1SRajendra Nayak 	control_context.msuspendmux_0 =
329c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
330c96631e1SRajendra Nayak 	control_context.msuspendmux_1 =
331c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);
332c96631e1SRajendra Nayak 	control_context.msuspendmux_2 =
333c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
334c96631e1SRajendra Nayak 	control_context.msuspendmux_3 =
335c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
336c96631e1SRajendra Nayak 	control_context.msuspendmux_4 =
337c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
338c96631e1SRajendra Nayak 	control_context.msuspendmux_5 =
339c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
340c96631e1SRajendra Nayak 	control_context.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
341c96631e1SRajendra Nayak 	control_context.devconf1 = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
342c96631e1SRajendra Nayak 	control_context.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
343c96631e1SRajendra Nayak 	control_context.iva2_bootaddr =
344c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
345c96631e1SRajendra Nayak 	control_context.iva2_bootmod =
346c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
347c96631e1SRajendra Nayak 	control_context.debobs_0 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(0));
348c96631e1SRajendra Nayak 	control_context.debobs_1 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(1));
349c96631e1SRajendra Nayak 	control_context.debobs_2 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(2));
350c96631e1SRajendra Nayak 	control_context.debobs_3 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(3));
351c96631e1SRajendra Nayak 	control_context.debobs_4 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(4));
352c96631e1SRajendra Nayak 	control_context.debobs_5 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(5));
353c96631e1SRajendra Nayak 	control_context.debobs_6 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(6));
354c96631e1SRajendra Nayak 	control_context.debobs_7 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(7));
355c96631e1SRajendra Nayak 	control_context.debobs_8 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(8));
356c96631e1SRajendra Nayak 	control_context.prog_io0 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);
357c96631e1SRajendra Nayak 	control_context.prog_io1 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
358c96631e1SRajendra Nayak 	control_context.dss_dpll_spreading =
359c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
360c96631e1SRajendra Nayak 	control_context.core_dpll_spreading =
361c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
362c96631e1SRajendra Nayak 	control_context.per_dpll_spreading =
363c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
364c96631e1SRajendra Nayak 	control_context.usbhost_dpll_spreading =
365c96631e1SRajendra Nayak 		omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
366c96631e1SRajendra Nayak 	control_context.pbias_lite =
367c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
368c96631e1SRajendra Nayak 	control_context.temp_sensor =
369c96631e1SRajendra Nayak 			omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);
370c96631e1SRajendra Nayak 	control_context.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);
371c96631e1SRajendra Nayak 	control_context.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);
372c96631e1SRajendra Nayak 	control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
373c96631e1SRajendra Nayak 	return;
374c96631e1SRajendra Nayak }
375c96631e1SRajendra Nayak 
376c96631e1SRajendra Nayak void omap3_control_restore_context(void)
377c96631e1SRajendra Nayak {
378c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.sysconfig, OMAP2_CONTROL_SYSCONFIG);
379c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.devconf0, OMAP2_CONTROL_DEVCONF0);
380c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.mem_dftrw0,
381c96631e1SRajendra Nayak 					OMAP343X_CONTROL_MEM_DFTRW0);
382c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.mem_dftrw1,
383c96631e1SRajendra Nayak 					OMAP343X_CONTROL_MEM_DFTRW1);
384c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.msuspendmux_0,
385c96631e1SRajendra Nayak 					OMAP2_CONTROL_MSUSPENDMUX_0);
386c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.msuspendmux_1,
387c96631e1SRajendra Nayak 					OMAP2_CONTROL_MSUSPENDMUX_1);
388c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.msuspendmux_2,
389c96631e1SRajendra Nayak 					OMAP2_CONTROL_MSUSPENDMUX_2);
390c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.msuspendmux_3,
391c96631e1SRajendra Nayak 					OMAP2_CONTROL_MSUSPENDMUX_3);
392c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.msuspendmux_4,
393c96631e1SRajendra Nayak 					OMAP2_CONTROL_MSUSPENDMUX_4);
394c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.msuspendmux_5,
395c96631e1SRajendra Nayak 					OMAP2_CONTROL_MSUSPENDMUX_5);
396c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.sec_ctrl, OMAP2_CONTROL_SEC_CTRL);
397c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.devconf1, OMAP343X_CONTROL_DEVCONF1);
398c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.csirxfe, OMAP343X_CONTROL_CSIRXFE);
399c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.iva2_bootaddr,
400c96631e1SRajendra Nayak 					OMAP343X_CONTROL_IVA2_BOOTADDR);
401c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.iva2_bootmod,
402c96631e1SRajendra Nayak 					OMAP343X_CONTROL_IVA2_BOOTMOD);
403c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_0, OMAP343X_CONTROL_DEBOBS(0));
404c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_1, OMAP343X_CONTROL_DEBOBS(1));
405c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_2, OMAP343X_CONTROL_DEBOBS(2));
406c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_3, OMAP343X_CONTROL_DEBOBS(3));
407c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_4, OMAP343X_CONTROL_DEBOBS(4));
408c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_5, OMAP343X_CONTROL_DEBOBS(5));
409c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_6, OMAP343X_CONTROL_DEBOBS(6));
410c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_7, OMAP343X_CONTROL_DEBOBS(7));
411c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.debobs_8, OMAP343X_CONTROL_DEBOBS(8));
412c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.prog_io0, OMAP343X_CONTROL_PROG_IO0);
413c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.prog_io1, OMAP343X_CONTROL_PROG_IO1);
414c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.dss_dpll_spreading,
415c96631e1SRajendra Nayak 					OMAP343X_CONTROL_DSS_DPLL_SPREADING);
416c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.core_dpll_spreading,
417c96631e1SRajendra Nayak 					OMAP343X_CONTROL_CORE_DPLL_SPREADING);
418c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.per_dpll_spreading,
419c96631e1SRajendra Nayak 					OMAP343X_CONTROL_PER_DPLL_SPREADING);
420c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.usbhost_dpll_spreading,
421c96631e1SRajendra Nayak 				OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
422c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.pbias_lite,
423c96631e1SRajendra Nayak 					OMAP343X_CONTROL_PBIAS_LITE);
424c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.temp_sensor,
425c96631e1SRajendra Nayak 					OMAP343X_CONTROL_TEMP_SENSOR);
426c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.sramldo4, OMAP343X_CONTROL_SRAMLDO4);
427c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.sramldo5, OMAP343X_CONTROL_SRAMLDO5);
428c96631e1SRajendra Nayak 	omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI);
429c96631e1SRajendra Nayak 	return;
430c96631e1SRajendra Nayak }
431c96631e1SRajendra Nayak #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
432