diff options
Diffstat (limited to 'drivers/scsi/sata_sil24.c')
-rw-r--r-- | drivers/scsi/sata_sil24.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index cb1933a3bd55..a6836a07a9eb 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -486,6 +486,31 @@ static void sil24_irq_clear(struct ata_port *ap) | |||
486 | /* unused */ | 486 | /* unused */ |
487 | } | 487 | } |
488 | 488 | ||
489 | static int __sil24_restart_controller(void __iomem *port) | ||
490 | { | ||
491 | u32 tmp; | ||
492 | int cnt; | ||
493 | |||
494 | writel(PORT_CS_INIT, port + PORT_CTRL_STAT); | ||
495 | |||
496 | /* Max ~10ms */ | ||
497 | for (cnt = 0; cnt < 10000; cnt++) { | ||
498 | tmp = readl(port + PORT_CTRL_STAT); | ||
499 | if (tmp & PORT_CS_RDY) | ||
500 | return 0; | ||
501 | udelay(1); | ||
502 | } | ||
503 | |||
504 | return -1; | ||
505 | } | ||
506 | |||
507 | static void sil24_restart_controller(struct ata_port *ap) | ||
508 | { | ||
509 | if (__sil24_restart_controller((void __iomem *)ap->ioaddr.cmd_addr)) | ||
510 | printk(KERN_ERR DRV_NAME | ||
511 | " ata%u: failed to restart controller\n", ap->id); | ||
512 | } | ||
513 | |||
489 | static int __sil24_reset_controller(void __iomem *port) | 514 | static int __sil24_reset_controller(void __iomem *port) |
490 | { | 515 | { |
491 | int cnt; | 516 | int cnt; |
@@ -505,7 +530,11 @@ static int __sil24_reset_controller(void __iomem *port) | |||
505 | 530 | ||
506 | if (tmp & PORT_CS_DEV_RST) | 531 | if (tmp & PORT_CS_DEV_RST) |
507 | return -1; | 532 | return -1; |
508 | return 0; | 533 | |
534 | if (tmp & PORT_CS_RDY) | ||
535 | return 0; | ||
536 | |||
537 | return __sil24_restart_controller(port); | ||
509 | } | 538 | } |
510 | 539 | ||
511 | static void sil24_reset_controller(struct ata_port *ap) | 540 | static void sil24_reset_controller(struct ata_port *ap) |
@@ -577,6 +606,7 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
577 | */ | 606 | */ |
578 | sil24_update_tf(ap); | 607 | sil24_update_tf(ap); |
579 | err_mask = ac_err_mask(pp->tf.command); | 608 | err_mask = ac_err_mask(pp->tf.command); |
609 | sil24_restart_controller(ap); | ||
580 | } else { | 610 | } else { |
581 | /* | 611 | /* |
582 | * Other errors. libata currently doesn't have any | 612 | * Other errors. libata currently doesn't have any |
@@ -584,12 +614,11 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
584 | * ATA_ERR. | 614 | * ATA_ERR. |
585 | */ | 615 | */ |
586 | err_mask = AC_ERR_OTHER; | 616 | err_mask = AC_ERR_OTHER; |
617 | sil24_reset_controller(ap); | ||
587 | } | 618 | } |
588 | 619 | ||
589 | if (qc) | 620 | if (qc) |
590 | ata_qc_complete(qc, err_mask); | 621 | ata_qc_complete(qc, err_mask); |
591 | |||
592 | sil24_reset_controller(ap); | ||
593 | } | 622 | } |
594 | 623 | ||
595 | static inline void sil24_host_intr(struct ata_port *ap) | 624 | static inline void sil24_host_intr(struct ata_port *ap) |