ARM: psci: boot_secondary: replace __pa with virt_to_idmap
[linux-2.6-block.git] / drivers / cpuidle / cpuidle-calxeda.c
CommitLineData
be6a98d3
RH
1/*
2 * Copyright 2012 Calxeda, Inc.
3 *
a8e39c35 4 * Based on arch/arm/plat-mxc/cpuidle.c: #v3.7
be6a98d3
RH
5 * Copyright 2012 Freescale Semiconductor, Inc.
6 * Copyright 2012 Linaro Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
a8e39c35
DL
19 *
20 * Maintainer: Rob Herring <rob.herring@calxeda.com>
be6a98d3
RH
21 */
22
23#include <linux/cpuidle.h>
34a5eeb2 24#include <linux/cpu_pm.h>
be6a98d3 25#include <linux/init.h>
a410146c 26#include <linux/mm.h>
60a66e37 27#include <linux/platform_device.h>
be6a98d3 28#include <asm/cpuidle.h>
be6a98d3 29#include <asm/suspend.h>
a410146c 30#include <asm/psci.h>
be6a98d3
RH
31
32static int calxeda_idle_finish(unsigned long val)
33{
a410146c
RH
34 const struct psci_power_state ps = {
35 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
36 };
37 return psci_ops.cpu_suspend(ps, __pa(cpu_resume));
be6a98d3
RH
38}
39
40static int calxeda_pwrdown_idle(struct cpuidle_device *dev,
41 struct cpuidle_driver *drv,
42 int index)
43{
34a5eeb2 44 cpu_pm_enter();
be6a98d3 45 cpu_suspend(0, calxeda_idle_finish);
34a5eeb2
RH
46 cpu_pm_exit();
47
be6a98d3
RH
48 return index;
49}
50
be6a98d3
RH
51static struct cpuidle_driver calxeda_idle_driver = {
52 .name = "calxeda_idle",
be6a98d3
RH
53 .states = {
54 ARM_CPUIDLE_WFI_STATE,
55 {
56 .name = "PG",
57 .desc = "Power Gate",
be6a98d3
RH
58 .exit_latency = 30,
59 .power_usage = 50,
60 .target_residency = 200,
61 .enter = calxeda_pwrdown_idle,
62 },
63 },
64 .state_count = 2,
65};
66
5781532e 67static int calxeda_cpuidle_probe(struct platform_device *pdev)
be6a98d3 68{
0b210d96 69 return cpuidle_register(&calxeda_idle_driver, NULL);
be6a98d3 70}
60a66e37
DL
71
72static struct platform_driver calxeda_cpuidle_plat_driver = {
73 .driver = {
74 .name = "cpuidle-calxeda",
60a66e37
DL
75 },
76 .probe = calxeda_cpuidle_probe,
77};
090d1cf1 78builtin_platform_driver(calxeda_cpuidle_plat_driver);