aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmt5.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/palmt5.c')
-rw-r--r--arch/arm/mach-pxa/palmt5.c80
1 files changed, 4 insertions, 76 deletions
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 33f726ff55e5..42d0528d3e9e 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -124,83 +124,11 @@ static unsigned long palmt5_pin_config[] __initdata = {
124/****************************************************************************** 124/******************************************************************************
125 * SD/MMC card controller 125 * SD/MMC card controller
126 ******************************************************************************/ 126 ******************************************************************************/
127static int palmt5_mci_init(struct device *dev, irq_handler_t palmt5_detect_int,
128 void *data)
129{
130 int err = 0;
131
132 /* Setup an interrupt for detecting card insert/remove events */
133 err = gpio_request(GPIO_NR_PALMT5_SD_DETECT_N, "SD IRQ");
134 if (err)
135 goto err;
136 err = gpio_direction_input(GPIO_NR_PALMT5_SD_DETECT_N);
137 if (err)
138 goto err2;
139 err = request_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N),
140 palmt5_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
141 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
142 "SD/MMC card detect", data);
143 if (err) {
144 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
145 __func__);
146 goto err2;
147 }
148
149 err = gpio_request(GPIO_NR_PALMT5_SD_POWER, "SD_POWER");
150 if (err)
151 goto err3;
152 err = gpio_direction_output(GPIO_NR_PALMT5_SD_POWER, 0);
153 if (err)
154 goto err4;
155
156 err = gpio_request(GPIO_NR_PALMT5_SD_READONLY, "SD_READONLY");
157 if (err)
158 goto err4;
159 err = gpio_direction_input(GPIO_NR_PALMT5_SD_READONLY);
160 if (err)
161 goto err5;
162
163 printk(KERN_DEBUG "%s: irq registered\n", __func__);
164
165 return 0;
166
167err5:
168 gpio_free(GPIO_NR_PALMT5_SD_READONLY);
169err4:
170 gpio_free(GPIO_NR_PALMT5_SD_POWER);
171err3:
172 free_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), data);
173err2:
174 gpio_free(GPIO_NR_PALMT5_SD_DETECT_N);
175err:
176 return err;
177}
178
179static void palmt5_mci_exit(struct device *dev, void *data)
180{
181 gpio_free(GPIO_NR_PALMT5_SD_READONLY);
182 gpio_free(GPIO_NR_PALMT5_SD_POWER);
183 free_irq(IRQ_GPIO_PALMT5_SD_DETECT_N, data);
184 gpio_free(GPIO_NR_PALMT5_SD_DETECT_N);
185}
186
187static void palmt5_mci_power(struct device *dev, unsigned int vdd)
188{
189 struct pxamci_platform_data *p_d = dev->platform_data;
190 gpio_set_value(GPIO_NR_PALMT5_SD_POWER, p_d->ocr_mask & (1 << vdd));
191}
192
193static int palmt5_mci_get_ro(struct device *dev)
194{
195 return gpio_get_value(GPIO_NR_PALMT5_SD_READONLY);
196}
197
198static struct pxamci_platform_data palmt5_mci_platform_data = { 127static struct pxamci_platform_data palmt5_mci_platform_data = {
199 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 128 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
200 .setpower = palmt5_mci_power, 129 .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N,
201 .get_ro = palmt5_mci_get_ro, 130 .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY,
202 .init = palmt5_mci_init, 131 .gpio_power = GPIO_NR_PALMT5_SD_POWER,
203 .exit = palmt5_mci_exit,
204}; 132};
205 133
206/****************************************************************************** 134/******************************************************************************