aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index d9832e234e44..4df8311968e9 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -483,8 +483,6 @@ static struct scsi_host_template mv6_sht = {
483}; 483};
484 484
485static const struct ata_port_operations mv5_ops = { 485static const struct ata_port_operations mv5_ops = {
486 .port_disable = ata_port_disable,
487
488 .tf_load = ata_tf_load, 486 .tf_load = ata_tf_load,
489 .tf_read = ata_tf_read, 487 .tf_read = ata_tf_read,
490 .check_status = ata_check_status, 488 .check_status = ata_check_status,
@@ -499,7 +497,6 @@ static const struct ata_port_operations mv5_ops = {
499 497
500 .irq_clear = mv_irq_clear, 498 .irq_clear = mv_irq_clear,
501 .irq_on = ata_irq_on, 499 .irq_on = ata_irq_on,
502 .irq_ack = ata_irq_ack,
503 500
504 .error_handler = mv_error_handler, 501 .error_handler = mv_error_handler,
505 .post_internal_cmd = mv_post_int_cmd, 502 .post_internal_cmd = mv_post_int_cmd,
@@ -514,8 +511,6 @@ static const struct ata_port_operations mv5_ops = {
514}; 511};
515 512
516static const struct ata_port_operations mv6_ops = { 513static const struct ata_port_operations mv6_ops = {
517 .port_disable = ata_port_disable,
518
519 .tf_load = ata_tf_load, 514 .tf_load = ata_tf_load,
520 .tf_read = ata_tf_read, 515 .tf_read = ata_tf_read,
521 .check_status = ata_check_status, 516 .check_status = ata_check_status,
@@ -530,7 +525,6 @@ static const struct ata_port_operations mv6_ops = {
530 525
531 .irq_clear = mv_irq_clear, 526 .irq_clear = mv_irq_clear,
532 .irq_on = ata_irq_on, 527 .irq_on = ata_irq_on,
533 .irq_ack = ata_irq_ack,
534 528
535 .error_handler = mv_error_handler, 529 .error_handler = mv_error_handler,
536 .post_internal_cmd = mv_post_int_cmd, 530 .post_internal_cmd = mv_post_int_cmd,
@@ -545,8 +539,6 @@ static const struct ata_port_operations mv6_ops = {
545}; 539};
546 540
547static const struct ata_port_operations mv_iie_ops = { 541static const struct ata_port_operations mv_iie_ops = {
548 .port_disable = ata_port_disable,
549
550 .tf_load = ata_tf_load, 542 .tf_load = ata_tf_load,
551 .tf_read = ata_tf_read, 543 .tf_read = ata_tf_read,
552 .check_status = ata_check_status, 544 .check_status = ata_check_status,
@@ -561,7 +553,6 @@ static const struct ata_port_operations mv_iie_ops = {
561 553
562 .irq_clear = mv_irq_clear, 554 .irq_clear = mv_irq_clear,
563 .irq_on = ata_irq_on, 555 .irq_on = ata_irq_on,
564 .irq_ack = ata_irq_ack,
565 556
566 .error_handler = mv_error_handler, 557 .error_handler = mv_error_handler,
567 .post_internal_cmd = mv_post_int_cmd, 558 .post_internal_cmd = mv_post_int_cmd,
@@ -1415,7 +1406,7 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
1415 struct mv_host_priv *hpriv = ap->host->private_data; 1406 struct mv_host_priv *hpriv = ap->host->private_data;
1416 unsigned int edma_enabled = (pp->pp_flags & MV_PP_FLAG_EDMA_EN); 1407 unsigned int edma_enabled = (pp->pp_flags & MV_PP_FLAG_EDMA_EN);
1417 unsigned int action = 0, err_mask = 0; 1408 unsigned int action = 0, err_mask = 0;
1418 struct ata_eh_info *ehi = &ap->eh_info; 1409 struct ata_eh_info *ehi = &ap->link.eh_info;
1419 1410
1420 ata_ehi_clear_desc(ehi); 1411 ata_ehi_clear_desc(ehi);
1421 1412
@@ -1423,8 +1414,8 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
1423 /* just a guess: do we need to do this? should we 1414 /* just a guess: do we need to do this? should we
1424 * expand this, and do it in all cases? 1415 * expand this, and do it in all cases?
1425 */ 1416 */
1426 sata_scr_read(ap, SCR_ERROR, &serr); 1417 sata_scr_read(&ap->link, SCR_ERROR, &serr);
1427 sata_scr_write_flush(ap, SCR_ERROR, serr); 1418 sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
1428 } 1419 }
1429 1420
1430 edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 1421 edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
@@ -1468,8 +1459,8 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
1468 } 1459 }
1469 1460
1470 if (edma_err_cause & EDMA_ERR_SERR) { 1461 if (edma_err_cause & EDMA_ERR_SERR) {
1471 sata_scr_read(ap, SCR_ERROR, &serr); 1462 sata_scr_read(&ap->link, SCR_ERROR, &serr);
1472 sata_scr_write_flush(ap, SCR_ERROR, serr); 1463 sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
1473 err_mask = AC_ERR_ATA_BUS; 1464 err_mask = AC_ERR_ATA_BUS;
1474 action |= ATA_EH_HARDRESET; 1465 action |= ATA_EH_HARDRESET;
1475 } 1466 }
@@ -1508,7 +1499,7 @@ static void mv_intr_pio(struct ata_port *ap)
1508 return; 1499 return;
1509 1500
1510 /* get active ATA command */ 1501 /* get active ATA command */
1511 qc = ata_qc_from_tag(ap, ap->active_tag); 1502 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1512 if (unlikely(!qc)) /* no active tag */ 1503 if (unlikely(!qc)) /* no active tag */
1513 return; 1504 return;
1514 if (qc->tf.flags & ATA_TFLAG_POLLING) /* polling; we don't own qc */ 1505 if (qc->tf.flags & ATA_TFLAG_POLLING) /* polling; we don't own qc */
@@ -1543,7 +1534,7 @@ static void mv_intr_edma(struct ata_port *ap)
1543 1534
1544 /* 50xx: get active ATA command */ 1535 /* 50xx: get active ATA command */
1545 if (IS_GEN_I(hpriv)) 1536 if (IS_GEN_I(hpriv))
1546 tag = ap->active_tag; 1537 tag = ap->link.active_tag;
1547 1538
1548 /* Gen II/IIE: get active ATA command via tag, to enable 1539 /* Gen II/IIE: get active ATA command via tag, to enable
1549 * support for queueing. this works transparently for 1540 * support for queueing. this works transparently for
@@ -1646,7 +1637,7 @@ static void mv_host_intr(struct ata_host *host, u32 relevant, unsigned int hc)
1646 if (unlikely(have_err_bits)) { 1637 if (unlikely(have_err_bits)) {
1647 struct ata_queued_cmd *qc; 1638 struct ata_queued_cmd *qc;
1648 1639
1649 qc = ata_qc_from_tag(ap, ap->active_tag); 1640 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1650 if (qc && (qc->tf.flags & ATA_TFLAG_POLLING)) 1641 if (qc && (qc->tf.flags & ATA_TFLAG_POLLING))
1651 continue; 1642 continue;
1652 1643
@@ -1687,15 +1678,15 @@ static void mv_pci_error(struct ata_host *host, void __iomem *mmio)
1687 1678
1688 for (i = 0; i < host->n_ports; i++) { 1679 for (i = 0; i < host->n_ports; i++) {
1689 ap = host->ports[i]; 1680 ap = host->ports[i];
1690 if (!ata_port_offline(ap)) { 1681 if (!ata_link_offline(&ap->link)) {
1691 ehi = &ap->eh_info; 1682 ehi = &ap->link.eh_info;
1692 ata_ehi_clear_desc(ehi); 1683 ata_ehi_clear_desc(ehi);
1693 if (!printed++) 1684 if (!printed++)
1694 ata_ehi_push_desc(ehi, 1685 ata_ehi_push_desc(ehi,
1695 "PCI err cause 0x%08x", err_cause); 1686 "PCI err cause 0x%08x", err_cause);
1696 err_mask = AC_ERR_HOST_BUS; 1687 err_mask = AC_ERR_HOST_BUS;
1697 ehi->action = ATA_EH_HARDRESET; 1688 ehi->action = ATA_EH_HARDRESET;
1698 qc = ata_qc_from_tag(ap, ap->active_tag); 1689 qc = ata_qc_from_tag(ap, ap->link.active_tag);
1699 if (qc) 1690 if (qc)
1700 qc->err_mask |= err_mask; 1691 qc->err_mask |= err_mask;
1701 else 1692 else
@@ -2198,14 +2189,14 @@ static void mv_phy_reset(struct ata_port *ap, unsigned int *class,
2198 2189
2199 /* Issue COMRESET via SControl */ 2190 /* Issue COMRESET via SControl */
2200comreset_retry: 2191comreset_retry:
2201 sata_scr_write_flush(ap, SCR_CONTROL, 0x301); 2192 sata_scr_write_flush(&ap->link, SCR_CONTROL, 0x301);
2202 msleep(1); 2193 msleep(1);
2203 2194
2204 sata_scr_write_flush(ap, SCR_CONTROL, 0x300); 2195 sata_scr_write_flush(&ap->link, SCR_CONTROL, 0x300);
2205 msleep(20); 2196 msleep(20);
2206 2197
2207 do { 2198 do {
2208 sata_scr_read(ap, SCR_STATUS, &sstatus); 2199 sata_scr_read(&ap->link, SCR_STATUS, &sstatus);
2209 if (((sstatus & 0x3) == 3) || ((sstatus & 0x3) == 0)) 2200 if (((sstatus & 0x3) == 3) || ((sstatus & 0x3) == 0))
2210 break; 2201 break;
2211 2202
@@ -2230,7 +2221,7 @@ comreset_retry:
2230 } 2221 }
2231#endif 2222#endif
2232 2223
2233 if (ata_port_offline(ap)) { 2224 if (ata_link_offline(&ap->link)) {
2234 *class = ATA_DEV_NONE; 2225 *class = ATA_DEV_NONE;
2235 return; 2226 return;
2236 } 2227 }
@@ -2257,7 +2248,7 @@ comreset_retry:
2257 */ 2248 */
2258 2249
2259 /* finally, read device signature from TF registers */ 2250 /* finally, read device signature from TF registers */
2260 *class = ata_dev_try_classify(ap, 0, NULL); 2251 *class = ata_dev_try_classify(ap->link.device, 1, NULL);
2261 2252
2262 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); 2253 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
2263 2254
@@ -2266,10 +2257,11 @@ comreset_retry:
2266 VPRINTK("EXIT\n"); 2257 VPRINTK("EXIT\n");
2267} 2258}
2268 2259
2269static int mv_prereset(struct ata_port *ap, unsigned long deadline) 2260static int mv_prereset(struct ata_link *link, unsigned long deadline)
2270{ 2261{
2262 struct ata_port *ap = link->ap;
2271 struct mv_port_priv *pp = ap->private_data; 2263 struct mv_port_priv *pp = ap->private_data;
2272 struct ata_eh_context *ehc = &ap->eh_context; 2264 struct ata_eh_context *ehc = &link->eh_context;
2273 int rc; 2265 int rc;
2274 2266
2275 rc = mv_stop_dma(ap); 2267 rc = mv_stop_dma(ap);
@@ -2285,7 +2277,7 @@ static int mv_prereset(struct ata_port *ap, unsigned long deadline)
2285 if (ehc->i.action & ATA_EH_HARDRESET) 2277 if (ehc->i.action & ATA_EH_HARDRESET)
2286 return 0; 2278 return 0;
2287 2279
2288 if (ata_port_online(ap)) 2280 if (ata_link_online(link))
2289 rc = ata_wait_ready(ap, deadline); 2281 rc = ata_wait_ready(ap, deadline);
2290 else 2282 else
2291 rc = -ENODEV; 2283 rc = -ENODEV;
@@ -2293,9 +2285,10 @@ static int mv_prereset(struct ata_port *ap, unsigned long deadline)
2293 return rc; 2285 return rc;
2294} 2286}
2295 2287
2296static int mv_hardreset(struct ata_port *ap, unsigned int *class, 2288static int mv_hardreset(struct ata_link *link, unsigned int *class,
2297 unsigned long deadline) 2289 unsigned long deadline)
2298{ 2290{
2291 struct ata_port *ap = link->ap;
2299 struct mv_host_priv *hpriv = ap->host->private_data; 2292 struct mv_host_priv *hpriv = ap->host->private_data;
2300 void __iomem *mmio = ap->host->iomap[MV_PRIMARY_BAR]; 2293 void __iomem *mmio = ap->host->iomap[MV_PRIMARY_BAR];
2301 2294
@@ -2308,16 +2301,17 @@ static int mv_hardreset(struct ata_port *ap, unsigned int *class,
2308 return 0; 2301 return 0;
2309} 2302}
2310 2303
2311static void mv_postreset(struct ata_port *ap, unsigned int *classes) 2304static void mv_postreset(struct ata_link *link, unsigned int *classes)
2312{ 2305{
2306 struct ata_port *ap = link->ap;
2313 u32 serr; 2307 u32 serr;
2314 2308
2315 /* print link status */ 2309 /* print link status */
2316 sata_print_link_status(ap); 2310 sata_print_link_status(link);
2317 2311
2318 /* clear SError */ 2312 /* clear SError */
2319 sata_scr_read(ap, SCR_ERROR, &serr); 2313 sata_scr_read(link, SCR_ERROR, &serr);
2320 sata_scr_write_flush(ap, SCR_ERROR, serr); 2314 sata_scr_write_flush(link, SCR_ERROR, serr);
2321 2315
2322 /* bail out if no device is present */ 2316 /* bail out if no device is present */
2323 if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) { 2317 if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
@@ -2590,8 +2584,14 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
2590 } 2584 }
2591 2585
2592 for (port = 0; port < host->n_ports; port++) { 2586 for (port = 0; port < host->n_ports; port++) {
2587 struct ata_port *ap = host->ports[port];
2593 void __iomem *port_mmio = mv_port_base(mmio, port); 2588 void __iomem *port_mmio = mv_port_base(mmio, port);
2594 mv_port_init(&host->ports[port]->ioaddr, port_mmio); 2589 unsigned int offset = port_mmio - mmio;
2590
2591 mv_port_init(&ap->ioaddr, port_mmio);
2592
2593 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio");
2594 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port");
2595 } 2595 }
2596 2596
2597 for (hc = 0; hc < n_hc; hc++) { 2597 for (hc = 0; hc < n_hc; hc++) {