diff options
author | Yuan-Hsin Chen <yhchen@faraday-tech.com> | 2011-06-21 05:17:38 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2011-07-23 17:57:36 -0400 |
commit | 345347c5d767332d7352f220808fe9b5e4af8c6b (patch) | |
tree | 7168a49db28e6fa13f938e21d6d661ff2b0be7ae /drivers/ata/ahci.c | |
parent | 8ea7645c5a949f9d0ea86edc0778713b5e63ab74 (diff) |
ahci: move ahci_sb600_softreset to libahci.c and rename it
ahci_sb600_softreset was in ahci.c. This function is used
to fix soft reset failure and renames as ahci_pmp_retry_softreset
in libahci.c.
Signed-off-by: Yuan-Hsin Chen <yhchen@faraday-tech.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r-- | drivers/ata/ahci.c | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 6ea99df87146..fd318ac36432 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -79,8 +79,6 @@ enum board_ids { | |||
79 | }; | 79 | }; |
80 | 80 | ||
81 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 81 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
82 | static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class, | ||
83 | unsigned long deadline); | ||
84 | static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, | 82 | static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, |
85 | unsigned long deadline); | 83 | unsigned long deadline); |
86 | static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class, | 84 | static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class, |
@@ -104,12 +102,6 @@ static struct ata_port_operations ahci_p5wdh_ops = { | |||
104 | .hardreset = ahci_p5wdh_hardreset, | 102 | .hardreset = ahci_p5wdh_hardreset, |
105 | }; | 103 | }; |
106 | 104 | ||
107 | static struct ata_port_operations ahci_sb600_ops = { | ||
108 | .inherits = &ahci_ops, | ||
109 | .softreset = ahci_sb600_softreset, | ||
110 | .pmp_softreset = ahci_sb600_softreset, | ||
111 | }; | ||
112 | |||
113 | #define AHCI_HFLAGS(flags) .private_data = (void *)(flags) | 105 | #define AHCI_HFLAGS(flags) .private_data = (void *)(flags) |
114 | 106 | ||
115 | static const struct ata_port_info ahci_port_info[] = { | 107 | static const struct ata_port_info ahci_port_info[] = { |
@@ -188,7 +180,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
188 | .flags = AHCI_FLAG_COMMON, | 180 | .flags = AHCI_FLAG_COMMON, |
189 | .pio_mask = ATA_PIO4, | 181 | .pio_mask = ATA_PIO4, |
190 | .udma_mask = ATA_UDMA6, | 182 | .udma_mask = ATA_UDMA6, |
191 | .port_ops = &ahci_sb600_ops, | 183 | .port_ops = &ahci_pmp_retry_srst_ops, |
192 | }, | 184 | }, |
193 | [board_ahci_sb700] = /* for SB700 and SB800 */ | 185 | [board_ahci_sb700] = /* for SB700 and SB800 */ |
194 | { | 186 | { |
@@ -196,7 +188,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
196 | .flags = AHCI_FLAG_COMMON, | 188 | .flags = AHCI_FLAG_COMMON, |
197 | .pio_mask = ATA_PIO4, | 189 | .pio_mask = ATA_PIO4, |
198 | .udma_mask = ATA_UDMA6, | 190 | .udma_mask = ATA_UDMA6, |
199 | .port_ops = &ahci_sb600_ops, | 191 | .port_ops = &ahci_pmp_retry_srst_ops, |
200 | }, | 192 | }, |
201 | [board_ahci_vt8251] = | 193 | [board_ahci_vt8251] = |
202 | { | 194 | { |
@@ -502,54 +494,6 @@ static void ahci_pci_init_controller(struct ata_host *host) | |||
502 | ahci_init_controller(host); | 494 | ahci_init_controller(host); |
503 | } | 495 | } |
504 | 496 | ||
505 | static int ahci_sb600_check_ready(struct ata_link *link) | ||
506 | { | ||
507 | void __iomem *port_mmio = ahci_port_base(link->ap); | ||
508 | u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF; | ||
509 | u32 irq_status = readl(port_mmio + PORT_IRQ_STAT); | ||
510 | |||
511 | /* | ||
512 | * There is no need to check TFDATA if BAD PMP is found due to HW bug, | ||
513 | * which can save timeout delay. | ||
514 | */ | ||
515 | if (irq_status & PORT_IRQ_BAD_PMP) | ||
516 | return -EIO; | ||
517 | |||
518 | return ata_check_ready(status); | ||
519 | } | ||
520 | |||
521 | static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class, | ||
522 | unsigned long deadline) | ||
523 | { | ||
524 | struct ata_port *ap = link->ap; | ||
525 | void __iomem *port_mmio = ahci_port_base(ap); | ||
526 | int pmp = sata_srst_pmp(link); | ||
527 | int rc; | ||
528 | u32 irq_sts; | ||
529 | |||
530 | DPRINTK("ENTER\n"); | ||
531 | |||
532 | rc = ahci_do_softreset(link, class, pmp, deadline, | ||
533 | ahci_sb600_check_ready); | ||
534 | |||
535 | /* | ||
536 | * Soft reset fails on some ATI chips with IPMS set when PMP | ||
537 | * is enabled but SATA HDD/ODD is connected to SATA port, | ||
538 | * do soft reset again to port 0. | ||
539 | */ | ||
540 | if (rc == -EIO) { | ||
541 | irq_sts = readl(port_mmio + PORT_IRQ_STAT); | ||
542 | if (irq_sts & PORT_IRQ_BAD_PMP) { | ||
543 | ata_link_warn(link, | ||
544 | "applying SB600 PMP SRST workaround and retrying\n"); | ||
545 | rc = ahci_do_softreset(link, class, 0, deadline, | ||
546 | ahci_check_ready); | ||
547 | } | ||
548 | } | ||
549 | |||
550 | return rc; | ||
551 | } | ||
552 | |||
553 | static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, | 497 | static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, |
554 | unsigned long deadline) | 498 | unsigned long deadline) |
555 | { | 499 | { |