aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-13 18:07:26 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-21 09:27:03 -0500
commit65474b457c323fa54aaff146e7caca9c0b37050f (patch)
tree6521ae0243c835d3305cf68df97415f488bab9c3
parentb1d8a5f91796179f33de9cd7fb26052fcc47b4fa (diff)
PCMCIA: sa11x0: h3600: convert to use new irq/gpio management
Convert iPAQ socket driver to use the new irq/gpio management. As this already uses the GPIO subsystem, these changes are localized to just the PCMCIA directory. Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/pcmcia/sa1100_h3600.c95
1 files changed, 15 insertions, 80 deletions
diff --git a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c
index edf8f0028898..410a636dbfc8 100644
--- a/drivers/pcmcia/sa1100_h3600.c
+++ b/drivers/pcmcia/sa1100_h3600.c
@@ -19,36 +19,20 @@
19 19
20#include "sa1100_generic.h" 20#include "sa1100_generic.h"
21 21
22static struct pcmcia_irqs irqs[] = {
23 { .sock = 0, .str = "PCMCIA CD0" }, /* .irq will be filled later */
24 { .sock = 1, .str = "PCMCIA CD1" }
25};
26
27static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 22static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
28{ 23{
29 int err; 24 int err;
30 25
31 switch (skt->nr) { 26 switch (skt->nr) {
32 case 0: 27 case 0:
33 err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ0, "PCMCIA IRQ0"); 28 skt->stat[SOC_STAT_CD].gpio = H3XXX_GPIO_PCMCIA_CD0;
34 if (err) 29 skt->stat[SOC_STAT_CD].name = "PCMCIA CD0";
35 goto err00; 30 skt->stat[SOC_STAT_RDY].gpio = H3XXX_GPIO_PCMCIA_IRQ0;
36 err = gpio_direction_input(H3XXX_GPIO_PCMCIA_IRQ0); 31 skt->stat[SOC_STAT_RDY].name = "PCMCIA IRQ0";
37 if (err)
38 goto err01;
39 skt->socket.pci_irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_IRQ0);
40
41 err = gpio_request(H3XXX_GPIO_PCMCIA_CD0, "PCMCIA CD0");
42 if (err)
43 goto err01;
44 err = gpio_direction_input(H3XXX_GPIO_PCMCIA_CD0);
45 if (err)
46 goto err02;
47 irqs[0].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD0);
48 32
49 err = gpio_request(H3XXX_EGPIO_OPT_NVRAM_ON, "OPT NVRAM ON"); 33 err = gpio_request(H3XXX_EGPIO_OPT_NVRAM_ON, "OPT NVRAM ON");
50 if (err) 34 if (err)
51 goto err02; 35 goto err01;
52 err = gpio_direction_output(H3XXX_EGPIO_OPT_NVRAM_ON, 0); 36 err = gpio_direction_output(H3XXX_EGPIO_OPT_NVRAM_ON, 0);
53 if (err) 37 if (err)
54 goto err03; 38 goto err03;
@@ -70,30 +54,12 @@ static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
70 err = gpio_direction_output(H3XXX_EGPIO_CARD_RESET, 0); 54 err = gpio_direction_output(H3XXX_EGPIO_CARD_RESET, 0);
71 if (err) 55 if (err)
72 goto err06; 56 goto err06;
73 err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
74 if (err)
75 goto err06;
76 break; 57 break;
77 case 1: 58 case 1:
78 err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ1, "PCMCIA IRQ1"); 59 skt->stat[SOC_STAT_CD].gpio = H3XXX_GPIO_PCMCIA_CD1;
79 if (err) 60 skt->stat[SOC_STAT_CD].name = "PCMCIA CD1";
80 goto err10; 61 skt->stat[SOC_STAT_RDY].gpio = H3XXX_GPIO_PCMCIA_IRQ1;
81 err = gpio_direction_input(H3XXX_GPIO_PCMCIA_IRQ1); 62 skt->stat[SOC_STAT_RDY].name = "PCMCIA IRQ1";
82 if (err)
83 goto err11;
84 skt->socket.pci_irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_IRQ1);
85
86 err = gpio_request(H3XXX_GPIO_PCMCIA_CD1, "PCMCIA CD1");
87 if (err)
88 goto err11;
89 err = gpio_direction_input(H3XXX_GPIO_PCMCIA_CD1);
90 if (err)
91 goto err12;
92 irqs[1].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD1);
93
94 err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
95 if (err)
96 goto err12;
97 break; 63 break;
98 } 64 }
99 return 0; 65 return 0;
@@ -102,19 +68,12 @@ err06: gpio_free(H3XXX_EGPIO_CARD_RESET);
102err05: gpio_free(H3XXX_EGPIO_OPT_RESET); 68err05: gpio_free(H3XXX_EGPIO_OPT_RESET);
103err04: gpio_free(H3XXX_EGPIO_OPT_ON); 69err04: gpio_free(H3XXX_EGPIO_OPT_ON);
104err03: gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON); 70err03: gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON);
105err02: gpio_free(H3XXX_GPIO_PCMCIA_CD0);
106err01: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); 71err01: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0);
107err00: return err; 72 return err;
108
109err12: gpio_free(H3XXX_GPIO_PCMCIA_CD0);
110err11: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0);
111err10: return err;
112} 73}
113 74
114static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 75static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
115{ 76{
116 soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
117
118 switch (skt->nr) { 77 switch (skt->nr) {
119 case 0: 78 case 0:
120 /* Disable CF bus: */ 79 /* Disable CF bus: */
@@ -126,12 +85,8 @@ static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
126 gpio_free(H3XXX_EGPIO_OPT_RESET); 85 gpio_free(H3XXX_EGPIO_OPT_RESET);
127 gpio_free(H3XXX_EGPIO_OPT_ON); 86 gpio_free(H3XXX_EGPIO_OPT_ON);
128 gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON); 87 gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON);
129 gpio_free(H3XXX_GPIO_PCMCIA_CD0);
130 gpio_free(H3XXX_GPIO_PCMCIA_IRQ0);
131 break; 88 break;
132 case 1: 89 case 1:
133 gpio_free(H3XXX_GPIO_PCMCIA_CD1);
134 gpio_free(H3XXX_GPIO_PCMCIA_IRQ1);
135 break; 90 break;
136 } 91 }
137} 92}
@@ -139,27 +94,11 @@ static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
139static void 94static void
140h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) 95h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
141{ 96{
142 switch (skt->nr) { 97 state->bvd1 = 0;
143 case 0: 98 state->bvd2 = 0;
144 state->detect = !gpio_get_value(H3XXX_GPIO_PCMCIA_CD0); 99 state->wrprot = 0; /* Not available on H3600. */
145 state->ready = !!gpio_get_value(H3XXX_GPIO_PCMCIA_IRQ0); 100 state->vs_3v = 0;
146 state->bvd1 = 0; 101 state->vs_Xv = 0;
147 state->bvd2 = 0;
148 state->wrprot = 0; /* Not available on H3600. */
149 state->vs_3v = 0;
150 state->vs_Xv = 0;
151 break;
152
153 case 1:
154 state->detect = !gpio_get_value(H3XXX_GPIO_PCMCIA_CD1);
155 state->ready = !!gpio_get_value(H3XXX_GPIO_PCMCIA_IRQ1);
156 state->bvd1 = 0;
157 state->bvd2 = 0;
158 state->wrprot = 0; /* Not available on H3600. */
159 state->vs_3v = 0;
160 state->vs_Xv = 0;
161 break;
162 }
163} 102}
164 103
165static int 104static int
@@ -186,14 +125,10 @@ static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
186 gpio_set_value(H3XXX_EGPIO_OPT_RESET, 0); 125 gpio_set_value(H3XXX_EGPIO_OPT_RESET, 0);
187 126
188 msleep(10); 127 msleep(10);
189
190 soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
191} 128}
192 129
193static void h3600_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) 130static void h3600_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
194{ 131{
195 soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
196
197 /* 132 /*
198 * FIXME: This doesn't fit well. We don't have the mechanism in 133 * FIXME: This doesn't fit well. We don't have the mechanism in
199 * the generic PCMCIA layer to deal with the idea of two sockets 134 * the generic PCMCIA layer to deal with the idea of two sockets