diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-06-27 14:46:14 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-07-23 01:18:30 -0400 |
commit | 9466a0510a5445d81eaf33affc20e2f7e2e718fb (patch) | |
tree | ecbecd217aedca3575d27444efeadf1fee1c8f38 /arch/blackfin/mach-bf538 | |
parent | eed7b8365807549c67613ea7d9a451262050ba3e (diff) |
Blackfin: bf538: pull gpio/port logic out of core hibernate paths
Re-architect how we save/restore the gpio/port logic that only pertains
to bf538/bf539 parts by pulling it out of the core code paths and pushing
it out to bf538-specific locations.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/mach-bf538')
-rw-r--r-- | arch/blackfin/mach-bf538/ext-gpio.c | 37 | ||||
-rw-r--r-- | arch/blackfin/mach-bf538/include/mach/gpio.h | 3 |
2 files changed, 39 insertions, 1 deletions
diff --git a/arch/blackfin/mach-bf538/ext-gpio.c b/arch/blackfin/mach-bf538/ext-gpio.c index 180b1252679f..471a9b184d5b 100644 --- a/arch/blackfin/mach-bf538/ext-gpio.c +++ b/arch/blackfin/mach-bf538/ext-gpio.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GPIOLIB interface for BF538/9 PORT C, D, and E GPIOs | 2 | * GPIOLIB interface for BF538/9 PORT C, D, and E GPIOs |
3 | * | 3 | * |
4 | * Copyright 2009 Analog Devices Inc. | 4 | * Copyright 2009-2011 Analog Devices Inc. |
5 | * | 5 | * |
6 | * Licensed under the GPL-2 or later. | 6 | * Licensed under the GPL-2 or later. |
7 | */ | 7 | */ |
@@ -121,3 +121,38 @@ static int __init bf538_extgpio_setup(void) | |||
121 | gpiochip_add(&bf538_porte_chip); | 121 | gpiochip_add(&bf538_porte_chip); |
122 | } | 122 | } |
123 | arch_initcall(bf538_extgpio_setup); | 123 | arch_initcall(bf538_extgpio_setup); |
124 | |||
125 | #ifdef CONFIG_PM | ||
126 | static struct { | ||
127 | u16 data, dir, inen; | ||
128 | } gpio_bank_saved[3]; | ||
129 | |||
130 | static void __iomem * const port_bases[3] = { | ||
131 | (void *)PORTCIO, | ||
132 | (void *)PORTDIO, | ||
133 | (void *)PORTEIO, | ||
134 | }; | ||
135 | |||
136 | void bfin_special_gpio_pm_hibernate_suspend(void) | ||
137 | { | ||
138 | int i; | ||
139 | |||
140 | for (i = 0; i < ARRAY_SIZE(port_bases); ++i) { | ||
141 | gpio_bank_saved[i].data = read_PORTIO(port_bases[i]); | ||
142 | gpio_bank_saved[i].inen = read_PORTIO_INEN(port_bases[i]); | ||
143 | gpio_bank_saved[i].dir = read_PORTIO_DIR(port_bases[i]); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | void bfin_special_gpio_pm_hibernate_restore(void) | ||
148 | { | ||
149 | int i; | ||
150 | |||
151 | for (i = 0; i < ARRAY_SIZE(port_bases); ++i) { | ||
152 | write_PORTIO_INEN(port_bases[i], gpio_bank_saved[i].inen); | ||
153 | write_PORTIO_SET(port_bases[i], | ||
154 | gpio_bank_saved[i].data & gpio_bank_saved[i].dir); | ||
155 | write_PORTIO_DIR(port_bases[i], gpio_bank_saved[i].dir); | ||
156 | } | ||
157 | } | ||
158 | #endif | ||
diff --git a/arch/blackfin/mach-bf538/include/mach/gpio.h b/arch/blackfin/mach-bf538/include/mach/gpio.h index 8a5beeece996..3561c7d8935b 100644 --- a/arch/blackfin/mach-bf538/include/mach/gpio.h +++ b/arch/blackfin/mach-bf538/include/mach/gpio.h | |||
@@ -8,7 +8,10 @@ | |||
8 | #define _MACH_GPIO_H_ | 8 | #define _MACH_GPIO_H_ |
9 | 9 | ||
10 | #define MAX_BLACKFIN_GPIOS 16 | 10 | #define MAX_BLACKFIN_GPIOS 16 |
11 | #ifdef CONFIG_GPIOLIB | ||
12 | /* We only use the special logic with GPIOLIB devices */ | ||
11 | #define BFIN_SPECIAL_GPIO_BANKS 3 | 13 | #define BFIN_SPECIAL_GPIO_BANKS 3 |
14 | #endif | ||
12 | 15 | ||
13 | #define GPIO_PF0 0 /* PF */ | 16 | #define GPIO_PF0 0 /* PF */ |
14 | #define GPIO_PF1 1 | 17 | #define GPIO_PF1 1 |