diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 18:02:15 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-04 09:32:23 -0500 |
commit | 03e0092c85e34b6f84bb3b852579b78a17496be2 (patch) | |
tree | caf8b1fc6e1f1a21ea2009437c8f4657d90ef6a0 /drivers/pcmcia | |
parent | 81f33c65e6c09597e748288010476861ac5bd166 (diff) |
PCMCIA: sa11x0: assabet: convert to use new irq/gpio management
Convert Assabet socket driver to use the new irq/gpio management.
This is slightly more involved because we have to touch the private
platform header file to modify the GPIO bitmasks to be GPIO numbers.
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/sa1100_assabet.c | 64 |
1 files changed, 15 insertions, 49 deletions
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c index f1e882272ab0..618f546e19c1 100644 --- a/drivers/pcmcia/sa1100_assabet.c +++ b/drivers/pcmcia/sa1100_assabet.c | |||
@@ -10,45 +10,30 @@ | |||
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/gpio.h> | ||
13 | 14 | ||
14 | #include <mach/hardware.h> | ||
15 | #include <asm/mach-types.h> | 15 | #include <asm/mach-types.h> |
16 | #include <asm/irq.h> | ||
17 | #include <asm/signal.h> | ||
18 | #include <mach/assabet.h> | 16 | #include <mach/assabet.h> |
19 | 17 | ||
20 | #include "sa1100_generic.h" | 18 | #include "sa1100_generic.h" |
21 | 19 | ||
22 | static struct pcmcia_irqs irqs[] = { | ||
23 | { 1, ASSABET_IRQ_GPIO_CF_CD, "CF CD" }, | ||
24 | { 1, ASSABET_IRQ_GPIO_CF_BVD2, "CF BVD2" }, | ||
25 | { 1, ASSABET_IRQ_GPIO_CF_BVD1, "CF BVD1" }, | ||
26 | }; | ||
27 | |||
28 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 20 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
29 | { | 21 | { |
30 | skt->socket.pci_irq = ASSABET_IRQ_GPIO_CF_IRQ; | 22 | skt->stat[SOC_STAT_CD].gpio = ASSABET_GPIO_CF_CD; |
31 | 23 | skt->stat[SOC_STAT_CD].name = "CF CD"; | |
32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 24 | skt->stat[SOC_STAT_BVD1].gpio = ASSABET_GPIO_CF_BVD1; |
33 | } | 25 | skt->stat[SOC_STAT_BVD1].name = "CF BVD1"; |
26 | skt->stat[SOC_STAT_BVD2].gpio = ASSABET_GPIO_CF_BVD2; | ||
27 | skt->stat[SOC_STAT_BVD2].name = "CF BVD2"; | ||
28 | skt->stat[SOC_STAT_RDY].gpio = ASSABET_GPIO_CF_IRQ; | ||
29 | skt->stat[SOC_STAT_RDY].name = "CF RDY"; | ||
34 | 30 | ||
35 | /* | 31 | return 0; |
36 | * Release all resources. | ||
37 | */ | ||
38 | static void assabet_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
39 | { | ||
40 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
41 | } | 32 | } |
42 | 33 | ||
43 | static void | 34 | static void |
44 | assabet_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | 35 | assabet_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) |
45 | { | 36 | { |
46 | unsigned long levels = GPLR; | ||
47 | |||
48 | state->detect = (levels & ASSABET_GPIO_CF_CD) ? 0 : 1; | ||
49 | state->ready = (levels & ASSABET_GPIO_CF_IRQ) ? 1 : 0; | ||
50 | state->bvd1 = (levels & ASSABET_GPIO_CF_BVD1) ? 1 : 0; | ||
51 | state->bvd2 = (levels & ASSABET_GPIO_CF_BVD2) ? 1 : 0; | ||
52 | state->wrprot = 0; /* Not available on Assabet. */ | 37 | state->wrprot = 0; /* Not available on Assabet. */ |
53 | state->vs_3v = 1; /* Can only apply 3.3V on Assabet. */ | 38 | state->vs_3v = 1; /* Can only apply 3.3V on Assabet. */ |
54 | state->vs_Xv = 0; | 39 | state->vs_Xv = 0; |
@@ -78,38 +63,24 @@ assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_stat | |||
78 | return -1; | 63 | return -1; |
79 | } | 64 | } |
80 | 65 | ||
81 | /* Silently ignore Vpp, output enable, speaker enable. */ | 66 | /* Silently ignore Vpp, speaker enable. */ |
82 | 67 | ||
83 | if (state->flags & SS_RESET) | 68 | if (state->flags & SS_RESET) |
84 | mask |= ASSABET_BCR_CF_RST; | 69 | mask |= ASSABET_BCR_CF_RST; |
70 | if (!(state->flags & SS_OUTPUT_ENA)) | ||
71 | mask |= ASSABET_BCR_CF_BUS_OFF; | ||
85 | 72 | ||
86 | ASSABET_BCR_frob(ASSABET_BCR_CF_RST | ASSABET_BCR_CF_PWR, mask); | 73 | ASSABET_BCR_frob(ASSABET_BCR_CF_RST | ASSABET_BCR_CF_PWR | |
74 | ASSABET_BCR_CF_BUS_OFF, mask); | ||
87 | 75 | ||
88 | return 0; | 76 | return 0; |
89 | } | 77 | } |
90 | 78 | ||
91 | /* | 79 | /* |
92 | * Enable card status IRQs on (re-)initialisation. This can | ||
93 | * be called at initialisation, power management event, or | ||
94 | * pcmcia event. | ||
95 | */ | ||
96 | static void assabet_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
97 | { | ||
98 | /* | ||
99 | * Enable CF bus | ||
100 | */ | ||
101 | ASSABET_BCR_clear(ASSABET_BCR_CF_BUS_OFF); | ||
102 | |||
103 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
104 | } | ||
105 | |||
106 | /* | ||
107 | * Disable card status IRQs on suspend. | 80 | * Disable card status IRQs on suspend. |
108 | */ | 81 | */ |
109 | static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | 82 | static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) |
110 | { | 83 | { |
111 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
112 | |||
113 | /* | 84 | /* |
114 | * Tristate the CF bus signals. Also assert CF | 85 | * Tristate the CF bus signals. Also assert CF |
115 | * reset as per user guide page 4-11. | 86 | * reset as per user guide page 4-11. |
@@ -119,14 +90,9 @@ static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | |||
119 | 90 | ||
120 | static struct pcmcia_low_level assabet_pcmcia_ops = { | 91 | static struct pcmcia_low_level assabet_pcmcia_ops = { |
121 | .owner = THIS_MODULE, | 92 | .owner = THIS_MODULE, |
122 | |||
123 | .hw_init = assabet_pcmcia_hw_init, | 93 | .hw_init = assabet_pcmcia_hw_init, |
124 | .hw_shutdown = assabet_pcmcia_hw_shutdown, | ||
125 | |||
126 | .socket_state = assabet_pcmcia_socket_state, | 94 | .socket_state = assabet_pcmcia_socket_state, |
127 | .configure_socket = assabet_pcmcia_configure_socket, | 95 | .configure_socket = assabet_pcmcia_configure_socket, |
128 | |||
129 | .socket_init = assabet_pcmcia_socket_init, | ||
130 | .socket_suspend = assabet_pcmcia_socket_suspend, | 96 | .socket_suspend = assabet_pcmcia_socket_suspend, |
131 | }; | 97 | }; |
132 | 98 | ||