fix up the second minipci slot in the wndap330, too
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 031-mmc-card-detect.patch
1 --- a/arch/arm/mach-pxa/gumstix.c
2 +++ b/arch/arm/mach-pxa/gumstix.c
3 @@ -29,19 +29,55 @@
4
5 #include "generic.h"
6
7 -static int gumstix_mci_init(struct device *dev, irqreturn_t (*lubbock_detect_int)(int, void *, struct pt_regs *), void *data)
8 +static struct pxamci_platform_data gumstix_mci_platform_data;
9 +
10 +static int gumstix_mci_init(struct device *dev, irqreturn_t (*gumstix_detect_int)(int, void *, struct pt_regs *), void *data)
11 {
12 - // Set up MMC controller
13 + int err;
14 +
15 pxa_gpio_mode(GPIO6_MMCCLK_MD);
16 pxa_gpio_mode(GPIO53_MMCCLK_MD);
17 pxa_gpio_mode(GPIO8_MMCCS0_MD);
18
19 + pxa_gpio_mode(GUMSTIX_GPIO_nSD_DETECT | GPIO_IN);
20 + set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
21 + pxa_gpio_mode(GUMSTIX_GPIO_nSD_WP | GPIO_IN);
22 +
23 + gumstix_mci_platform_data.detect_delay = msecs_to_jiffies(250);
24 +
25 + err = request_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, gumstix_detect_int, SA_INTERRUPT,
26 + "MMC card detect", data);
27 + if (err) {
28 + printk(KERN_ERR "gumstix_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
29 + return -1;
30 + }
31 +
32 + err = set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
33 +
34 return 0;
35 }
36
37 +static int gumstix_mci_get_ro(struct device *dev)
38 +{
39 +#ifdef CONFIG_ARCH_GUMSTIX_VERDEX
40 + return 0; // microSD is always writable on verdex
41 +#else
42 + int ro;
43 + ro = GPLR(GUMSTIX_GPIO_nSD_WP) & GPIO_bit(GUMSTIX_GPIO_nSD_WP);
44 + return ro;
45 +#endif
46 +}
47 +
48 +static void gumstix_mci_exit(struct device *dev, void *data)
49 +{
50 + free_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, data);
51 +}
52 +
53 static struct pxamci_platform_data gumstix_mci_platform_data = {
54 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
55 - .init = &gumstix_mci_init,
56 + .init = gumstix_mci_init,
57 + .get_ro = gumstix_mci_get_ro,
58 + .exit = gumstix_mci_exit,
59 };
60
61 static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = {
62 --- a/include/asm-arm/arch-pxa/gumstix.h
63 +++ b/include/asm-arm/arch-pxa/gumstix.h
64 @@ -36,6 +36,12 @@
65 #define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT)
66 #define GPIO_GUMSTIX_USB_GPIOx_DIS_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_IN)
67
68 +/*
69 + * SD/MMC definitions
70 + */
71 +#define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */
72 +#define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */
73 +#define GUMSTIX_IRQ_GPIO_nSD_DETECT IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT)
74
75 /*
76 * SMC Ethernet definitions
This page took 0.042674 seconds and 5 git commands to generate.