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