Linux 2.6.18
[gumsense-br.git] / target / device / Gumstix / basix-connex / kernel-patches / mmc-card-detect.patch
blobd748eab98d122adcf9018d6b62a13a8ded1b364e
1 Index: linux-2.6.18gum/arch/arm/mach-pxa/gumstix.c
2 ===================================================================
3 --- linux-2.6.18gum.orig/arch/arm/mach-pxa/gumstix.c
4 +++ linux-2.6.18gum/arch/arm/mach-pxa/gumstix.c
5 @@ -29,19 +29,51 @@
7 #include "generic.h"
9 -static int gumstix_mci_init(struct device *dev, irqreturn_t (*lubbock_detect_int)(int, void *, struct pt_regs *), void *data)
10 +static struct pxamci_platform_data gumstix_mci_platform_data;
12 +static int gumstix_mci_init(struct device *dev, irqreturn_t (*gumstix_detect_int)(int, void *, struct pt_regs *), void *data)
14 - // Set up MMC controller
15 + int err;
17 pxa_gpio_mode(GPIO6_MMCCLK_MD);
18 pxa_gpio_mode(GPIO53_MMCCLK_MD);
19 pxa_gpio_mode(GPIO8_MMCCS0_MD);
21 + pxa_gpio_mode(GUMSTIX_GPIO_nSD_DETECT | GPIO_IN);
22 + set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
23 + pxa_gpio_mode(GUMSTIX_GPIO_nSD_WP | GPIO_IN);
25 + gumstix_mci_platform_data.detect_delay = msecs_to_jiffies(250);
27 + err = request_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, gumstix_detect_int, SA_INTERRUPT,
28 + "MMC card detect", data);
29 + if (err) {
30 + printk(KERN_ERR "gumstix_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
31 + return -1;
32 + }
34 + err = set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
36 return 0;
39 +static int gumstix_mci_get_ro(struct device *dev)
41 + int ro;
42 + ro = GPLR(GUMSTIX_GPIO_nSD_WP) & GPIO_bit(GUMSTIX_GPIO_nSD_WP);
43 + return ro;
46 +static void gumstix_mci_exit(struct device *dev, void *data)
48 + free_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, data);
51 static struct pxamci_platform_data gumstix_mci_platform_data = {
52 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
53 - .init = &gumstix_mci_init,
54 + .init = gumstix_mci_init,
55 + .get_ro = gumstix_mci_get_ro,
56 + .exit = gumstix_mci_exit,
59 static int gumstix_udc_is_connected(void)
60 Index: linux-2.6.18gum/include/asm-arm/arch-pxa/gumstix.h
61 ===================================================================
62 --- linux-2.6.18gum.orig/include/asm-arm/arch-pxa/gumstix.h
63 +++ linux-2.6.18gum/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)
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)
76 * SMC Ethernet definitions