aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-13 17:56:32 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-04 09:32:22 -0500
commita9bb5a4bf9f84256499c802fd397d56d55227e4f (patch)
tree793a74bebd0ed3f254035cb14caa093f58bb8bf6 /drivers/pcmcia
parentd9dc878769f521f494d1617d7cd0c92073df75d8 (diff)
PCMCIA: pxa: convert PXA socket drivers to use new irq/gpio management
Convert all the PXA platform socket drivers to use the new irq/gpio management provided by soc_common. This relieves these drivers from having to do anything with these GPIOs other than provide the numbers to soc_common. Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/pxa2xx_balloon3.c21
-rw-r--r--drivers/pcmcia/pxa2xx_cm_x255.c38
-rw-r--r--drivers/pcmcia/pxa2xx_cm_x270.c22
-rw-r--r--drivers/pcmcia/pxa2xx_colibri.c20
-rw-r--r--drivers/pcmcia/pxa2xx_e740.c70
-rw-r--r--drivers/pcmcia/pxa2xx_mainstone.c30
-rw-r--r--drivers/pcmcia/pxa2xx_palmld.c7
-rw-r--r--drivers/pcmcia/pxa2xx_palmtc.c7
-rw-r--r--drivers/pcmcia/pxa2xx_palmtx.c7
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c30
-rw-r--r--drivers/pcmcia/pxa2xx_stargate2.c33
-rw-r--r--drivers/pcmcia/pxa2xx_trizeps4.c60
-rw-r--r--drivers/pcmcia/pxa2xx_viper.c38
-rw-r--r--drivers/pcmcia/pxa2xx_vpac270.c53
14 files changed, 81 insertions, 355 deletions
diff --git a/drivers/pcmcia/pxa2xx_balloon3.c b/drivers/pcmcia/pxa2xx_balloon3.c
index 22a75e610f12..12e38b497719 100644
--- a/drivers/pcmcia/pxa2xx_balloon3.c
+++ b/drivers/pcmcia/pxa2xx_balloon3.c
@@ -29,15 +29,6 @@
29 29
30#include "soc_common.h" 30#include "soc_common.h"
31 31
32/*
33 * These are a list of interrupt sources that provokes a polled
34 * check of status
35 */
36static struct pcmcia_irqs irqs[] = {
37 { 0, BALLOON3_S0_CD_IRQ, "PCMCIA0 CD" },
38 { 0, BALLOON3_BP_NSTSCHG_IRQ, "PCMCIA0 STSCHG" },
39};
40
41static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 32static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
42{ 33{
43 uint16_t ver; 34 uint16_t ver;
@@ -49,12 +40,12 @@ static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
49 ver); 40 ver);
50 41
51 skt->socket.pci_irq = BALLOON3_BP_CF_NRDY_IRQ; 42 skt->socket.pci_irq = BALLOON3_BP_CF_NRDY_IRQ;
52 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 43 skt->stat[SOC_STAT_CD].gpio = BALLOON3_GPIO_S0_CD;
53} 44 skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD";
45 skt->stat[SOC_STAT_BVD1].irq = BALLOON3_BP_NSTSCHG_IRQ;
46 skt->stat[SOC_STAT_BVD1].name = "PCMCIA0 STSCHG";
54 47
55static void balloon3_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 48 return 0;
56{
57 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
58} 49}
59 50
60static unsigned long balloon3_pcmcia_status[2] = { 51static unsigned long balloon3_pcmcia_status[2] = {
@@ -85,7 +76,6 @@ static void balloon3_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
85 disable_irq(BALLOON3_BP_NSTSCHG_IRQ); 76 disable_irq(BALLOON3_BP_NSTSCHG_IRQ);
86 } 77 }
87 78
88 state->detect = !gpio_get_value(BALLOON3_GPIO_S0_CD);
89 state->ready = !!(status & BALLOON3_CF_nIRQ); 79 state->ready = !!(status & BALLOON3_CF_nIRQ);
90 state->bvd1 = !!(status & BALLOON3_CF_nSTSCHG_BVD1); 80 state->bvd1 = !!(status & BALLOON3_CF_nSTSCHG_BVD1);
91 state->bvd2 = 0; /* not available */ 81 state->bvd2 = 0; /* not available */
@@ -106,7 +96,6 @@ static int balloon3_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
106static struct pcmcia_low_level balloon3_pcmcia_ops = { 96static struct pcmcia_low_level balloon3_pcmcia_ops = {
107 .owner = THIS_MODULE, 97 .owner = THIS_MODULE,
108 .hw_init = balloon3_pcmcia_hw_init, 98 .hw_init = balloon3_pcmcia_hw_init,
109 .hw_shutdown = balloon3_pcmcia_hw_shutdown,
110 .socket_state = balloon3_pcmcia_socket_state, 99 .socket_state = balloon3_pcmcia_socket_state,
111 .configure_socket = balloon3_pcmcia_configure_socket, 100 .configure_socket = balloon3_pcmcia_configure_socket,
112 .first = 0, 101 .first = 0,
diff --git a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c
index 31ab6ddf52c9..f90e7b1a5958 100644
--- a/drivers/pcmcia/pxa2xx_cm_x255.c
+++ b/drivers/pcmcia/pxa2xx_cm_x255.c
@@ -25,17 +25,6 @@
25#define GPIO_PCMCIA_S1_RDYINT (8) 25#define GPIO_PCMCIA_S1_RDYINT (8)
26#define GPIO_PCMCIA_RESET (9) 26#define GPIO_PCMCIA_RESET (9)
27 27
28#define PCMCIA_S0_CD_VALID gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID)
29#define PCMCIA_S1_CD_VALID gpio_to_irq(GPIO_PCMCIA_S1_CD_VALID)
30#define PCMCIA_S0_RDYINT gpio_to_irq(GPIO_PCMCIA_S0_RDYINT)
31#define PCMCIA_S1_RDYINT gpio_to_irq(GPIO_PCMCIA_S1_RDYINT)
32
33
34static struct pcmcia_irqs irqs[] = {
35 { .sock = 0, .str = "PCMCIA0 CD" },
36 { .sock = 1, .str = "PCMCIA1 CD" },
37};
38
39static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 28static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
40{ 29{
41 int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset"); 30 int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
@@ -43,19 +32,23 @@ static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
43 return ret; 32 return ret;
44 gpio_direction_output(GPIO_PCMCIA_RESET, 0); 33 gpio_direction_output(GPIO_PCMCIA_RESET, 0);
45 34
46 skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; 35 if (skt->nr == 0) {
47 irqs[0].irq = PCMCIA_S0_CD_VALID; 36 skt->stat[SOC_STAT_CD].gpio = GPIO_PCMCIA_S0_CD_VALID;
48 irqs[1].irq = PCMCIA_S1_CD_VALID; 37 skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD";
49 ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 38 skt->stat[SOC_STAT_RDY].gpio = GPIO_PCMCIA_S0_RDYINT;
50 if (!ret) 39 skt->stat[SOC_STAT_RDY].name = "PCMCIA0 RDY";
51 gpio_free(GPIO_PCMCIA_RESET); 40 } else {
41 skt->stat[SOC_STAT_CD].gpio = GPIO_PCMCIA_S1_CD_VALID;
42 skt->stat[SOC_STAT_CD].name = "PCMCIA1 CD";
43 skt->stat[SOC_STAT_RDY].gpio = GPIO_PCMCIA_S1_RDYINT;
44 skt->stat[SOC_STAT_RDY].name = "PCMCIA1 RDY";
45 }
52 46
53 return ret; 47 return 0;
54} 48}
55 49
56static void cmx255_pcmcia_shutdown(struct soc_pcmcia_socket *skt) 50static void cmx255_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
57{ 51{
58 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
59 gpio_free(GPIO_PCMCIA_RESET); 52 gpio_free(GPIO_PCMCIA_RESET);
60} 53}
61 54
@@ -63,13 +56,6 @@ static void cmx255_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
63static void cmx255_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 56static void cmx255_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
64 struct pcmcia_state *state) 57 struct pcmcia_state *state)
65{ 58{
66 int cd = skt->nr ? GPIO_PCMCIA_S1_CD_VALID : GPIO_PCMCIA_S0_CD_VALID;
67 int rdy = skt->nr ? GPIO_PCMCIA_S1_RDYINT : GPIO_PCMCIA_S0_RDYINT;
68
69 state->detect = !gpio_get_value(cd);
70 state->ready = !!gpio_get_value(rdy);
71 state->bvd1 = 1;
72 state->bvd2 = 1;
73 state->vs_3v = 0; 59 state->vs_3v = 0;
74 state->vs_Xv = 0; 60 state->vs_Xv = 0;
75 state->wrprot = 0; /* not available */ 61 state->wrprot = 0; /* not available */
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c
index 3dc7621a0767..efb5f132851b 100644
--- a/drivers/pcmcia/pxa2xx_cm_x270.c
+++ b/drivers/pcmcia/pxa2xx_cm_x270.c
@@ -22,14 +22,6 @@
22#define GPIO_PCMCIA_S0_RDYINT (82) 22#define GPIO_PCMCIA_S0_RDYINT (82)
23#define GPIO_PCMCIA_RESET (53) 23#define GPIO_PCMCIA_RESET (53)
24 24
25#define PCMCIA_S0_CD_VALID gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID)
26#define PCMCIA_S0_RDYINT gpio_to_irq(GPIO_PCMCIA_S0_RDYINT)
27
28
29static struct pcmcia_irqs irqs[] = {
30 { .sock = 0, .str = "PCMCIA0 CD" },
31};
32
33static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 25static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
34{ 26{
35 int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset"); 27 int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
@@ -37,18 +29,16 @@ static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
37 return ret; 29 return ret;
38 gpio_direction_output(GPIO_PCMCIA_RESET, 0); 30 gpio_direction_output(GPIO_PCMCIA_RESET, 0);
39 31
40 skt->socket.pci_irq = PCMCIA_S0_RDYINT; 32 skt->stat[SOC_STAT_CD].gpio = GPIO_PCMCIA_S0_CD_VALID;
41 irqs[0].irq = PCMCIA_S0_CD_VALID; 33 skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD";
42 ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 34 skt->stat[SOC_STAT_RDY].gpio = GPIO_PCMCIA_S0_RDYINT;
43 if (!ret) 35 skt->stat[SOC_STAT_RDY].name = "PCMCIA0 RDY";
44 gpio_free(GPIO_PCMCIA_RESET);
45 36
46 return ret; 37 return ret;
47} 38}
48 39
49static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt) 40static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
50{ 41{
51 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
52 gpio_free(GPIO_PCMCIA_RESET); 42 gpio_free(GPIO_PCMCIA_RESET);
53} 43}
54 44
@@ -56,10 +46,6 @@ static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
56static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 46static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
57 struct pcmcia_state *state) 47 struct pcmcia_state *state)
58{ 48{
59 state->detect = (gpio_get_value(GPIO_PCMCIA_S0_CD_VALID) == 0) ? 1 : 0;
60 state->ready = (gpio_get_value(GPIO_PCMCIA_S0_RDYINT) == 0) ? 0 : 1;
61 state->bvd1 = 1;
62 state->bvd2 = 1;
63 state->vs_3v = 0; 49 state->vs_3v = 0;
64 state->vs_Xv = 0; 50 state->vs_Xv = 0;
65 state->wrprot = 0; /* not available */ 51 state->wrprot = 0; /* not available */
diff --git a/drivers/pcmcia/pxa2xx_colibri.c b/drivers/pcmcia/pxa2xx_colibri.c
index c6dec572a05d..3565169a00f2 100644
--- a/drivers/pcmcia/pxa2xx_colibri.c
+++ b/drivers/pcmcia/pxa2xx_colibri.c
@@ -53,13 +53,6 @@ static struct gpio colibri_pcmcia_gpios[] = {
53 { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 53 { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" },
54}; 54};
55 55
56static struct pcmcia_irqs colibri_irqs[] = {
57 {
58 .sock = 0,
59 .str = "PCMCIA CD"
60 },
61};
62
63static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 56static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
64{ 57{
65 int ret; 58 int ret;
@@ -69,19 +62,10 @@ static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
69 if (ret) 62 if (ret)
70 goto err1; 63 goto err1;
71 64
72 colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio);
73 skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio); 65 skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio);
66 skt->stat[SOC_STAT_CD].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio);
67 skt->stat[SOC_STAT_CD].name = "PCMCIA CD";
74 68
75 ret = soc_pcmcia_request_irqs(skt, colibri_irqs,
76 ARRAY_SIZE(colibri_irqs));
77 if (ret)
78 goto err2;
79
80 return ret;
81
82err2:
83 gpio_free_array(colibri_pcmcia_gpios,
84 ARRAY_SIZE(colibri_pcmcia_gpios));
85err1: 69err1:
86 return ret; 70 return ret;
87} 71}
diff --git a/drivers/pcmcia/pxa2xx_e740.c b/drivers/pcmcia/pxa2xx_e740.c
index 17cd2ce7428f..24e00a503d08 100644
--- a/drivers/pcmcia/pxa2xx_e740.c
+++ b/drivers/pcmcia/pxa2xx_e740.c
@@ -23,52 +23,27 @@
23 23
24#include "soc_common.h" 24#include "soc_common.h"
25 25
26static struct pcmcia_irqs cd_irqs[] = {
27 {
28 .sock = 0,
29 .str = "CF card detect"
30 },
31 {
32 .sock = 1,
33 .str = "Wifi switch"
34 },
35};
36
37static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 26static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
38{ 27{
39 if (skt->nr == 0) 28 if (skt->nr == 0) {
40 skt->socket.pci_irq = gpio_to_irq(GPIO_E740_PCMCIA_RDY0); 29 skt->stat[SOC_STAT_CD].gpio = GPIO_E740_PCMCIA_CD0;
41 else 30 skt->stat[SOC_STAT_CD].name = "CF card detect";
42 skt->socket.pci_irq = gpio_to_irq(GPIO_E740_PCMCIA_RDY1); 31 skt->stat[SOC_STAT_RDY].gpio = GPIO_E740_PCMCIA_RDY0;
43 32 skt->stat[SOC_STAT_RDY].name = "CF ready";
44 cd_irqs[0].irq = gpio_to_irq(GPIO_E740_PCMCIA_CD0); 33 } else {
45 cd_irqs[1].irq = gpio_to_irq(GPIO_E740_PCMCIA_CD1); 34 skt->stat[SOC_STAT_CD].gpio = GPIO_E740_PCMCIA_CD1;
46 35 skt->stat[SOC_STAT_CD].name = "Wifi switch";
47 return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); 36 skt->stat[SOC_STAT_RDY].gpio = GPIO_E740_PCMCIA_RDY1;
48} 37 skt->stat[SOC_STAT_RDY].name = "Wifi ready";
38 }
49 39
50/* 40 return 0;
51 * Release all resources.
52 */
53static void e740_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
54{
55 soc_pcmcia_free_irqs(skt, &cd_irqs[skt->nr], 1);
56} 41}
57 42
58static void e740_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 43static void e740_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
59 struct pcmcia_state *state) 44 struct pcmcia_state *state)
60{ 45{
61 if (skt->nr == 0) {
62 state->detect = gpio_get_value(GPIO_E740_PCMCIA_CD0) ? 0 : 1;
63 state->ready = gpio_get_value(GPIO_E740_PCMCIA_RDY0) ? 1 : 0;
64 } else {
65 state->detect = gpio_get_value(GPIO_E740_PCMCIA_CD1) ? 0 : 1;
66 state->ready = gpio_get_value(GPIO_E740_PCMCIA_RDY1) ? 1 : 0;
67 }
68
69 state->vs_3v = 1; 46 state->vs_3v = 1;
70 state->bvd1 = 1;
71 state->bvd2 = 1;
72 state->wrprot = 0; 47 state->wrprot = 0;
73 state->vs_Xv = 0; 48 state->vs_Xv = 0;
74} 49}
@@ -109,32 +84,11 @@ static int e740_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
109 return 0; 84 return 0;
110} 85}
111 86
112/*
113 * Enable card status IRQs on (re-)initialisation. This can
114 * be called at initialisation, power management event, or
115 * pcmcia event.
116 */
117static void e740_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
118{
119 soc_pcmcia_enable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs));
120}
121
122/*
123 * Disable card status IRQs on suspend.
124 */
125static void e740_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
126{
127 soc_pcmcia_disable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs));
128}
129
130static struct pcmcia_low_level e740_pcmcia_ops = { 87static struct pcmcia_low_level e740_pcmcia_ops = {
131 .owner = THIS_MODULE, 88 .owner = THIS_MODULE,
132 .hw_init = e740_pcmcia_hw_init, 89 .hw_init = e740_pcmcia_hw_init,
133 .hw_shutdown = e740_pcmcia_hw_shutdown,
134 .socket_state = e740_pcmcia_socket_state, 90 .socket_state = e740_pcmcia_socket_state,
135 .configure_socket = e740_pcmcia_configure_socket, 91 .configure_socket = e740_pcmcia_configure_socket,
136 .socket_init = e740_pcmcia_socket_init,
137 .socket_suspend = e740_pcmcia_socket_suspend,
138 .nr = 2, 92 .nr = 2,
139}; 93};
140 94
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c
index aded706c0b9f..b0ea4d3f8a1c 100644
--- a/drivers/pcmcia/pxa2xx_mainstone.c
+++ b/drivers/pcmcia/pxa2xx_mainstone.c
@@ -30,27 +30,26 @@
30#include "soc_common.h" 30#include "soc_common.h"
31 31
32 32
33static struct pcmcia_irqs irqs[] = {
34 { 0, MAINSTONE_S0_CD_IRQ, "PCMCIA0 CD" },
35 { 1, MAINSTONE_S1_CD_IRQ, "PCMCIA1 CD" },
36 { 0, MAINSTONE_S0_STSCHG_IRQ, "PCMCIA0 STSCHG" },
37 { 1, MAINSTONE_S1_STSCHG_IRQ, "PCMCIA1 STSCHG" },
38};
39
40static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 33static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
41{ 34{
42 /* 35 /*
43 * Setup default state of GPIO outputs 36 * Setup default state of GPIO outputs
44 * before we enable them as outputs. 37 * before we enable them as outputs.
45 */ 38 */
46 39 if (skt->nr == 0) {
47 skt->socket.pci_irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; 40 skt->socket.pci_irq = MAINSTONE_S0_IRQ;
48 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 41 skt->stat[SOC_STAT_CD].irq = MAINSTONE_S0_CD_IRQ;
49} 42 skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD";
50 43 skt->stat[SOC_STAT_BVD1].irq = MAINSTONE_S0_STSCHG_IRQ;
51static void mst_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 44 skt->stat[SOC_STAT_BVD1].name = "PCMCIA0 STSCHG";
52{ 45 } else {
53 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); 46 skt->socket.pci_irq = MAINSTONE_S1_IRQ;
47 skt->stat[SOC_STAT_CD].irq = MAINSTONE_S1_CD_IRQ;
48 skt->stat[SOC_STAT_CD].name = "PCMCIA1 CD";
49 skt->stat[SOC_STAT_BVD1].irq = MAINSTONE_S1_STSCHG_IRQ;
50 skt->stat[SOC_STAT_BVD1].name = "PCMCIA1 STSCHG";
51 }
52 return 0;
54} 53}
55 54
56static unsigned long mst_pcmcia_status[2]; 55static unsigned long mst_pcmcia_status[2];
@@ -131,7 +130,6 @@ static int mst_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
131static struct pcmcia_low_level mst_pcmcia_ops __initdata = { 130static struct pcmcia_low_level mst_pcmcia_ops __initdata = {
132 .owner = THIS_MODULE, 131 .owner = THIS_MODULE,
133 .hw_init = mst_pcmcia_hw_init, 132 .hw_init = mst_pcmcia_hw_init,
134 .hw_shutdown = mst_pcmcia_hw_shutdown,
135 .socket_state = mst_pcmcia_socket_state, 133 .socket_state = mst_pcmcia_socket_state,
136 .configure_socket = mst_pcmcia_configure_socket, 134 .configure_socket = mst_pcmcia_configure_socket,
137 .nr = 2, 135 .nr = 2,
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c
index 6a8e011a8c13..4bf68144c365 100644
--- a/drivers/pcmcia/pxa2xx_palmld.c
+++ b/drivers/pcmcia/pxa2xx_palmld.c
@@ -23,7 +23,6 @@
23static struct gpio palmld_pcmcia_gpios[] = { 23static struct gpio palmld_pcmcia_gpios[] = {
24 { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" }, 24 { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" },
25 { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 25 { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
26 { GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
27}; 26};
28 27
29static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 28static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
@@ -33,7 +32,8 @@ static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
33 ret = gpio_request_array(palmld_pcmcia_gpios, 32 ret = gpio_request_array(palmld_pcmcia_gpios,
34 ARRAY_SIZE(palmld_pcmcia_gpios)); 33 ARRAY_SIZE(palmld_pcmcia_gpios));
35 34
36 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMLD_PCMCIA_READY); 35 skt->stat[SOC_STAT_RDY].gpio = GPIO_NR_PALMLD_PCMCIA_READY;
36 skt->stat[SOC_STAT_RDY].name = "PCMCIA Ready";
37 37
38 return ret; 38 return ret;
39} 39}
@@ -47,9 +47,6 @@ static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
47 struct pcmcia_state *state) 47 struct pcmcia_state *state)
48{ 48{
49 state->detect = 1; /* always inserted */ 49 state->detect = 1; /* always inserted */
50 state->ready = !!gpio_get_value(GPIO_NR_PALMLD_PCMCIA_READY);
51 state->bvd1 = 1;
52 state->bvd2 = 1;
53 state->wrprot = 0; 50 state->wrprot = 0;
54 state->vs_3v = 1; 51 state->vs_3v = 1;
55 state->vs_Xv = 0; 52 state->vs_Xv = 0;
diff --git a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c
index 9e38de769ba3..b32d05f86789 100644
--- a/drivers/pcmcia/pxa2xx_palmtc.c
+++ b/drivers/pcmcia/pxa2xx_palmtc.c
@@ -26,7 +26,6 @@ static struct gpio palmtc_pcmcia_gpios[] = {
26 { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" }, 26 { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },
27 { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" }, 27 { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" },
28 { GPIO_NR_PALMTC_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 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" }, 29 { GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN, "PCMCIA Power Ready" },
31}; 30};
32 31
@@ -37,7 +36,8 @@ static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
37 ret = gpio_request_array(palmtc_pcmcia_gpios, 36 ret = gpio_request_array(palmtc_pcmcia_gpios,
38 ARRAY_SIZE(palmtc_pcmcia_gpios)); 37 ARRAY_SIZE(palmtc_pcmcia_gpios));
39 38
40 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTC_PCMCIA_READY); 39 skt->stat[SOC_STAT_RDY].gpio = GPIO_NR_PALMTC_PCMCIA_READY;
40 skt->stat[SOC_STAT_RDY].name = "PCMCIA Ready";
41 41
42 return ret; 42 return ret;
43} 43}
@@ -51,9 +51,6 @@ static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
51 struct pcmcia_state *state) 51 struct pcmcia_state *state)
52{ 52{
53 state->detect = 1; /* always inserted */ 53 state->detect = 1; /* always inserted */
54 state->ready = !!gpio_get_value(GPIO_NR_PALMTC_PCMCIA_READY);
55 state->bvd1 = 1;
56 state->bvd2 = 1;
57 state->wrprot = 0; 54 state->wrprot = 0;
58 state->vs_3v = 1; 55 state->vs_3v = 1;
59 state->vs_Xv = 0; 56 state->vs_Xv = 0;
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c
index 80645a688ee3..ee024ff0980a 100644
--- a/drivers/pcmcia/pxa2xx_palmtx.c
+++ b/drivers/pcmcia/pxa2xx_palmtx.c
@@ -23,7 +23,6 @@ static struct gpio palmtx_pcmcia_gpios[] = {
23 { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" }, 23 { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },
24 { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" }, 24 { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },
25 { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 25 { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
26 { GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
27}; 26};
28 27
29static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 28static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
@@ -33,7 +32,8 @@ static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
33 ret = gpio_request_array(palmtx_pcmcia_gpios, 32 ret = gpio_request_array(palmtx_pcmcia_gpios,
34 ARRAY_SIZE(palmtx_pcmcia_gpios)); 33 ARRAY_SIZE(palmtx_pcmcia_gpios));
35 34
36 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); 35 skt->stat[SOC_STAT_RDY].gpio = GPIO_NR_PALMTX_PCMCIA_READY;
36 skt->stat[SOC_STAT_RDY].name = "PCMCIA Ready";
37 37
38 return ret; 38 return ret;
39} 39}
@@ -47,9 +47,6 @@ static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
47 struct pcmcia_state *state) 47 struct pcmcia_state *state)
48{ 48{
49 state->detect = 1; /* always inserted */ 49 state->detect = 1; /* always inserted */
50 state->ready = !!gpio_get_value(GPIO_NR_PALMTX_PCMCIA_READY);
51 state->bvd1 = 1;
52 state->bvd2 = 1;
53 state->wrprot = 0; 50 state->wrprot = 0;
54 state->vs_3v = 1; 51 state->vs_3v = 1;
55 state->vs_Xv = 0; 52 state->vs_Xv = 0;
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index 69ae2fd22400..b066273b6b4f 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -46,21 +46,9 @@ static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
46 46
47static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 47static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
48{ 48{
49 int ret;
50
51 /* Register interrupts */
52 if (SCOOP_DEV[skt->nr].cd_irq >= 0) { 49 if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
53 struct pcmcia_irqs cd_irq; 50 skt->stat[SOC_STAT_CD].irq = SCOOP_DEV[skt->nr].cd_irq;
54 51 skt->stat[SOC_STAT_CD].name = SCOOP_DEV[skt->nr].cd_irq_str;
55 cd_irq.sock = skt->nr;
56 cd_irq.irq = SCOOP_DEV[skt->nr].cd_irq;
57 cd_irq.str = SCOOP_DEV[skt->nr].cd_irq_str;
58 ret = soc_pcmcia_request_irqs(skt, &cd_irq, 1);
59
60 if (ret) {
61 printk(KERN_ERR "Request for Compact Flash IRQ failed\n");
62 return ret;
63 }
64 } 52 }
65 53
66 skt->socket.pci_irq = SCOOP_DEV[skt->nr].irq; 54 skt->socket.pci_irq = SCOOP_DEV[skt->nr].irq;
@@ -68,19 +56,6 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
68 return 0; 56 return 0;
69} 57}
70 58
71static void sharpsl_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
72{
73 if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
74 struct pcmcia_irqs cd_irq;
75
76 cd_irq.sock = skt->nr;
77 cd_irq.irq = SCOOP_DEV[skt->nr].cd_irq;
78 cd_irq.str = SCOOP_DEV[skt->nr].cd_irq_str;
79 soc_pcmcia_free_irqs(skt, &cd_irq, 1);
80 }
81}
82
83
84static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 59static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
85 struct pcmcia_state *state) 60 struct pcmcia_state *state)
86{ 61{
@@ -222,7 +197,6 @@ static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
222static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = { 197static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = {
223 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
224 .hw_init = sharpsl_pcmcia_hw_init, 199 .hw_init = sharpsl_pcmcia_hw_init,
225 .hw_shutdown = sharpsl_pcmcia_hw_shutdown,
226 .socket_state = sharpsl_pcmcia_socket_state, 200 .socket_state = sharpsl_pcmcia_socket_state,
227 .configure_socket = sharpsl_pcmcia_configure_socket, 201 .configure_socket = sharpsl_pcmcia_configure_socket,
228 .socket_init = sharpsl_pcmcia_socket_init, 202 .socket_init = sharpsl_pcmcia_socket_init,
diff --git a/drivers/pcmcia/pxa2xx_stargate2.c b/drivers/pcmcia/pxa2xx_stargate2.c
index 6c2366b74a35..e7c7eb530cb1 100644
--- a/drivers/pcmcia/pxa2xx_stargate2.c
+++ b/drivers/pcmcia/pxa2xx_stargate2.c
@@ -33,10 +33,6 @@
33#define SG2_S0_GPIO_DETECT 53 33#define SG2_S0_GPIO_DETECT 53
34#define SG2_S0_GPIO_READY 81 34#define SG2_S0_GPIO_READY 81
35 35
36static struct pcmcia_irqs irqs[] = {
37 {.sock = 0, .str = "PCMCIA0 CD" },
38};
39
40static struct gpio sg2_pcmcia_gpios[] = { 36static struct gpio sg2_pcmcia_gpios[] = {
41 { SG2_S0_GPIO_RESET, GPIOF_OUT_INIT_HIGH, "PCMCIA Reset" }, 37 { SG2_S0_GPIO_RESET, GPIOF_OUT_INIT_HIGH, "PCMCIA Reset" },
42 { SG2_S0_POWER_CTL, GPIOF_OUT_INIT_HIGH, "PCMCIA Power Ctrl" }, 38 { SG2_S0_POWER_CTL, GPIOF_OUT_INIT_HIGH, "PCMCIA Power Ctrl" },
@@ -44,22 +40,16 @@ static struct gpio sg2_pcmcia_gpios[] = {
44 40
45static int sg2_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 41static int sg2_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
46{ 42{
47 skt->socket.pci_irq = gpio_to_irq(SG2_S0_GPIO_READY); 43 skt->stat[SOC_STAT_CD].gpio = SG2_S0_GPIO_DETECT;
48 irqs[0].irq = gpio_to_irq(SG2_S0_GPIO_DETECT); 44 skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD";
49 45 skt->stat[SOC_STAT_RDY].gpio = SG2_S0_GPIO_READY;
50 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 46 skt->stat[SOC_STAT_RDY].name = "PCMCIA0 RDY";
51} 47 return 0;
52
53static void sg2_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
54{
55 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
56} 48}
57 49
58static void sg2_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 50static void sg2_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
59 struct pcmcia_state *state) 51 struct pcmcia_state *state)
60{ 52{
61 state->detect = !gpio_get_value(SG2_S0_GPIO_DETECT);
62 state->ready = !!gpio_get_value(SG2_S0_GPIO_READY);
63 state->bvd1 = 0; /* not available - battery detect on card */ 53 state->bvd1 = 0; /* not available - battery detect on card */
64 state->bvd2 = 0; /* not available */ 54 state->bvd2 = 0; /* not available */
65 state->vs_3v = 1; /* not available - voltage detect for card */ 55 state->vs_3v = 1; /* not available - voltage detect for card */
@@ -94,24 +84,11 @@ static int sg2_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
94 return 0; 84 return 0;
95} 85}
96 86
97static void sg2_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
98{
99 soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
100}
101
102static void sg2_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
103{
104 soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
105}
106
107static struct pcmcia_low_level sg2_pcmcia_ops __initdata = { 87static struct pcmcia_low_level sg2_pcmcia_ops __initdata = {
108 .owner = THIS_MODULE, 88 .owner = THIS_MODULE,
109 .hw_init = sg2_pcmcia_hw_init, 89 .hw_init = sg2_pcmcia_hw_init,
110 .hw_shutdown = sg2_pcmcia_hw_shutdown,
111 .socket_state = sg2_pcmcia_socket_state, 90 .socket_state = sg2_pcmcia_socket_state,
112 .configure_socket = sg2_pcmcia_configure_socket, 91 .configure_socket = sg2_pcmcia_configure_socket,
113 .socket_init = sg2_pcmcia_socket_init,
114 .socket_suspend = sg2_pcmcia_socket_suspend,
115 .nr = 1, 92 .nr = 1,
116}; 93};
117 94
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c
index 7c33f898135a..31fd93449913 100644
--- a/drivers/pcmcia/pxa2xx_trizeps4.c
+++ b/drivers/pcmcia/pxa2xx_trizeps4.c
@@ -29,32 +29,17 @@
29 29
30extern void board_pcmcia_power(int power); 30extern void board_pcmcia_power(int power);
31 31
32static struct pcmcia_irqs irqs[] = {
33 { .sock = 0, .str = "cs0_cd" }
34 /* on other baseboards we can have more inputs */
35};
36
37static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 32static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
38{ 33{
39 int ret, i;
40 /* we dont have voltage/card/ready detection 34 /* we dont have voltage/card/ready detection
41 * so we dont need interrupts for it 35 * so we dont need interrupts for it
42 */ 36 */
43 switch (skt->nr) { 37 switch (skt->nr) {
44 case 0: 38 case 0:
45 if (gpio_request(GPIO_PRDY, "cf_irq") < 0) { 39 skt->stat[SOC_STAT_CD].gpio = GPIO_PCD;
46 pr_err("%s: sock %d unable to request gpio %d\n", __func__, 40 skt->stat[SOC_STAT_CD].name = "cs0_cd";
47 skt->nr, GPIO_PRDY); 41 skt->stat[SOC_STAT_RDY].gpio = GPIO_PRDY;
48 return -EBUSY; 42 skt->stat[SOC_STAT_RDY].name = "cs0_rdy";
49 }
50 if (gpio_direction_input(GPIO_PRDY) < 0) {
51 pr_err("%s: sock %d unable to set input gpio %d\n", __func__,
52 skt->nr, GPIO_PRDY);
53 gpio_free(GPIO_PRDY);
54 return -EINVAL;
55 }
56 skt->socket.pci_irq = gpio_to_irq(GPIO_PRDY);
57 irqs[0].irq = gpio_to_irq(GPIO_PCD);
58 break; 43 break;
59 default: 44 default:
60 break; 45 break;
@@ -62,39 +47,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
62 /* release the reset of this card */ 47 /* release the reset of this card */
63 pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->socket.pci_irq); 48 pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->socket.pci_irq);
64 49
65 /* supplementory irqs for the socket */ 50 return 0;
66 for (i = 0; i < ARRAY_SIZE(irqs); i++) {
67 if (irqs[i].sock != skt->nr)
68 continue;
69 if (gpio_request(irq_to_gpio(irqs[i].irq), irqs[i].str) < 0) {
70 pr_err("%s: sock %d unable to request gpio %d\n",
71 __func__, skt->nr, irq_to_gpio(irqs[i].irq));
72 ret = -EBUSY;
73 goto error;
74 }
75 if (gpio_direction_input(irq_to_gpio(irqs[i].irq)) < 0) {
76 pr_err("%s: sock %d unable to set input gpio %d\n",
77 __func__, skt->nr, irq_to_gpio(irqs[i].irq));
78 ret = -EINVAL;
79 goto error;
80 }
81 }
82 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
83
84error:
85 for (; i >= 0; i--) {
86 gpio_free(irq_to_gpio(irqs[i].irq));
87 }
88 return (ret);
89}
90
91static void trizeps_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
92{
93 int i;
94 /* free allocated gpio's */
95 gpio_free(GPIO_PRDY);
96 for (i = 0; i < ARRAY_SIZE(irqs); i++)
97 gpio_free(irq_to_gpio(irqs[i].irq));
98} 51}
99 52
100static unsigned long trizeps_pcmcia_status[2]; 53static unsigned long trizeps_pcmcia_status[2];
@@ -118,8 +71,6 @@ static void trizeps_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
118 switch (skt->nr) { 71 switch (skt->nr) {
119 case 0: 72 case 0:
120 /* just fill in fix states */ 73 /* just fill in fix states */
121 state->detect = gpio_get_value(GPIO_PCD) ? 0 : 1;
122 state->ready = gpio_get_value(GPIO_PRDY) ? 1 : 0;
123 state->bvd1 = (status & ConXS_CFSR_BVD1) ? 1 : 0; 74 state->bvd1 = (status & ConXS_CFSR_BVD1) ? 1 : 0;
124 state->bvd2 = (status & ConXS_CFSR_BVD2) ? 1 : 0; 75 state->bvd2 = (status & ConXS_CFSR_BVD2) ? 1 : 0;
125 state->vs_3v = (status & ConXS_CFSR_VS1) ? 0 : 1; 76 state->vs_3v = (status & ConXS_CFSR_VS1) ? 0 : 1;
@@ -204,7 +155,6 @@ static void trizeps_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
204static struct pcmcia_low_level trizeps_pcmcia_ops = { 155static struct pcmcia_low_level trizeps_pcmcia_ops = {
205 .owner = THIS_MODULE, 156 .owner = THIS_MODULE,
206 .hw_init = trizeps_pcmcia_hw_init, 157 .hw_init = trizeps_pcmcia_hw_init,
207 .hw_shutdown = trizeps_pcmcia_hw_shutdown,
208 .socket_state = trizeps_pcmcia_socket_state, 158 .socket_state = trizeps_pcmcia_socket_state,
209 .configure_socket = trizeps_pcmcia_configure_socket, 159 .configure_socket = trizeps_pcmcia_configure_socket,
210 .socket_init = trizeps_pcmcia_socket_init, 160 .socket_init = trizeps_pcmcia_socket_init,
diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c
index 1064b1c2869d..6100ef8ce53e 100644
--- a/drivers/pcmcia/pxa2xx_viper.c
+++ b/drivers/pcmcia/pxa2xx_viper.c
@@ -32,13 +32,6 @@
32 32
33static struct platform_device *arcom_pcmcia_dev; 33static struct platform_device *arcom_pcmcia_dev;
34 34
35static struct pcmcia_irqs irqs[] = {
36 {
37 .sock = 0,
38 .str = "PCMCIA_CD",
39 },
40};
41
42static inline struct arcom_pcmcia_pdata *viper_get_pdata(void) 35static inline struct arcom_pcmcia_pdata *viper_get_pdata(void)
43{ 36{
44 return arcom_pcmcia_dev->dev.platform_data; 37 return arcom_pcmcia_dev->dev.platform_data;
@@ -49,38 +42,28 @@ static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
49 struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); 42 struct arcom_pcmcia_pdata *pdata = viper_get_pdata();
50 unsigned long flags; 43 unsigned long flags;
51 44
52 skt->socket.pci_irq = gpio_to_irq(pdata->rdy_gpio); 45 skt->stat[SOC_STAT_CD].gpio = pdata->cd_gpio;
53 irqs[0].irq = gpio_to_irq(pdata->cd_gpio); 46 skt->stat[SOC_STAT_CD].name = "PCMCIA_CD";
54 47 skt->stat[SOC_STAT_RDY].gpio = pdata->rdy_gpio;
55 if (gpio_request(pdata->cd_gpio, "CF detect")) 48 skt->stat[SOC_STAT_RDY].name = "CF ready";
56 goto err_request_cd;
57
58 if (gpio_request(pdata->rdy_gpio, "CF ready"))
59 goto err_request_rdy;
60 49
61 if (gpio_request(pdata->pwr_gpio, "CF power")) 50 if (gpio_request(pdata->pwr_gpio, "CF power"))
62 goto err_request_pwr; 51 goto err_request_pwr;
63 52
64 local_irq_save(flags); 53 local_irq_save(flags);
65 54
66 if (gpio_direction_output(pdata->pwr_gpio, 0) || 55 if (gpio_direction_output(pdata->pwr_gpio, 0)) {
67 gpio_direction_input(pdata->cd_gpio) ||
68 gpio_direction_input(pdata->rdy_gpio)) {
69 local_irq_restore(flags); 56 local_irq_restore(flags);
70 goto err_dir; 57 goto err_dir;
71 } 58 }
72 59
73 local_irq_restore(flags); 60 local_irq_restore(flags);
74 61
75 return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 62 return 0;
76 63
77err_dir: 64err_dir:
78 gpio_free(pdata->pwr_gpio); 65 gpio_free(pdata->pwr_gpio);
79err_request_pwr: 66err_request_pwr:
80 gpio_free(pdata->rdy_gpio);
81err_request_rdy:
82 gpio_free(pdata->cd_gpio);
83err_request_cd:
84 dev_err(&arcom_pcmcia_dev->dev, "Failed to setup PCMCIA GPIOs\n"); 67 dev_err(&arcom_pcmcia_dev->dev, "Failed to setup PCMCIA GPIOs\n");
85 return -1; 68 return -1;
86} 69}
@@ -92,21 +75,12 @@ static void viper_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
92{ 75{
93 struct arcom_pcmcia_pdata *pdata = viper_get_pdata(); 76 struct arcom_pcmcia_pdata *pdata = viper_get_pdata();
94 77
95 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
96 gpio_free(pdata->pwr_gpio); 78 gpio_free(pdata->pwr_gpio);
97 gpio_free(pdata->rdy_gpio);
98 gpio_free(pdata->cd_gpio);
99} 79}
100 80
101static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 81static void viper_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
102 struct pcmcia_state *state) 82 struct pcmcia_state *state)
103{ 83{
104 struct arcom_pcmcia_pdata *pdata = viper_get_pdata();
105
106 state->detect = !gpio_get_value(pdata->cd_gpio);
107 state->ready = !!gpio_get_value(pdata->rdy_gpio);
108 state->bvd1 = 1;
109 state->bvd2 = 1;
110 state->wrprot = 0; 84 state->wrprot = 0;
111 state->vs_3v = 1; /* Can only apply 3.3V */ 85 state->vs_3v = 1; /* Can only apply 3.3V */
112 state->vs_Xv = 0; 86 state->vs_Xv = 0;
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
index 61b17d235dbe..cf07d8825513 100644
--- a/drivers/pcmcia/pxa2xx_vpac270.c
+++ b/drivers/pcmcia/pxa2xx_vpac270.c
@@ -23,29 +23,14 @@
23#include "soc_common.h" 23#include "soc_common.h"
24 24
25static struct gpio vpac270_pcmcia_gpios[] = { 25static struct gpio vpac270_pcmcia_gpios[] = {
26 { GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN, "PCMCIA Card Detect" },
27 { GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN, "PCMCIA Ready" },
28 { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" }, 26 { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" },
29 { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" }, 27 { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" },
30}; 28};
31 29
32static struct gpio vpac270_cf_gpios[] = { 30static struct gpio vpac270_cf_gpios[] = {
33 { GPIO17_VPAC270_CF_CD, GPIOF_IN, "CF Card Detect" },
34 { GPIO12_VPAC270_CF_RDY, GPIOF_IN, "CF Ready" },
35 { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" }, 31 { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" },
36}; 32};
37 33
38static struct pcmcia_irqs cd_irqs[] = {
39 {
40 .sock = 0,
41 .str = "PCMCIA CD"
42 },
43 {
44 .sock = 1,
45 .str = "CF CD"
46 },
47};
48
49static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 34static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
50{ 35{
51 int ret; 36 int ret;
@@ -54,20 +39,18 @@ static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
54 ret = gpio_request_array(vpac270_pcmcia_gpios, 39 ret = gpio_request_array(vpac270_pcmcia_gpios,
55 ARRAY_SIZE(vpac270_pcmcia_gpios)); 40 ARRAY_SIZE(vpac270_pcmcia_gpios));
56 41
57 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY); 42 skt->stat[SOC_STAT_CD].gpio = GPIO84_VPAC270_PCMCIA_CD;
58 cd_irqs[0].irq = gpio_to_irq(GPIO84_VPAC270_PCMCIA_CD); 43 skt->stat[SOC_STAT_CD].name = "PCMCIA CD";
59 44 skt->stat[SOC_STAT_RDY].gpio = GPIO35_VPAC270_PCMCIA_RDY;
60 if (!ret) 45 skt->stat[SOC_STAT_RDY].name = "PCMCIA Ready";
61 ret = soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1);
62 } else { 46 } else {
63 ret = gpio_request_array(vpac270_cf_gpios, 47 ret = gpio_request_array(vpac270_cf_gpios,
64 ARRAY_SIZE(vpac270_cf_gpios)); 48 ARRAY_SIZE(vpac270_cf_gpios));
65 49
66 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY); 50 skt->stat[SOC_STAT_CD].gpio = GPIO17_VPAC270_CF_CD;
67 cd_irqs[1].irq = gpio_to_irq(GPIO17_VPAC270_CF_CD); 51 skt->stat[SOC_STAT_CD].name = "CF CD";
68 52 skt->stat[SOC_STAT_RDY].gpio = GPIO12_VPAC270_CF_RDY;
69 if (!ret) 53 skt->stat[SOC_STAT_RDY].name = "CF Ready";
70 ret = soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1);
71 } 54 }
72 55
73 return ret; 56 return ret;
@@ -86,15 +69,6 @@ static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
86static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 69static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
87 struct pcmcia_state *state) 70 struct pcmcia_state *state)
88{ 71{
89 if (skt->nr == 0) {
90 state->detect = !gpio_get_value(GPIO84_VPAC270_PCMCIA_CD);
91 state->ready = !!gpio_get_value(GPIO35_VPAC270_PCMCIA_RDY);
92 } else {
93 state->detect = !gpio_get_value(GPIO17_VPAC270_CF_CD);
94 state->ready = !!gpio_get_value(GPIO12_VPAC270_CF_RDY);
95 }
96 state->bvd1 = 1;
97 state->bvd2 = 1;
98 state->wrprot = 0; 72 state->wrprot = 0;
99 state->vs_3v = 1; 73 state->vs_3v = 1;
100 state->vs_Xv = 0; 74 state->vs_Xv = 0;
@@ -117,14 +91,6 @@ vpac270_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
117 return 0; 91 return 0;
118} 92}
119 93
120static void vpac270_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
121{
122}
123
124static void vpac270_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
125{
126}
127
128static struct pcmcia_low_level vpac270_pcmcia_ops = { 94static struct pcmcia_low_level vpac270_pcmcia_ops = {
129 .owner = THIS_MODULE, 95 .owner = THIS_MODULE,
130 96
@@ -136,9 +102,6 @@ static struct pcmcia_low_level vpac270_pcmcia_ops = {
136 102
137 .socket_state = vpac270_pcmcia_socket_state, 103 .socket_state = vpac270_pcmcia_socket_state,
138 .configure_socket = vpac270_pcmcia_configure_socket, 104 .configure_socket = vpac270_pcmcia_configure_socket,
139
140 .socket_init = vpac270_pcmcia_socket_init,
141 .socket_suspend = vpac270_pcmcia_socket_suspend,
142}; 105};
143 106
144static struct platform_device *vpac270_pcmcia_device; 107static struct platform_device *vpac270_pcmcia_device;