diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 18:03:57 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-04 09:32:23 -0500 |
commit | f793e3ab9f4cfbdba6269c8a6c522c5d665289b1 (patch) | |
tree | 6744793c063a6c80269c36c49badc8d6e1674ff0 | |
parent | 03e0092c85e34b6f84bb3b852579b78a17496be2 (diff) |
PCMCIA: sa11x0: cerf: convert to use new irq/gpio management
Convert Cerf 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>
-rw-r--r-- | arch/arm/mach-sa1100/include/mach/cerf.h | 13 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_cerf.c | 42 |
2 files changed, 13 insertions, 42 deletions
diff --git a/arch/arm/mach-sa1100/include/mach/cerf.h b/arch/arm/mach-sa1100/include/mach/cerf.h index c3ac3d0f9465..0e49545a3723 100644 --- a/arch/arm/mach-sa1100/include/mach/cerf.h +++ b/arch/arm/mach-sa1100/include/mach/cerf.h | |||
@@ -14,15 +14,10 @@ | |||
14 | #define CERF_ETH_IO 0xf0000000 | 14 | #define CERF_ETH_IO 0xf0000000 |
15 | #define CERF_ETH_IRQ IRQ_GPIO26 | 15 | #define CERF_ETH_IRQ IRQ_GPIO26 |
16 | 16 | ||
17 | #define CERF_GPIO_CF_BVD2 GPIO_GPIO (19) | 17 | #define CERF_GPIO_CF_BVD2 19 |
18 | #define CERF_GPIO_CF_BVD1 GPIO_GPIO (20) | 18 | #define CERF_GPIO_CF_BVD1 20 |
19 | #define CERF_GPIO_CF_RESET GPIO_GPIO (21) | 19 | #define CERF_GPIO_CF_RESET GPIO_GPIO (21) |
20 | #define CERF_GPIO_CF_IRQ GPIO_GPIO (22) | 20 | #define CERF_GPIO_CF_IRQ 22 |
21 | #define CERF_GPIO_CF_CD GPIO_GPIO (23) | 21 | #define CERF_GPIO_CF_CD 23 |
22 | |||
23 | #define CERF_IRQ_GPIO_CF_BVD2 IRQ_GPIO19 | ||
24 | #define CERF_IRQ_GPIO_CF_BVD1 IRQ_GPIO20 | ||
25 | #define CERF_IRQ_GPIO_CF_IRQ IRQ_GPIO22 | ||
26 | #define CERF_IRQ_GPIO_CF_CD IRQ_GPIO23 | ||
27 | 22 | ||
28 | #endif // _INCLUDE_CERF_H_ | 23 | #endif // _INCLUDE_CERF_H_ |
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c index 30560df8c76b..9d0424ea9a4f 100644 --- a/drivers/pcmcia/sa1100_cerf.c +++ b/drivers/pcmcia/sa1100_cerf.c | |||
@@ -19,33 +19,23 @@ | |||
19 | 19 | ||
20 | #define CERF_SOCKET 1 | 20 | #define CERF_SOCKET 1 |
21 | 21 | ||
22 | static struct pcmcia_irqs irqs[] = { | ||
23 | { CERF_SOCKET, CERF_IRQ_GPIO_CF_CD, "CF_CD" }, | ||
24 | { CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD2, "CF_BVD2" }, | ||
25 | { CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD1, "CF_BVD1" } | ||
26 | }; | ||
27 | |||
28 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 22 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
29 | { | 23 | { |
30 | skt->socket.pci_irq = CERF_IRQ_GPIO_CF_IRQ; | 24 | skt->stat[SOC_STAT_CD].gpio = CERF_GPIO_CF_CD; |
31 | 25 | skt->stat[SOC_STAT_CD].name = "CF_CD"; | |
32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 26 | skt->stat[SOC_STAT_BVD1].gpio = CERF_GPIO_CF_BVD1; |
33 | } | 27 | skt->stat[SOC_STAT_BVD1].name = "CF_BVD1"; |
28 | skt->stat[SOC_STAT_BVD2].gpio = CERF_GPIO_CF_BVD2; | ||
29 | skt->stat[SOC_STAT_BVD2].name = "CF_BVD2"; | ||
30 | skt->stat[SOC_STAT_RDY].gpio = CERF_GPIO_CF_IRQ; | ||
31 | skt->stat[SOC_STAT_RDY].name = "CF_IRQ"; | ||
34 | 32 | ||
35 | static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 33 | return 0; |
36 | { | ||
37 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
38 | } | 34 | } |
39 | 35 | ||
40 | static void | 36 | static void |
41 | cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | 37 | cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) |
42 | { | 38 | { |
43 | unsigned long levels = GPLR; | ||
44 | |||
45 | state->detect = (levels & CERF_GPIO_CF_CD) ?0:1; | ||
46 | state->ready = (levels & CERF_GPIO_CF_IRQ) ?1:0; | ||
47 | state->bvd1 = (levels & CERF_GPIO_CF_BVD1)?1:0; | ||
48 | state->bvd2 = (levels & CERF_GPIO_CF_BVD2)?1:0; | ||
49 | state->wrprot = 0; | 39 | state->wrprot = 0; |
50 | state->vs_3v = 1; | 40 | state->vs_3v = 1; |
51 | state->vs_Xv = 0; | 41 | state->vs_Xv = 0; |
@@ -76,25 +66,11 @@ cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
76 | return 0; | 66 | return 0; |
77 | } | 67 | } |
78 | 68 | ||
79 | static void cerf_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
80 | { | ||
81 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
82 | } | ||
83 | |||
84 | static void cerf_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
85 | { | ||
86 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
87 | } | ||
88 | |||
89 | static struct pcmcia_low_level cerf_pcmcia_ops = { | 69 | static struct pcmcia_low_level cerf_pcmcia_ops = { |
90 | .owner = THIS_MODULE, | 70 | .owner = THIS_MODULE, |
91 | .hw_init = cerf_pcmcia_hw_init, | 71 | .hw_init = cerf_pcmcia_hw_init, |
92 | .hw_shutdown = cerf_pcmcia_hw_shutdown, | ||
93 | .socket_state = cerf_pcmcia_socket_state, | 72 | .socket_state = cerf_pcmcia_socket_state, |
94 | .configure_socket = cerf_pcmcia_configure_socket, | 73 | .configure_socket = cerf_pcmcia_configure_socket, |
95 | |||
96 | .socket_init = cerf_pcmcia_socket_init, | ||
97 | .socket_suspend = cerf_pcmcia_socket_suspend, | ||
98 | }; | 74 | }; |
99 | 75 | ||
100 | int __devinit pcmcia_cerf_init(struct device *dev) | 76 | int __devinit pcmcia_cerf_init(struct device *dev) |