diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-05-10 17:25:46 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@marvell.com> | 2008-06-22 16:44:47 -0400 |
commit | 19cfd5c09f780ac870fd9d89201c4ebc0b22be81 (patch) | |
tree | 655e4eb79d22a8e9a62676f6fc13391bf8de931f /arch/arm/mach-orion5x/dns323-setup.c | |
parent | 386a048a1ea42ff9ac87ffa344c4c19a5cc59678 (diff) |
[ARM] Orion: rework MPP handling
Instead of having board code poke directly into the MPP configuration
registers, and separately calling orion5x_gpio_set_valid_pins() to
indicate which MPP pins can be used as GPIO pins, introduce a helper
function for configuring the roles of each of the MPP pins, and have
that helper function handle gpio validity internally.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Sylver Bruneau <sylver.bruneau@googlemail.com>
Acked-by: Russell King <linux@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-orion5x/dns323-setup.c')
-rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index 9ec53501b2a8..05ce66048741 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/mach/pci.h> | 27 | #include <asm/mach/pci.h> |
28 | #include <asm/arch/orion5x.h> | 28 | #include <asm/arch/orion5x.h> |
29 | #include "common.h" | 29 | #include "common.h" |
30 | #include "mpp.h" | ||
30 | 31 | ||
31 | #define DNS323_GPIO_LED_RIGHT_AMBER 1 | 32 | #define DNS323_GPIO_LED_RIGHT_AMBER 1 |
32 | #define DNS323_GPIO_LED_LEFT_AMBER 2 | 33 | #define DNS323_GPIO_LED_LEFT_AMBER 2 |
@@ -212,6 +213,29 @@ static struct platform_device dns323_button_device = { | |||
212 | /**************************************************************************** | 213 | /**************************************************************************** |
213 | * General Setup | 214 | * General Setup |
214 | */ | 215 | */ |
216 | static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = { | ||
217 | { 0, MPP_PCIE_RST_OUTn }, | ||
218 | { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ | ||
219 | { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ | ||
220 | { 3, MPP_UNUSED }, | ||
221 | { 4, MPP_GPIO }, /* power button LED */ | ||
222 | { 5, MPP_GPIO }, /* power button LED */ | ||
223 | { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ | ||
224 | { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */ | ||
225 | { 8, MPP_GPIO }, /* triggers power off */ | ||
226 | { 9, MPP_GPIO }, /* power button switch */ | ||
227 | { 10, MPP_GPIO }, /* reset button switch */ | ||
228 | { 11, MPP_UNUSED }, | ||
229 | { 12, MPP_UNUSED }, | ||
230 | { 13, MPP_UNUSED }, | ||
231 | { 14, MPP_UNUSED }, | ||
232 | { 15, MPP_UNUSED }, | ||
233 | { 16, MPP_UNUSED }, | ||
234 | { 17, MPP_UNUSED }, | ||
235 | { 18, MPP_UNUSED }, | ||
236 | { 19, MPP_UNUSED }, | ||
237 | { -1 }, | ||
238 | }; | ||
215 | 239 | ||
216 | /* | 240 | /* |
217 | * On the DNS-323 the following devices are attached via I2C: | 241 | * On the DNS-323 the following devices are attached via I2C: |
@@ -247,34 +271,8 @@ static void __init dns323_init(void) | |||
247 | /* Setup basic Orion functions. Need to be called early. */ | 271 | /* Setup basic Orion functions. Need to be called early. */ |
248 | orion5x_init(); | 272 | orion5x_init(); |
249 | 273 | ||
250 | /* set MPP to 0 as D-Link's 2.6.12.6 kernel did */ | 274 | orion5x_mpp_conf(dns323_mpp_modes); |
251 | orion5x_write(MPP_0_7_CTRL, 0); | 275 | orion5x_write(MPP_DEV_CTRL, 0); /* DEV_D[31:16] */ |
252 | orion5x_write(MPP_8_15_CTRL, 0); | ||
253 | orion5x_write(MPP_16_19_CTRL, 0); | ||
254 | orion5x_write(MPP_DEV_CTRL, 0); | ||
255 | |||
256 | /* Define used GPIO pins | ||
257 | |||
258 | GPIO Map: | ||
259 | |||
260 | | 0 | | PEX_RST_OUT (not controlled by GPIO) | ||
261 | | 1 | Out | right amber LED (= sata ch0 LED) (low-active) | ||
262 | | 2 | Out | left amber LED (= sata ch1 LED) (low-active) | ||
263 | | 3 | Out | //unknown// | ||
264 | | 4 | Out | power button LED (low-active, together with pin #5) | ||
265 | | 5 | Out | power button LED (low-active, together with pin #4) | ||
266 | | 6 | In | GMT G751-2f overtemp. shutdown signal (low-active) | ||
267 | | 7 | In | M41T80 nIRQ/OUT/SQW signal | ||
268 | | 8 | Out | triggers power off (high-active) | ||
269 | | 9 | In | power button switch (low-active) | ||
270 | | 10 | In | reset button switch (low-active) | ||
271 | | 11 | Out | //unknown// | ||
272 | | 12 | Out | //unknown// | ||
273 | | 13 | Out | //unknown// | ||
274 | | 14 | Out | //unknown// | ||
275 | | 15 | Out | //unknown// | ||
276 | */ | ||
277 | orion5x_gpio_set_valid_pins(0x07f6); | ||
278 | 276 | ||
279 | /* | 277 | /* |
280 | * Configure peripherals. | 278 | * Configure peripherals. |