aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/pcm037.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-03-10 06:56:10 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-07 10:15:26 -0400
commitdddd4a493dfa9ff2640ff683f04d0f3c8c287111 (patch)
tree142212c172bb3e0b6a5fef539e7859283c2d1829 /arch/arm/mach-mx3/pcm037.c
parent01ac7d584d7299c787bb64067231a06d3b5e52e3 (diff)
pcm037: add SDHC card detection
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3/pcm037.c')
-rw-r--r--arch/arm/mach-mx3/pcm037.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index c26919d05b1e..91495cfeb79e 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -28,6 +28,9 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30#include <linux/i2c/at24.h> 30#include <linux/i2c/at24.h>
31#include <linux/delay.h>
32#include <linux/spi/spi.h>
33#include <linux/irq.h>
31 34
32#include <mach/hardware.h> 35#include <mach/hardware.h>
33#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -218,17 +221,41 @@ static struct i2c_board_info pcm037_i2c_devices[] = {
218}; 221};
219#endif 222#endif
220 223
221static int pcm970_sdhc1_init(struct device *dev, irq_handler_t h, void *data) 224/* Not connected by default */
225#ifdef PCM970_SDHC_RW_SWITCH
226static int pcm970_sdhc1_get_ro(struct device *dev)
222{ 227{
223 return 0; 228 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_SFS6));
229}
230#endif
231
232static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
233 void *data)
234{
235 int ret;
236 int gpio_det, gpio_wp;
237
238 gpio_det = IOMUX_TO_GPIO(MX31_PIN_SCK6);
239 gpio_wp = IOMUX_TO_GPIO(MX31_PIN_SFS6);
240
241 gpio_direction_input(gpio_det);
242 gpio_direction_input(gpio_wp);
243
244 ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq,
245 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
246 "sdhc-detect", data);
247 return ret;
224} 248}
225 249
226static void pcm970_sdhc1_exit(struct device *dev, void *data) 250static void pcm970_sdhc1_exit(struct device *dev, void *data)
227{ 251{
252 free_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), data);
228} 253}
229 254
230/* No card and rw detection at the moment */
231static struct imxmmc_platform_data sdhc_pdata = { 255static struct imxmmc_platform_data sdhc_pdata = {
256#ifdef PCM970_SDHC_RW_SWITCH
257 .get_ro = pcm970_sdhc1_get_ro,
258#endif
232 .init = pcm970_sdhc1_init, 259 .init = pcm970_sdhc1_init,
233 .exit = pcm970_sdhc1_exit, 260 .exit = pcm970_sdhc1_exit,
234}; 261};