summaryrefslogtreecommitdiff
path: root/packages/linux/linux-2.6.21/mmc-card-detect.patch
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2007-08-21 16:36:38 +0000
committerKoen Kooi <koen@openembedded.org>2007-08-21 16:36:38 +0000
commitea6d83f002e29a33dfb8c5ff07bfd1f5312893a0 (patch)
tree366808c4a94ac279260e8fe301acddd4fe04f078 /packages/linux/linux-2.6.21/mmc-card-detect.patch
parent3786a532d9a55b93434bef6d8e20f26f45e30140 (diff)
linux 2.6.21: add gumstix support
Diffstat (limited to 'packages/linux/linux-2.6.21/mmc-card-detect.patch')
-rw-r--r--packages/linux/linux-2.6.21/mmc-card-detect.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/packages/linux/linux-2.6.21/mmc-card-detect.patch b/packages/linux/linux-2.6.21/mmc-card-detect.patch
new file mode 100644
index 0000000000..9a853b4df8
--- /dev/null
+++ b/packages/linux/linux-2.6.21/mmc-card-detect.patch
@@ -0,0 +1,76 @@
+Index: linux-2.6.21gum/arch/arm/mach-pxa/gumstix.c
+===================================================================
+--- linux-2.6.21gum.orig/arch/arm/mach-pxa/gumstix.c
++++ linux-2.6.21gum/arch/arm/mach-pxa/gumstix.c
+@@ -29,19 +29,51 @@
+
+ #include "generic.h"
+
+-static int gumstix_mci_init(struct device *dev, irqreturn_t (*lubbock_detect_int)(int, void *, struct pt_regs *), void *data)
++static struct pxamci_platform_data gumstix_mci_platform_data;
++
++static int gumstix_mci_init(struct device *dev, irqreturn_t (*gumstix_detect_int)(int, void *, struct pt_regs *), void *data)
+ {
+- // Set up MMC controller
++ int err;
++
+ pxa_gpio_mode(GPIO6_MMCCLK_MD);
+ pxa_gpio_mode(GPIO53_MMCCLK_MD);
+ pxa_gpio_mode(GPIO8_MMCCS0_MD);
+
++ pxa_gpio_mode(GUMSTIX_GPIO_nSD_DETECT | GPIO_IN);
++ set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
++ pxa_gpio_mode(GUMSTIX_GPIO_nSD_WP | GPIO_IN);
++
++ gumstix_mci_platform_data.detect_delay = msecs_to_jiffies(250);
++
++ err = request_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, gumstix_detect_int, SA_INTERRUPT,
++ "MMC card detect", data);
++ if (err) {
++ printk(KERN_ERR "gumstix_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
++ return -1;
++ }
++
++ err = set_irq_type(GUMSTIX_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
++
+ return 0;
+ }
+
++static int gumstix_mci_get_ro(struct device *dev)
++{
++ int ro;
++ ro = GPLR(GUMSTIX_GPIO_nSD_WP) & GPIO_bit(GUMSTIX_GPIO_nSD_WP);
++ return ro;
++}
++
++static void gumstix_mci_exit(struct device *dev, void *data)
++{
++ free_irq(GUMSTIX_IRQ_GPIO_nSD_DETECT, data);
++}
++
+ static struct pxamci_platform_data gumstix_mci_platform_data = {
+ .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
+- .init = &gumstix_mci_init,
++ .init = gumstix_mci_init,
++ .get_ro = gumstix_mci_get_ro,
++ .exit = gumstix_mci_exit,
+ };
+
+ static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = {
+Index: linux-2.6.21gum/include/asm-arm/arch-pxa/gumstix.h
+===================================================================
+--- linux-2.6.21gum.orig/include/asm-arm/arch-pxa/gumstix.h
++++ linux-2.6.21gum/include/asm-arm/arch-pxa/gumstix.h
+@@ -36,6 +36,12 @@
+ #define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT)
+ #define GPIO_GUMSTIX_USB_GPIOx_DIS_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_IN)
+
++/*
++ * SD/MMC definitions
++ */
++#define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */
++#define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */
++#define GUMSTIX_IRQ_GPIO_nSD_DETECT IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT)
+
+ /*
+ * SMC Ethernet definitions