diff options
author | Dmitry Artamonow <mad_soft@inbox.ru> | 2009-11-27 06:02:28 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-06 11:52:55 -0500 |
commit | 22f9740552b89c9f458f972f881d222b298ab165 (patch) | |
tree | 71939e8d7636afd8422bd18c00c8b33679f9c92a /drivers/pcmcia | |
parent | 2eec62d7dbaa8ed05f318d88f938a86fcf274b34 (diff) |
ARM: 5814/1: SA1100: h3100/h3600: convert all users of assign_h3600_egpio to gpiolib
Use of gpio_request/gpio_free in some callbacks may look ugly, but
corresponding drivers (sa1100_serial and sa1100_fb) don't provide (yet)
init/exit hooks and registering these gpios in *_mach_init is also
not possible, because htc-gpio driver starts a bit later...
Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/sa1100_h3600.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c index 97e5667fb2e3..fd7af123053c 100644 --- a/drivers/pcmcia/sa1100_h3600.c +++ b/drivers/pcmcia/sa1100_h3600.c | |||
@@ -47,9 +47,33 @@ static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
47 | goto err02; | 47 | goto err02; |
48 | irqs[0].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD0); | 48 | irqs[0].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD0); |
49 | 49 | ||
50 | err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 50 | err = gpio_request(H3XXX_EGPIO_OPT_NVRAM_ON, "OPT NVRAM ON"); |
51 | if (err) | 51 | if (err) |
52 | goto err02; | 52 | goto err02; |
53 | err = gpio_direction_output(H3XXX_EGPIO_OPT_NVRAM_ON, 0); | ||
54 | if (err) | ||
55 | goto err03; | ||
56 | err = gpio_request(H3XXX_EGPIO_OPT_ON, "OPT ON"); | ||
57 | if (err) | ||
58 | goto err03; | ||
59 | err = gpio_direction_output(H3XXX_EGPIO_OPT_ON, 0); | ||
60 | if (err) | ||
61 | goto err04; | ||
62 | err = gpio_request(H3XXX_EGPIO_OPT_RESET, "OPT RESET"); | ||
63 | if (err) | ||
64 | goto err04; | ||
65 | err = gpio_direction_output(H3XXX_EGPIO_OPT_RESET, 0); | ||
66 | if (err) | ||
67 | goto err05; | ||
68 | err = gpio_request(H3XXX_EGPIO_CARD_RESET, "PCMCIA CARD RESET"); | ||
69 | if (err) | ||
70 | goto err05; | ||
71 | err = gpio_direction_output(H3XXX_EGPIO_CARD_RESET, 0); | ||
72 | if (err) | ||
73 | goto err06; | ||
74 | err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
75 | if (err) | ||
76 | goto err06; | ||
53 | break; | 77 | break; |
54 | case 1: | 78 | case 1: |
55 | err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ1, "PCMCIA IRQ1"); | 79 | err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ1, "PCMCIA IRQ1"); |
@@ -75,6 +99,10 @@ static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
75 | } | 99 | } |
76 | return 0; | 100 | return 0; |
77 | 101 | ||
102 | err06: gpio_free(H3XXX_EGPIO_CARD_RESET); | ||
103 | err05: gpio_free(H3XXX_EGPIO_OPT_RESET); | ||
104 | err04: gpio_free(H3XXX_EGPIO_OPT_ON); | ||
105 | err03: gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON); | ||
78 | err02: gpio_free(H3XXX_GPIO_PCMCIA_CD0); | 106 | err02: gpio_free(H3XXX_GPIO_PCMCIA_CD0); |
79 | err01: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); | 107 | err01: gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); |
80 | err00: return err; | 108 | err00: return err; |
@@ -88,12 +116,17 @@ static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | |||
88 | { | 116 | { |
89 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 117 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
90 | 118 | ||
91 | /* Disable CF bus: */ | ||
92 | assign_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON, 0); | ||
93 | assign_h3600_egpio(IPAQ_EGPIO_OPT_ON, 0); | ||
94 | assign_h3600_egpio(IPAQ_EGPIO_OPT_RESET, 1); | ||
95 | switch (skt->nr) { | 119 | switch (skt->nr) { |
96 | case 0: | 120 | case 0: |
121 | /* Disable CF bus: */ | ||
122 | gpio_set_value(H3XXX_EGPIO_OPT_NVRAM_ON, 0); | ||
123 | gpio_set_value(H3XXX_EGPIO_OPT_ON, 0); | ||
124 | gpio_set_value(H3XXX_EGPIO_OPT_RESET, 1); | ||
125 | |||
126 | gpio_free(H3XXX_EGPIO_CARD_RESET); | ||
127 | gpio_free(H3XXX_EGPIO_OPT_RESET); | ||
128 | gpio_free(H3XXX_EGPIO_OPT_ON); | ||
129 | gpio_free(H3XXX_EGPIO_OPT_NVRAM_ON); | ||
97 | gpio_free(H3XXX_GPIO_PCMCIA_CD0); | 130 | gpio_free(H3XXX_GPIO_PCMCIA_CD0); |
98 | gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); | 131 | gpio_free(H3XXX_GPIO_PCMCIA_IRQ0); |
99 | break; | 132 | break; |
@@ -139,7 +172,7 @@ h3600_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_ | |||
139 | return -1; | 172 | return -1; |
140 | } | 173 | } |
141 | 174 | ||
142 | assign_h3600_egpio(IPAQ_EGPIO_CARD_RESET, !!(state->flags & SS_RESET)); | 175 | gpio_set_value(H3XXX_EGPIO_CARD_RESET, !!(state->flags & SS_RESET)); |
143 | 176 | ||
144 | /* Silently ignore Vpp, output enable, speaker enable. */ | 177 | /* Silently ignore Vpp, output enable, speaker enable. */ |
145 | 178 | ||
@@ -149,9 +182,9 @@ h3600_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_ | |||
149 | static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | 182 | static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt) |
150 | { | 183 | { |
151 | /* Enable CF bus: */ | 184 | /* Enable CF bus: */ |
152 | assign_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON, 1); | 185 | gpio_set_value(H3XXX_EGPIO_OPT_NVRAM_ON, 1); |
153 | assign_h3600_egpio(IPAQ_EGPIO_OPT_ON, 1); | 186 | gpio_set_value(H3XXX_EGPIO_OPT_ON, 1); |
154 | assign_h3600_egpio(IPAQ_EGPIO_OPT_RESET, 0); | 187 | gpio_set_value(H3XXX_EGPIO_OPT_RESET, 0); |
155 | 188 | ||
156 | msleep(10); | 189 | msleep(10); |
157 | 190 | ||
@@ -169,10 +202,10 @@ static void h3600_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | |||
169 | * socket 0 then socket 1. | 202 | * socket 0 then socket 1. |
170 | */ | 203 | */ |
171 | if (skt->nr == 1) { | 204 | if (skt->nr == 1) { |
172 | assign_h3600_egpio(IPAQ_EGPIO_OPT_ON, 0); | 205 | gpio_set_value(H3XXX_EGPIO_OPT_ON, 0); |
173 | assign_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON, 0); | 206 | gpio_set_value(H3XXX_EGPIO_OPT_NVRAM_ON, 0); |
174 | /* hmm, does this suck power? */ | 207 | /* hmm, does this suck power? */ |
175 | assign_h3600_egpio(IPAQ_EGPIO_OPT_RESET, 1); | 208 | gpio_set_value(H3XXX_EGPIO_OPT_RESET, 1); |
176 | } | 209 | } |
177 | } | 210 | } |
178 | 211 | ||