aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mx31moboard-marxbot.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/mx31moboard-marxbot.c')
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index daeb1e97da20..4fc271145b0c 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -16,7 +16,9 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/gpio.h>
19#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/interrupt.h>
20#include <linux/platform_device.h> 22#include <linux/platform_device.h>
21#include <linux/types.h> 23#include <linux/types.h>
22 24
@@ -24,6 +26,7 @@
24#include <mach/hardware.h> 26#include <mach/hardware.h>
25#include <mach/imx-uart.h> 27#include <mach/imx-uart.h>
26#include <mach/iomux-mx3.h> 28#include <mach/iomux-mx3.h>
29#include <mach/mmc.h>
27 30
28#include "devices.h" 31#include "devices.h"
29 32
@@ -46,6 +49,33 @@ static unsigned int marxbot_pins[] = {
46 MX31_PIN_TXD2__GPIO1_28, 49 MX31_PIN_TXD2__GPIO1_28,
47}; 50};
48 51
52#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
53#define SDHC2_WP IOMUX_TO_GPIO(MX31_PIN_ATA_DIOW)
54
55static int marxbot_sdhc2_get_ro(struct device *dev)
56{
57 return gpio_get_value(SDHC2_WP);
58}
59
60static int marxbot_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
61 void *data)
62{
63 return request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
64 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
65 "sdhc2-card-detect", data);
66}
67
68static void marxbot_sdhc2_exit(struct device *dev, void *data)
69{
70 free_irq(gpio_to_irq(SDHC2_CD), data);
71}
72
73static struct imxmmc_platform_data sdhc2_pdata = {
74 .get_ro = marxbot_sdhc2_get_ro,
75 .init = marxbot_sdhc2_init,
76 .exit = marxbot_sdhc2_exit,
77};
78
49/* 79/*
50 * system init for baseboard usage. Will be called by mx31moboard init. 80 * system init for baseboard usage. Will be called by mx31moboard init.
51 */ 81 */
@@ -55,4 +85,6 @@ void __init mx31moboard_marxbot_init(void)
55 85
56 mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins), 86 mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins),
57 "marxbot"); 87 "marxbot");
88
89 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
58} 90}