2009-05-29 00:56:16 +07:00
|
|
|
/*
|
|
|
|
* OMAP2 Power Management Routines
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Texas Instruments, Inc.
|
|
|
|
* Copyright (C) 2006-2008 Nokia Corporation
|
|
|
|
*
|
|
|
|
* Written by:
|
|
|
|
* Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
* Tony Lindgren
|
|
|
|
* Juha Yrjola
|
|
|
|
* Amit Kucheria <amit.kucheria@nokia.com>
|
|
|
|
* Igor Stoppa <igor.stoppa@nokia.com>
|
|
|
|
*
|
|
|
|
* Based on pm.c for omap1
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/suspend.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/sysfs.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/delay.h>
|
2012-04-27 17:29:32 +07:00
|
|
|
#include <linux/clk-provider.h>
|
2009-05-29 00:56:16 +07:00
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/time.h>
|
|
|
|
#include <linux/gpio.h>
|
2012-08-31 05:37:24 +07:00
|
|
|
#include <linux/platform_data/gpio-omap.h>
|
2009-05-29 00:56:16 +07:00
|
|
|
|
2012-10-30 03:54:06 +07:00
|
|
|
#include <asm/fncpy.h>
|
|
|
|
|
2009-05-29 00:56:16 +07:00
|
|
|
#include <asm/mach/time.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
#include <asm/mach-types.h>
|
2012-03-29 00:30:01 +07:00
|
|
|
#include <asm/system_misc.h>
|
2009-05-29 00:56:16 +07:00
|
|
|
|
2012-11-30 23:41:50 +07:00
|
|
|
#include <linux/omap-dma.h>
|
2009-05-29 00:56:16 +07:00
|
|
|
|
2012-10-06 03:25:59 +07:00
|
|
|
#include "soc.h"
|
2011-11-11 04:45:17 +07:00
|
|
|
#include "common.h"
|
2012-09-27 23:33:34 +07:00
|
|
|
#include "clock.h"
|
2012-10-21 14:01:10 +07:00
|
|
|
#include "prm2xxx.h"
|
2009-05-29 00:56:16 +07:00
|
|
|
#include "prm-regbits-24xx.h"
|
2012-10-21 14:01:11 +07:00
|
|
|
#include "cm2xxx.h"
|
2009-05-29 00:56:16 +07:00
|
|
|
#include "cm-regbits-24xx.h"
|
|
|
|
#include "sdrc.h"
|
2012-10-30 03:54:06 +07:00
|
|
|
#include "sram.h"
|
2009-05-29 00:56:16 +07:00
|
|
|
#include "pm.h"
|
2010-10-09 00:40:20 +07:00
|
|
|
#include "control.h"
|
2010-12-22 11:05:16 +07:00
|
|
|
#include "powerdomain.h"
|
2010-12-22 11:05:15 +07:00
|
|
|
#include "clockdomain.h"
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl,
|
|
|
|
void __iomem *sdrc_power);
|
|
|
|
|
OMAP clockdomains: add usecounting for wakeup and sleep dependencies
Add usecounting for wakeup and sleep dependencies. In the current
situation, if several functions add dependencies on the same
clockdomains, when the first dependency removal function is called,
the dependency will be incorrectly removed from the hardware.
Add clkdm_clear_all_wkdeps() and clkdm_clear_all_sleepdeps(), which
provide a fast and usecounting-consistent way to clear all hardware
clockdomain dependencies, since accesses to these registers can be
quite slow. pm{2,3}4xx.c has been updated to use these new functions.
The original version of this patch did not touch these files, which
previously wrote directly to the wkdep registers, and thus confused
the usecounting code. This problem was found by Kevin Hilman
<khilman@deeprootsystems.com>.
N.B.: This patch introduces one significant functional difference over
the previous pm34xx.c code: sleepdeps are now cleared during
clockdomain initialization, whereas previously they were left
untouched. This has been tested by Kevin and confirmed to work.
The original version of this patch also did not take into
consideration that some clockdomains do not have sleep or wakeup
dependency sources, which caused NULL pointer dereferences. This
problem was debugged and fixed by Kevin Hilman
<khilman@deeprootsystems.com>.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Jouni Högander <jouni.hogander@nokia.com>
2010-01-27 10:13:01 +07:00
|
|
|
static struct powerdomain *mpu_pwrdm, *core_pwrdm;
|
|
|
|
static struct clockdomain *dsp_clkdm, *mpu_clkdm, *wkup_clkdm, *gfx_clkdm;
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
static struct clk *osc_ck, *emul_ck;
|
|
|
|
|
2012-02-02 16:30:50 +07:00
|
|
|
static int omap2_enter_full_retention(void)
|
2009-05-29 00:56:16 +07:00
|
|
|
{
|
|
|
|
u32 l;
|
|
|
|
|
|
|
|
/* There is 1 reference hold for all children of the oscillator
|
|
|
|
* clock, the following will remove it. If no one else uses the
|
|
|
|
* oscillator itself it will be disabled if/when we enter retention
|
|
|
|
* mode.
|
|
|
|
*/
|
|
|
|
clk_disable(osc_ck);
|
|
|
|
|
|
|
|
/* Clear old wake-up events */
|
|
|
|
/* REVISIT: These write to reserved bits? */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1);
|
|
|
|
omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2);
|
|
|
|
omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
2013-01-26 14:58:14 +07:00
|
|
|
pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_RET);
|
2009-05-29 00:56:16 +07:00
|
|
|
pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET);
|
|
|
|
|
|
|
|
/* Workaround to kill USB */
|
|
|
|
l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL;
|
|
|
|
omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0);
|
|
|
|
|
2010-12-22 11:05:16 +07:00
|
|
|
omap2_gpio_prepare_for_idle(0);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
/* One last check for pending IRQs to avoid extra latency due
|
|
|
|
* to sleeping unnecessarily. */
|
2009-02-04 06:49:04 +07:00
|
|
|
if (omap_irq_pending())
|
2009-05-29 00:56:16 +07:00
|
|
|
goto no_sleep;
|
|
|
|
|
|
|
|
/* Jump to SRAM suspend code */
|
|
|
|
omap2_sram_suspend(sdrc_read_reg(SDRC_DLLA_CTRL),
|
|
|
|
OMAP_SDRC_REGADDR(SDRC_DLLA_CTRL),
|
|
|
|
OMAP_SDRC_REGADDR(SDRC_POWER));
|
|
|
|
|
OMAP3: PM: UART: disable clocks when idle and off-mode support
This patch allows the UART clocks to be disabled when the OMAP UARTs
are inactive, thus permitting the chip to hit retention in idle.
After the expiration of an activity timer, each UART is allowed to
disable its clocks so the system can enter retention. The activity
timer is (re)activated on any UART interrupt, UART wake event or any
IO pad wakeup. The actual disable of the UART clocks is done in the
'prepare_idle' hook called from the OMAP idle loop.
While the activity timer is active, the smart-idle mode of the UART is
also disabled. This is due to a "feature" of the UART module that
after a UART wakeup, the smart-idle mode may be entered before the
UART has communicated the interrupt, or upon TX, an idle mode may be
entered before the TX FIFOs are emptied.
Upon suspend, the 'prepare_suspend' hook cancels any pending activity
timers and allows the clocks to be disabled immediately.
In addition, upon disabling clocks the UART state is saved in case
of an off-mode transition while clocks are off.
Special thanks to Tero Kristo for the initial ideas and first versions
of UART idle support, and to Jouni Hogander for extra testing and
bugfixes.
Tested on OMAP3 (Beagle, RX51, SDP, EVM) and OMAP2 (n810)
Cc: Tero Kristo <tero.kristo@nokia.com>
Cc: Jouni Hogander <jouni.hogander@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
2009-02-05 01:51:40 +07:00
|
|
|
no_sleep:
|
2009-01-28 02:09:24 +07:00
|
|
|
omap2_gpio_resume_after_idle();
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
clk_enable(osc_ck);
|
|
|
|
|
|
|
|
/* clear CORE wake-up events */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1);
|
|
|
|
omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
/* wakeup domain events - bit 1: GPT1, bit5 GPIO */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_clear_mod_reg_bits(0x4 | 0x1, WKUP_MOD, PM_WKST);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
/* MPU domain wake events */
|
2010-12-22 11:05:14 +07:00
|
|
|
l = omap2_prm_read_mod_reg(OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
|
2009-05-29 00:56:16 +07:00
|
|
|
if (l & 0x01)
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(0x01, OCP_MOD,
|
2009-05-29 00:56:16 +07:00
|
|
|
OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
|
|
|
|
if (l & 0x20)
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(0x20, OCP_MOD,
|
2009-05-29 00:56:16 +07:00
|
|
|
OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
|
|
|
|
|
|
|
|
/* Mask future PRCM-to-MPU interrupts */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
|
2012-02-02 16:30:50 +07:00
|
|
|
|
2013-01-26 14:58:14 +07:00
|
|
|
pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
|
|
|
|
pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_ON);
|
|
|
|
|
2012-02-02 16:30:50 +07:00
|
|
|
return 0;
|
2009-05-29 00:56:16 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int sti_console_enabled;
|
|
|
|
|
|
|
|
static int omap2_allow_mpu_retention(void)
|
|
|
|
{
|
2013-10-11 23:15:31 +07:00
|
|
|
if (!omap2xxx_cm_mpu_retention_allowed())
|
2009-05-29 00:56:16 +07:00
|
|
|
return 0;
|
|
|
|
if (sti_console_enabled)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void omap2_enter_mpu_retention(void)
|
|
|
|
{
|
2012-12-31 00:15:48 +07:00
|
|
|
const int zero = 0;
|
|
|
|
|
2009-05-29 00:56:16 +07:00
|
|
|
/* The peripherals seem not to be able to wake up the MPU when
|
|
|
|
* it is in retention mode. */
|
|
|
|
if (omap2_allow_mpu_retention()) {
|
|
|
|
/* REVISIT: These write to reserved bits? */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1);
|
|
|
|
omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2);
|
|
|
|
omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
/* Try to enter MPU retention */
|
2013-01-26 14:58:14 +07:00
|
|
|
pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET);
|
|
|
|
|
2009-05-29 00:56:16 +07:00
|
|
|
} else {
|
|
|
|
/* Block MPU retention */
|
2013-01-26 14:58:14 +07:00
|
|
|
pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
|
2009-05-29 00:56:16 +07:00
|
|
|
}
|
|
|
|
|
2012-12-31 00:15:48 +07:00
|
|
|
/* WFI */
|
|
|
|
asm("mcr p15, 0, %0, c7, c0, 4" : : "r" (zero) : "memory", "cc");
|
2013-01-26 14:58:14 +07:00
|
|
|
|
|
|
|
pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
|
2009-05-29 00:56:16 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int omap2_can_sleep(void)
|
|
|
|
{
|
2013-10-11 23:15:31 +07:00
|
|
|
if (omap2xxx_cm_fclks_active())
|
2009-05-29 00:56:16 +07:00
|
|
|
return 0;
|
2012-04-27 17:29:32 +07:00
|
|
|
if (__clk_is_enabled(osc_ck))
|
2009-05-29 00:56:16 +07:00
|
|
|
return 0;
|
|
|
|
if (omap_dma_running())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void omap2_pm_idle(void)
|
|
|
|
{
|
|
|
|
if (!omap2_can_sleep()) {
|
2009-02-04 06:49:04 +07:00
|
|
|
if (omap_irq_pending())
|
2013-02-11 20:59:45 +07:00
|
|
|
return;
|
2009-05-29 00:56:16 +07:00
|
|
|
omap2_enter_mpu_retention();
|
2013-02-11 20:59:45 +07:00
|
|
|
return;
|
2009-05-29 00:56:16 +07:00
|
|
|
}
|
|
|
|
|
2009-02-04 06:49:04 +07:00
|
|
|
if (omap_irq_pending())
|
2013-02-11 20:59:45 +07:00
|
|
|
return;
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
omap2_enter_full_retention();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init prcm_setup_regs(void)
|
|
|
|
{
|
|
|
|
int i, num_mem_banks;
|
|
|
|
struct powerdomain *pwrdm;
|
|
|
|
|
2011-02-26 05:39:30 +07:00
|
|
|
/*
|
|
|
|
* Enable autoidle
|
|
|
|
* XXX This should be handled by hwmod code or PRCM init code
|
|
|
|
*/
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(OMAP24XX_AUTOIDLE_MASK, OCP_MOD,
|
2009-05-29 00:56:16 +07:00
|
|
|
OMAP2_PRCM_SYSCONFIG_OFFSET);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set CORE powerdomain memory banks to retain their contents
|
|
|
|
* during RETENTION
|
|
|
|
*/
|
|
|
|
num_mem_banks = pwrdm_get_mem_bank_count(core_pwrdm);
|
|
|
|
for (i = 0; i < num_mem_banks; i++)
|
|
|
|
pwrdm_set_mem_retst(core_pwrdm, i, PWRDM_POWER_RET);
|
|
|
|
|
2013-01-26 14:58:14 +07:00
|
|
|
pwrdm_set_logic_retst(core_pwrdm, PWRDM_POWER_RET);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
pwrdm_set_logic_retst(mpu_pwrdm, PWRDM_POWER_RET);
|
|
|
|
|
|
|
|
/* Force-power down DSP, GFX powerdomains */
|
|
|
|
|
|
|
|
pwrdm = clkdm_get_pwrdm(dsp_clkdm);
|
|
|
|
pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF);
|
|
|
|
|
|
|
|
pwrdm = clkdm_get_pwrdm(gfx_clkdm);
|
|
|
|
pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF);
|
|
|
|
|
2011-01-27 16:52:55 +07:00
|
|
|
/* Enable hardware-supervised idle for all clkdms */
|
2012-02-02 16:38:50 +07:00
|
|
|
clkdm_for_each(omap_pm_clkdms_setup, NULL);
|
OMAP clockdomains: add usecounting for wakeup and sleep dependencies
Add usecounting for wakeup and sleep dependencies. In the current
situation, if several functions add dependencies on the same
clockdomains, when the first dependency removal function is called,
the dependency will be incorrectly removed from the hardware.
Add clkdm_clear_all_wkdeps() and clkdm_clear_all_sleepdeps(), which
provide a fast and usecounting-consistent way to clear all hardware
clockdomain dependencies, since accesses to these registers can be
quite slow. pm{2,3}4xx.c has been updated to use these new functions.
The original version of this patch did not touch these files, which
previously wrote directly to the wkdep registers, and thus confused
the usecounting code. This problem was found by Kevin Hilman
<khilman@deeprootsystems.com>.
N.B.: This patch introduces one significant functional difference over
the previous pm34xx.c code: sleepdeps are now cleared during
clockdomain initialization, whereas previously they were left
untouched. This has been tested by Kevin and confirmed to work.
The original version of this patch also did not take into
consideration that some clockdomains do not have sleep or wakeup
dependency sources, which caused NULL pointer dereferences. This
problem was debugged and fixed by Kevin Hilman
<khilman@deeprootsystems.com>.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Jouni Högander <jouni.hogander@nokia.com>
2010-01-27 10:13:01 +07:00
|
|
|
clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
2012-02-02 16:30:50 +07:00
|
|
|
#ifdef CONFIG_SUSPEND
|
|
|
|
omap_pm_suspend = omap2_enter_full_retention;
|
|
|
|
#endif
|
|
|
|
|
2009-05-29 00:56:16 +07:00
|
|
|
/* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
|
|
|
|
* stabilisation */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD,
|
|
|
|
OMAP2_PRCM_CLKSSETUP_OFFSET);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
/* Configure automatic voltage transition */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(2 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD,
|
|
|
|
OMAP2_PRCM_VOLTSETUP_OFFSET);
|
|
|
|
omap2_prm_write_mod_reg(OMAP24XX_AUTO_EXTVOLT_MASK |
|
|
|
|
(0x1 << OMAP24XX_SETOFF_LEVEL_SHIFT) |
|
|
|
|
OMAP24XX_MEMRETCTRL_MASK |
|
|
|
|
(0x1 << OMAP24XX_SETRET_LEVEL_SHIFT) |
|
|
|
|
(0x0 << OMAP24XX_VOLT_LEVEL_SHIFT),
|
|
|
|
OMAP24XX_GR_MOD, OMAP2_PRCM_VOLTCTRL_OFFSET);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
/* Enable wake-up events */
|
2010-12-22 11:05:14 +07:00
|
|
|
omap2_prm_write_mod_reg(OMAP24XX_EN_GPIOS_MASK | OMAP24XX_EN_GPT1_MASK,
|
|
|
|
WKUP_MOD, PM_WKEN);
|
2009-05-29 00:56:16 +07:00
|
|
|
}
|
|
|
|
|
2012-04-26 15:06:50 +07:00
|
|
|
int __init omap2_pm_init(void)
|
2009-05-29 00:56:16 +07:00
|
|
|
{
|
|
|
|
u32 l;
|
|
|
|
|
|
|
|
printk(KERN_INFO "Power Management for OMAP2 initializing\n");
|
2010-12-22 11:05:14 +07:00
|
|
|
l = omap2_prm_read_mod_reg(OCP_MOD, OMAP2_PRCM_REVISION_OFFSET);
|
2009-05-29 00:56:16 +07:00
|
|
|
printk(KERN_INFO "PRCM revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f);
|
|
|
|
|
OMAP clockdomains: add usecounting for wakeup and sleep dependencies
Add usecounting for wakeup and sleep dependencies. In the current
situation, if several functions add dependencies on the same
clockdomains, when the first dependency removal function is called,
the dependency will be incorrectly removed from the hardware.
Add clkdm_clear_all_wkdeps() and clkdm_clear_all_sleepdeps(), which
provide a fast and usecounting-consistent way to clear all hardware
clockdomain dependencies, since accesses to these registers can be
quite slow. pm{2,3}4xx.c has been updated to use these new functions.
The original version of this patch did not touch these files, which
previously wrote directly to the wkdep registers, and thus confused
the usecounting code. This problem was found by Kevin Hilman
<khilman@deeprootsystems.com>.
N.B.: This patch introduces one significant functional difference over
the previous pm34xx.c code: sleepdeps are now cleared during
clockdomain initialization, whereas previously they were left
untouched. This has been tested by Kevin and confirmed to work.
The original version of this patch also did not take into
consideration that some clockdomains do not have sleep or wakeup
dependency sources, which caused NULL pointer dereferences. This
problem was debugged and fixed by Kevin Hilman
<khilman@deeprootsystems.com>.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Jouni Högander <jouni.hogander@nokia.com>
2010-01-27 10:13:01 +07:00
|
|
|
/* Look up important powerdomains */
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
|
|
|
|
if (!mpu_pwrdm)
|
|
|
|
pr_err("PM: mpu_pwrdm not found\n");
|
|
|
|
|
|
|
|
core_pwrdm = pwrdm_lookup("core_pwrdm");
|
|
|
|
if (!core_pwrdm)
|
|
|
|
pr_err("PM: core_pwrdm not found\n");
|
|
|
|
|
OMAP clockdomains: add usecounting for wakeup and sleep dependencies
Add usecounting for wakeup and sleep dependencies. In the current
situation, if several functions add dependencies on the same
clockdomains, when the first dependency removal function is called,
the dependency will be incorrectly removed from the hardware.
Add clkdm_clear_all_wkdeps() and clkdm_clear_all_sleepdeps(), which
provide a fast and usecounting-consistent way to clear all hardware
clockdomain dependencies, since accesses to these registers can be
quite slow. pm{2,3}4xx.c has been updated to use these new functions.
The original version of this patch did not touch these files, which
previously wrote directly to the wkdep registers, and thus confused
the usecounting code. This problem was found by Kevin Hilman
<khilman@deeprootsystems.com>.
N.B.: This patch introduces one significant functional difference over
the previous pm34xx.c code: sleepdeps are now cleared during
clockdomain initialization, whereas previously they were left
untouched. This has been tested by Kevin and confirmed to work.
The original version of this patch also did not take into
consideration that some clockdomains do not have sleep or wakeup
dependency sources, which caused NULL pointer dereferences. This
problem was debugged and fixed by Kevin Hilman
<khilman@deeprootsystems.com>.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Jouni Högander <jouni.hogander@nokia.com>
2010-01-27 10:13:01 +07:00
|
|
|
/* Look up important clockdomains */
|
|
|
|
|
|
|
|
mpu_clkdm = clkdm_lookup("mpu_clkdm");
|
|
|
|
if (!mpu_clkdm)
|
|
|
|
pr_err("PM: mpu_clkdm not found\n");
|
|
|
|
|
|
|
|
wkup_clkdm = clkdm_lookup("wkup_clkdm");
|
|
|
|
if (!wkup_clkdm)
|
|
|
|
pr_err("PM: wkup_clkdm not found\n");
|
|
|
|
|
2009-05-29 00:56:16 +07:00
|
|
|
dsp_clkdm = clkdm_lookup("dsp_clkdm");
|
|
|
|
if (!dsp_clkdm)
|
OMAP clockdomains: add usecounting for wakeup and sleep dependencies
Add usecounting for wakeup and sleep dependencies. In the current
situation, if several functions add dependencies on the same
clockdomains, when the first dependency removal function is called,
the dependency will be incorrectly removed from the hardware.
Add clkdm_clear_all_wkdeps() and clkdm_clear_all_sleepdeps(), which
provide a fast and usecounting-consistent way to clear all hardware
clockdomain dependencies, since accesses to these registers can be
quite slow. pm{2,3}4xx.c has been updated to use these new functions.
The original version of this patch did not touch these files, which
previously wrote directly to the wkdep registers, and thus confused
the usecounting code. This problem was found by Kevin Hilman
<khilman@deeprootsystems.com>.
N.B.: This patch introduces one significant functional difference over
the previous pm34xx.c code: sleepdeps are now cleared during
clockdomain initialization, whereas previously they were left
untouched. This has been tested by Kevin and confirmed to work.
The original version of this patch also did not take into
consideration that some clockdomains do not have sleep or wakeup
dependency sources, which caused NULL pointer dereferences. This
problem was debugged and fixed by Kevin Hilman
<khilman@deeprootsystems.com>.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Jouni Högander <jouni.hogander@nokia.com>
2010-01-27 10:13:01 +07:00
|
|
|
pr_err("PM: dsp_clkdm not found\n");
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
gfx_clkdm = clkdm_lookup("gfx_clkdm");
|
|
|
|
if (!gfx_clkdm)
|
|
|
|
pr_err("PM: gfx_clkdm not found\n");
|
|
|
|
|
|
|
|
|
|
|
|
osc_ck = clk_get(NULL, "osc_ck");
|
|
|
|
if (IS_ERR(osc_ck)) {
|
|
|
|
printk(KERN_ERR "could not get osc_ck\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cpu_is_omap242x()) {
|
|
|
|
emul_ck = clk_get(NULL, "emul_ck");
|
|
|
|
if (IS_ERR(emul_ck)) {
|
|
|
|
printk(KERN_ERR "could not get emul_ck\n");
|
|
|
|
clk_put(osc_ck);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
prcm_setup_regs();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We copy the assembler sleep/wakeup routines to SRAM.
|
|
|
|
* These routines need to be in SRAM as that's the only
|
2012-12-31 00:15:48 +07:00
|
|
|
* memory the MPU can see when it wakes up after the entire
|
|
|
|
* chip enters idle.
|
2009-05-29 00:56:16 +07:00
|
|
|
*/
|
2012-04-26 15:06:50 +07:00
|
|
|
omap2_sram_suspend = omap_sram_push(omap24xx_cpu_suspend,
|
|
|
|
omap24xx_cpu_suspend_sz);
|
2009-05-29 00:56:16 +07:00
|
|
|
|
2012-01-05 04:27:48 +07:00
|
|
|
arm_pm_idle = omap2_pm_idle;
|
2009-05-29 00:56:16 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|