Commit | Line | Data |
---|---|---|
2c8086a5 | 1 | /* |
2 | * linux/arch/arm/mach-pxa/mfp.c | |
3 | * | |
4 | * PXA3xx Multi-Function Pin Support | |
5 | * | |
6 | * Copyright (C) 2007 Marvell Internation Ltd. | |
7 | * | |
e9bba8ee | 8 | * 2007-08-21: eric miao <eric.miao@marvell.com> |
2c8086a5 | 9 | * initial version |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License version 2 as | |
13 | * published by the Free Software Foundation. | |
14 | */ | |
15 | ||
16 | #include <linux/module.h> | |
17 | #include <linux/kernel.h> | |
18 | #include <linux/init.h> | |
19 | #include <linux/io.h> | |
d4fc858f | 20 | #include <linux/sysdev.h> |
2c8086a5 | 21 | |
a09e64fb | 22 | #include <mach/hardware.h> |
a09e64fb RK |
23 | #include <mach/mfp-pxa3xx.h> |
24 | #include <mach/pxa3xx-regs.h> | |
2c8086a5 | 25 | |
d4fc858f RK |
26 | #ifdef CONFIG_PM |
27 | /* | |
28 | * Configure the MFPs appropriately for suspend/resume. | |
29 | * FIXME: this should probably depend on which system state we're | |
30 | * entering - for instance, we might not want to place MFP pins in | |
31 | * a pull-down mode if they're an active low chip select, and we're | |
32 | * just entering standby. | |
33 | */ | |
34 | static int pxa3xx_mfp_suspend(struct sys_device *d, pm_message_t state) | |
35 | { | |
f8dec04d | 36 | mfp_config_lpm(); |
d4fc858f RK |
37 | return 0; |
38 | } | |
39 | ||
40 | static int pxa3xx_mfp_resume(struct sys_device *d) | |
41 | { | |
f8dec04d | 42 | mfp_config_run(); |
c4d1fb62 | 43 | |
44 | /* clear RDH bit when MFP settings are restored | |
45 | * | |
46 | * NOTE: the last 3 bits DxS are write-1-to-clear so carefully | |
47 | * preserve them here in case they will be referenced later | |
48 | */ | |
49 | ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); | |
d4fc858f RK |
50 | return 0; |
51 | } | |
4be35e23 | 52 | #else |
53 | #define pxa3xx_mfp_suspend NULL | |
54 | #define pxa3xx_mfp_resume NULL | |
55 | #endif | |
d4fc858f | 56 | |
4be35e23 | 57 | struct sysdev_class pxa3xx_mfp_sysclass = { |
14271a70 | 58 | .name = "mfp", |
d4fc858f RK |
59 | .suspend = pxa3xx_mfp_suspend, |
60 | .resume = pxa3xx_mfp_resume, | |
61 | }; | |
62 | ||
d4fc858f RK |
63 | static int __init mfp_init_devicefs(void) |
64 | { | |
4be35e23 | 65 | if (cpu_is_pxa3xx()) |
66 | return sysdev_class_register(&pxa3xx_mfp_sysclass); | |
67 | ||
68 | return 0; | |
d4fc858f | 69 | } |
4be35e23 | 70 | postcore_initcall(mfp_init_devicefs); |