aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-24 17:10:02 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-09 10:34:15 -0500
commitae14c2e28cd6d78a975dda853d2fdb00a3219c16 (patch)
tree6dfb05cb3c7433e3bacfb75a47e0ddcb4b65322f /arch/arm/mach-sa1100
parent398e58d09d9ca024ecbf9b67dac57a995865bfcd (diff)
ARM: sa11x0: neponset: save and restore MDM_CTL_0
Save and restore the modem output control register across a suspend/ resume, as well as the NCR register. Place these in a locally allocated data structure rather than needing a new static variable. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/neponset.c53
1 files changed, 42 insertions, 11 deletions
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 1beaa0e5bf3f..6f0aa91d5d34 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -1,12 +1,13 @@
1/* 1/*
2 * linux/arch/arm/mach-sa1100/neponset.c 2 * linux/arch/arm/mach-sa1100/neponset.c
3 *
4 */ 3 */
5#include <linux/init.h> 4#include <linux/init.h>
6#include <linux/ioport.h> 5#include <linux/ioport.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/serial_core.h> 9#include <linux/serial_core.h>
10#include <linux/slab.h>
10 11
11#include <asm/mach-types.h> 12#include <asm/mach-types.h>
12#include <asm/irq.h> 13#include <asm/irq.h>
@@ -20,6 +21,13 @@
20#include <mach/assabet.h> 21#include <mach/assabet.h>
21#include <mach/neponset.h> 22#include <mach/neponset.h>
22 23
24struct neponset_drvdata {
25#ifdef CONFIG_PM_SLEEP
26 u32 ncr0;
27 u32 mdm_ctl_0;
28#endif
29};
30
23void neponset_ncr_frob(unsigned int mask, unsigned int val) 31void neponset_ncr_frob(unsigned int mask, unsigned int val)
24{ 32{
25 unsigned long flags; 33 unsigned long flags;
@@ -200,6 +208,15 @@ static struct platform_device smc91x_device = {
200 208
201static int __devinit neponset_probe(struct platform_device *dev) 209static int __devinit neponset_probe(struct platform_device *dev)
202{ 210{
211 struct neponset_drvdata *d;
212 int ret;
213
214 d = kzalloc(sizeof(*d), GFP_KERNEL);
215 if (!d) {
216 ret = -ENOMEM;
217 goto err_alloc;
218 }
219
203 sa1100_register_uart_fns(&neponset_port_fns); 220 sa1100_register_uart_fns(&neponset_port_fns);
204 221
205 /* 222 /*
@@ -234,29 +251,42 @@ static int __devinit neponset_probe(struct platform_device *dev)
234 */ 251 */
235 NCR_0 = NCR_GP01_OFF; 252 NCR_0 = NCR_GP01_OFF;
236 253
254 platform_set_drvdata(dev, d);
255
237 return 0; 256 return 0;
257
258 err_alloc:
259 return ret;
238} 260}
239 261
240#ifdef CONFIG_PM 262static int __devexit neponset_remove(struct platform_device *dev)
263{
264 struct neponset_drvdata *d = platform_get_drvdata(dev);
241 265
242/* 266 irq_set_chained_handler(IRQ_GPIO25, NULL);
243 * LDM power management. 267
244 */ 268 kfree(d);
245static unsigned int neponset_saved_state; 269
270 return 0;
271}
246 272
273#ifdef CONFIG_PM
247static int neponset_suspend(struct platform_device *dev, pm_message_t state) 274static int neponset_suspend(struct platform_device *dev, pm_message_t state)
248{ 275{
249 /* 276 struct neponset_drvdata *d = platform_get_drvdata(dev);
250 * Save state. 277
251 */ 278 d->ncr0 = NCR_0;
252 neponset_saved_state = NCR_0; 279 d->mdm_ctl_0 = MDM_CTL_0;
253 280
254 return 0; 281 return 0;
255} 282}
256 283
257static int neponset_resume(struct platform_device *dev) 284static int neponset_resume(struct platform_device *dev)
258{ 285{
259 NCR_0 = neponset_saved_state; 286 struct neponset_drvdata *d = platform_get_drvdata(dev);
287
288 NCR_0 = d->ncr0;
289 MDM_CTL_0 = d->mdm_ctl_0;
260 290
261 return 0; 291 return 0;
262} 292}
@@ -268,6 +298,7 @@ static int neponset_resume(struct platform_device *dev)
268 298
269static struct platform_driver neponset_device_driver = { 299static struct platform_driver neponset_device_driver = {
270 .probe = neponset_probe, 300 .probe = neponset_probe,
301 .remove = __devexit_p(neponset_remove),
271 .suspend = neponset_suspend, 302 .suspend = neponset_suspend,
272 .resume = neponset_resume, 303 .resume = neponset_resume,
273 .driver = { 304 .driver = {