USB: serial: option: reimplement interface masking
[linux/fpc-iii.git] / arch / arm / mach-mvebu / kirkwood-pm.c
blob1e1f879f16ce0a4fc411a2f6e2c932ed58e31337
1 /*
2 * Power Management driver for Marvell Kirkwood SoCs
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License,
9 * version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <linux/kernel.h>
18 #include <linux/suspend.h>
19 #include <linux/io.h>
20 #include "kirkwood.h"
21 #include "kirkwood-pm.h"
23 static void __iomem *ddr_operation_base;
24 static void __iomem *memory_pm_ctrl;
26 static void kirkwood_low_power(void)
28 u32 mem_pm_ctrl;
30 mem_pm_ctrl = readl(memory_pm_ctrl);
32 /* Set peripherals to low-power mode */
33 writel_relaxed(~0, memory_pm_ctrl);
35 /* Set DDR in self-refresh */
36 writel_relaxed(0x7, ddr_operation_base);
39 * Set CPU in wait-for-interrupt state.
40 * This disables the CPU core clocks,
41 * the array clocks, and also the L2 controller.
43 cpu_do_idle();
45 writel_relaxed(mem_pm_ctrl, memory_pm_ctrl);
48 static int kirkwood_suspend_enter(suspend_state_t state)
50 switch (state) {
51 case PM_SUSPEND_STANDBY:
52 kirkwood_low_power();
53 break;
54 default:
55 return -EINVAL;
57 return 0;
60 static int kirkwood_pm_valid_standby(suspend_state_t state)
62 return state == PM_SUSPEND_STANDBY;
65 static const struct platform_suspend_ops kirkwood_suspend_ops = {
66 .enter = kirkwood_suspend_enter,
67 .valid = kirkwood_pm_valid_standby,
70 void __init kirkwood_pm_init(void)
72 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
73 memory_pm_ctrl = ioremap(MEMORY_PM_CTRL_PHYS, 4);
75 suspend_set_ops(&kirkwood_suspend_ops);