aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/at91_cf.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index a8fa6c17fcf1..b6746301d9a9 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -157,9 +157,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
157 157
158 /* 158 /*
159 * Use 16 bit accesses unless/until we need 8-bit i/o space. 159 * Use 16 bit accesses unless/until we need 8-bit i/o space.
160 * Always set CSR4 ... PCMCIA won't always unmap things.
161 */ 160 */
162 csr = at91_sys_read(AT91_SMC_CSR(4)) & ~AT91_SMC_DBW; 161 csr = at91_sys_read(AT91_SMC_CSR(cf->board->chipselect)) & ~AT91_SMC_DBW;
163 162
164 /* 163 /*
165 * NOTE: this CF controller ignores IOIS16, so we can't really do 164 * NOTE: this CF controller ignores IOIS16, so we can't really do
@@ -178,7 +177,7 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
178 csr |= AT91_SMC_DBW_16; 177 csr |= AT91_SMC_DBW_16;
179 pr_debug("%s: 16bit i/o bus\n", driver_name); 178 pr_debug("%s: 16bit i/o bus\n", driver_name);
180 } 179 }
181 at91_sys_write(AT91_SMC_CSR(4), csr); 180 at91_sys_write(AT91_SMC_CSR(cf->board->chipselect), csr);
182 181
183 io->start = cf->socket.io_offset; 182 io->start = cf->socket.io_offset;
184 io->stop = io->start + SZ_2K - 1; 183 io->stop = io->start + SZ_2K - 1;
@@ -222,7 +221,6 @@ static int __init at91_cf_probe(struct platform_device *pdev)
222 struct at91_cf_socket *cf; 221 struct at91_cf_socket *cf;
223 struct at91_cf_data *board = pdev->dev.platform_data; 222 struct at91_cf_data *board = pdev->dev.platform_data;
224 struct resource *io; 223 struct resource *io;
225 unsigned int csa;
226 int status; 224 int status;
227 225
228 if (!board || !board->det_pin || !board->rst_pin) 226 if (!board || !board->det_pin || !board->rst_pin)
@@ -241,28 +239,6 @@ static int __init at91_cf_probe(struct platform_device *pdev)
241 cf->phys_baseaddr = io->start; 239 cf->phys_baseaddr = io->start;
242 platform_set_drvdata(pdev, cf); 240 platform_set_drvdata(pdev, cf);
243 241
244 /* CF takes over CS4, CS5, CS6 */
245 csa = at91_sys_read(AT91_EBI_CSA);
246 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
247
248 /* nWAIT is _not_ a default setting */
249 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
250
251 /*
252 * Static memory controller timing adjustments.
253 * REVISIT: these timings are in terms of MCK cycles, so
254 * when MCK changes (cpufreq etc) so must these values...
255 */
256 at91_sys_write(AT91_SMC_CSR(4),
257 AT91_SMC_ACSS_STD
258 | AT91_SMC_DBW_16
259 | AT91_SMC_BAT
260 | AT91_SMC_WSEN
261 | AT91_SMC_NWS_(32) /* wait states */
262 | AT91_SMC_RWSETUP_(6) /* setup time */
263 | AT91_SMC_RWHOLD_(4) /* hold time */
264 );
265
266 /* must be a GPIO; ergo must trigger on both edges */ 242 /* must be a GPIO; ergo must trigger on both edges */
267 status = request_irq(board->det_pin, at91_cf_irq, 0, driver_name, cf); 243 status = request_irq(board->det_pin, at91_cf_irq, 0, driver_name, cf);
268 if (status < 0) 244 if (status < 0)
@@ -291,7 +267,7 @@ static int __init at91_cf_probe(struct platform_device *pdev)
291 goto fail1; 267 goto fail1;
292 } 268 }
293 269
294 /* reserve CS4, CS5, and CS6 regions; but use just CS4 */ 270 /* reserve chip-select regions */
295 if (!request_mem_region(io->start, io->end + 1 - io->start, 271 if (!request_mem_region(io->start, io->end + 1 - io->start,
296 driver_name)) { 272 driver_name)) {
297 status = -ENXIO; 273 status = -ENXIO;
@@ -327,7 +303,6 @@ fail0a:
327 device_init_wakeup(&pdev->dev, 0); 303 device_init_wakeup(&pdev->dev, 0);
328 free_irq(board->det_pin, cf); 304 free_irq(board->det_pin, cf);
329fail0: 305fail0:
330 at91_sys_write(AT91_EBI_CSA, csa);
331 kfree(cf); 306 kfree(cf);
332 return status; 307 return status;
333} 308}
@@ -337,7 +312,6 @@ static int __exit at91_cf_remove(struct platform_device *pdev)
337 struct at91_cf_socket *cf = platform_get_drvdata(pdev); 312 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
338 struct at91_cf_data *board = cf->board; 313 struct at91_cf_data *board = cf->board;
339 struct resource *io = cf->socket.io[0].res; 314 struct resource *io = cf->socket.io[0].res;
340 unsigned int csa;
341 315
342 pcmcia_unregister_socket(&cf->socket); 316 pcmcia_unregister_socket(&cf->socket);
343 if (board->irq_pin) 317 if (board->irq_pin)
@@ -347,9 +321,6 @@ static int __exit at91_cf_remove(struct platform_device *pdev)
347 iounmap((void __iomem *) cf->socket.io_offset); 321 iounmap((void __iomem *) cf->socket.io_offset);
348 release_mem_region(io->start, io->end + 1 - io->start); 322 release_mem_region(io->start, io->end + 1 - io->start);
349 323
350 csa = at91_sys_read(AT91_EBI_CSA);
351 at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A);
352
353 kfree(cf); 324 kfree(cf);
354 return 0; 325 return 0;
355} 326}