fix small logic error in x86 sysupgrade script, which prevented upgrades from jffs2...
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 031-mmc-card-detect.patch
1 Index: linux-2.6.21.7/arch/arm/mach-pxa/gumstix.c
2 ===================================================================
3 --- linux-2.6.21.7.orig/arch/arm/mach-pxa/gumstix.c
4 +++ linux-2.6.21.7/arch/arm/mach-pxa/gumstix.c
5 @@ -29,19 +29,55 @@
6
7 #include "generic.h"
8
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;
11 +
12 +static int gumstix_mci_init(struct device *dev, irqreturn_t (*gumstix_detect_int)(int, void *, struct pt_regs *), void *data)
13 {
14 - // Set up MMC controller
15 + int err;
16 +
17 pxa_gpio_mode(GPIO6_MMCCLK_MD);
18 pxa_gpio_mode(GPIO53_MMCCLK_MD);
19 pxa_gpio_mode(GPIO8_MMCCS0_MD);
20
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);
24 +
25 + gumstix_mci_platform_data.detect_delay = msecs_to_jiffies(250);
26 +
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 + }
33 +
34 + err = set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
35 +
36 return 0;
37 }
38
39 +static int gumstix_mci_get_ro(struct device *dev)
40 +{
41 +#ifdef CONFIG_ARCH_GUMSTIX_VERDEX
42 + return 0; // microSD is always writable on verdex
43 +#else
44 + int ro;
45 + ro = GPLR(GUMSTIX_GPIO_nSD_WP) & GPIO_bit(GUMSTIX_GPIO_nSD_WP);
46 + return ro;
47 +#endif
48 +}
49 +
50 +static void gumstix_mci_exit(struct device *dev, void *data)
51 +{
52 + free_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, data);
53 +}
54 +
55 static struct pxamci_platform_data gumstix_mci_platform_data = {
56 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
57 - .init = &gumstix_mci_init,
58 + .init = gumstix_mci_init,
59 + .get_ro = gumstix_mci_get_ro,
60 + .exit = gumstix_mci_exit,
61 };
62
63 static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = {
64 Index: linux-2.6.21.7/include/asm-arm/arch-pxa/gumstix.h
65 ===================================================================
66 --- linux-2.6.21.7.orig/include/asm-arm/arch-pxa/gumstix.h
67 +++ linux-2.6.21.7/include/asm-arm/arch-pxa/gumstix.h
68 @@ -36,6 +36,12 @@
69 #define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT)
70 #define GPIO_GUMSTIX_USB_GPIOx_DIS_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_IN)
71
72 +/*
73 + * SD/MMC definitions
74 + */
75 +#define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */
76 +#define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */
77 +#define GUMSTIX_IRQ_GPIO_nSD_DETECT IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT)
78
79 /*
80 * SMC Ethernet definitions
This page took 0.054469 seconds and 5 git commands to generate.