diff options
author | Olof Johansson <olof@lixom.net> | 2012-06-30 19:13:15 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-06-30 19:13:15 -0400 |
commit | 839ab0c18fe4cf83dd99ca814f2b4cf822cd99be (patch) | |
tree | 868e835a3cee2d3bb5071a0f00eb98bcce8ebdea /arch/arm/plat-mxc | |
parent | 6b16351acbd415e66ba16bf7d473ece1574cf0bc (diff) | |
parent | b9d18dc3a05d59894d60d5e173ebfb89a4b91bdf (diff) |
Merge branch 'imx/cpuidle' into next/pm
* imx/cpuidle:
ARM: imx: Add imx6q cpuidle driver
ARM: imx: Add imx5 cpuidle
ARM: imx: Add common imx cpuidle init functionality.
ARM: imx: Enable imx53 low power idle
ARM: imx: clean and consolidate imx5 suspend and idle code
ARM: imx: Add comments to tzic_enable_waker()
ARM: imx: Modify IMX_IO_P2V macro
Resolved trivial context conflict in arch/arm/plat-mxc/include/mach/common.h
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r-- | arch/arm/plat-mxc/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/cpuidle.c | 80 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/common.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/cpuidle.h | 22 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/hardware.h | 25 | ||||
-rw-r--r-- | arch/arm/plat-mxc/tzic.c | 4 |
6 files changed, 126 insertions, 12 deletions
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile index e81290c27c65..63b064b5c1d5 100644 --- a/arch/arm/plat-mxc/Makefile +++ b/arch/arm/plat-mxc/Makefile | |||
@@ -16,6 +16,7 @@ obj-$(CONFIG_MXC_ULPI) += ulpi.o | |||
16 | obj-$(CONFIG_MXC_USE_EPIT) += epit.o | 16 | obj-$(CONFIG_MXC_USE_EPIT) += epit.o |
17 | obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o | 17 | obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o |
18 | obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o | 18 | obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o |
19 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | ||
19 | ifdef CONFIG_SND_IMX_SOC | 20 | ifdef CONFIG_SND_IMX_SOC |
20 | obj-y += ssi-fiq.o | 21 | obj-y += ssi-fiq.o |
21 | obj-y += ssi-fiq-ksym.o | 22 | obj-y += ssi-fiq-ksym.o |
diff --git a/arch/arm/plat-mxc/cpuidle.c b/arch/arm/plat-mxc/cpuidle.c new file mode 100644 index 000000000000..d4cb511a44a8 --- /dev/null +++ b/arch/arm/plat-mxc/cpuidle.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * Copyright 2012 Linaro Ltd. | ||
4 | * | ||
5 | * The code contained herein is licensed under the GNU General Public | ||
6 | * License. You may obtain a copy of the GNU General Public License | ||
7 | * Version 2 or later at the following locations: | ||
8 | * | ||
9 | * http://www.opensource.org/licenses/gpl-license.html | ||
10 | * http://www.gnu.org/copyleft/gpl.html | ||
11 | */ | ||
12 | |||
13 | #include <linux/cpuidle.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/hrtimer.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/slab.h> | ||
19 | |||
20 | static struct cpuidle_device __percpu * imx_cpuidle_devices; | ||
21 | |||
22 | static void __init imx_cpuidle_devices_uninit(void) | ||
23 | { | ||
24 | int cpu_id; | ||
25 | struct cpuidle_device *dev; | ||
26 | |||
27 | for_each_possible_cpu(cpu_id) { | ||
28 | dev = per_cpu_ptr(imx_cpuidle_devices, cpu_id); | ||
29 | cpuidle_unregister_device(dev); | ||
30 | } | ||
31 | |||
32 | free_percpu(imx_cpuidle_devices); | ||
33 | } | ||
34 | |||
35 | int __init imx_cpuidle_init(struct cpuidle_driver *drv) | ||
36 | { | ||
37 | struct cpuidle_device *dev; | ||
38 | int cpu_id, ret; | ||
39 | |||
40 | if (drv->state_count > CPUIDLE_STATE_MAX) { | ||
41 | pr_err("%s: state_count exceeds maximum\n", __func__); | ||
42 | return -EINVAL; | ||
43 | } | ||
44 | |||
45 | ret = cpuidle_register_driver(drv); | ||
46 | if (ret) { | ||
47 | pr_err("%s: Failed to register cpuidle driver with error: %d\n", | ||
48 | __func__, ret); | ||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | imx_cpuidle_devices = alloc_percpu(struct cpuidle_device); | ||
53 | if (imx_cpuidle_devices == NULL) { | ||
54 | ret = -ENOMEM; | ||
55 | goto unregister_drv; | ||
56 | } | ||
57 | |||
58 | /* initialize state data for each cpuidle_device */ | ||
59 | for_each_possible_cpu(cpu_id) { | ||
60 | dev = per_cpu_ptr(imx_cpuidle_devices, cpu_id); | ||
61 | dev->cpu = cpu_id; | ||
62 | dev->state_count = drv->state_count; | ||
63 | |||
64 | ret = cpuidle_register_device(dev); | ||
65 | if (ret) { | ||
66 | pr_err("%s: Failed to register cpu %u, error: %d\n", | ||
67 | __func__, cpu_id, ret); | ||
68 | goto uninit; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | return 0; | ||
73 | |||
74 | uninit: | ||
75 | imx_cpuidle_devices_uninit(); | ||
76 | |||
77 | unregister_drv: | ||
78 | cpuidle_unregister_driver(drv); | ||
79 | return ret; | ||
80 | } | ||
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index e429ca1b814a..7ca15044154f 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h | |||
@@ -54,6 +54,7 @@ extern void imx50_soc_init(void); | |||
54 | extern void imx51_soc_init(void); | 54 | extern void imx51_soc_init(void); |
55 | extern void imx53_soc_init(void); | 55 | extern void imx53_soc_init(void); |
56 | extern void imx51_init_late(void); | 56 | extern void imx51_init_late(void); |
57 | extern void imx53_init_late(void); | ||
57 | extern void epit_timer_init(void __iomem *base, int irq); | 58 | extern void epit_timer_init(void __iomem *base, int irq); |
58 | extern void mxc_timer_init(void __iomem *, int); | 59 | extern void mxc_timer_init(void __iomem *, int); |
59 | extern int mx1_clocks_init(unsigned long fref); | 60 | extern int mx1_clocks_init(unsigned long fref); |
@@ -95,7 +96,6 @@ enum mx3_cpu_pwr_mode { | |||
95 | }; | 96 | }; |
96 | 97 | ||
97 | extern void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode); | 98 | extern void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode); |
98 | extern void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode); | ||
99 | extern void imx_print_silicon_rev(const char *cpu, int srev); | 99 | extern void imx_print_silicon_rev(const char *cpu, int srev); |
100 | 100 | ||
101 | void avic_handle_irq(struct pt_regs *); | 101 | void avic_handle_irq(struct pt_regs *); |
@@ -146,8 +146,12 @@ extern void imx6q_clock_map_io(void); | |||
146 | 146 | ||
147 | #ifdef CONFIG_PM | 147 | #ifdef CONFIG_PM |
148 | extern void imx6q_pm_init(void); | 148 | extern void imx6q_pm_init(void); |
149 | extern void imx51_pm_init(void); | ||
150 | extern void imx53_pm_init(void); | ||
149 | #else | 151 | #else |
150 | static inline void imx6q_pm_init(void) {} | 152 | static inline void imx6q_pm_init(void) {} |
153 | static inline void imx51_pm_init(void) {} | ||
154 | static inline void imx53_pm_init(void) {} | ||
151 | #endif | 155 | #endif |
152 | 156 | ||
153 | #ifdef CONFIG_NEON | 157 | #ifdef CONFIG_NEON |
diff --git a/arch/arm/plat-mxc/include/mach/cpuidle.h b/arch/arm/plat-mxc/include/mach/cpuidle.h new file mode 100644 index 000000000000..bc932d1af372 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/cpuidle.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * Copyright 2012 Linaro Ltd. | ||
4 | * | ||
5 | * The code contained herein is licensed under the GNU General Public | ||
6 | * License. You may obtain a copy of the GNU General Public License | ||
7 | * Version 2 or later at the following locations: | ||
8 | * | ||
9 | * http://www.opensource.org/licenses/gpl-license.html | ||
10 | * http://www.gnu.org/copyleft/gpl.html | ||
11 | */ | ||
12 | |||
13 | #include <linux/cpuidle.h> | ||
14 | |||
15 | #ifdef CONFIG_CPU_IDLE | ||
16 | extern int imx_cpuidle_init(struct cpuidle_driver *drv); | ||
17 | #else | ||
18 | static inline int imx_cpuidle_init(struct cpuidle_driver *drv) | ||
19 | { | ||
20 | return -ENODEV; | ||
21 | } | ||
22 | #endif | ||
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h index 0630513554de..071afd0b9283 100644 --- a/arch/arm/plat-mxc/include/mach/hardware.h +++ b/arch/arm/plat-mxc/include/mach/hardware.h | |||
@@ -50,7 +50,7 @@ | |||
50 | * IO 0x00200000+0x100000 -> 0xf4000000+0x100000 | 50 | * IO 0x00200000+0x100000 -> 0xf4000000+0x100000 |
51 | * mx21: | 51 | * mx21: |
52 | * AIPI 0x10000000+0x100000 -> 0xf4400000+0x100000 | 52 | * AIPI 0x10000000+0x100000 -> 0xf4400000+0x100000 |
53 | * SAHB1 0x80000000+0x100000 -> 0xf4000000+0x100000 | 53 | * SAHB1 0x80000000+0x100000 -> 0xf5000000+0x100000 |
54 | * X_MEMC 0xdf000000+0x004000 -> 0xf5f00000+0x004000 | 54 | * X_MEMC 0xdf000000+0x004000 -> 0xf5f00000+0x004000 |
55 | * mx25: | 55 | * mx25: |
56 | * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000 | 56 | * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000 |
@@ -58,47 +58,50 @@ | |||
58 | * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000 | 58 | * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000 |
59 | * mx27: | 59 | * mx27: |
60 | * AIPI 0x10000000+0x100000 -> 0xf4400000+0x100000 | 60 | * AIPI 0x10000000+0x100000 -> 0xf4400000+0x100000 |
61 | * SAHB1 0x80000000+0x100000 -> 0xf4000000+0x100000 | 61 | * SAHB1 0x80000000+0x100000 -> 0xf5000000+0x100000 |
62 | * X_MEMC 0xd8000000+0x100000 -> 0xf5c00000+0x100000 | 62 | * X_MEMC 0xd8000000+0x100000 -> 0xf5c00000+0x100000 |
63 | * mx31: | 63 | * mx31: |
64 | * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000 | 64 | * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000 |
65 | * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000 | 65 | * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000 |
66 | * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000 | 66 | * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000 |
67 | * X_MEMC 0xb8000000+0x010000 -> 0xf4c00000+0x010000 | 67 | * X_MEMC 0xb8000000+0x010000 -> 0xf5c00000+0x010000 |
68 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 | 68 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 |
69 | * mx35: | 69 | * mx35: |
70 | * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000 | 70 | * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000 |
71 | * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000 | 71 | * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000 |
72 | * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000 | 72 | * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000 |
73 | * X_MEMC 0xb8000000+0x010000 -> 0xf4c00000+0x010000 | 73 | * X_MEMC 0xb8000000+0x010000 -> 0xf5c00000+0x010000 |
74 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 | 74 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 |
75 | * mx50: | 75 | * mx50: |
76 | * TZIC 0x0fffc000+0x004000 -> 0xf4bfc000+0x004000 | 76 | * TZIC 0x0fffc000+0x004000 -> 0xf4bfc000+0x004000 |
77 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 | ||
78 | * AIPS1 0x53f00000+0x100000 -> 0xf5700000+0x100000 | 77 | * AIPS1 0x53f00000+0x100000 -> 0xf5700000+0x100000 |
78 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 | ||
79 | * AIPS2 0x63f00000+0x100000 -> 0xf5300000+0x100000 | 79 | * AIPS2 0x63f00000+0x100000 -> 0xf5300000+0x100000 |
80 | * mx51: | 80 | * mx51: |
81 | * TZIC 0xe0000000+0x004000 -> 0xf5000000+0x004000 | 81 | * TZIC 0x0fffc000+0x004000 -> 0xf4bfc000+0x004000 |
82 | * IRAM 0x1ffe0000+0x020000 -> 0xf4fe0000+0x020000 | 82 | * IRAM 0x1ffe0000+0x020000 -> 0xf4fe0000+0x020000 |
83 | * DEBUG 0x60000000+0x100000 -> 0xf5000000+0x100000 | ||
83 | * SPBA0 0x70000000+0x100000 -> 0xf5400000+0x100000 | 84 | * SPBA0 0x70000000+0x100000 -> 0xf5400000+0x100000 |
84 | * AIPS1 0x73f00000+0x100000 -> 0xf5700000+0x100000 | 85 | * AIPS1 0x73f00000+0x100000 -> 0xf5700000+0x100000 |
85 | * AIPS2 0x83f00000+0x100000 -> 0xf4300000+0x100000 | 86 | * AIPS2 0x83f00000+0x100000 -> 0xf5300000+0x100000 |
86 | * mx53: | 87 | * mx53: |
87 | * TZIC 0x0fffc000+0x004000 -> 0xf4bfc000+0x004000 | 88 | * TZIC 0x0fffc000+0x004000 -> 0xf4bfc000+0x004000 |
89 | * DEBUG 0x40000000+0x100000 -> 0xf5000000+0x100000 | ||
88 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 | 90 | * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000 |
89 | * AIPS1 0x53f00000+0x100000 -> 0xf5700000+0x100000 | 91 | * AIPS1 0x53f00000+0x100000 -> 0xf5700000+0x100000 |
90 | * AIPS2 0x63f00000+0x100000 -> 0xf5300000+0x100000 | 92 | * AIPS2 0x63f00000+0x100000 -> 0xf5300000+0x100000 |
91 | * mx6q: | 93 | * mx6q: |
92 | * SCU 0x00a00000+0x001000 -> 0xf4000000+0x001000 | 94 | * SCU 0x00a00000+0x004000 -> 0xf4000000+0x004000 |
93 | * CCM 0x020c4000+0x004000 -> 0xf42c4000+0x004000 | 95 | * CCM 0x020c4000+0x004000 -> 0xf42c4000+0x004000 |
94 | * ANATOP 0x020c8000+0x001000 -> 0xf42c8000+0x001000 | 96 | * ANATOP 0x020c8000+0x004000 -> 0xf42c8000+0x004000 |
95 | * UART4 0x021f0000+0x004000 -> 0xf42f0000+0x004000 | 97 | * UART4 0x021f0000+0x004000 -> 0xf42f0000+0x004000 |
96 | */ | 98 | */ |
97 | #define IMX_IO_P2V(x) ( \ | 99 | #define IMX_IO_P2V(x) ( \ |
98 | 0xf4000000 + \ | 100 | (((x) & 0x80000000) >> 7) | \ |
101 | (0xf4000000 + \ | ||
99 | (((x) & 0x50000000) >> 6) + \ | 102 | (((x) & 0x50000000) >> 6) + \ |
100 | (((x) & 0x0b000000) >> 4) + \ | 103 | (((x) & 0x0b000000) >> 4) + \ |
101 | (((x) & 0x000fffff))) | 104 | (((x) & 0x000fffff)))) |
102 | 105 | ||
103 | #define IMX_IO_ADDRESS(x) IOMEM(IMX_IO_P2V(x)) | 106 | #define IMX_IO_ADDRESS(x) IOMEM(IMX_IO_P2V(x)) |
104 | 107 | ||
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index 98308ec1f321..a45dbea5e176 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c | |||
@@ -190,6 +190,10 @@ void __init tzic_init_irq(void __iomem *irqbase) | |||
190 | * tzic_enable_wake() - enable wakeup interrupt | 190 | * tzic_enable_wake() - enable wakeup interrupt |
191 | * | 191 | * |
192 | * @return 0 if successful; non-zero otherwise | 192 | * @return 0 if successful; non-zero otherwise |
193 | * | ||
194 | * This function provides an interrupt synchronization point that is required | ||
195 | * by tzic enabled platforms before entering imx specific low power modes (ie, | ||
196 | * those low power modes beyond the WAIT_CLOCKED basic ARM WFI only mode). | ||
193 | */ | 197 | */ |
194 | int tzic_enable_wake(void) | 198 | int tzic_enable_wake(void) |
195 | { | 199 | { |