aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValentin Longchamp <valentin.longchamp@epfl.ch>2009-04-21 04:24:56 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-07 10:17:57 -0400
commit45b131a78ceeb3bc776db08c8eaa67d4676b6cd7 (patch)
tree49b6c4894ba2bcb31573099f2ead67d68a6ec9ac
parent4ec6ecc77872a57b471b60dce298ed25556944f0 (diff)
mx31moboard: add sdhc support (v3)
This support both sdhc1 and sdhc2 with WP and CD for the marxbot and devboard mx31moboard baseboards. sdhc2 is present on both, but is not directly included in the mx31moboard file because a third baseboard (not supported yet) without sdhc2 is planned. Changes since v1: removed pin initialization from init/exit function and taken different comments into account Changes since v2: pin initialiation now is done in another patch for all current mx31moboard pins Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c32
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c32
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c32
3 files changed, 96 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 59b3a744c560..0a69a4f212a3 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.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/imx-uart.h> 26#include <mach/imx-uart.h>
25#include <mach/iomux-mx3.h> 27#include <mach/iomux-mx3.h>
26#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/mmc.h>
27 30
28#include "devices.h" 31#include "devices.h"
29 32
@@ -42,6 +45,33 @@ static struct imxuart_platform_data uart_pdata = {
42 .flags = IMXUART_HAVE_RTSCTS, 45 .flags = IMXUART_HAVE_RTSCTS,
43}; 46};
44 47
48#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
49#define SDHC2_WP IOMUX_TO_GPIO(MX31_PIN_ATA_DIOW)
50
51static int devboard_sdhc2_get_ro(struct device *dev)
52{
53 return gpio_get_value(SDHC2_WP);
54}
55
56static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
57 void *data)
58{
59 return request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
60 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
61 "sdhc2-card-detect", data);
62}
63
64static void devboard_sdhc2_exit(struct device *dev, void *data)
65{
66 free_irq(gpio_to_irq(SDHC2_CD), data);
67}
68
69static struct imxmmc_platform_data sdhc2_pdata = {
70 .get_ro = devboard_sdhc2_get_ro,
71 .init = devboard_sdhc2_init,
72 .exit = devboard_sdhc2_exit,
73};
74
45/* 75/*
46 * system init for baseboard usage. Will be called by mx31moboard init. 76 * system init for baseboard usage. Will be called by mx31moboard init.
47 */ 77 */
@@ -53,4 +83,6 @@ void __init mx31moboard_devboard_init(void)
53 "devboard"); 83 "devboard");
54 84
55 mxc_register_device(&mxc_uart_device1, &uart_pdata); 85 mxc_register_device(&mxc_uart_device1, &uart_pdata);
86
87 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
56} 88}
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}
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index d846527e1a59..2cca3f2e72b9 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.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/memory.h> 22#include <linux/memory.h>
21#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
22#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
@@ -33,6 +35,7 @@
33#include <mach/imx-uart.h> 35#include <mach/imx-uart.h>
34#include <mach/iomux-mx3.h> 36#include <mach/iomux-mx3.h>
35#include <mach/i2c.h> 37#include <mach/i2c.h>
38#include <mach/mmc.h>
36 39
37#include "devices.h" 40#include "devices.h"
38 41
@@ -98,6 +101,33 @@ static struct imxi2c_platform_data moboard_i2c1_pdata = {
98 .bitrate = 100000, 101 .bitrate = 100000,
99}; 102};
100 103
104#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
105#define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
106
107static int moboard_sdhc1_get_ro(struct device *dev)
108{
109 return gpio_get_value(SDHC1_WP);
110}
111
112static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
113 void *data)
114{
115 return request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
116 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
117 "sdhc1-card-detect", data);
118}
119
120static void moboard_sdhc1_exit(struct device *dev, void *data)
121{
122 free_irq(gpio_to_irq(SDHC1_CD), data);
123}
124
125static struct imxmmc_platform_data sdhc1_pdata = {
126 .get_ro = moboard_sdhc1_get_ro,
127 .init = moboard_sdhc1_init,
128 .exit = moboard_sdhc1_exit,
129};
130
101static struct platform_device *devices[] __initdata = { 131static struct platform_device *devices[] __initdata = {
102 &mx31moboard_flash, 132 &mx31moboard_flash,
103}; 133};
@@ -121,6 +151,8 @@ static void __init mxc_board_init(void)
121 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); 151 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
122 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); 152 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
123 153
154 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
155
124 switch (mx31moboard_baseboard) { 156 switch (mx31moboard_baseboard) {
125 case MX31NOBOARD: 157 case MX31NOBOARD:
126 break; 158 break;