aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pxa2xx_e740.c
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/pxa2xx_e740.c
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/pxa2xx_e740.c')
-rw-r--r--drivers/pcmcia/pxa2xx_e740.c70
1 files changed, 12 insertions, 58 deletions
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