u-boot-mkimage-gta01-native: re-add till uboot-utils actually works
[openembedded.git] / packages / linux / linux-ezx-2.6.21 / ezx-mci.patch
1 Index: linux-2.6.20.7/arch/arm/mach-pxa/ezx-mci.c
2 ===================================================================
3 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4 +++ linux-2.6.20.7/arch/arm/mach-pxa/ezx-mci.c  2007-04-20 01:10:13.000000000 -0300
5 @@ -0,0 +1,159 @@
6 +/*
7 + *  linux/arch/arm/mach-ezx/a780.c
8 + *
9 + *  Support for the Motorola Ezx A780 Development Platform.
10 + *
11 + *  Author:    Zhuang Xiaofan
12 + *  Created:   Nov 25, 2003
13 + *  Copyright: Motorola Inc.
14 + *
15 + *  This program is free software; you can redistribute it and/or modify
16 + *  it under the terms of the GNU General Public License version 2 as
17 + *  published by the Free Software Foundation.
18 + */
19 +
20 +#include <linux/mmc/host.h>
21 +#include <linux/irq.h>
22 +#include <asm/irq.h>
23 +#include <asm/arch/pxa-regs.h>
24 +#include <asm/arch/ezx-pcap.h>
25 +#include <asm/arch/mmc.h>
26 +#include <asm/arch/hardware.h>
27 +
28 +extern int ezx_pcap_mmcsd_power(int);
29 +extern void ezx_pcap_mmcsd_voltage(u_int32_t);
30 +
31 +static struct pxamci_platform_data ezx_mci_platform_data;
32 +
33 +static int ezx_mci_init(struct device *dev,
34 +                        irqreturn_t (*ezx_detect_int)(int, void *),
35 +                        void *data)
36 +{
37 +        int err;
38 +        printk("%s entered\n", __FUNCTION__);
39 +
40 +        /* Setup GPIO for PXA27x MMC/SD controller */
41 +        pxa_gpio_mode(GPIO32_MMCCLK_MD);
42 +        pxa_gpio_mode(GPIO112_MMCCMD_MD);
43 +        pxa_gpio_mode(GPIO92_MMCDAT0_MD);
44 +        pxa_gpio_mode(GPIO109_MMCDAT1_MD);
45 +        pxa_gpio_mode(GPIO110_MMCDAT2_MD);
46 +        pxa_gpio_mode(GPIO111_MMCDAT3_MD);
47 +
48 +        ezx_pcap_mmcsd_power(1);
49 +
50 +        ezx_mci_platform_data.detect_delay = msecs_to_jiffies(250);
51 +
52 +        err = request_irq(0x49, ezx_detect_int, SA_INTERRUPT,
53 +                          "MMC card detect", data);
54 +        if (err) {
55 +                printk(KERN_ERR "ezx_mci_detect: MMC/SD: can't request "
56 +                      "MMC card detect IRQ\n");
57 +                return -1;
58 +        }
59 +
60 +        set_irq_type(0x0b, IRQT_BOTHEDGE);
61 +
62 +        return 0;
63 +}
64 +
65 +static int ezx_mci_get_ro(struct device *dev)
66 +{
67 +        printk("%s entered\n", __FUNCTION__);
68 +#if defined(CONFIG_PXA_EZX_E680)
69 +        /* this is only e680, i guess */
70 +        // return GPIO_is_high(96+4);
71 +        return (GPLR3 & 0x800);
72 +#else
73 +        return 0;
74 +#endif
75 +}
76 +
77 +#if defined(CONFIG_PXA_EZX_A780)
78 +static u_int8_t mmc_voltage[] = {
79 +       [MMC_VDD_160] = 5,
80 +       [MMC_VDD_170] = 5,
81 +       [MMC_VDD_180] = 6,
82 +       [MMC_VDD_190] = 6,
83 +       [MMC_VDD_200] = 7,
84 +       [MMC_VDD_210] = 7,
85 +       [MMC_VDD_220] = 8,
86 +       [MMC_VDD_230] = 8,
87 +       [MMC_VDD_240] = 9,
88 +       [MMC_VDD_250] = 9,
89 +       [MMC_VDD_260] = 10,
90 +       [MMC_VDD_270] = 10,
91 +       [MMC_VDD_280] = 11,
92 +       [MMC_VDD_290] = 11,
93 +       [MMC_VDD_300] = 12,
94 +       [MMC_VDD_310] = 12,
95 +       [MMC_VDD_320] = 13,
96 +       [MMC_VDD_330] = 13,
97 +       [MMC_VDD_340] = 14,
98 +       [MMC_VDD_350] = 14,
99 +       [MMC_VDD_360] = 15,
100 +};
101 +#elif defined(CONFIG_PXA_EZX_E680)
102 +static u_int8_t mmc_voltage[] = {
103 +       [MMC_VDD_160] = 3,
104 +       [MMC_VDD_170] = 3,
105 +       [MMC_VDD_180] = 3,
106 +       [MMC_VDD_190] = 3,
107 +       [MMC_VDD_200] = 3,
108 +       [MMC_VDD_210] = 3,
109 +       [MMC_VDD_220] = 3,
110 +       [MMC_VDD_230] = 3,
111 +       [MMC_VDD_240] = 3,
112 +       [MMC_VDD_250] = 3,
113 +       [MMC_VDD_260] = 3,
114 +       [MMC_VDD_270] = 3,
115 +       [MMC_VDD_280] = 3,
116 +       [MMC_VDD_290] = 3,
117 +       [MMC_VDD_300] = 3,
118 +       [MMC_VDD_310] = 3,
119 +       [MMC_VDD_320] = 3,
120 +       [MMC_VDD_330] = 3,
121 +       [MMC_VDD_340] = 3,
122 +       [MMC_VDD_350] = 3,
123 +       [MMC_VDD_360] = 3,
124 +};
125 +#endif
126 +
127 +static void ezx_mci_setpower(struct device *dev, unsigned int vdd)
128 +{
129 +        printk("%s(vdd=%u) entered\n", __FUNCTION__, vdd);
130 +        if (vdd <= MMC_VDD_360)
131 +                ezx_pcap_mmcsd_voltage(mmc_voltage[vdd]);
132 +
133 +        ezx_pcap_mmcsd_power(1);
134 +}
135 +
136 +static void ezx_mci_exit(struct device *dev, void *data)
137 +{
138 +        printk("%s entered\n", __FUNCTION__);
139 +        ezx_pcap_mmcsd_power(0);
140 +        free_irq(0x49, data);
141 +}
142 +
143 +static struct pxamci_platform_data ezx_mci_platform_data = {
144 +#if defined(CONFIG_PXA_EZX_E680)
145 +        .ocr_mask       = MMC_VDD_27_28,
146 +#elif defined(CONFIG_PXA_EZX_A780)
147 +        .ocr_mask       = MMC_VDD_160_165|MMC_VDD_18_19|MMC_VDD_20_21
148 +                          |MMC_VDD_22_23|MMC_VDD_24_25|MMC_VDD_26_27
149 +                          |MMC_VDD_28_29|MMC_VDD_30_31|MMC_VDD_32_33
150 +                          |MMC_VDD_34_35|MMC_VDD_35_36,
151 +#endif
152 +        .init           = ezx_mci_init,
153 +        .get_ro         = ezx_mci_get_ro,
154 +        .setpower       = ezx_mci_setpower,
155 +        .exit           = ezx_mci_exit,
156 +};
157 +
158 +int __init __ezx_mci_init (void)
159 +{
160 +       pxa_set_mci_info(&ezx_mci_platform_data);
161 +       return 0;
162 +}
163 +
164 +arch_initcall(__ezx_mci_init);
165 Index: linux-2.6.20.7/arch/arm/mach-pxa/Makefile
166 ===================================================================
167 --- linux-2.6.20.7.orig/arch/arm/mach-pxa/Makefile      2007-04-21 02:56:16.000000000 -0300
168 +++ linux-2.6.20.7/arch/arm/mach-pxa/Makefile   2007-04-21 03:00:03.000000000 -0300
169 @@ -18,7 +18,7 @@
170  obj-$(CONFIG_MACH_AKITA)       += akita-ioexp.o
171  obj-$(CONFIG_MACH_POODLE)      += poodle.o corgi_ssp.o
172  obj-$(CONFIG_MACH_TOSA)         += tosa.o
173 -obj-$(CONFIG_PXA_EZX)          += ezx.o ezx_lcd.o ezx_ssp.o ezx-pcap.o
174 +obj-$(CONFIG_PXA_EZX)          += ezx.o ezx_lcd.o ezx_ssp.o ezx-pcap.o ezx-mci.o
175  
176  # Support for blinky lights
177  led-y := leds.o