aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmtx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/palmtx.c')
-rw-r--r--arch/arm/mach-pxa/palmtx.c80
1 files changed, 4 insertions, 76 deletions
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 83d020879581..4a9ca718962f 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -140,83 +140,11 @@ static unsigned long palmtx_pin_config[] __initdata = {
140/****************************************************************************** 140/******************************************************************************
141 * SD/MMC card controller 141 * SD/MMC card controller
142 ******************************************************************************/ 142 ******************************************************************************/
143static int palmtx_mci_init(struct device *dev, irq_handler_t palmtx_detect_int,
144 void *data)
145{
146 int err = 0;
147
148 /* Setup an interrupt for detecting card insert/remove events */
149 err = gpio_request(GPIO_NR_PALMTX_SD_DETECT_N, "SD IRQ");
150 if (err)
151 goto err;
152 err = gpio_direction_input(GPIO_NR_PALMTX_SD_DETECT_N);
153 if (err)
154 goto err2;
155 err = request_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N),
156 palmtx_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
157 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
158 "SD/MMC card detect", data);
159 if (err) {
160 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
161 __func__);
162 goto err2;
163 }
164
165 err = gpio_request(GPIO_NR_PALMTX_SD_POWER, "SD_POWER");
166 if (err)
167 goto err3;
168 err = gpio_direction_output(GPIO_NR_PALMTX_SD_POWER, 0);
169 if (err)
170 goto err4;
171
172 err = gpio_request(GPIO_NR_PALMTX_SD_READONLY, "SD_READONLY");
173 if (err)
174 goto err4;
175 err = gpio_direction_input(GPIO_NR_PALMTX_SD_READONLY);
176 if (err)
177 goto err5;
178
179 printk(KERN_DEBUG "%s: irq registered\n", __func__);
180
181 return 0;
182
183err5:
184 gpio_free(GPIO_NR_PALMTX_SD_READONLY);
185err4:
186 gpio_free(GPIO_NR_PALMTX_SD_POWER);
187err3:
188 free_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), data);
189err2:
190 gpio_free(GPIO_NR_PALMTX_SD_DETECT_N);
191err:
192 return err;
193}
194
195static void palmtx_mci_exit(struct device *dev, void *data)
196{
197 gpio_free(GPIO_NR_PALMTX_SD_READONLY);
198 gpio_free(GPIO_NR_PALMTX_SD_POWER);
199 free_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), data);
200 gpio_free(GPIO_NR_PALMTX_SD_DETECT_N);
201}
202
203static void palmtx_mci_power(struct device *dev, unsigned int vdd)
204{
205 struct pxamci_platform_data *p_d = dev->platform_data;
206 gpio_set_value(GPIO_NR_PALMTX_SD_POWER, p_d->ocr_mask & (1 << vdd));
207}
208
209static int palmtx_mci_get_ro(struct device *dev)
210{
211 return gpio_get_value(GPIO_NR_PALMTX_SD_READONLY);
212}
213
214static struct pxamci_platform_data palmtx_mci_platform_data = { 143static struct pxamci_platform_data palmtx_mci_platform_data = {
215 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 144 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
216 .setpower = palmtx_mci_power, 145 .gpio_card_detect = GPIO_NR_PALMTX_SD_DETECT_N,
217 .get_ro = palmtx_mci_get_ro, 146 .gpio_card_ro = GPIO_NR_PALMTX_SD_READONLY,
218 .init = palmtx_mci_init, 147 .gpio_power = GPIO_NR_PALMTX_SD_POWER,
219 .exit = palmtx_mci_exit,
220}; 148};
221 149
222/****************************************************************************** 150/******************************************************************************