aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/cm-x270.c
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2009-07-06 16:16:42 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-09-10 06:49:30 -0400
commit7a648256b20c493c99757fe1d248daf7954647bc (patch)
tree82aa6566accc96ea07a89121cb9779090a6dab40 /arch/arm/mach-pxa/cm-x270.c
parentb405db6c015fe8e4c9d8199a0355bb16d95d7049 (diff)
[ARM] pxa: factor pxamci gpio handling
Several boards use always the same pattern with pxamci : request gpio, request irq for that gpio to detect MMC card insertion, request gpio for read-only mode detection, etc ... Now that pxamci provides platform_data to describe simple gpio management of the MMC external controls, use it. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Mike Rapoport <mike@compulab.co.il> Acked-by: Philipp Zabel <philipp.zabel@gmail.com> Acked-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: rpurdie@rpsys.net Cc: drwyrm@gmail.com Cc: sakoman@gmail.com Cc: marek.vasut@gmail.com Cc: s.hauer@pengutronix.de Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/cm-x270.c')
-rw-r--r--arch/arm/mach-pxa/cm-x270.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 1d2cec25391d..59292181088c 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -271,56 +271,12 @@ static inline void cmx270_init_ohci(void) {}
271#endif 271#endif
272 272
273#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) 273#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
274static int cmx270_mci_init(struct device *dev,
275 irq_handler_t cmx270_detect_int,
276 void *data)
277{
278 int err;
279
280 err = gpio_request(GPIO105_MMC_POWER, "MMC/SD power");
281 if (err) {
282 dev_warn(dev, "power gpio unavailable\n");
283 return err;
284 }
285
286 gpio_direction_output(GPIO105_MMC_POWER, 0);
287
288 err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int,
289 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
290 "MMC card detect", data);
291 if (err) {
292 gpio_free(GPIO105_MMC_POWER);
293 dev_err(dev, "cmx270_mci_init: MMC/SD: can't"
294 " request MMC card detect IRQ\n");
295 }
296
297 return err;
298}
299
300static void cmx270_mci_setpower(struct device *dev, unsigned int vdd)
301{
302 struct pxamci_platform_data *p_d = dev->platform_data;
303
304 if ((1 << vdd) & p_d->ocr_mask) {
305 dev_dbg(dev, "power on\n");
306 gpio_set_value(GPIO105_MMC_POWER, 0);
307 } else {
308 gpio_set_value(GPIO105_MMC_POWER, 1);
309 dev_dbg(dev, "power off\n");
310 }
311}
312
313static void cmx270_mci_exit(struct device *dev, void *data)
314{
315 free_irq(CMX270_MMC_IRQ, data);
316 gpio_free(GPIO105_MMC_POWER);
317}
318
319static struct pxamci_platform_data cmx270_mci_platform_data = { 274static struct pxamci_platform_data cmx270_mci_platform_data = {
320 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 275 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
321 .init = cmx270_mci_init, 276 .gpio_card_detect = GPIO83_MMC_IRQ,
322 .setpower = cmx270_mci_setpower, 277 .gpio_card_ro = -1,
323 .exit = cmx270_mci_exit, 278 .gpio_power = GPIO105_MMC_POWER,
279 .gpio_power_invert = 1,
324}; 280};
325 281
326static void __init cmx270_init_mmc(void) 282static void __init cmx270_init_mmc(void)