diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:23 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:31 -0400 |
commit | cc0680a580b5be81a1ca321b58f8e9b80b5c1052 (patch) | |
tree | 57454cdfdc9890f4e8d9f532e9cd240c7361951f /drivers/ata/sata_sil24.c | |
parent | 955e57dfde4ff75e4d7329ac7a3d645b16015309 (diff) |
libata-link: linkify reset
Make reset methods and related functions deal with ata_link instead of
ata_port.
* ata_do_reset()
* ata_eh_reset()
* all prereset/reset/postreset methods and related functions
This patch introduces no behavior change.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_sil24.c')
-rw-r--r-- | drivers/ata/sata_sil24.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 0cd40d5215fe..869e414d7ed3 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -583,9 +583,10 @@ static int sil24_exec_polled_cmd(struct ata_port *ap, int pmp, | |||
583 | return rc; | 583 | return rc; |
584 | } | 584 | } |
585 | 585 | ||
586 | static int sil24_do_softreset(struct ata_port *ap, unsigned int *class, | 586 | static int sil24_do_softreset(struct ata_link *link, unsigned int *class, |
587 | int pmp, unsigned long deadline) | 587 | int pmp, unsigned long deadline) |
588 | { | 588 | { |
589 | struct ata_port *ap = link->ap; | ||
589 | unsigned long timeout_msec = 0; | 590 | unsigned long timeout_msec = 0; |
590 | struct ata_taskfile tf; | 591 | struct ata_taskfile tf; |
591 | const char *reason; | 592 | const char *reason; |
@@ -593,7 +594,7 @@ static int sil24_do_softreset(struct ata_port *ap, unsigned int *class, | |||
593 | 594 | ||
594 | DPRINTK("ENTER\n"); | 595 | DPRINTK("ENTER\n"); |
595 | 596 | ||
596 | if (ata_link_offline(&ap->link)) { | 597 | if (ata_link_offline(link)) { |
597 | DPRINTK("PHY reports no device\n"); | 598 | DPRINTK("PHY reports no device\n"); |
598 | *class = ATA_DEV_NONE; | 599 | *class = ATA_DEV_NONE; |
599 | goto out; | 600 | goto out; |
@@ -609,7 +610,7 @@ static int sil24_do_softreset(struct ata_port *ap, unsigned int *class, | |||
609 | if (time_after(deadline, jiffies)) | 610 | if (time_after(deadline, jiffies)) |
610 | timeout_msec = jiffies_to_msecs(deadline - jiffies); | 611 | timeout_msec = jiffies_to_msecs(deadline - jiffies); |
611 | 612 | ||
612 | ata_tf_init(ap->link.device, &tf); /* doesn't really matter */ | 613 | ata_tf_init(link->device, &tf); /* doesn't really matter */ |
613 | rc = sil24_exec_polled_cmd(ap, pmp, &tf, 0, PRB_CTRL_SRST, | 614 | rc = sil24_exec_polled_cmd(ap, pmp, &tf, 0, PRB_CTRL_SRST, |
614 | timeout_msec); | 615 | timeout_msec); |
615 | if (rc == -EBUSY) { | 616 | if (rc == -EBUSY) { |
@@ -631,29 +632,30 @@ static int sil24_do_softreset(struct ata_port *ap, unsigned int *class, | |||
631 | return 0; | 632 | return 0; |
632 | 633 | ||
633 | err: | 634 | err: |
634 | ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason); | 635 | ata_link_printk(link, KERN_ERR, "softreset failed (%s)\n", reason); |
635 | return -EIO; | 636 | return -EIO; |
636 | } | 637 | } |
637 | 638 | ||
638 | static int sil24_softreset(struct ata_port *ap, unsigned int *class, | 639 | static int sil24_softreset(struct ata_link *link, unsigned int *class, |
639 | unsigned long deadline) | 640 | unsigned long deadline) |
640 | { | 641 | { |
641 | return sil24_do_softreset(ap, class, 0, deadline); | 642 | return sil24_do_softreset(link, class, 0, deadline); |
642 | } | 643 | } |
643 | 644 | ||
644 | static int sil24_hardreset(struct ata_port *ap, unsigned int *class, | 645 | static int sil24_hardreset(struct ata_link *link, unsigned int *class, |
645 | unsigned long deadline) | 646 | unsigned long deadline) |
646 | { | 647 | { |
648 | struct ata_port *ap = link->ap; | ||
647 | void __iomem *port = ap->ioaddr.cmd_addr; | 649 | void __iomem *port = ap->ioaddr.cmd_addr; |
648 | const char *reason; | 650 | const char *reason; |
649 | int tout_msec, rc; | 651 | int tout_msec, rc; |
650 | u32 tmp; | 652 | u32 tmp; |
651 | 653 | ||
652 | /* sil24 does the right thing(tm) without any protection */ | 654 | /* sil24 does the right thing(tm) without any protection */ |
653 | sata_set_spd(&ap->link); | 655 | sata_set_spd(link); |
654 | 656 | ||
655 | tout_msec = 100; | 657 | tout_msec = 100; |
656 | if (ata_link_online(&ap->link)) | 658 | if (ata_link_online(link)) |
657 | tout_msec = 5000; | 659 | tout_msec = 5000; |
658 | 660 | ||
659 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); | 661 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); |
@@ -663,14 +665,14 @@ static int sil24_hardreset(struct ata_port *ap, unsigned int *class, | |||
663 | /* SStatus oscillates between zero and valid status after | 665 | /* SStatus oscillates between zero and valid status after |
664 | * DEV_RST, debounce it. | 666 | * DEV_RST, debounce it. |
665 | */ | 667 | */ |
666 | rc = sata_link_debounce(&ap->link, sata_deb_timing_long, deadline); | 668 | rc = sata_link_debounce(link, sata_deb_timing_long, deadline); |
667 | if (rc) { | 669 | if (rc) { |
668 | reason = "PHY debouncing failed"; | 670 | reason = "PHY debouncing failed"; |
669 | goto err; | 671 | goto err; |
670 | } | 672 | } |
671 | 673 | ||
672 | if (tmp & PORT_CS_DEV_RST) { | 674 | if (tmp & PORT_CS_DEV_RST) { |
673 | if (ata_link_offline(&ap->link)) | 675 | if (ata_link_offline(link)) |
674 | return 0; | 676 | return 0; |
675 | reason = "link not ready"; | 677 | reason = "link not ready"; |
676 | goto err; | 678 | goto err; |
@@ -685,7 +687,7 @@ static int sil24_hardreset(struct ata_port *ap, unsigned int *class, | |||
685 | return -EAGAIN; | 687 | return -EAGAIN; |
686 | 688 | ||
687 | err: | 689 | err: |
688 | ata_port_printk(ap, KERN_ERR, "hardreset failed (%s)\n", reason); | 690 | ata_link_printk(link, KERN_ERR, "hardreset failed (%s)\n", reason); |
689 | return -EIO; | 691 | return -EIO; |
690 | } | 692 | } |
691 | 693 | ||