Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/pxa27x.c |
| 3 | * |
| 4 | * Author: Nicolas Pitre |
| 5 | * Created: Nov 05, 2002 |
| 6 | * Copyright: MontaVista Software Inc. |
| 7 | * |
| 8 | * Code specific to PXA27x aka Bulverde. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 14 | #include <linux/gpio.h> |
Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 15 | #include <linux/gpio-pxa.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/module.h> |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/init.h> |
Robert Jarzmik | 32f1799 | 2016-08-15 00:24:55 +0200 | [diff] [blame] | 19 | #include <linux/irqchip.h> |
Rafael J. Wysocki | 95d9ffb | 2007-10-18 03:04:39 -0700 | [diff] [blame] | 20 | #include <linux/suspend.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 21 | #include <linux/platform_device.h> |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 22 | #include <linux/syscore_ops.h> |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 23 | #include <linux/io.h> |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 24 | #include <linux/irq.h> |
Sebastian Andrzej Siewior | b459396 | 2011-02-23 12:38:16 +0100 | [diff] [blame] | 25 | #include <linux/i2c/pxa-i2c.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 27 | #include <asm/mach/map.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 28 | #include <mach/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <asm/irq.h> |
Russell King | 2c74a0c | 2011-06-22 17:41:48 +0100 | [diff] [blame] | 30 | #include <asm/suspend.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 31 | #include <mach/irqs.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 32 | #include "pxa27x.h" |
Russell King | afd2fc0 | 2008-08-07 11:05:25 +0100 | [diff] [blame] | 33 | #include <mach/reset.h> |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 34 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 35 | #include "pm.h" |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 36 | #include <mach/dma.h> |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 37 | #include <mach/smemc.h> |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include "generic.h" |
Russell King | 46c41e6 | 2007-05-15 15:39:36 +0100 | [diff] [blame] | 40 | #include "devices.h" |
Robert Jarzmik | 48a17db | 2014-12-27 14:55:26 +0100 | [diff] [blame] | 41 | #include <linux/clk-provider.h> |
| 42 | #include <linux/clkdev.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Eric Miao | 0cb0b0d | 2008-10-04 12:45:39 +0800 | [diff] [blame] | 44 | void pxa27x_clear_otgph(void) |
| 45 | { |
| 46 | if (cpu_is_pxa27x() && (PSSR & PSSR_OTGPH)) |
| 47 | PSSR |= PSSR_OTGPH; |
| 48 | } |
| 49 | EXPORT_SYMBOL(pxa27x_clear_otgph); |
| 50 | |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 51 | static unsigned long ac97_reset_config[] = { |
Mike Dunn | 3b4bc7b | 2013-01-07 13:55:13 -0800 | [diff] [blame] | 52 | GPIO113_AC97_nRESET_GPIO_HIGH, |
Eric Miao | 5e16e3c | 2010-07-13 09:41:28 +0800 | [diff] [blame] | 53 | GPIO113_AC97_nRESET, |
Mike Dunn | 3b4bc7b | 2013-01-07 13:55:13 -0800 | [diff] [blame] | 54 | GPIO95_AC97_nRESET_GPIO_HIGH, |
Eric Miao | 5e16e3c | 2010-07-13 09:41:28 +0800 | [diff] [blame] | 55 | GPIO95_AC97_nRESET, |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 56 | }; |
| 57 | |
Mike Dunn | 053fe0f | 2013-01-07 13:55:14 -0800 | [diff] [blame] | 58 | void pxa27x_configure_ac97reset(int reset_gpio, bool to_gpio) |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 59 | { |
Mike Dunn | 053fe0f | 2013-01-07 13:55:14 -0800 | [diff] [blame] | 60 | /* |
| 61 | * This helper function is used to work around a bug in the pxa27x's |
| 62 | * ac97 controller during a warm reset. The configuration of the |
| 63 | * reset_gpio is changed as follows: |
| 64 | * to_gpio == true: configured to generic output gpio and driven high |
| 65 | * to_gpio == false: configured to ac97 controller alt fn AC97_nRESET |
| 66 | */ |
| 67 | |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 68 | if (reset_gpio == 113) |
Mike Dunn | 053fe0f | 2013-01-07 13:55:14 -0800 | [diff] [blame] | 69 | pxa2xx_mfp_config(to_gpio ? &ac97_reset_config[0] : |
| 70 | &ac97_reset_config[1], 1); |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 71 | |
| 72 | if (reset_gpio == 95) |
Mike Dunn | 053fe0f | 2013-01-07 13:55:14 -0800 | [diff] [blame] | 73 | pxa2xx_mfp_config(to_gpio ? &ac97_reset_config[2] : |
| 74 | &ac97_reset_config[3], 1); |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 75 | } |
Mike Dunn | 053fe0f | 2013-01-07 13:55:14 -0800 | [diff] [blame] | 76 | EXPORT_SYMBOL_GPL(pxa27x_configure_ac97reset); |
Eric Miao | fb1bf8c | 2010-01-04 16:30:58 +0800 | [diff] [blame] | 77 | |
Nicolas Pitre | a8fa3f0 | 2005-06-13 22:35:41 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_PM |
| 79 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 80 | #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x |
| 81 | #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] |
| 82 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 83 | /* |
Mike Rapoport | d082d36 | 2009-05-26 09:10:18 +0300 | [diff] [blame] | 84 | * allow platforms to override default PWRMODE setting used for PM_SUSPEND_MEM |
| 85 | */ |
| 86 | static unsigned int pwrmode = PWRMODE_SLEEP; |
| 87 | |
Arnd Bergmann | 54c0988 | 2015-10-12 15:46:08 +0200 | [diff] [blame] | 88 | int pxa27x_set_pwrmode(unsigned int mode) |
Mike Rapoport | d082d36 | 2009-05-26 09:10:18 +0300 | [diff] [blame] | 89 | { |
| 90 | switch (mode) { |
| 91 | case PWRMODE_SLEEP: |
| 92 | case PWRMODE_DEEPSLEEP: |
| 93 | pwrmode = mode; |
| 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | return -EINVAL; |
| 98 | } |
| 99 | |
| 100 | /* |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 101 | * List of global PXA peripheral registers to preserve. |
| 102 | * More ones like CP and general purpose register values are preserved |
| 103 | * with the stack pointer in sleep.S. |
| 104 | */ |
Eric Miao | 5a3d965 | 2008-09-03 18:06:34 +0800 | [diff] [blame] | 105 | enum { |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 106 | SLEEP_SAVE_PSTR, |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 107 | SLEEP_SAVE_MDREFR, |
Eric Miao | 5a3d965 | 2008-09-03 18:06:34 +0800 | [diff] [blame] | 108 | SLEEP_SAVE_PCFR, |
Robert Jarzmik | 649de51 | 2008-05-02 21:17:06 +0100 | [diff] [blame] | 109 | SLEEP_SAVE_COUNT |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | void pxa27x_cpu_pm_save(unsigned long *sleep_save) |
| 113 | { |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 114 | sleep_save[SLEEP_SAVE_MDREFR] = __raw_readl(MDREFR); |
Eric Miao | 5a3d965 | 2008-09-03 18:06:34 +0800 | [diff] [blame] | 115 | SAVE(PCFR); |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 116 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 117 | SAVE(PSTR); |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | void pxa27x_cpu_pm_restore(unsigned long *sleep_save) |
| 121 | { |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 122 | __raw_writel(sleep_save[SLEEP_SAVE_MDREFR], MDREFR); |
Eric Miao | 5a3d965 | 2008-09-03 18:06:34 +0800 | [diff] [blame] | 123 | RESTORE(PCFR); |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 124 | |
| 125 | PSSR = PSSR_RDH | PSSR_PH; |
| 126 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 127 | RESTORE(PSTR); |
| 128 | } |
| 129 | |
| 130 | void pxa27x_cpu_pm_enter(suspend_state_t state) |
Todd Poynor | 8775420 | 2005-06-03 20:52:27 +0100 | [diff] [blame] | 131 | { |
| 132 | extern void pxa_cpu_standby(void); |
Russell King | a9503d2 | 2011-06-21 16:29:30 +0100 | [diff] [blame] | 133 | #ifndef CONFIG_IWMMXT |
| 134 | u64 acc0; |
| 135 | |
Arnd Bergmann | 343c1cd | 2016-01-29 15:06:31 +0100 | [diff] [blame] | 136 | asm volatile(".arch_extension xscale\n\t" |
| 137 | "mra %Q0, %R0, acc0" : "=r" (acc0)); |
Russell King | a9503d2 | 2011-06-21 16:29:30 +0100 | [diff] [blame] | 138 | #endif |
Todd Poynor | 8775420 | 2005-06-03 20:52:27 +0100 | [diff] [blame] | 139 | |
Todd Poynor | 8775420 | 2005-06-03 20:52:27 +0100 | [diff] [blame] | 140 | /* ensure voltage-change sequencer not initiated, which hangs */ |
| 141 | PCFR &= ~PCFR_FVC; |
| 142 | |
| 143 | /* Clear edge-detect status register. */ |
| 144 | PEDR = 0xDF12FE1B; |
| 145 | |
Russell King | dc38e2a | 2008-05-08 16:50:39 +0100 | [diff] [blame] | 146 | /* Clear reset status */ |
| 147 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; |
| 148 | |
Todd Poynor | 8775420 | 2005-06-03 20:52:27 +0100 | [diff] [blame] | 149 | switch (state) { |
Todd Poynor | 26705ca | 2005-07-01 11:27:05 +0100 | [diff] [blame] | 150 | case PM_SUSPEND_STANDBY: |
| 151 | pxa_cpu_standby(); |
| 152 | break; |
Todd Poynor | 8775420 | 2005-06-03 20:52:27 +0100 | [diff] [blame] | 153 | case PM_SUSPEND_MEM: |
Russell King | 2c74a0c | 2011-06-22 17:41:48 +0100 | [diff] [blame] | 154 | cpu_suspend(pwrmode, pxa27x_finish_suspend); |
Russell King | a9503d2 | 2011-06-21 16:29:30 +0100 | [diff] [blame] | 155 | #ifndef CONFIG_IWMMXT |
Arnd Bergmann | 343c1cd | 2016-01-29 15:06:31 +0100 | [diff] [blame] | 156 | asm volatile(".arch_extension xscale\n\t" |
| 157 | "mar acc0, %Q0, %R0" : "=r" (acc0)); |
Russell King | a9503d2 | 2011-06-21 16:29:30 +0100 | [diff] [blame] | 158 | #endif |
Todd Poynor | 8775420 | 2005-06-03 20:52:27 +0100 | [diff] [blame] | 159 | break; |
| 160 | } |
| 161 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 163 | static int pxa27x_cpu_pm_valid(suspend_state_t state) |
Russell King | 88dfe98 | 2007-05-15 11:22:48 +0100 | [diff] [blame] | 164 | { |
| 165 | return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY; |
| 166 | } |
| 167 | |
Russell King | 4104980 | 2008-08-27 12:55:04 +0100 | [diff] [blame] | 168 | static int pxa27x_cpu_pm_prepare(void) |
| 169 | { |
| 170 | /* set resume return address */ |
Russell King | 4f5ad99 | 2011-02-06 17:41:26 +0000 | [diff] [blame] | 171 | PSPR = virt_to_phys(cpu_resume); |
Russell King | 4104980 | 2008-08-27 12:55:04 +0100 | [diff] [blame] | 172 | return 0; |
| 173 | } |
| 174 | |
| 175 | static void pxa27x_cpu_pm_finish(void) |
| 176 | { |
| 177 | /* ensure not to come back here if it wasn't intended */ |
| 178 | PSPR = 0; |
| 179 | } |
| 180 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 181 | static struct pxa_cpu_pm_fns pxa27x_cpu_pm_fns = { |
Robert Jarzmik | 649de51 | 2008-05-02 21:17:06 +0100 | [diff] [blame] | 182 | .save_count = SLEEP_SAVE_COUNT, |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 183 | .save = pxa27x_cpu_pm_save, |
| 184 | .restore = pxa27x_cpu_pm_restore, |
| 185 | .valid = pxa27x_cpu_pm_valid, |
| 186 | .enter = pxa27x_cpu_pm_enter, |
Russell King | 4104980 | 2008-08-27 12:55:04 +0100 | [diff] [blame] | 187 | .prepare = pxa27x_cpu_pm_prepare, |
| 188 | .finish = pxa27x_cpu_pm_finish, |
Russell King | e176bb0 | 2007-05-15 11:16:10 +0100 | [diff] [blame] | 189 | }; |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 190 | |
| 191 | static void __init pxa27x_init_pm(void) |
| 192 | { |
| 193 | pxa_cpu_pm_fns = &pxa27x_cpu_pm_fns; |
| 194 | } |
eric miao | f79299c | 2008-01-02 08:24:49 +0800 | [diff] [blame] | 195 | #else |
| 196 | static inline void pxa27x_init_pm(void) {} |
Nicolas Pitre | a8fa3f0 | 2005-06-13 22:35:41 +0100 | [diff] [blame] | 197 | #endif |
| 198 | |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 199 | /* PXA27x: Various gpios can issue wakeup events. This logic only |
| 200 | * handles the simple cases, not the WEMUX2 and WEMUX3 options |
| 201 | */ |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 202 | static int pxa27x_set_wake(struct irq_data *d, unsigned int on) |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 203 | { |
Haojian Zhuang | 4929f5a | 2011-10-10 16:03:51 +0800 | [diff] [blame] | 204 | int gpio = pxa_irq_to_gpio(d->irq); |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 205 | uint32_t mask; |
| 206 | |
eric miao | c0a596d | 2008-03-11 09:46:28 +0800 | [diff] [blame] | 207 | if (gpio >= 0 && gpio < 128) |
| 208 | return gpio_set_wake(gpio, on); |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 209 | |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 210 | if (d->irq == IRQ_KEYPAD) |
eric miao | c0a596d | 2008-03-11 09:46:28 +0800 | [diff] [blame] | 211 | return keypad_set_wake(on); |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 212 | |
Lennert Buytenhek | a3f4c92 | 2010-11-29 11:18:26 +0100 | [diff] [blame] | 213 | switch (d->irq) { |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 214 | case IRQ_RTCAlrm: |
| 215 | mask = PWER_RTC; |
| 216 | break; |
| 217 | case IRQ_USB: |
| 218 | mask = 1u << 26; |
| 219 | break; |
| 220 | default: |
| 221 | return -EINVAL; |
| 222 | } |
| 223 | |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 224 | if (on) |
| 225 | PWER |= mask; |
| 226 | else |
| 227 | PWER &=~mask; |
| 228 | |
| 229 | return 0; |
| 230 | } |
| 231 | |
| 232 | void __init pxa27x_init_irq(void) |
| 233 | { |
eric miao | b9e25ac | 2008-03-04 14:19:58 +0800 | [diff] [blame] | 234 | pxa_init_irq(34, pxa27x_set_wake); |
eric miao | c95530c | 2007-08-29 10:22:17 +0100 | [diff] [blame] | 235 | } |
| 236 | |
Robert Jarzmik | 32f1799 | 2016-08-15 00:24:55 +0200 | [diff] [blame] | 237 | static int __init |
| 238 | pxa27x_dt_init_irq(struct device_node *node, struct device_node *parent) |
Robert Jarzmik | ef6dbda | 2014-09-28 15:20:06 +0200 | [diff] [blame] | 239 | { |
Robert Jarzmik | 32f1799 | 2016-08-15 00:24:55 +0200 | [diff] [blame] | 240 | pxa_dt_irq_init(pxa27x_set_wake); |
| 241 | set_handle_irq(ichp_handle_irq); |
| 242 | |
| 243 | return 0; |
Robert Jarzmik | ef6dbda | 2014-09-28 15:20:06 +0200 | [diff] [blame] | 244 | } |
Robert Jarzmik | 32f1799 | 2016-08-15 00:24:55 +0200 | [diff] [blame] | 245 | IRQCHIP_DECLARE(pxa27x_intc, "marvell,pxa-intc", pxa27x_dt_init_irq); |
Robert Jarzmik | ef6dbda | 2014-09-28 15:20:06 +0200 | [diff] [blame] | 246 | |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 247 | static struct map_desc pxa27x_io_desc[] __initdata = { |
| 248 | { /* Mem Ctl */ |
Arnd Bergmann | 97b09da | 2011-10-01 22:03:45 +0200 | [diff] [blame] | 249 | .virtual = (unsigned long)SMEMC_VIRT, |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 250 | .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE), |
Laurent Pinchart | 0e32986 | 2014-07-11 13:00:36 +0200 | [diff] [blame] | 251 | .length = SMEMC_SIZE, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 252 | .type = MT_DEVICE |
Laurent Pinchart | b10f1c8 | 2014-07-11 13:00:37 +0200 | [diff] [blame] | 253 | }, { /* UNCACHED_PHYS_0 */ |
| 254 | .virtual = UNCACHED_PHYS_0, |
| 255 | .pfn = __phys_to_pfn(0x00000000), |
| 256 | .length = UNCACHED_PHYS_0_SIZE, |
| 257 | .type = MT_DEVICE |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 258 | }, |
| 259 | }; |
| 260 | |
| 261 | void __init pxa27x_map_io(void) |
| 262 | { |
| 263 | pxa_map_io(); |
| 264 | iotable_init(ARRAY_AND_SIZE(pxa27x_io_desc)); |
| 265 | pxa27x_get_clk_frequency_khz(1); |
| 266 | } |
| 267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | /* |
| 269 | * device registration specific to PXA27x. |
| 270 | */ |
Mike Rapoport | 9ba63c4 | 2008-08-17 06:23:05 +0100 | [diff] [blame] | 271 | void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info) |
Mike Rapoport | b7a3670 | 2008-01-27 18:14:50 +0100 | [diff] [blame] | 272 | { |
Philipp Zabel | bc3a595 | 2008-06-02 18:49:27 +0100 | [diff] [blame] | 273 | local_irq_disable(); |
| 274 | PCFR |= PCFR_PI2CEN; |
| 275 | local_irq_enable(); |
Eric Miao | 1475822 | 2008-11-28 15:24:12 +0800 | [diff] [blame] | 276 | pxa_register_device(&pxa27x_device_i2c_power, info); |
Mike Rapoport | b7a3670 | 2008-01-27 18:14:50 +0100 | [diff] [blame] | 277 | } |
| 278 | |
Robert Jarzmik | b95ace5 | 2012-04-22 13:37:24 +0200 | [diff] [blame] | 279 | static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 280 | .irq_base = PXA_GPIO_TO_IRQ(0), |
| 281 | .gpio_set_wake = gpio_set_wake, |
Robert Jarzmik | b95ace5 | 2012-04-22 13:37:24 +0200 | [diff] [blame] | 282 | }; |
| 283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | static struct platform_device *devices[] __initdata = { |
Philipp Zabel | 7a85762 | 2008-06-22 23:36:39 +0100 | [diff] [blame] | 285 | &pxa27x_device_udc, |
Eric Miao | 09a5358 | 2010-06-14 00:43:00 +0800 | [diff] [blame] | 286 | &pxa_device_pmu, |
Eric Miao | e09d02e | 2007-07-17 10:45:58 +0100 | [diff] [blame] | 287 | &pxa_device_i2s, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 288 | &pxa_device_asoc_ssp1, |
| 289 | &pxa_device_asoc_ssp2, |
| 290 | &pxa_device_asoc_ssp3, |
| 291 | &pxa_device_asoc_platform, |
Eric Miao | e09d02e | 2007-07-17 10:45:58 +0100 | [diff] [blame] | 292 | &pxa_device_rtc, |
eric miao | d8e0db1 | 2007-12-10 17:54:36 +0800 | [diff] [blame] | 293 | &pxa27x_device_ssp1, |
| 294 | &pxa27x_device_ssp2, |
| 295 | &pxa27x_device_ssp3, |
eric miao | 75540c1 | 2008-04-13 21:44:04 +0100 | [diff] [blame] | 296 | &pxa27x_device_pwm0, |
| 297 | &pxa27x_device_pwm1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | }; |
| 299 | |
| 300 | static int __init pxa27x_init(void) |
| 301 | { |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 302 | int ret = 0; |
eric miao | c0165504 | 2008-01-28 23:00:02 +0000 | [diff] [blame] | 303 | |
Russell King | e176bb0 | 2007-05-15 11:16:10 +0100 | [diff] [blame] | 304 | if (cpu_is_pxa27x()) { |
Eric Miao | 04fef22 | 2008-07-29 14:26:00 +0800 | [diff] [blame] | 305 | |
| 306 | reset_status = RCSR; |
| 307 | |
Eric Miao | 711be5c | 2007-07-18 11:38:45 +0100 | [diff] [blame] | 308 | pxa27x_init_pm(); |
eric miao | f79299c | 2008-01-02 08:24:49 +0800 | [diff] [blame] | 309 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 310 | register_syscore_ops(&pxa_irq_syscore_ops); |
| 311 | register_syscore_ops(&pxa2xx_mfp_syscore_ops); |
eric miao | c0165504 | 2008-01-28 23:00:02 +0000 | [diff] [blame] | 312 | |
Robert Jarzmik | 24e32a5 | 2015-02-07 22:18:34 +0100 | [diff] [blame] | 313 | if (!of_have_populated_dt()) { |
| 314 | pxa_register_device(&pxa27x_device_gpio, |
| 315 | &pxa27x_gpio_info); |
Robert Jarzmik | 72b195c | 2016-02-15 21:57:47 +0100 | [diff] [blame] | 316 | pxa2xx_set_dmac_info(32, 75); |
Robert Jarzmik | 24e32a5 | 2015-02-07 22:18:34 +0100 | [diff] [blame] | 317 | ret = platform_add_devices(devices, |
| 318 | ARRAY_SIZE(devices)); |
| 319 | } |
Russell King | e176bb0 | 2007-05-15 11:16:10 +0100 | [diff] [blame] | 320 | } |
eric miao | c0165504 | 2008-01-28 23:00:02 +0000 | [diff] [blame] | 321 | |
Russell King | e176bb0 | 2007-05-15 11:16:10 +0100 | [diff] [blame] | 322 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | } |
| 324 | |
Russell King | 1c104e0 | 2008-04-19 10:59:24 +0100 | [diff] [blame] | 325 | postcore_initcall(pxa27x_init); |