aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/icside.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-04-05 02:14:15 -0400
committerLen Brown <len.brown@intel.com>2009-04-05 02:14:15 -0400
commit478c6a43fcbc6c11609f8cee7c7b57223907754f (patch)
treea7f7952099da60d33032aed6de9c0c56c9f8779e /drivers/ide/icside.c
parent8a3f257c704e02aee9869decd069a806b45be3f1 (diff)
parent6bb597507f9839b13498781e481f5458aea33620 (diff)
Merge branch 'linus' into release
Conflicts: arch/x86/kernel/cpu/cpufreq/longhaul.c Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/ide/icside.c')
-rw-r--r--drivers/ide/icside.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index 415d7e24f2b6..4e16ce68b063 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -287,13 +287,8 @@ static int icside_dma_end(ide_drive_t *drive)
287 ide_hwif_t *hwif = drive->hwif; 287 ide_hwif_t *hwif = drive->hwif;
288 struct expansion_card *ec = ECARD_DEV(hwif->dev); 288 struct expansion_card *ec = ECARD_DEV(hwif->dev);
289 289
290 drive->waiting_for_dma = 0;
291
292 disable_dma(ec->dma); 290 disable_dma(ec->dma);
293 291
294 /* Teardown mappings after DMA has completed. */
295 ide_destroy_dmatable(drive);
296
297 return get_dma_residue(ec->dma) != 0; 292 return get_dma_residue(ec->dma) != 0;
298} 293}
299 294
@@ -307,15 +302,14 @@ static void icside_dma_start(ide_drive_t *drive)
307 enable_dma(ec->dma); 302 enable_dma(ec->dma);
308} 303}
309 304
310static int icside_dma_setup(ide_drive_t *drive) 305static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
311{ 306{
312 ide_hwif_t *hwif = drive->hwif; 307 ide_hwif_t *hwif = drive->hwif;
313 struct expansion_card *ec = ECARD_DEV(hwif->dev); 308 struct expansion_card *ec = ECARD_DEV(hwif->dev);
314 struct icside_state *state = ecard_get_drvdata(ec); 309 struct icside_state *state = ecard_get_drvdata(ec);
315 struct request *rq = hwif->rq;
316 unsigned int dma_mode; 310 unsigned int dma_mode;
317 311
318 if (rq_data_dir(rq)) 312 if (cmd->tf_flags & IDE_TFLAG_WRITE)
319 dma_mode = DMA_MODE_WRITE; 313 dma_mode = DMA_MODE_WRITE;
320 else 314 else
321 dma_mode = DMA_MODE_READ; 315 dma_mode = DMA_MODE_READ;
@@ -325,8 +319,6 @@ static int icside_dma_setup(ide_drive_t *drive)
325 */ 319 */
326 BUG_ON(dma_channel_active(ec->dma)); 320 BUG_ON(dma_channel_active(ec->dma));
327 321
328 hwif->sg_nents = ide_build_sglist(drive, rq);
329
330 /* 322 /*
331 * Ensure that we have the right interrupt routed. 323 * Ensure that we have the right interrupt routed.
332 */ 324 */
@@ -346,20 +338,12 @@ static int icside_dma_setup(ide_drive_t *drive)
346 * Tell the DMA engine about the SG table and 338 * Tell the DMA engine about the SG table and
347 * data direction. 339 * data direction.
348 */ 340 */
349 set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents); 341 set_dma_sg(ec->dma, hwif->sg_table, cmd->sg_nents);
350 set_dma_mode(ec->dma, dma_mode); 342 set_dma_mode(ec->dma, dma_mode);
351 343
352 drive->waiting_for_dma = 1;
353
354 return 0; 344 return 0;
355} 345}
356 346
357static void icside_dma_exec_cmd(ide_drive_t *drive, u8 cmd)
358{
359 /* issue cmd to drive */
360 ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD, NULL);
361}
362
363static int icside_dma_test_irq(ide_drive_t *drive) 347static int icside_dma_test_irq(ide_drive_t *drive)
364{ 348{
365 ide_hwif_t *hwif = drive->hwif; 349 ide_hwif_t *hwif = drive->hwif;
@@ -383,11 +367,9 @@ static int icside_dma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
383static const struct ide_dma_ops icside_v6_dma_ops = { 367static const struct ide_dma_ops icside_v6_dma_ops = {
384 .dma_host_set = icside_dma_host_set, 368 .dma_host_set = icside_dma_host_set,
385 .dma_setup = icside_dma_setup, 369 .dma_setup = icside_dma_setup,
386 .dma_exec_cmd = icside_dma_exec_cmd,
387 .dma_start = icside_dma_start, 370 .dma_start = icside_dma_start,
388 .dma_end = icside_dma_end, 371 .dma_end = icside_dma_end,
389 .dma_test_irq = icside_dma_test_irq, 372 .dma_test_irq = icside_dma_test_irq,
390 .dma_timeout = ide_dma_timeout,
391 .dma_lost_irq = ide_dma_lost_irq, 373 .dma_lost_irq = ide_dma_lost_irq,
392}; 374};
393#else 375#else
@@ -419,6 +401,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base,
419 hw->chipset = ide_acorn; 401 hw->chipset = ide_acorn;
420} 402}
421 403
404static const struct ide_port_info icside_v5_port_info = {
405 .host_flags = IDE_HFLAG_NO_DMA,
406};
407
422static int __devinit 408static int __devinit
423icside_register_v5(struct icside_state *state, struct expansion_card *ec) 409icside_register_v5(struct icside_state *state, struct expansion_card *ec)
424{ 410{
@@ -445,7 +431,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
445 431
446 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); 432 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec);
447 433
448 host = ide_host_alloc(NULL, hws); 434 host = ide_host_alloc(&icside_v5_port_info, hws);
449 if (host == NULL) 435 if (host == NULL)
450 return -ENODEV; 436 return -ENODEV;
451 437
@@ -453,7 +439,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
453 439
454 ecard_set_drvdata(ec, state); 440 ecard_set_drvdata(ec, state);
455 441
456 ret = ide_host_register(host, NULL, hws); 442 ret = ide_host_register(host, &icside_v5_port_info, hws);
457 if (ret) 443 if (ret)
458 goto err_free; 444 goto err_free;
459 445