diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-12-19 08:32:07 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-03-13 05:34:39 -0400 |
commit | 7c107dcb652c2101426adfc3193140db95b44594 (patch) | |
tree | 50aa0256a8fd8fe730855a276fb396d32ed1bc95 /arch/arm/mach-mx2 | |
parent | f2cb641f565dccebfa934b1a940bc6517734d391 (diff) |
pcm970 baseboard: Add SDHC support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx2')
-rw-r--r-- | arch/arm/mach-mx2/pcm970-baseboard.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c index 232e0416f15b..bf4e520bc1bc 100644 --- a/arch/arm/mach-mx2/pcm970-baseboard.c +++ b/arch/arm/mach-mx2/pcm970-baseboard.c | |||
@@ -17,16 +17,78 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/gpio.h> | ||
21 | #include <linux/irq.h> | ||
20 | 22 | ||
21 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
22 | 24 | ||
23 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
24 | #include <mach/common.h> | 26 | #include <mach/common.h> |
27 | #include <mach/mmc.h> | ||
25 | #include <mach/imxfb.h> | 28 | #include <mach/imxfb.h> |
26 | #include <mach/iomux.h> | 29 | #include <mach/iomux.h> |
27 | 30 | ||
28 | #include "devices.h" | 31 | #include "devices.h" |
29 | 32 | ||
33 | static int pcm970_sdhc2_get_ro(struct device *dev) | ||
34 | { | ||
35 | return gpio_get_value(GPIO_PORTC + 28); | ||
36 | } | ||
37 | |||
38 | static int pcm970_sdhc2_pins[] = { | ||
39 | PB4_PF_SD2_D0, | ||
40 | PB5_PF_SD2_D1, | ||
41 | PB6_PF_SD2_D2, | ||
42 | PB7_PF_SD2_D3, | ||
43 | PB8_PF_SD2_CMD, | ||
44 | PB9_PF_SD2_CLK, | ||
45 | }; | ||
46 | |||
47 | static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data) | ||
48 | { | ||
49 | int ret; | ||
50 | |||
51 | ret = mxc_gpio_setup_multiple_pins(pcm970_sdhc2_pins, | ||
52 | ARRAY_SIZE(pcm970_sdhc2_pins), "sdhc2"); | ||
53 | if(ret) | ||
54 | return ret; | ||
55 | |||
56 | ret = request_irq(IRQ_GPIOC(29), detect_irq, 0, | ||
57 | "imx-mmc-detect", data); | ||
58 | if (ret) | ||
59 | goto out_release_gpio; | ||
60 | |||
61 | set_irq_type(IRQ_GPIOC(29), IRQF_TRIGGER_FALLING); | ||
62 | |||
63 | ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro"); | ||
64 | if (ret) | ||
65 | goto out_release_gpio; | ||
66 | |||
67 | mxc_gpio_mode((GPIO_PORTC | 28) | GPIO_GPIO | GPIO_IN); | ||
68 | gpio_direction_input(GPIO_PORTC + 28); | ||
69 | |||
70 | return 0; | ||
71 | |||
72 | out_release_gpio: | ||
73 | mxc_gpio_release_multiple_pins(pcm970_sdhc2_pins, | ||
74 | ARRAY_SIZE(pcm970_sdhc2_pins)); | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | static void pcm970_sdhc2_exit(struct device *dev, void *data) | ||
79 | { | ||
80 | free_irq(IRQ_GPIOC(29), data); | ||
81 | gpio_free(GPIO_PORTC + 28); | ||
82 | mxc_gpio_release_multiple_pins(pcm970_sdhc2_pins, | ||
83 | ARRAY_SIZE(pcm970_sdhc2_pins)); | ||
84 | } | ||
85 | |||
86 | static struct imxmmc_platform_data sdhc_pdata = { | ||
87 | .get_ro = pcm970_sdhc2_get_ro, | ||
88 | .init = pcm970_sdhc2_init, | ||
89 | .exit = pcm970_sdhc2_exit, | ||
90 | }; | ||
91 | |||
30 | static int mxc_fb_pins[] = { | 92 | static int mxc_fb_pins[] = { |
31 | PA5_PF_LSCLK, PA6_PF_LD0, PA7_PF_LD1, PA8_PF_LD2, | 93 | PA5_PF_LSCLK, PA6_PF_LD0, PA7_PF_LD1, PA8_PF_LD2, |
32 | PA9_PF_LD3, PA10_PF_LD4, PA11_PF_LD5, PA12_PF_LD6, | 94 | PA9_PF_LD3, PA10_PF_LD4, PA11_PF_LD5, PA12_PF_LD6, |
@@ -96,4 +158,5 @@ static struct imx_fb_platform_data pcm038_fb_data = { | |||
96 | void __init pcm970_baseboard_init(void) | 158 | void __init pcm970_baseboard_init(void) |
97 | { | 159 | { |
98 | mxc_register_device(&mxc_fb_device, &pcm038_fb_data); | 160 | mxc_register_device(&mxc_fb_device, &pcm038_fb_data); |
161 | mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); | ||
99 | } | 162 | } |