diff options
Diffstat (limited to 'arch/arm/plat-nomadik')
-rw-r--r-- | arch/arm/plat-nomadik/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/gpio.c | 76 |
2 files changed, 3 insertions, 79 deletions
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig index ad25c963d437..187f4e84bb22 100644 --- a/arch/arm/plat-nomadik/Kconfig +++ b/arch/arm/plat-nomadik/Kconfig | |||
@@ -25,10 +25,4 @@ config NOMADIK_GPIO | |||
25 | help | 25 | help |
26 | Support for the Nomadik GPIO controller. | 26 | Support for the Nomadik GPIO controller. |
27 | 27 | ||
28 | config NOMADIK_GPIO_PM | ||
29 | bool | ||
30 | depends on NOMADIK_GPIO && PM | ||
31 | help | ||
32 | Support PM for the Nomadik GPIO controller. | ||
33 | |||
34 | endif | 28 | endif |
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c index acc9de213246..5e6653f63286 100644 --- a/arch/arm/plat-nomadik/gpio.c +++ b/arch/arm/plat-nomadik/gpio.c | |||
@@ -35,18 +35,6 @@ | |||
35 | * Symbols in this file are called "nmk_gpio" for "nomadik gpio" | 35 | * Symbols in this file are called "nmk_gpio" for "nomadik gpio" |
36 | */ | 36 | */ |
37 | 37 | ||
38 | static const u32 backup_regs[] = { | ||
39 | NMK_GPIO_PDIS, | ||
40 | NMK_GPIO_DIR, | ||
41 | NMK_GPIO_AFSLA, | ||
42 | NMK_GPIO_AFSLB, | ||
43 | NMK_GPIO_SLPC, | ||
44 | NMK_GPIO_RIMSC, | ||
45 | NMK_GPIO_FIMSC, | ||
46 | NMK_GPIO_RWIMSC, | ||
47 | NMK_GPIO_FWIMSC, | ||
48 | }; | ||
49 | |||
50 | #define NMK_GPIO_PER_CHIP 32 | 38 | #define NMK_GPIO_PER_CHIP 32 |
51 | 39 | ||
52 | struct nmk_gpio_chip { | 40 | struct nmk_gpio_chip { |
@@ -62,9 +50,6 @@ struct nmk_gpio_chip { | |||
62 | /* Keep track of configured edges */ | 50 | /* Keep track of configured edges */ |
63 | u32 edge_rising; | 51 | u32 edge_rising; |
64 | u32 edge_falling; | 52 | u32 edge_falling; |
65 | u32 backup[ARRAY_SIZE(backup_regs)]; | ||
66 | /* Bitmap, 1 = pull up, 0 = pull down */ | ||
67 | u32 pull; | ||
68 | }; | 53 | }; |
69 | 54 | ||
70 | static struct nmk_gpio_chip * | 55 | static struct nmk_gpio_chip * |
@@ -117,13 +102,10 @@ static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip, | |||
117 | pdis &= ~bit; | 102 | pdis &= ~bit; |
118 | writel(pdis, nmk_chip->addr + NMK_GPIO_PDIS); | 103 | writel(pdis, nmk_chip->addr + NMK_GPIO_PDIS); |
119 | 104 | ||
120 | if (pull == NMK_GPIO_PULL_UP) { | 105 | if (pull == NMK_GPIO_PULL_UP) |
121 | nmk_chip->pull |= bit; | ||
122 | writel(bit, nmk_chip->addr + NMK_GPIO_DATS); | 106 | writel(bit, nmk_chip->addr + NMK_GPIO_DATS); |
123 | } else if (pull == NMK_GPIO_PULL_DOWN) { | 107 | else if (pull == NMK_GPIO_PULL_DOWN) |
124 | nmk_chip->pull &= ~bit; | ||
125 | writel(bit, nmk_chip->addr + NMK_GPIO_DATC); | 108 | writel(bit, nmk_chip->addr + NMK_GPIO_DATC); |
126 | } | ||
127 | } | 109 | } |
128 | 110 | ||
129 | static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, | 111 | static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, |
@@ -991,64 +973,12 @@ out: | |||
991 | return ret; | 973 | return ret; |
992 | } | 974 | } |
993 | 975 | ||
994 | #ifdef CONFIG_NOMADIK_GPIO_PM | ||
995 | static int nmk_gpio_pm(struct platform_device *dev, bool suspend) | ||
996 | { | ||
997 | struct nmk_gpio_chip *nmk_chip = platform_get_drvdata(dev); | ||
998 | int i; | ||
999 | u32 dir; | ||
1000 | u32 dat; | ||
1001 | |||
1002 | for (i = 0; i < ARRAY_SIZE(backup_regs); i++) { | ||
1003 | if (suspend) | ||
1004 | nmk_chip->backup[i] = readl(nmk_chip->addr + | ||
1005 | backup_regs[i]); | ||
1006 | else | ||
1007 | writel(nmk_chip->backup[i], | ||
1008 | nmk_chip->addr + backup_regs[i]); | ||
1009 | } | ||
1010 | |||
1011 | if (!suspend) { | ||
1012 | /* | ||
1013 | * Restore pull-up and pull-down on inputs and | ||
1014 | * outputs. | ||
1015 | */ | ||
1016 | dir = readl(nmk_chip->addr + NMK_GPIO_DIR); | ||
1017 | dat = readl(nmk_chip->addr + NMK_GPIO_DAT); | ||
1018 | |||
1019 | writel((nmk_chip->pull & ~dir) | | ||
1020 | (dat & dir), | ||
1021 | nmk_chip->addr + NMK_GPIO_DATS); | ||
1022 | |||
1023 | writel((~nmk_chip->pull & ~dir) | | ||
1024 | (~dat & dir), | ||
1025 | nmk_chip->addr + NMK_GPIO_DATC); | ||
1026 | } | ||
1027 | return 0; | ||
1028 | } | ||
1029 | |||
1030 | static int nmk_gpio_suspend(struct platform_device *dev, pm_message_t state) | ||
1031 | { | ||
1032 | return nmk_gpio_pm(dev, true); | ||
1033 | } | ||
1034 | |||
1035 | static int nmk_gpio_resume(struct platform_device *dev) | ||
1036 | { | ||
1037 | return nmk_gpio_pm(dev, false); | ||
1038 | } | ||
1039 | #else | ||
1040 | #define nmk_gpio_suspend NULL | ||
1041 | #define nmk_gpio_resume NULL | ||
1042 | #endif | ||
1043 | |||
1044 | static struct platform_driver nmk_gpio_driver = { | 976 | static struct platform_driver nmk_gpio_driver = { |
1045 | .driver = { | 977 | .driver = { |
1046 | .owner = THIS_MODULE, | 978 | .owner = THIS_MODULE, |
1047 | .name = "gpio", | 979 | .name = "gpio", |
1048 | }, | 980 | }, |
1049 | .probe = nmk_gpio_probe, | 981 | .probe = nmk_gpio_probe, |
1050 | .suspend = nmk_gpio_suspend, | ||
1051 | .resume = nmk_gpio_resume, | ||
1052 | }; | 982 | }; |
1053 | 983 | ||
1054 | static int __init nmk_gpio_init(void) | 984 | static int __init nmk_gpio_init(void) |