aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/colibri-pxa3xx.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-03-22 21:04:17 -0400
committerEric Miao <eric.miao@marvell.com>2009-03-22 21:59:04 -0400
commitacb3655973de30cb74549986e5e118a374967702 (patch)
tree3ed765a1498c77c0dca59b0a2f82de1a96d1a5c7 /arch/arm/mach-pxa/colibri-pxa3xx.c
parent626806d96fcfe355af5e1d299f651c774f68ead0 (diff)
[ARM] pxa: Refactor Colibri board support code
- Move common function for all Colibri PXA3xx boards to the newly added colibri-pxa3xx.c - Drop some unnecessary defines from colibri.h - Make Kconfig reflect the fact that code for colibri 300 module does also work for the 310 model - Give up on the huge pin config table which was messed up with lots of #ifdefs and switch over to locally defined tables for configured functions Cc: Matthias Meier <matthias.j.meier@gmx.net> Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa3xx.c')
-rw-r--r--arch/arm/mach-pxa/colibri-pxa3xx.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c
new file mode 100644
index 000000000000..cbaa8424fc86
--- /dev/null
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-pxa/colibri-pxa3xx.c
3 *
4 * Common functions for all Toradex PXA3xx modules
5 *
6 * Daniel Mack <daniel@caiaq.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17#include <asm/mach-types.h>
18#include <mach/hardware.h>
19#include <asm/sizes.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/irq.h>
22#include <mach/pxa3xx-regs.h>
23#include <mach/mfp-pxa300.h>
24#include <mach/colibri.h>
25#include <mach/mmc.h>
26
27#include "generic.h"
28#include "devices.h"
29
30#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
31static int mmc_detect_pin;
32
33static int colibri_pxa3xx_mci_init(struct device *dev,
34 irq_handler_t colibri_mmc_detect_int,
35 void *data)
36{
37 int ret;
38
39 ret = gpio_request(mmc_detect_pin, "mmc card detect");
40 if (ret)
41 return ret;
42
43 gpio_direction_input(mmc_detect_pin);
44 ret = request_irq(gpio_to_irq(mmc_detect_pin), colibri_mmc_detect_int,
45 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
46 "MMC card detect", data);
47 if (ret) {
48 gpio_free(mmc_detect_pin);
49 return ret;
50 }
51
52 return 0;
53}
54
55static void colibri_pxa3xx_mci_exit(struct device *dev, void *data)
56{
57 free_irq(mmc_detect_pin, data);
58 gpio_free(gpio_to_irq(mmc_detect_pin));
59}
60
61static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = {
62 .detect_delay = 20,
63 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
64 .init = colibri_pxa3xx_mci_init,
65 .exit = colibri_pxa3xx_mci_exit,
66};
67
68void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin)
69{
70 pxa3xx_mfp_config(pins, len);
71 mmc_detect_pin = detect_pin;
72 pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data);
73}
74#endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */
75