162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * arch/arm/mach-omap1/pm.h 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Header file for OMAP1 Power Management Routines 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Author: MontaVista Software, Inc. 762306a36Sopenharmony_ci * support@mvista.com 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Copyright 2002 MontaVista Software Inc. 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * Cleanup 2004 for Linux 2.6 by Dirk Behme <dirk.behme@de.bosch.com> 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 1462306a36Sopenharmony_ci * under the terms of the GNU General Public License as published by the 1562306a36Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 1662306a36Sopenharmony_ci * option) any later version. 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 1962306a36Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 2062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 2162306a36Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2262306a36Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2362306a36Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2462306a36Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 2562306a36Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2662306a36Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2762306a36Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2862306a36Sopenharmony_ci * 2962306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License along 3062306a36Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 3162306a36Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#ifndef __ARCH_ARM_MACH_OMAP1_PM_H 3562306a36Sopenharmony_ci#define __ARCH_ARM_MACH_OMAP1_PM_H 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#include <linux/soc/ti/omap1-io.h> 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* 4062306a36Sopenharmony_ci * ---------------------------------------------------------------------------- 4162306a36Sopenharmony_ci * Register and offset definitions to be used in PM assembler code 4262306a36Sopenharmony_ci * ---------------------------------------------------------------------------- 4362306a36Sopenharmony_ci */ 4462306a36Sopenharmony_ci#define CLKGEN_REG_ASM_BASE OMAP1_IO_ADDRESS(0xfffece00) 4562306a36Sopenharmony_ci#define ARM_IDLECT1_ASM_OFFSET 0x04 4662306a36Sopenharmony_ci#define ARM_IDLECT2_ASM_OFFSET 0x08 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define TCMIF_ASM_BASE OMAP1_IO_ADDRESS(0xfffecc00) 4962306a36Sopenharmony_ci#define EMIFS_CONFIG_ASM_OFFSET 0x0c 5062306a36Sopenharmony_ci#define EMIFF_SDRAM_CONFIG_ASM_OFFSET 0x20 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* 5362306a36Sopenharmony_ci * ---------------------------------------------------------------------------- 5462306a36Sopenharmony_ci * Power management bitmasks 5562306a36Sopenharmony_ci * ---------------------------------------------------------------------------- 5662306a36Sopenharmony_ci */ 5762306a36Sopenharmony_ci#define IDLE_WAIT_CYCLES 0x00000fff 5862306a36Sopenharmony_ci#define PERIPHERAL_ENABLE 0x2 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#define SELF_REFRESH_MODE 0x0c000001 6162306a36Sopenharmony_ci#define IDLE_EMIFS_REQUEST 0xc 6262306a36Sopenharmony_ci#define MODEM_32K_EN 0x1 6362306a36Sopenharmony_ci#define PER_EN 0x1 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#define CPU_SUSPEND_SIZE 200 6662306a36Sopenharmony_ci#define ULPD_LOW_PWR_EN 0x0001 6762306a36Sopenharmony_ci#define ULPD_DEEP_SLEEP_TRANSITION_EN 0x0010 6862306a36Sopenharmony_ci#define ULPD_SETUP_ANALOG_CELL_3_VAL 0 6962306a36Sopenharmony_ci#define ULPD_POWER_CTRL_REG_VAL 0x0219 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#define DSP_IDLE_DELAY 10 7262306a36Sopenharmony_ci#define DSP_IDLE 0x0040 7362306a36Sopenharmony_ci#define DSP_RST 0x0004 7462306a36Sopenharmony_ci#define DSP_ENABLE 0x0002 7562306a36Sopenharmony_ci#define SUFFICIENT_DSP_RESET_TIME 1000 7662306a36Sopenharmony_ci#define DEFAULT_MPUI_CONFIG 0x05cf 7762306a36Sopenharmony_ci#define ENABLE_XORCLK 0x2 7862306a36Sopenharmony_ci#define DSP_CLOCK_ENABLE 0x2000 7962306a36Sopenharmony_ci#define DSP_IDLE_MODE 0x2 8062306a36Sopenharmony_ci#define TC_IDLE_REQUEST (0x0000000c) 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci#define IRQ_LEVEL2 (1<<0) 8362306a36Sopenharmony_ci#define IRQ_KEYBOARD (1<<1) 8462306a36Sopenharmony_ci#define IRQ_UART2 (1<<15) 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define PDE_BIT 0x08 8762306a36Sopenharmony_ci#define PWD_EN_BIT 0x04 8862306a36Sopenharmony_ci#define EN_PERCK_BIT 0x04 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define OMAP1510_DEEP_SLEEP_REQUEST 0x0ec7 9162306a36Sopenharmony_ci#define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5 9262306a36Sopenharmony_ci#define OMAP1510_IDLE_LOOP_REQUEST 0x0c00 9362306a36Sopenharmony_ci#define OMAP1510_IDLE_CLOCK_DOMAINS 0x2 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci/* Both big sleep and deep sleep use same values. Difference is in ULPD. */ 9662306a36Sopenharmony_ci#define OMAP1610_IDLECT1_SLEEP_VAL 0x13c7 9762306a36Sopenharmony_ci#define OMAP1610_IDLECT2_SLEEP_VAL 0x09c7 9862306a36Sopenharmony_ci#define OMAP1610_IDLECT3_VAL 0x3f 9962306a36Sopenharmony_ci#define OMAP1610_IDLECT3_SLEEP_ORMASK 0x2c 10062306a36Sopenharmony_ci#define OMAP1610_IDLECT3 0xfffece24 10162306a36Sopenharmony_ci#define OMAP1610_IDLE_LOOP_REQUEST 0x0400 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci#ifndef __ASSEMBLER__ 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#include <linux/clk.h> 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ciextern struct kset power_subsys; 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ciextern void prevent_idle_sleep(void); 11062306a36Sopenharmony_ciextern void allow_idle_sleep(void); 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ciextern void omap1_pm_idle(void); 11362306a36Sopenharmony_ciextern void omap1_pm_suspend(void); 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ciextern void omap1510_cpu_suspend(unsigned long, unsigned long); 11662306a36Sopenharmony_ciextern void omap1610_cpu_suspend(unsigned long, unsigned long); 11762306a36Sopenharmony_ciextern void omap1510_idle_loop_suspend(void); 11862306a36Sopenharmony_ciextern void omap1610_idle_loop_suspend(void); 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ciextern unsigned int omap1510_cpu_suspend_sz; 12162306a36Sopenharmony_ciextern unsigned int omap1610_cpu_suspend_sz; 12262306a36Sopenharmony_ciextern unsigned int omap1510_idle_loop_suspend_sz; 12362306a36Sopenharmony_ciextern unsigned int omap1610_idle_loop_suspend_sz; 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#ifdef CONFIG_OMAP_SERIAL_WAKE 12662306a36Sopenharmony_ciextern void omap_serial_wake_trigger(int enable); 12762306a36Sopenharmony_ci#else 12862306a36Sopenharmony_ci#define omap_serial_wakeup_init() {} 12962306a36Sopenharmony_ci#define omap_serial_wake_trigger(x) {} 13062306a36Sopenharmony_ci#endif /* CONFIG_OMAP_SERIAL_WAKE */ 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define ARM_SAVE(x) arm_sleep_save[ARM_SLEEP_SAVE_##x] = omap_readl(x) 13362306a36Sopenharmony_ci#define ARM_RESTORE(x) omap_writel((arm_sleep_save[ARM_SLEEP_SAVE_##x]), (x)) 13462306a36Sopenharmony_ci#define ARM_SHOW(x) arm_sleep_save[ARM_SLEEP_SAVE_##x] 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#define DSP_SAVE(x) dsp_sleep_save[DSP_SLEEP_SAVE_##x] = __raw_readw(x) 13762306a36Sopenharmony_ci#define DSP_RESTORE(x) __raw_writew((dsp_sleep_save[DSP_SLEEP_SAVE_##x]), (x)) 13862306a36Sopenharmony_ci#define DSP_SHOW(x) dsp_sleep_save[DSP_SLEEP_SAVE_##x] 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define ULPD_SAVE(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] = omap_readw(x) 14162306a36Sopenharmony_ci#define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x)) 14262306a36Sopenharmony_ci#define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci#define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x) 14562306a36Sopenharmony_ci#define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x)) 14662306a36Sopenharmony_ci#define MPUI1510_SHOW(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#define MPUI1610_SAVE(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x] = omap_readl(x) 14962306a36Sopenharmony_ci#define MPUI1610_RESTORE(x) omap_writel((mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]), (x)) 15062306a36Sopenharmony_ci#define MPUI1610_SHOW(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x] 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci/* 15362306a36Sopenharmony_ci * List of global OMAP registers to preserve. 15462306a36Sopenharmony_ci * More ones like CP and general purpose register values are preserved 15562306a36Sopenharmony_ci * with the stack pointer in sleep.S. 15662306a36Sopenharmony_ci */ 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_cienum arm_save_state { 15962306a36Sopenharmony_ci ARM_SLEEP_SAVE_START = 0, 16062306a36Sopenharmony_ci /* 16162306a36Sopenharmony_ci * MPU control registers 32 bits 16262306a36Sopenharmony_ci */ 16362306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_CKCTL, 16462306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_IDLECT1, 16562306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_IDLECT2, 16662306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_IDLECT3, 16762306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_EWUPCT, 16862306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_RSTCT1, 16962306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_RSTCT2, 17062306a36Sopenharmony_ci ARM_SLEEP_SAVE_ARM_SYSST, 17162306a36Sopenharmony_ci ARM_SLEEP_SAVE_SIZE 17262306a36Sopenharmony_ci}; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_cienum dsp_save_state { 17562306a36Sopenharmony_ci DSP_SLEEP_SAVE_START = 0, 17662306a36Sopenharmony_ci /* 17762306a36Sopenharmony_ci * DSP registers 16 bits 17862306a36Sopenharmony_ci */ 17962306a36Sopenharmony_ci DSP_SLEEP_SAVE_DSP_IDLECT2, 18062306a36Sopenharmony_ci DSP_SLEEP_SAVE_SIZE 18162306a36Sopenharmony_ci}; 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_cienum ulpd_save_state { 18462306a36Sopenharmony_ci ULPD_SLEEP_SAVE_START = 0, 18562306a36Sopenharmony_ci /* 18662306a36Sopenharmony_ci * ULPD registers 16 bits 18762306a36Sopenharmony_ci */ 18862306a36Sopenharmony_ci ULPD_SLEEP_SAVE_ULPD_IT_STATUS, 18962306a36Sopenharmony_ci ULPD_SLEEP_SAVE_ULPD_CLOCK_CTRL, 19062306a36Sopenharmony_ci ULPD_SLEEP_SAVE_ULPD_SOFT_REQ, 19162306a36Sopenharmony_ci ULPD_SLEEP_SAVE_ULPD_STATUS_REQ, 19262306a36Sopenharmony_ci ULPD_SLEEP_SAVE_ULPD_DPLL_CTRL, 19362306a36Sopenharmony_ci ULPD_SLEEP_SAVE_ULPD_POWER_CTRL, 19462306a36Sopenharmony_ci ULPD_SLEEP_SAVE_SIZE 19562306a36Sopenharmony_ci}; 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_cienum mpui1510_save_state { 19862306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_START = 0, 19962306a36Sopenharmony_ci /* 20062306a36Sopenharmony_ci * MPUI registers 32 bits 20162306a36Sopenharmony_ci */ 20262306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_MPUI_CTRL, 20362306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG, 20462306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_MPUI_DSP_API_CONFIG, 20562306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_MPUI_DSP_STATUS, 20662306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_EMIFF_SDRAM_CONFIG, 20762306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_EMIFS_CONFIG, 20862306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_OMAP_IH1_MIR, 20962306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_OMAP_IH2_MIR, 21062306a36Sopenharmony_ci#if defined(CONFIG_ARCH_OMAP15XX) 21162306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_SIZE 21262306a36Sopenharmony_ci#else 21362306a36Sopenharmony_ci MPUI1510_SLEEP_SAVE_SIZE = 0 21462306a36Sopenharmony_ci#endif 21562306a36Sopenharmony_ci}; 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_cienum mpui1610_save_state { 21862306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_START = 0, 21962306a36Sopenharmony_ci /* 22062306a36Sopenharmony_ci * MPUI registers 32 bits 22162306a36Sopenharmony_ci */ 22262306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_MPUI_CTRL, 22362306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG, 22462306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_MPUI_DSP_API_CONFIG, 22562306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_MPUI_DSP_STATUS, 22662306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_EMIFF_SDRAM_CONFIG, 22762306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_EMIFS_CONFIG, 22862306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_OMAP_IH1_MIR, 22962306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_OMAP_IH2_0_MIR, 23062306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_OMAP_IH2_1_MIR, 23162306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_OMAP_IH2_2_MIR, 23262306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_OMAP_IH2_3_MIR, 23362306a36Sopenharmony_ci#if defined(CONFIG_ARCH_OMAP16XX) 23462306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_SIZE 23562306a36Sopenharmony_ci#else 23662306a36Sopenharmony_ci MPUI1610_SLEEP_SAVE_SIZE = 0 23762306a36Sopenharmony_ci#endif 23862306a36Sopenharmony_ci}; 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci#endif /* ASSEMBLER */ 24162306a36Sopenharmony_ci#endif /* __ASM_ARCH_OMAP_PM_H */ 242