blob: 425bfcd67db62e48ec03a83e941fc858301b01f4 [file] [log] [blame]
Kevin Hilman8bd22942009-05-28 10:56:16 -07001/*
2 * OMAP2/3 Power Management Routines
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 * Jouni Hogander
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __ARCH_ARM_MACH_OMAP2_PM_H
12#define __ARCH_ARM_MACH_OMAP2_PM_H
13
Thara Gopinath0c0a5d62010-05-29 22:02:23 +053014#include <linux/err.h>
15
Paul Walmsley72e06d02010-12-21 21:05:16 -070016#include "powerdomain.h"
Peter 'p2' De Schrijver331b93f2008-10-15 18:13:48 +030017
Daniel Lezcano164e0cb2012-05-10 12:02:57 +020018#ifdef CONFIG_CPU_IDLE
19extern int __init omap3_idle_init(void);
20extern int __init omap4_idle_init(void);
21#else
22static inline int omap3_idle_init(void)
23{
24 return 0;
25}
26
27static inline int omap4_idle_init(void)
28{
29 return 0;
30}
31#endif
32
Tero Kristo27d59a42008-10-13 13:15:00 +030033extern void *omap3_secure_ram_storage;
Kevin Hilmanc40552b2009-10-06 14:25:09 -070034extern void omap3_pm_off_mode_enable(int);
Rajendra Nayak99e6a4d2008-10-08 17:30:58 +053035extern void omap_sram_idle(void);
Paul Walmsley92206fd2012-02-02 02:38:50 -070036extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
Tero Kristo27d59a42008-10-13 13:15:00 +030037
Nishanth Menonfd1478c2010-12-09 09:13:46 -060038#if defined(CONFIG_PM_OPP)
39extern int omap3_opp_init(void);
Nishanth Menonf5a64222010-12-09 09:13:47 -060040extern int omap4_opp_init(void);
Nishanth Menonfd1478c2010-12-09 09:13:46 -060041#else
42static inline int omap3_opp_init(void)
43{
44 return -EINVAL;
45}
Nishanth Menonf5a64222010-12-09 09:13:47 -060046static inline int omap4_opp_init(void)
47{
48 return -EINVAL;
49}
Nishanth Menonfd1478c2010-12-09 09:13:46 -060050#endif
51
Tero Kristo68d47782008-11-26 12:26:24 +020052extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
53extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
54
Kevin Hilman8bd22942009-05-28 10:56:16 -070055#ifdef CONFIG_PM_DEBUG
Loïc Minierebfa88c2010-09-27 23:04:20 +020056extern u32 enable_off_mode;
Manjunatha GKae559d82009-11-16 20:16:52 +053057#else
Loïc Minierebfa88c2010-09-27 23:04:20 +020058#define enable_off_mode 0
Manjunatha GKae559d82009-11-16 20:16:52 +053059#endif
60
61#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
Peter 'p2' De Schrijver331b93f2008-10-15 18:13:48 +030062extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
Kevin Hilman8bd22942009-05-28 10:56:16 -070063#else
Peter 'p2' De Schrijver331b93f2008-10-15 18:13:48 +030064#define pm_dbg_update_time(pwrdm, prev) do {} while (0);
Kevin Hilman8bd22942009-05-28 10:56:16 -070065#endif /* CONFIG_PM_DEBUG */
66
Jean Pihet46e130d2011-06-29 18:40:23 +020067/* 24xx */
Kevin Hilman8bd22942009-05-28 10:56:16 -070068extern void omap24xx_idle_loop_suspend(void);
Jean Pihet46e130d2011-06-29 18:40:23 +020069extern unsigned int omap24xx_idle_loop_suspend_sz;
Kevin Hilman8bd22942009-05-28 10:56:16 -070070
71extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl,
72 void __iomem *sdrc_power);
Kevin Hilman8bd22942009-05-28 10:56:16 -070073extern unsigned int omap24xx_cpu_suspend_sz;
Jean Pihet46e130d2011-06-29 18:40:23 +020074
75/* 3xxx */
Russell Kingcbe26342011-06-30 08:45:49 +010076extern void omap34xx_cpu_suspend(int save_state);
Jean Pihet46e130d2011-06-29 18:40:23 +020077
78/* omap3_do_wfi function pointer and size, for copy to SRAM */
79extern void omap3_do_wfi(void);
80extern unsigned int omap3_do_wfi_sz;
81/* ... and its pointer from SRAM after copy */
82extern void (*omap3_do_wfi_sram)(void);
83
84/* save_secure_ram_context function pointer and size, for copy to SRAM */
85extern int save_secure_ram_context(u32 *addr);
86extern unsigned int save_secure_ram_context_sz;
87
88extern void omap3_save_scratchpad_contents(void);
Kevin Hilman8bd22942009-05-28 10:56:16 -070089
Nishanth Menon458e9992010-12-20 14:05:06 -060090#define PM_RTA_ERRATUM_i608 (1 << 0)
Eduardo Valentincc1b6022010-12-20 14:05:09 -060091#define PM_SDRC_WAKEUP_ERRATUM_i583 (1 << 1)
Paul Walmsley856c3c52012-10-16 00:08:53 -060092#define PM_PER_MEMORIES_ERRATUM_i582 (1 << 2)
Nishanth Menon458e9992010-12-20 14:05:06 -060093
Nishanth Menon8cdfd832010-12-20 14:05:05 -060094#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
95extern u16 pm34xx_errata;
96#define IS_PM34XX_ERRATUM(id) (pm34xx_errata & (id))
Peter 'p2' De Schrijverc4236d22010-12-20 14:05:07 -060097extern void enable_omap3630_toggle_l2_on_restore(void);
Nishanth Menon8cdfd832010-12-20 14:05:05 -060098#else
99#define IS_PM34XX_ERRATUM(id) 0
Peter 'p2' De Schrijverc4236d22010-12-20 14:05:07 -0600100static inline void enable_omap3630_toggle_l2_on_restore(void) { }
Nishanth Menon8cdfd832010-12-20 14:05:05 -0600101#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
102
Santosh Shilimkarff999b82012-10-18 12:20:05 +0300103#define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0)
Rajendra Nayak6099dd32013-05-27 15:46:44 +0530104#define PM_OMAP4_CPU_OSWR_DISABLE (1 << 1)
Santosh Shilimkarff999b82012-10-18 12:20:05 +0300105
Nishanth Menon07484ca2014-03-12 16:43:20 -0500106#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4)
Tero Kristoc9621842012-10-18 12:20:04 +0300107extern u16 pm44xx_errata;
108#define IS_PM44XX_ERRATUM(id) (pm44xx_errata & (id))
109#else
110#define IS_PM44XX_ERRATUM(id) 0
111#endif
112
Jean Pihet7fb149f2012-04-24 11:38:50 +0530113#ifdef CONFIG_POWER_AVS_OMAP
Thara Gopinath0c0a5d62010-05-29 22:02:23 +0530114extern int omap_devinit_smartreflex(void);
115extern void omap_enable_smartreflex_on_init(void);
116#else
117static inline int omap_devinit_smartreflex(void)
118{
119 return -EINVAL;
120}
121
122static inline void omap_enable_smartreflex_on_init(void) {}
123#endif
124
Thara Gopinathfbc319f2010-12-10 22:51:05 +0530125#ifdef CONFIG_TWL4030_CORE
126extern int omap3_twl_init(void);
Thara Gopinath7bc3ed92010-12-10 23:15:16 +0530127extern int omap4_twl_init(void);
Thara Gopinath40713182011-02-15 13:28:58 +0530128extern int omap3_twl_set_sr_bit(bool enable);
Thara Gopinathfbc319f2010-12-10 22:51:05 +0530129#else
130static inline int omap3_twl_init(void)
131{
132 return -EINVAL;
133}
Thara Gopinath7bc3ed92010-12-10 23:15:16 +0530134static inline int omap4_twl_init(void)
135{
136 return -EINVAL;
137}
Thara Gopinathfbc319f2010-12-10 22:51:05 +0530138#endif
139
Tero Kristo908b75e2012-09-25 19:33:39 +0300140#ifdef CONFIG_PM
141extern void omap_pm_setup_oscillator(u32 tstart, u32 tshut);
142extern void omap_pm_get_oscillator(u32 *tstart, u32 *tshut);
Tero Kristo00bd2282012-09-25 19:33:48 +0300143extern void omap_pm_setup_sr_i2c_pcb_length(u32 mm);
Tero Kristo908b75e2012-09-25 19:33:39 +0300144#else
145static inline void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { }
Kevin Hilman74d29162012-11-14 17:13:04 -0800146static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { *tstart = *tshut = 0; }
Tero Kristo00bd2282012-09-25 19:33:48 +0300147static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { }
Tero Kristo908b75e2012-09-25 19:33:39 +0300148#endif
149
Dave Gerlach2e4b62d2014-05-12 13:33:21 -0500150#ifdef CONFIG_SUSPEND
151void omap_common_suspend_init(void *pm_suspend);
152#else
153static inline void omap_common_suspend_init(void *pm_suspend)
154{
155}
156#endif /* CONFIG_SUSPEND */
Kevin Hilman8bd22942009-05-28 10:56:16 -0700157#endif