aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_fsl.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-09-06 11:56:29 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-10-21 20:21:05 -0400
commit97750cebb3000a9cc08f8ce8dc8c7143be7d7201 (patch)
tree04220b8a8ed3f353e3e0023805b32e7d746dc6f3 /drivers/ata/sata_fsl.c
parenta97c40068fab5d85c4241451fc312cb9025d7e6c (diff)
libata: add @ap to ata_wait_register() and introduce ata_msleep()
Add optional @ap argument to ata_wait_register() and replace msleep() calls with ata_msleep() which take optional @ap in addition to the duration. These will be used to implement EH exclusion. This patch doesn't cause any behavior difference. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_fsl.c')
-rw-r--r--drivers/ata/sata_fsl.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 1440dc0af242..b0214d00d50b 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -678,7 +678,7 @@ static void sata_fsl_port_stop(struct ata_port *ap)
678 iowrite32(temp, hcr_base + HCONTROL); 678 iowrite32(temp, hcr_base + HCONTROL);
679 679
680 /* Poll for controller to go offline - should happen immediately */ 680 /* Poll for controller to go offline - should happen immediately */
681 ata_wait_register(hcr_base + HSTATUS, ONLINE, ONLINE, 1, 1); 681 ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, ONLINE, 1, 1);
682 682
683 ap->private_data = NULL; 683 ap->private_data = NULL;
684 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, 684 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ,
@@ -729,7 +729,8 @@ try_offline_again:
729 iowrite32(temp, hcr_base + HCONTROL); 729 iowrite32(temp, hcr_base + HCONTROL);
730 730
731 /* Poll for controller to go offline */ 731 /* Poll for controller to go offline */
732 temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, ONLINE, 1, 500); 732 temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, ONLINE,
733 1, 500);
733 734
734 if (temp & ONLINE) { 735 if (temp & ONLINE) {
735 ata_port_printk(ap, KERN_ERR, 736 ata_port_printk(ap, KERN_ERR,
@@ -752,7 +753,7 @@ try_offline_again:
752 /* 753 /*
753 * PHY reset should remain asserted for atleast 1ms 754 * PHY reset should remain asserted for atleast 1ms
754 */ 755 */
755 msleep(1); 756 ata_msleep(ap, 1);
756 757
757 /* 758 /*
758 * Now, bring the host controller online again, this can take time 759 * Now, bring the host controller online again, this can take time
@@ -766,7 +767,7 @@ try_offline_again:
766 temp |= HCONTROL_PMP_ATTACHED; 767 temp |= HCONTROL_PMP_ATTACHED;
767 iowrite32(temp, hcr_base + HCONTROL); 768 iowrite32(temp, hcr_base + HCONTROL);
768 769
769 temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500); 770 temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, 0, 1, 500);
770 771
771 if (!(temp & ONLINE)) { 772 if (!(temp & ONLINE)) {
772 ata_port_printk(ap, KERN_ERR, 773 ata_port_printk(ap, KERN_ERR,
@@ -784,7 +785,7 @@ try_offline_again:
784 * presence 785 * presence
785 */ 786 */
786 787
787 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); 788 temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0, 1, 500);
788 if ((!(temp & 0x10)) || ata_link_offline(link)) { 789 if ((!(temp & 0x10)) || ata_link_offline(link)) {
789 ata_port_printk(ap, KERN_WARNING, 790 ata_port_printk(ap, KERN_WARNING,
790 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 791 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
@@ -797,7 +798,7 @@ try_offline_again:
797 * Wait for the first D2H from device,i.e,signature update notification 798 * Wait for the first D2H from device,i.e,signature update notification
798 */ 799 */
799 start_jiffies = jiffies; 800 start_jiffies = jiffies;
800 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0x10, 801 temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0x10,
801 500, jiffies_to_msecs(deadline - start_jiffies)); 802 500, jiffies_to_msecs(deadline - start_jiffies));
802 803
803 if ((temp & 0xFF) != 0x18) { 804 if ((temp & 0xFF) != 0x18) {
@@ -880,7 +881,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
880 iowrite32(pmp, CQPMP + hcr_base); 881 iowrite32(pmp, CQPMP + hcr_base);
881 iowrite32(1, CQ + hcr_base); 882 iowrite32(1, CQ + hcr_base);
882 883
883 temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); 884 temp = ata_wait_register(ap, CQ + hcr_base, 0x1, 0x1, 1, 5000);
884 if (temp & 0x1) { 885 if (temp & 0x1) {
885 ata_port_printk(ap, KERN_WARNING, "ATA_SRST issue failed\n"); 886 ata_port_printk(ap, KERN_WARNING, "ATA_SRST issue failed\n");
886 887
@@ -896,7 +897,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
896 goto err; 897 goto err;
897 } 898 }
898 899
899 msleep(1); 900 ata_msleep(ap, 1);
900 901
901 /* 902 /*
902 * SATA device enters reset state after receving a Control register 903 * SATA device enters reset state after receving a Control register
@@ -915,7 +916,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
915 if (pmp != SATA_PMP_CTRL_PORT) 916 if (pmp != SATA_PMP_CTRL_PORT)
916 iowrite32(pmp, CQPMP + hcr_base); 917 iowrite32(pmp, CQPMP + hcr_base);
917 iowrite32(1, CQ + hcr_base); 918 iowrite32(1, CQ + hcr_base);
918 msleep(150); /* ?? */ 919 ata_msleep(ap, 150); /* ?? */
919 920
920 /* 921 /*
921 * The above command would have signalled an interrupt on command 922 * The above command would have signalled an interrupt on command