diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 18:06:09 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-21 09:27:02 -0500 |
commit | 3b61436a792517848ee386bd2ccf4fc3a75f1a0f (patch) | |
tree | 86c0b6149e5bbdf488aee3f2eb479cc37905e358 /drivers/pcmcia/sa1100_shannon.c | |
parent | 76346a4eabf85a44dc425c0197ba46a8884e6090 (diff) |
PCMCIA: sa11x0: shannon: convert to use new irq/gpio management
Convert Shannon 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/sa1100_shannon.c')
-rw-r--r-- | drivers/pcmcia/sa1100_shannon.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c index 7ff1b43540b8..7552d8591a29 100644 --- a/drivers/pcmcia/sa1100_shannon.c +++ b/drivers/pcmcia/sa1100_shannon.c | |||
@@ -15,39 +15,35 @@ | |||
15 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
16 | #include "sa1100_generic.h" | 16 | #include "sa1100_generic.h" |
17 | 17 | ||
18 | static struct pcmcia_irqs irqs[] = { | ||
19 | { 0, SHANNON_IRQ_GPIO_EJECT_0, "PCMCIA_CD_0" }, | ||
20 | { 1, SHANNON_IRQ_GPIO_EJECT_1, "PCMCIA_CD_1" }, | ||
21 | }; | ||
22 | |||
23 | static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 18 | static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
24 | { | 19 | { |
25 | /* All those are inputs */ | 20 | /* All those are inputs */ |
26 | GPDR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | | 21 | GAFR &= ~(GPIO_GPIO(SHANNON_GPIO_EJECT_0) | |
27 | SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1); | 22 | GPIO_GPIO(SHANNON_GPIO_EJECT_1) | |
28 | GAFR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | | 23 | GPIO_GPIO(SHANNON_GPIO_RDY_0) | |
29 | SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1); | 24 | GPIO_GPIO(SHANNON_GPIO_RDY_1)); |
30 | 25 | ||
31 | skt->socket.pci_irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0; | 26 | if (skt->nr == 0) { |
32 | 27 | skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_0; | |
33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 28 | skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_0"; |
34 | } | 29 | skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_0; |
30 | skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_0"; | ||
31 | } else { | ||
32 | skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_1; | ||
33 | skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_1"; | ||
34 | skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_1; | ||
35 | skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_1"; | ||
36 | } | ||
35 | 37 | ||
36 | static void shannon_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 38 | return 0; |
37 | { | ||
38 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
39 | } | 39 | } |
40 | 40 | ||
41 | static void | 41 | static void |
42 | shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 42 | shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
43 | struct pcmcia_state *state) | 43 | struct pcmcia_state *state) |
44 | { | 44 | { |
45 | unsigned long levels = GPLR; | ||
46 | |||
47 | switch (skt->nr) { | 45 | switch (skt->nr) { |
48 | case 0: | 46 | case 0: |
49 | state->detect = (levels & SHANNON_GPIO_EJECT_0) ? 0 : 1; | ||
50 | state->ready = (levels & SHANNON_GPIO_RDY_0) ? 1 : 0; | ||
51 | state->wrprot = 0; /* Not available on Shannon. */ | 47 | state->wrprot = 0; /* Not available on Shannon. */ |
52 | state->bvd1 = 1; | 48 | state->bvd1 = 1; |
53 | state->bvd2 = 1; | 49 | state->bvd2 = 1; |
@@ -56,8 +52,6 @@ shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | |||
56 | break; | 52 | break; |
57 | 53 | ||
58 | case 1: | 54 | case 1: |
59 | state->detect = (levels & SHANNON_GPIO_EJECT_1) ? 0 : 1; | ||
60 | state->ready = (levels & SHANNON_GPIO_RDY_1) ? 1 : 0; | ||
61 | state->wrprot = 0; /* Not available on Shannon. */ | 55 | state->wrprot = 0; /* Not available on Shannon. */ |
62 | state->bvd1 = 1; | 56 | state->bvd1 = 1; |
63 | state->bvd2 = 1; | 57 | state->bvd2 = 1; |
@@ -92,25 +86,11 @@ shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
92 | return 0; | 86 | return 0; |
93 | } | 87 | } |
94 | 88 | ||
95 | static void shannon_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
96 | { | ||
97 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
98 | } | ||
99 | |||
100 | static void shannon_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
101 | { | ||
102 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
103 | } | ||
104 | |||
105 | static struct pcmcia_low_level shannon_pcmcia_ops = { | 89 | static struct pcmcia_low_level shannon_pcmcia_ops = { |
106 | .owner = THIS_MODULE, | 90 | .owner = THIS_MODULE, |
107 | .hw_init = shannon_pcmcia_hw_init, | 91 | .hw_init = shannon_pcmcia_hw_init, |
108 | .hw_shutdown = shannon_pcmcia_hw_shutdown, | ||
109 | .socket_state = shannon_pcmcia_socket_state, | 92 | .socket_state = shannon_pcmcia_socket_state, |
110 | .configure_socket = shannon_pcmcia_configure_socket, | 93 | .configure_socket = shannon_pcmcia_configure_socket, |
111 | |||
112 | .socket_init = shannon_pcmcia_socket_init, | ||
113 | .socket_suspend = shannon_pcmcia_socket_suspend, | ||
114 | }; | 94 | }; |
115 | 95 | ||
116 | int __devinit pcmcia_shannon_init(struct device *dev) | 96 | int __devinit pcmcia_shannon_init(struct device *dev) |