diff options
author | walker@suse.cz <walker@suse.cz> | 2009-08-31 13:25:57 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-09-10 06:49:38 -0400 |
commit | 7dafdf3d22a59499a1d4dddeb626c0bc76ef455d (patch) | |
tree | 5176372cdca1f5545384e429cc89996b86bf0b55 | |
parent | 93dd29a818a0fdb485a8f10bac58f5993e55d9c8 (diff) |
[ARM] pxa/treo680: pxamci simplify to use GPIO
Signed-off-by: Tomáš Čech <sleep_walker@suse.cz>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r-- | arch/arm/mach-pxa/treo680.c | 84 |
1 files changed, 4 insertions, 80 deletions
diff --git a/arch/arm/mach-pxa/treo680.c b/arch/arm/mach-pxa/treo680.c index 753ec4df17b9..5d3ec0807708 100644 --- a/arch/arm/mach-pxa/treo680.c +++ b/arch/arm/mach-pxa/treo680.c | |||
@@ -153,87 +153,11 @@ static unsigned long treo680_pin_config[] __initdata = { | |||
153 | /****************************************************************************** | 153 | /****************************************************************************** |
154 | * SD/MMC card controller | 154 | * SD/MMC card controller |
155 | ******************************************************************************/ | 155 | ******************************************************************************/ |
156 | static int treo680_mci_init(struct device *dev, | ||
157 | irq_handler_t treo680_detect_int, void *data) | ||
158 | { | ||
159 | int err = 0; | ||
160 | |||
161 | /* Setup an interrupt for detecting card insert/remove events */ | ||
162 | err = gpio_request(GPIO_NR_TREO680_SD_DETECT_N, "SD IRQ"); | ||
163 | |||
164 | if (err) | ||
165 | goto err; | ||
166 | |||
167 | err = gpio_direction_input(GPIO_NR_TREO680_SD_DETECT_N); | ||
168 | if (err) | ||
169 | goto err2; | ||
170 | |||
171 | err = request_irq(gpio_to_irq(GPIO_NR_TREO680_SD_DETECT_N), | ||
172 | treo680_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
173 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
174 | "SD/MMC card detect", data); | ||
175 | |||
176 | if (err) { | ||
177 | dev_err(dev, "%s: cannot request SD/MMC card detect IRQ\n", | ||
178 | __func__); | ||
179 | goto err2; | ||
180 | } | ||
181 | |||
182 | err = gpio_request(GPIO_NR_TREO680_SD_POWER, "SD_POWER"); | ||
183 | if (err) | ||
184 | goto err3; | ||
185 | |||
186 | err = gpio_direction_output(GPIO_NR_TREO680_SD_POWER, 1); | ||
187 | if (err) | ||
188 | goto err4; | ||
189 | |||
190 | err = gpio_request(GPIO_NR_TREO680_SD_READONLY, "SD_READONLY"); | ||
191 | if (err) | ||
192 | goto err4; | ||
193 | |||
194 | err = gpio_direction_input(GPIO_NR_TREO680_SD_READONLY); | ||
195 | if (err) | ||
196 | goto err5; | ||
197 | |||
198 | return 0; | ||
199 | |||
200 | err5: | ||
201 | gpio_free(GPIO_NR_TREO680_SD_READONLY); | ||
202 | err4: | ||
203 | gpio_free(GPIO_NR_TREO680_SD_POWER); | ||
204 | err3: | ||
205 | free_irq(gpio_to_irq(GPIO_NR_TREO680_SD_DETECT_N), data); | ||
206 | err2: | ||
207 | gpio_free(GPIO_NR_TREO680_SD_DETECT_N); | ||
208 | err: | ||
209 | return err; | ||
210 | } | ||
211 | |||
212 | static void treo680_mci_exit(struct device *dev, void *data) | ||
213 | { | ||
214 | gpio_free(GPIO_NR_TREO680_SD_READONLY); | ||
215 | gpio_free(GPIO_NR_TREO680_SD_POWER); | ||
216 | free_irq(gpio_to_irq(GPIO_NR_TREO680_SD_DETECT_N), data); | ||
217 | gpio_free(GPIO_NR_TREO680_SD_DETECT_N); | ||
218 | } | ||
219 | |||
220 | static void treo680_mci_power(struct device *dev, unsigned int vdd) | ||
221 | { | ||
222 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
223 | gpio_set_value(GPIO_NR_TREO680_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
224 | } | ||
225 | |||
226 | static int treo680_mci_get_ro(struct device *dev) | ||
227 | { | ||
228 | return gpio_get_value(GPIO_NR_TREO680_SD_READONLY); | ||
229 | } | ||
230 | |||
231 | static struct pxamci_platform_data treo680_mci_platform_data = { | 156 | static struct pxamci_platform_data treo680_mci_platform_data = { |
232 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 157 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
233 | .setpower = treo680_mci_power, | 158 | .gpio_card_detect = GPIO_NR_TREO680_SD_DETECT_N, |
234 | .get_ro = treo680_mci_get_ro, | 159 | .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY, |
235 | .init = treo680_mci_init, | 160 | .gpio_power = GPIO_NR_TREO680_SD_POWER, |
236 | .exit = treo680_mci_exit, | ||
237 | }; | 161 | }; |
238 | 162 | ||
239 | /****************************************************************************** | 163 | /****************************************************************************** |