diff options
Diffstat (limited to 'drivers/ide/tx4939ide.c')
-rw-r--r-- | drivers/ide/tx4939ide.c | 62 |
1 files changed, 17 insertions, 45 deletions
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index e0e0a803dde..0040a9a3e26 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -279,8 +279,6 @@ use_pio_instead: | |||
279 | printk(KERN_ERR "%s: %s\n", drive->name, | 279 | printk(KERN_ERR "%s: %s\n", drive->name, |
280 | count ? "DMA table too small" : "empty DMA table?"); | 280 | count ? "DMA table too small" : "empty DMA table?"); |
281 | 281 | ||
282 | ide_destroy_dmatable(drive); | ||
283 | |||
284 | return 0; /* revert to PIO for this request */ | 282 | return 0; /* revert to PIO for this request */ |
285 | } | 283 | } |
286 | #else | 284 | #else |
@@ -294,10 +292,8 @@ static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) | |||
294 | u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; | 292 | u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; |
295 | 293 | ||
296 | /* fall back to PIO! */ | 294 | /* fall back to PIO! */ |
297 | if (tx4939ide_build_dmatable(drive, cmd) == 0) { | 295 | if (tx4939ide_build_dmatable(drive, cmd) == 0) |
298 | ide_map_sg(drive, cmd); | ||
299 | return 1; | 296 | return 1; |
300 | } | ||
301 | 297 | ||
302 | /* PRD table */ | 298 | /* PRD table */ |
303 | tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); | 299 | tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); |
@@ -308,8 +304,6 @@ static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) | |||
308 | /* clear INTR & ERROR flags */ | 304 | /* clear INTR & ERROR flags */ |
309 | tx4939ide_clear_dma_status(base); | 305 | tx4939ide_clear_dma_status(base); |
310 | 306 | ||
311 | drive->waiting_for_dma = 1; | ||
312 | |||
313 | tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? | 307 | tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? |
314 | TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); | 308 | TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); |
315 | 309 | ||
@@ -325,8 +319,6 @@ static int tx4939ide_dma_end(ide_drive_t *drive) | |||
325 | void __iomem *base = TX4939IDE_BASE(hwif); | 319 | void __iomem *base = TX4939IDE_BASE(hwif); |
326 | u16 ctl = tx4939ide_readw(base, TX4939IDE_Int_Ctl); | 320 | u16 ctl = tx4939ide_readw(base, TX4939IDE_Int_Ctl); |
327 | 321 | ||
328 | drive->waiting_for_dma = 0; | ||
329 | |||
330 | /* get DMA command mode */ | 322 | /* get DMA command mode */ |
331 | dma_cmd = tx4939ide_readb(base, TX4939IDE_DMA_Cmd); | 323 | dma_cmd = tx4939ide_readb(base, TX4939IDE_DMA_Cmd); |
332 | /* stop DMA */ | 324 | /* stop DMA */ |
@@ -335,11 +327,9 @@ static int tx4939ide_dma_end(ide_drive_t *drive) | |||
335 | /* read and clear the INTR & ERROR bits */ | 327 | /* read and clear the INTR & ERROR bits */ |
336 | dma_stat = tx4939ide_clear_dma_status(base); | 328 | dma_stat = tx4939ide_clear_dma_status(base); |
337 | 329 | ||
338 | /* purge DMA mappings */ | ||
339 | ide_destroy_dmatable(drive); | ||
340 | /* verify good DMA status */ | ||
341 | wmb(); | 330 | wmb(); |
342 | 331 | ||
332 | /* verify good DMA status */ | ||
343 | if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && | 333 | if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && |
344 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == | 334 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == |
345 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) | 335 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) |
@@ -439,7 +429,7 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive) | |||
439 | * Fix ATA100 CORE System Control Register. (The write to the | 429 | * Fix ATA100 CORE System Control Register. (The write to the |
440 | * Device/Head register may write wrong data to the System | 430 | * Device/Head register may write wrong data to the System |
441 | * Control Register) | 431 | * Control Register) |
442 | * While Sys_Ctl is written here, selectproc is not needed. | 432 | * While Sys_Ctl is written here, dev_select() is not needed. |
443 | */ | 433 | */ |
444 | tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); | 434 | tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); |
445 | } | 435 | } |
@@ -467,13 +457,6 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | |||
467 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | 457 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
468 | HIHI = 0xFF; | 458 | HIHI = 0xFF; |
469 | 459 | ||
470 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { | ||
471 | u16 data = (tf->hob_data << 8) | tf->data; | ||
472 | |||
473 | /* no endian swap */ | ||
474 | __raw_writew(data, (void __iomem *)io_ports->data_addr); | ||
475 | } | ||
476 | |||
477 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 460 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
478 | tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); | 461 | tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); |
479 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 462 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
@@ -509,20 +492,11 @@ static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
509 | struct ide_io_ports *io_ports = &hwif->io_ports; | 492 | struct ide_io_ports *io_ports = &hwif->io_ports; |
510 | struct ide_taskfile *tf = &cmd->tf; | 493 | struct ide_taskfile *tf = &cmd->tf; |
511 | 494 | ||
512 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { | ||
513 | u16 data; | ||
514 | |||
515 | /* no endian swap */ | ||
516 | data = __raw_readw((void __iomem *)io_ports->data_addr); | ||
517 | tf->data = data & 0xff; | ||
518 | tf->hob_data = (data >> 8) & 0xff; | ||
519 | } | ||
520 | |||
521 | /* be sure we're looking at the low order bits */ | 495 | /* be sure we're looking at the low order bits */ |
522 | tx4939ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 496 | tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); |
523 | 497 | ||
524 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) | 498 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) |
525 | tf->feature = tx4939ide_inb(io_ports->feature_addr); | 499 | tf->error = tx4939ide_inb(io_ports->feature_addr); |
526 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | 500 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
527 | tf->nsect = tx4939ide_inb(io_ports->nsect_addr); | 501 | tf->nsect = tx4939ide_inb(io_ports->nsect_addr); |
528 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | 502 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
@@ -535,19 +509,18 @@ static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
535 | tf->device = tx4939ide_inb(io_ports->device_addr); | 509 | tf->device = tx4939ide_inb(io_ports->device_addr); |
536 | 510 | ||
537 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | 511 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
538 | tx4939ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 512 | tx4939ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); |
539 | 513 | ||
540 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 514 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) |
541 | tf->hob_feature = | 515 | tf->hob_error = tx4939ide_inb(io_ports->feature_addr); |
542 | tx4939ide_inb(io_ports->feature_addr); | ||
543 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 516 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
544 | tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); | 517 | tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); |
545 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 518 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
546 | tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); | 519 | tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); |
547 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 520 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
548 | tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); | 521 | tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); |
549 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 522 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
550 | tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); | 523 | tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); |
551 | } | 524 | } |
552 | } | 525 | } |
553 | 526 | ||
@@ -581,9 +554,9 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
581 | .exec_command = ide_exec_command, | 554 | .exec_command = ide_exec_command, |
582 | .read_status = ide_read_status, | 555 | .read_status = ide_read_status, |
583 | .read_altstatus = ide_read_altstatus, | 556 | .read_altstatus = ide_read_altstatus, |
557 | .write_devctl = ide_write_devctl, | ||
584 | 558 | ||
585 | .set_irq = ide_set_irq, | 559 | .dev_select = ide_dev_select, |
586 | |||
587 | .tf_load = tx4939ide_tf_load, | 560 | .tf_load = tx4939ide_tf_load, |
588 | .tf_read = tx4939ide_tf_read, | 561 | .tf_read = tx4939ide_tf_read, |
589 | 562 | ||
@@ -605,9 +578,9 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
605 | .exec_command = ide_exec_command, | 578 | .exec_command = ide_exec_command, |
606 | .read_status = ide_read_status, | 579 | .read_status = ide_read_status, |
607 | .read_altstatus = ide_read_altstatus, | 580 | .read_altstatus = ide_read_altstatus, |
581 | .write_devctl = ide_write_devctl, | ||
608 | 582 | ||
609 | .set_irq = ide_set_irq, | 583 | .dev_select = ide_dev_select, |
610 | |||
611 | .tf_load = tx4939ide_tf_load, | 584 | .tf_load = tx4939ide_tf_load, |
612 | .tf_read = ide_tf_read, | 585 | .tf_read = ide_tf_read, |
613 | 586 | ||
@@ -632,7 +605,6 @@ static const struct ide_dma_ops tx4939ide_dma_ops = { | |||
632 | .dma_test_irq = tx4939ide_dma_test_irq, | 605 | .dma_test_irq = tx4939ide_dma_test_irq, |
633 | .dma_lost_irq = ide_dma_lost_irq, | 606 | .dma_lost_irq = ide_dma_lost_irq, |
634 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | 607 | .dma_timer_expiry = ide_dma_sff_timer_expiry, |
635 | .dma_timeout = ide_dma_timeout, | ||
636 | .dma_sff_read_status = tx4939ide_dma_sff_read_status, | 608 | .dma_sff_read_status = tx4939ide_dma_sff_read_status, |
637 | }; | 609 | }; |
638 | 610 | ||