2012-10-31 09:41:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Google, Inc.
|
|
|
|
* Copyright (c) 2010-2012 NVIDIA Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Colin Cross <ccross@google.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MACH_TEGRA_PM_H_
|
|
|
|
#define _MACH_TEGRA_PM_H_
|
|
|
|
|
2013-04-03 11:31:47 +00:00
|
|
|
#include "pmc.h"
|
|
|
|
|
2013-08-12 09:40:03 +00:00
|
|
|
struct tegra_lp1_iram {
|
|
|
|
void *start_addr;
|
|
|
|
void *end_addr;
|
|
|
|
};
|
|
|
|
extern struct tegra_lp1_iram tegra_lp1_iram;
|
|
|
|
extern void (*tegra_sleep_core_finish)(unsigned long v2p);
|
|
|
|
|
2013-08-12 09:40:05 +00:00
|
|
|
void tegra20_lp1_iram_hook(void);
|
|
|
|
void tegra20_sleep_core_init(void);
|
ARM: tegra: add LP1 suspend support for Tegra30
The LP1 suspend mode will power off the CPU, clock gated the PLLs and put
SDRAM to self-refresh mode. Any interrupt can wake up device from LP1. The
sequence when LP1 suspending:
* tunning off L1 data cache and the MMU
* storing some EMC registers, DPD (deep power down) status, clk source of
mselect and SCLK burst policy
* putting SDRAM into self-refresh
* switching CPU to CLK_M (12MHz OSC)
* tunning off PLLM, PLLP, PLLA, PLLC and PLLX
* switching SCLK to CLK_S (32KHz OSC)
* shutting off the CPU rail
The sequence of LP1 resuming:
* re-enabling PLLM, PLLP, PLLA, PLLC and PLLX
* restoring the clk source of mselect and SCLK burst policy
* setting up CCLK burst policy to PLLX
* restoring DPD status and some EMC registers
* resuming SDRAM to normal mode
* jumping to the "tegra_resume" from PMC_SCRATCH41
Due to the SDRAM will be put into self-refresh mode, the low level
procedures of LP1 suspending and resuming should be copied to
TEGRA_IRAM_CODE_AREA (TEGRA_IRAM_BASE + SZ_4K) when suspending. Before
restoring the CPU context when resuming, the SDRAM needs to be switched
back to normal mode. And the PLLs need to be re-enabled, SCLK burst policy
be restored, CCLK burst policy be set in PLLX. Then jumping to
"tegra_resume" that was expected to be stored in PMC_SCRATCH41 to restore
CPU context and back to kernel.
Based on the work by: Scott Williams <scwilliams@nvidia.com>
Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-08-12 09:40:04 +00:00
|
|
|
void tegra30_lp1_iram_hook(void);
|
|
|
|
void tegra30_sleep_core_init(void);
|
|
|
|
|
2012-11-13 02:04:48 +00:00
|
|
|
extern unsigned long l2x0_saved_regs_addr;
|
|
|
|
|
2013-06-04 10:47:35 +00:00
|
|
|
void tegra_clear_cpu_in_lp2(void);
|
|
|
|
bool tegra_set_cpu_in_lp2(void);
|
2012-10-31 09:41:17 +00:00
|
|
|
|
2013-04-02 01:20:50 +00:00
|
|
|
void tegra_idle_lp2_last(void);
|
2012-10-31 09:41:21 +00:00
|
|
|
extern void (*tegra_tear_down_cpu)(void);
|
|
|
|
|
2013-04-03 11:31:47 +00:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
|
|
|
|
enum tegra_suspend_mode mode);
|
|
|
|
void tegra_init_suspend(void);
|
|
|
|
#else
|
2013-04-15 22:53:05 +00:00
|
|
|
static inline enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
|
2013-04-03 11:31:47 +00:00
|
|
|
enum tegra_suspend_mode mode)
|
|
|
|
{
|
|
|
|
return TEGRA_SUSPEND_NONE;
|
|
|
|
}
|
|
|
|
static inline void tegra_init_suspend(void) {}
|
|
|
|
#endif
|
|
|
|
|
2012-10-31 09:41:17 +00:00
|
|
|
#endif /* _MACH_TEGRA_PM_H_ */
|