diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 17:56:32 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-04 09:32:22 -0500 |
commit | a9bb5a4bf9f84256499c802fd397d56d55227e4f (patch) | |
tree | 793a74bebd0ed3f254035cb14caa093f58bb8bf6 /drivers/pcmcia/pxa2xx_trizeps4.c | |
parent | d9dc878769f521f494d1617d7cd0c92073df75d8 (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_trizeps4.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_trizeps4.c | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c index 7c33f898135a..31fd93449913 100644 --- a/drivers/pcmcia/pxa2xx_trizeps4.c +++ b/drivers/pcmcia/pxa2xx_trizeps4.c | |||
@@ -29,32 +29,17 @@ | |||
29 | 29 | ||
30 | extern void board_pcmcia_power(int power); | 30 | extern void board_pcmcia_power(int power); |
31 | 31 | ||
32 | static struct pcmcia_irqs irqs[] = { | ||
33 | { .sock = 0, .str = "cs0_cd" } | ||
34 | /* on other baseboards we can have more inputs */ | ||
35 | }; | ||
36 | |||
37 | static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 32 | static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
38 | { | 33 | { |
39 | int ret, i; | ||
40 | /* we dont have voltage/card/ready detection | 34 | /* we dont have voltage/card/ready detection |
41 | * so we dont need interrupts for it | 35 | * so we dont need interrupts for it |
42 | */ | 36 | */ |
43 | switch (skt->nr) { | 37 | switch (skt->nr) { |
44 | case 0: | 38 | case 0: |
45 | if (gpio_request(GPIO_PRDY, "cf_irq") < 0) { | 39 | skt->stat[SOC_STAT_CD].gpio = GPIO_PCD; |
46 | pr_err("%s: sock %d unable to request gpio %d\n", __func__, | 40 | skt->stat[SOC_STAT_CD].name = "cs0_cd"; |
47 | skt->nr, GPIO_PRDY); | 41 | skt->stat[SOC_STAT_RDY].gpio = GPIO_PRDY; |
48 | return -EBUSY; | 42 | skt->stat[SOC_STAT_RDY].name = "cs0_rdy"; |
49 | } | ||
50 | if (gpio_direction_input(GPIO_PRDY) < 0) { | ||
51 | pr_err("%s: sock %d unable to set input gpio %d\n", __func__, | ||
52 | skt->nr, GPIO_PRDY); | ||
53 | gpio_free(GPIO_PRDY); | ||
54 | return -EINVAL; | ||
55 | } | ||
56 | skt->socket.pci_irq = gpio_to_irq(GPIO_PRDY); | ||
57 | irqs[0].irq = gpio_to_irq(GPIO_PCD); | ||
58 | break; | 43 | break; |
59 | default: | 44 | default: |
60 | break; | 45 | break; |
@@ -62,39 +47,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
62 | /* release the reset of this card */ | 47 | /* release the reset of this card */ |
63 | pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->socket.pci_irq); | 48 | pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->socket.pci_irq); |
64 | 49 | ||
65 | /* supplementory irqs for the socket */ | 50 | return 0; |
66 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { | ||
67 | if (irqs[i].sock != skt->nr) | ||
68 | continue; | ||
69 | if (gpio_request(irq_to_gpio(irqs[i].irq), irqs[i].str) < 0) { | ||
70 | pr_err("%s: sock %d unable to request gpio %d\n", | ||
71 | __func__, skt->nr, irq_to_gpio(irqs[i].irq)); | ||
72 | ret = -EBUSY; | ||
73 | goto error; | ||
74 | } | ||
75 | if (gpio_direction_input(irq_to_gpio(irqs[i].irq)) < 0) { | ||
76 | pr_err("%s: sock %d unable to set input gpio %d\n", | ||
77 | __func__, skt->nr, irq_to_gpio(irqs[i].irq)); | ||
78 | ret = -EINVAL; | ||
79 | goto error; | ||
80 | } | ||
81 | } | ||
82 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
83 | |||
84 | error: | ||
85 | for (; i >= 0; i--) { | ||
86 | gpio_free(irq_to_gpio(irqs[i].irq)); | ||
87 | } | ||
88 | return (ret); | ||
89 | } | ||
90 | |||
91 | static void trizeps_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
92 | { | ||
93 | int i; | ||
94 | /* free allocated gpio's */ | ||
95 | gpio_free(GPIO_PRDY); | ||
96 | for (i = 0; i < ARRAY_SIZE(irqs); i++) | ||
97 | gpio_free(irq_to_gpio(irqs[i].irq)); | ||
98 | } | 51 | } |
99 | 52 | ||
100 | static unsigned long trizeps_pcmcia_status[2]; | 53 | static unsigned long trizeps_pcmcia_status[2]; |
@@ -118,8 +71,6 @@ static void trizeps_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | |||
118 | switch (skt->nr) { | 71 | switch (skt->nr) { |
119 | case 0: | 72 | case 0: |
120 | /* just fill in fix states */ | 73 | /* just fill in fix states */ |
121 | state->detect = gpio_get_value(GPIO_PCD) ? 0 : 1; | ||
122 | state->ready = gpio_get_value(GPIO_PRDY) ? 1 : 0; | ||
123 | state->bvd1 = (status & ConXS_CFSR_BVD1) ? 1 : 0; | 74 | state->bvd1 = (status & ConXS_CFSR_BVD1) ? 1 : 0; |
124 | state->bvd2 = (status & ConXS_CFSR_BVD2) ? 1 : 0; | 75 | state->bvd2 = (status & ConXS_CFSR_BVD2) ? 1 : 0; |
125 | state->vs_3v = (status & ConXS_CFSR_VS1) ? 0 : 1; | 76 | state->vs_3v = (status & ConXS_CFSR_VS1) ? 0 : 1; |
@@ -204,7 +155,6 @@ static void trizeps_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | |||
204 | static struct pcmcia_low_level trizeps_pcmcia_ops = { | 155 | static struct pcmcia_low_level trizeps_pcmcia_ops = { |
205 | .owner = THIS_MODULE, | 156 | .owner = THIS_MODULE, |
206 | .hw_init = trizeps_pcmcia_hw_init, | 157 | .hw_init = trizeps_pcmcia_hw_init, |
207 | .hw_shutdown = trizeps_pcmcia_hw_shutdown, | ||
208 | .socket_state = trizeps_pcmcia_socket_state, | 158 | .socket_state = trizeps_pcmcia_socket_state, |
209 | .configure_socket = trizeps_pcmcia_configure_socket, | 159 | .configure_socket = trizeps_pcmcia_configure_socket, |
210 | .socket_init = trizeps_pcmcia_socket_init, | 160 | .socket_init = trizeps_pcmcia_socket_init, |