aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-30 10:50:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-30 10:50:45 -0400
commit85eb1513c15652cdaa9fd656345825bf55514a96 (patch)
treeb445b8d6d9184a897a2656a9f16a6ec592137644 /drivers/pcmcia
parente122996ae1edf2caf19643cb79366fc2117a6188 (diff)
parentb43d151e9679a06df896ac3db65a9dca80040fed (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (65 commits) ARM: 6826/1: Merge v6 and v7 DEBUG_LL DCC support ARM: 6838/1: etm: fix section mismatch warning ARM: 6837/1: remove unused pci_fixup_prpmc1100 ARM: 6836/1: kprobes/fix emulation of LDR/STR instruction when Rn == PC Fix the broken build for Marvell Dove platform. ARM: 6835/1: perf: ensure overflows aren't missed due to IRQ latency ARM: 6834/1: perf: reset counters on all CPUs during initialisation ARM: 6833/1: perf: add required isbs() to ARMv7 backend ARM: 6825/1: kernel/sleep.S: fix Thumb2 compilation issues ARM: 6807/1: realview: Fix secondary GIC initialisation for EB with MPCore tile arm: mach-mx3: pcm043: add write-protect and card-detect for SD1 eukrea_mbimxsd51: add SD Card detect eukrea_mbimxsd25-baseboard: add SD card detect mx3/eukrea_mbimxsd-baseboard: add SD card detect support mx3/eukrea_mbimxsd-baseboard: fix gpio request ARM: mxs/mx28evk: add mmc device ARM: mxs/mx23evk: add mmc device ARM: mxs: dynamically allocate mmc device ARM: mx51_efika: update platform data for new mfd changes mx2/iomux: Set direction for CSPI2 pins ...
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/pxa2xx_colibri.c133
-rw-r--r--drivers/pcmcia/pxa2xx_palmld.c42
-rw-r--r--drivers/pcmcia/pxa2xx_palmtc.c75
-rw-r--r--drivers/pcmcia/pxa2xx_palmtx.c57
-rw-r--r--drivers/pcmcia/pxa2xx_vpac270.c110
5 files changed, 114 insertions, 303 deletions
diff --git a/drivers/pcmcia/pxa2xx_colibri.c b/drivers/pcmcia/pxa2xx_colibri.c
index a52039564e74..443cb7fc872d 100644
--- a/drivers/pcmcia/pxa2xx_colibri.c
+++ b/drivers/pcmcia/pxa2xx_colibri.c
@@ -34,14 +34,24 @@
34#define COLIBRI320_DETECT_GPIO 81 34#define COLIBRI320_DETECT_GPIO 81
35#define COLIBRI320_READY_GPIO 29 35#define COLIBRI320_READY_GPIO 29
36 36
37static struct { 37enum {
38 int reset_gpio; 38 DETECT = 0,
39 int ppen_gpio; 39 READY = 1,
40 int bvd1_gpio; 40 BVD1 = 2,
41 int bvd2_gpio; 41 BVD2 = 3,
42 int detect_gpio; 42 PPEN = 4,
43 int ready_gpio; 43 RESET = 5,
44} colibri_pcmcia_gpio; 44};
45
46/* Contents of this array are configured on-the-fly in init function */
47static struct gpio colibri_pcmcia_gpios[] = {
48 { 0, GPIOF_IN, "PCMCIA Detect" },
49 { 0, GPIOF_IN, "PCMCIA Ready" },
50 { 0, GPIOF_IN, "PCMCIA BVD1" },
51 { 0, GPIOF_IN, "PCMCIA BVD2" },
52 { 0, GPIOF_INIT_LOW, "PCMCIA PPEN" },
53 { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" },
54};
45 55
46static struct pcmcia_irqs colibri_irqs[] = { 56static struct pcmcia_irqs colibri_irqs[] = {
47 { 57 {
@@ -54,88 +64,42 @@ static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
54{ 64{
55 int ret; 65 int ret;
56 66
57 ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT"); 67 ret = gpio_request_array(colibri_pcmcia_gpios,
68 ARRAY_SIZE(colibri_pcmcia_gpios));
58 if (ret) 69 if (ret)
59 goto err1; 70 goto err1;
60 ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);
61 if (ret)
62 goto err2;
63
64 ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");
65 if (ret)
66 goto err2;
67 ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);
68 if (ret)
69 goto err3;
70 71
71 ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1"); 72 colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio);
72 if (ret) 73 skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio);
73 goto err3;
74 ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);
75 if (ret)
76 goto err4;
77 74
78 ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2"); 75 ret = soc_pcmcia_request_irqs(skt, colibri_irqs,
79 if (ret) 76 ARRAY_SIZE(colibri_irqs));
80 goto err4;
81 ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);
82 if (ret)
83 goto err5;
84
85 ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");
86 if (ret)
87 goto err5;
88 ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);
89 if (ret)
90 goto err6;
91
92 ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");
93 if (ret)
94 goto err6;
95 ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);
96 if (ret) 77 if (ret)
97 goto err7; 78 goto err2;
98
99 colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio);
100 skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio);
101 79
102 return soc_pcmcia_request_irqs(skt, colibri_irqs, 80 return ret;
103 ARRAY_SIZE(colibri_irqs));
104 81
105err7:
106 gpio_free(colibri_pcmcia_gpio.detect_gpio);
107err6:
108 gpio_free(colibri_pcmcia_gpio.ready_gpio);
109err5:
110 gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
111err4:
112 gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
113err3:
114 gpio_free(colibri_pcmcia_gpio.reset_gpio);
115err2: 82err2:
116 gpio_free(colibri_pcmcia_gpio.ppen_gpio); 83 gpio_free_array(colibri_pcmcia_gpios,
84 ARRAY_SIZE(colibri_pcmcia_gpios));
117err1: 85err1:
118 return ret; 86 return ret;
119} 87}
120 88
121static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 89static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
122{ 90{
123 gpio_free(colibri_pcmcia_gpio.detect_gpio); 91 gpio_free_array(colibri_pcmcia_gpios,
124 gpio_free(colibri_pcmcia_gpio.ready_gpio); 92 ARRAY_SIZE(colibri_pcmcia_gpios));
125 gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
126 gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
127 gpio_free(colibri_pcmcia_gpio.reset_gpio);
128 gpio_free(colibri_pcmcia_gpio.ppen_gpio);
129} 93}
130 94
131static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 95static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
132 struct pcmcia_state *state) 96 struct pcmcia_state *state)
133{ 97{
134 98
135 state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio); 99 state->detect = !!gpio_get_value(colibri_pcmcia_gpios[DETECT].gpio);
136 state->ready = !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio); 100 state->ready = !!gpio_get_value(colibri_pcmcia_gpios[READY].gpio);
137 state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio); 101 state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpios[BVD1].gpio);
138 state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio); 102 state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpios[BVD2].gpio);
139 state->wrprot = 0; 103 state->wrprot = 0;
140 state->vs_3v = 1; 104 state->vs_3v = 1;
141 state->vs_Xv = 0; 105 state->vs_Xv = 0;
@@ -145,9 +109,10 @@ static int
145colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, 109colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
146 const socket_state_t *state) 110 const socket_state_t *state)
147{ 111{
148 gpio_set_value(colibri_pcmcia_gpio.ppen_gpio, 112 gpio_set_value(colibri_pcmcia_gpios[PPEN].gpio,
149 !(state->Vcc == 33 && state->Vpp < 50)); 113 !(state->Vcc == 33 && state->Vpp < 50));
150 gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET); 114 gpio_set_value(colibri_pcmcia_gpios[RESET].gpio,
115 state->flags & SS_RESET);
151 return 0; 116 return 0;
152} 117}
153 118
@@ -190,20 +155,20 @@ static int __init colibri_pcmcia_init(void)
190 155
191 /* Colibri PXA270 */ 156 /* Colibri PXA270 */
192 if (machine_is_colibri()) { 157 if (machine_is_colibri()) {
193 colibri_pcmcia_gpio.reset_gpio = COLIBRI270_RESET_GPIO; 158 colibri_pcmcia_gpios[RESET].gpio = COLIBRI270_RESET_GPIO;
194 colibri_pcmcia_gpio.ppen_gpio = COLIBRI270_PPEN_GPIO; 159 colibri_pcmcia_gpios[PPEN].gpio = COLIBRI270_PPEN_GPIO;
195 colibri_pcmcia_gpio.bvd1_gpio = COLIBRI270_BVD1_GPIO; 160 colibri_pcmcia_gpios[BVD1].gpio = COLIBRI270_BVD1_GPIO;
196 colibri_pcmcia_gpio.bvd2_gpio = COLIBRI270_BVD2_GPIO; 161 colibri_pcmcia_gpios[BVD2].gpio = COLIBRI270_BVD2_GPIO;
197 colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO; 162 colibri_pcmcia_gpios[DETECT].gpio = COLIBRI270_DETECT_GPIO;
198 colibri_pcmcia_gpio.ready_gpio = COLIBRI270_READY_GPIO; 163 colibri_pcmcia_gpios[READY].gpio = COLIBRI270_READY_GPIO;
199 /* Colibri PXA320 */ 164 /* Colibri PXA320 */
200 } else if (machine_is_colibri320()) { 165 } else if (machine_is_colibri320()) {
201 colibri_pcmcia_gpio.reset_gpio = COLIBRI320_RESET_GPIO; 166 colibri_pcmcia_gpios[RESET].gpio = COLIBRI320_RESET_GPIO;
202 colibri_pcmcia_gpio.ppen_gpio = COLIBRI320_PPEN_GPIO; 167 colibri_pcmcia_gpios[PPEN].gpio = COLIBRI320_PPEN_GPIO;
203 colibri_pcmcia_gpio.bvd1_gpio = COLIBRI320_BVD1_GPIO; 168 colibri_pcmcia_gpios[BVD1].gpio = COLIBRI320_BVD1_GPIO;
204 colibri_pcmcia_gpio.bvd2_gpio = COLIBRI320_BVD2_GPIO; 169 colibri_pcmcia_gpios[BVD2].gpio = COLIBRI320_BVD2_GPIO;
205 colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO; 170 colibri_pcmcia_gpios[DETECT].gpio = COLIBRI320_DETECT_GPIO;
206 colibri_pcmcia_gpio.ready_gpio = COLIBRI320_READY_GPIO; 171 colibri_pcmcia_gpios[READY].gpio = COLIBRI320_READY_GPIO;
207 } 172 }
208 173
209 ret = platform_device_add_data(colibri_pcmcia_device, 174 ret = platform_device_add_data(colibri_pcmcia_device,
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c
index 6fb6f7f0672e..69f73670949a 100644
--- a/drivers/pcmcia/pxa2xx_palmld.c
+++ b/drivers/pcmcia/pxa2xx_palmld.c
@@ -4,7 +4,7 @@
4 * Driver for Palm LifeDrive PCMCIA 4 * Driver for Palm LifeDrive PCMCIA
5 * 5 *
6 * Copyright (C) 2006 Alex Osborne <ato@meshy.org> 6 * Copyright (C) 2006 Alex Osborne <ato@meshy.org>
7 * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> 7 * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -20,49 +20,27 @@
20#include <mach/palmld.h> 20#include <mach/palmld.h>
21#include "soc_common.h" 21#include "soc_common.h"
22 22
23static struct gpio palmld_pcmcia_gpios[] = {
24 { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" },
25 { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
26 { GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
27};
28
23static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 29static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
24{ 30{
25 int ret; 31 int ret;
26 32
27 ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR"); 33 ret = gpio_request_array(palmld_pcmcia_gpios,
28 if (ret) 34 ARRAY_SIZE(palmld_pcmcia_gpios));
29 goto err1;
30 ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0);
31 if (ret)
32 goto err2;
33
34 ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST");
35 if (ret)
36 goto err2;
37 ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1);
38 if (ret)
39 goto err3;
40
41 ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY");
42 if (ret)
43 goto err3;
44 ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY);
45 if (ret)
46 goto err4;
47 35
48 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); 36 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY);
49 return 0;
50 37
51err4:
52 gpio_free(GPIO_NR_PALMLD_PCMCIA_READY);
53err3:
54 gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET);
55err2:
56 gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER);
57err1:
58 return ret; 38 return ret;
59} 39}
60 40
61static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 41static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
62{ 42{
63 gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); 43 gpio_free_array(palmld_pcmcia_gpios, ARRAY_SIZE(palmld_pcmcia_gpios));
64 gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET);
65 gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER);
66} 44}
67 45
68static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 46static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c
index 459a232d66be..d0ad6a76bbde 100644
--- a/drivers/pcmcia/pxa2xx_palmtc.c
+++ b/drivers/pcmcia/pxa2xx_palmtc.c
@@ -4,7 +4,7 @@
4 * Driver for Palm Tungsten|C PCMCIA 4 * Driver for Palm Tungsten|C PCMCIA
5 * 5 *
6 * Copyright (C) 2008 Alex Osborne <ato@meshy.org> 6 * Copyright (C) 2008 Alex Osborne <ato@meshy.org>
7 * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com> 7 * Copyright (C) 2009-2011 Marek Vasut <marek.vasut@gmail.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -21,79 +21,30 @@
21#include <mach/palmtc.h> 21#include <mach/palmtc.h>
22#include "soc_common.h" 22#include "soc_common.h"
23 23
24static struct gpio palmtc_pcmcia_gpios[] = {
25 { GPIO_NR_PALMTC_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },
26 { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },
27 { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" },
28 { GPIO_NR_PALMTC_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
29 { GPIO_NR_PALMTC_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
30 { GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN, "PCMCIA Power Ready" },
31};
32
24static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 33static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
25{ 34{
26 int ret; 35 int ret;
27 36
28 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1"); 37 ret = gpio_request_array(palmtc_pcmcia_gpios,
29 if (ret) 38 ARRAY_SIZE(palmtc_pcmcia_gpios));
30 goto err1;
31 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0);
32 if (ret)
33 goto err2;
34
35 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2");
36 if (ret)
37 goto err2;
38 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0);
39 if (ret)
40 goto err3;
41
42 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3");
43 if (ret)
44 goto err3;
45 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0);
46 if (ret)
47 goto err4;
48
49 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST");
50 if (ret)
51 goto err4;
52 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1);
53 if (ret)
54 goto err5;
55
56 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY");
57 if (ret)
58 goto err5;
59 ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY);
60 if (ret)
61 goto err6;
62
63 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY");
64 if (ret)
65 goto err6;
66 ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
67 if (ret)
68 goto err7;
69 39
70 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY); 40 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY);
71 return 0;
72 41
73err7:
74 gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
75err6:
76 gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);
77err5:
78 gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);
79err4:
80 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);
81err3:
82 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);
83err2:
84 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);
85err1:
86 return ret; 42 return ret;
87} 43}
88 44
89static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 45static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
90{ 46{
91 gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); 47 gpio_free_array(palmtc_pcmcia_gpios, ARRAY_SIZE(palmtc_pcmcia_gpios));
92 gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);
93 gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);
94 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);
95 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);
96 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);
97} 48}
98 49
99static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 50static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c
index b07b247a399f..1a2580450402 100644
--- a/drivers/pcmcia/pxa2xx_palmtx.c
+++ b/drivers/pcmcia/pxa2xx_palmtx.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Driver for Palm T|X PCMCIA 4 * Driver for Palm T|X PCMCIA
5 * 5 *
6 * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> 6 * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -13,67 +13,34 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18
19#include <mach/gpio.h>
20#include <mach/palmtx.h> 19#include <mach/palmtx.h>
21
22#include "soc_common.h" 20#include "soc_common.h"
23 21
22static struct gpio palmtx_pcmcia_gpios[] = {
23 { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },
24 { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },
25 { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
26 { GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
27};
28
24static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 29static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
25{ 30{
26 int ret; 31 int ret;
27 32
28 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1"); 33 ret = gpio_request_array(palmtx_pcmcia_gpios,
29 if (ret) 34 ARRAY_SIZE(palmtx_pcmcia_gpios));
30 goto err1;
31 ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0);
32 if (ret)
33 goto err2;
34
35 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2");
36 if (ret)
37 goto err2;
38 ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0);
39 if (ret)
40 goto err3;
41
42 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST");
43 if (ret)
44 goto err3;
45 ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1);
46 if (ret)
47 goto err4;
48
49 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY");
50 if (ret)
51 goto err4;
52 ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY);
53 if (ret)
54 goto err5;
55 35
56 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); 36 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY);
57 return 0;
58 37
59err5:
60 gpio_free(GPIO_NR_PALMTX_PCMCIA_READY);
61err4:
62 gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET);
63err3:
64 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2);
65err2:
66 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1);
67err1:
68 return ret; 38 return ret;
69} 39}
70 40
71static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 41static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
72{ 42{
73 gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); 43 gpio_free_array(palmtx_pcmcia_gpios, ARRAY_SIZE(palmtx_pcmcia_gpios));
74 gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET);
75 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2);
76 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1);
77} 44}
78 45
79static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 46static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
index 55627eccee8e..435002dfc3ca 100644
--- a/drivers/pcmcia/pxa2xx_vpac270.c
+++ b/drivers/pcmcia/pxa2xx_vpac270.c
@@ -3,8 +3,7 @@
3 * 3 *
4 * Driver for Voipac PXA270 PCMCIA and CF sockets 4 * Driver for Voipac PXA270 PCMCIA and CF sockets
5 * 5 *
6 * Copyright (C) 2010 6 * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com>
7 * Marek Vasut <marek.vasut@gmail.com>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -22,6 +21,19 @@
22 21
23#include "soc_common.h" 22#include "soc_common.h"
24 23
24static struct gpio vpac270_pcmcia_gpios[] = {
25 { GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN, "PCMCIA Card Detect" },
26 { GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN, "PCMCIA Ready" },
27 { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" },
28 { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" },
29};
30
31static struct gpio vpac270_cf_gpios[] = {
32 { GPIO17_VPAC270_CF_CD, GPIOF_IN, "CF Card Detect" },
33 { GPIO12_VPAC270_CF_RDY, GPIOF_IN, "CF Ready" },
34 { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" },
35};
36
25static struct pcmcia_irqs cd_irqs[] = { 37static struct pcmcia_irqs cd_irqs[] = {
26 { 38 {
27 .sock = 0, 39 .sock = 0,
@@ -40,96 +52,34 @@ static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
40 int ret; 52 int ret;
41 53
42 if (skt->nr == 0) { 54 if (skt->nr == 0) {
43 ret = gpio_request(GPIO84_VPAC270_PCMCIA_CD, "PCMCIA CD"); 55 ret = gpio_request_array(vpac270_pcmcia_gpios,
44 if (ret) 56 ARRAY_SIZE(vpac270_pcmcia_gpios));
45 goto err1;
46 ret = gpio_direction_input(GPIO84_VPAC270_PCMCIA_CD);
47 if (ret)
48 goto err2;
49
50 ret = gpio_request(GPIO35_VPAC270_PCMCIA_RDY, "PCMCIA RDY");
51 if (ret)
52 goto err2;
53 ret = gpio_direction_input(GPIO35_VPAC270_PCMCIA_RDY);
54 if (ret)
55 goto err3;
56
57 ret = gpio_request(GPIO107_VPAC270_PCMCIA_PPEN, "PCMCIA PPEN");
58 if (ret)
59 goto err3;
60 ret = gpio_direction_output(GPIO107_VPAC270_PCMCIA_PPEN, 0);
61 if (ret)
62 goto err4;
63
64 ret = gpio_request(GPIO11_VPAC270_PCMCIA_RESET, "PCMCIA RESET");
65 if (ret)
66 goto err4;
67 ret = gpio_direction_output(GPIO11_VPAC270_PCMCIA_RESET, 0);
68 if (ret)
69 goto err5;
70 57
71 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY); 58 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY);
72 59
73 return soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1); 60 if (!ret)
74 61 ret = soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1);
75err5:
76 gpio_free(GPIO11_VPAC270_PCMCIA_RESET);
77err4:
78 gpio_free(GPIO107_VPAC270_PCMCIA_PPEN);
79err3:
80 gpio_free(GPIO35_VPAC270_PCMCIA_RDY);
81err2:
82 gpio_free(GPIO84_VPAC270_PCMCIA_CD);
83err1:
84 return ret;
85
86 } else { 62 } else {
87 ret = gpio_request(GPIO17_VPAC270_CF_CD, "CF CD"); 63 ret = gpio_request_array(vpac270_cf_gpios,
88 if (ret) 64 ARRAY_SIZE(vpac270_cf_gpios));
89 goto err6;
90 ret = gpio_direction_input(GPIO17_VPAC270_CF_CD);
91 if (ret)
92 goto err7;
93
94 ret = gpio_request(GPIO12_VPAC270_CF_RDY, "CF RDY");
95 if (ret)
96 goto err7;
97 ret = gpio_direction_input(GPIO12_VPAC270_CF_RDY);
98 if (ret)
99 goto err8;
100
101 ret = gpio_request(GPIO16_VPAC270_CF_RESET, "CF RESET");
102 if (ret)
103 goto err8;
104 ret = gpio_direction_output(GPIO16_VPAC270_CF_RESET, 0);
105 if (ret)
106 goto err9;
107 65
108 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY); 66 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY);
109 67
110 return soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1); 68 if (!ret)
111 69 ret = soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1);
112err9:
113 gpio_free(GPIO16_VPAC270_CF_RESET);
114err8:
115 gpio_free(GPIO12_VPAC270_CF_RDY);
116err7:
117 gpio_free(GPIO17_VPAC270_CF_CD);
118err6:
119 return ret;
120
121 } 70 }
71
72 return ret;
122} 73}
123 74
124static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 75static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
125{ 76{
126 gpio_free(GPIO11_VPAC270_PCMCIA_RESET); 77 if (skt->nr == 0)
127 gpio_free(GPIO107_VPAC270_PCMCIA_PPEN); 78 gpio_request_array(vpac270_pcmcia_gpios,
128 gpio_free(GPIO35_VPAC270_PCMCIA_RDY); 79 ARRAY_SIZE(vpac270_pcmcia_gpios));
129 gpio_free(GPIO84_VPAC270_PCMCIA_CD); 80 else
130 gpio_free(GPIO16_VPAC270_CF_RESET); 81 gpio_request_array(vpac270_cf_gpios,
131 gpio_free(GPIO12_VPAC270_CF_RDY); 82 ARRAY_SIZE(vpac270_cf_gpios));
132 gpio_free(GPIO17_VPAC270_CF_CD);
133} 83}
134 84
135static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 85static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,