Lines Matching full:ap
156 #define HSDEV_FROM_AP(ap) ((struct sata_dwc_device *)(ap)->host->private_data) argument
157 #define HSDEVP_FROM_AP(ap) ((struct sata_dwc_device_port *)(ap)->private_data) argument
158 #define HSDEV_FROM_QC(qc) ((struct sata_dwc_device *)(qc)->ap->host->private_data)
176 static int sata_dwc_qc_complete(struct ata_port *ap, struct ata_queued_cmd *qc);
177 static void sata_dwc_dma_xfer_complete(struct ata_port *ap);
293 struct ata_port *ap; in dma_dwc_xfer_done() local
299 ap = host->ports[port]; in dma_dwc_xfer_done()
300 hsdevp = HSDEVP_FROM_AP(ap); in dma_dwc_xfer_done()
301 tag = ap->link.active_tag; in dma_dwc_xfer_done()
312 dev_err(ap->dev, "DMA not pending tag=0x%02x pending=%d\n", in dma_dwc_xfer_done()
317 sata_dwc_dma_xfer_complete(ap); in dma_dwc_xfer_done()
324 struct ata_port *ap = qc->ap; in dma_dwc_xfer_setup() local
325 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in dma_dwc_xfer_setup()
326 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); in dma_dwc_xfer_setup()
366 dev_err(link->ap->dev, "%s: Incorrect SCR offset 0x%02x\n", in sata_dwc_scr_read()
371 *val = sata_dwc_readl(link->ap->ioaddr.scr_addr + (scr * 4)); in sata_dwc_scr_read()
372 dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=0x%08x\n", __func__, in sata_dwc_scr_read()
373 link->ap->print_id, scr, *val); in sata_dwc_scr_read()
380 dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=0x%08x\n", __func__, in sata_dwc_scr_write()
381 link->ap->print_id, scr, val); in sata_dwc_scr_write()
383 dev_err(link->ap->dev, "%s: Incorrect SCR offset 0x%02x\n", in sata_dwc_scr_write()
387 sata_dwc_writel(link->ap->ioaddr.scr_addr + (scr * 4), val); in sata_dwc_scr_write()
392 static void clear_serror(struct ata_port *ap) in clear_serror() argument
395 sata_dwc_scr_read(&ap->link, SCR_ERROR, &val); in clear_serror()
396 sata_dwc_scr_write(&ap->link, SCR_ERROR, val); in clear_serror()
411 static void sata_dwc_error_intr(struct ata_port *ap, in sata_dwc_error_intr() argument
414 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_error_intr()
415 struct ata_eh_info *ehi = &ap->link.eh_info; in sata_dwc_error_intr()
423 sata_dwc_scr_read(&ap->link, SCR_ERROR, &serror); in sata_dwc_error_intr()
424 status = ap->ops->sff_check_status(ap); in sata_dwc_error_intr()
426 tag = ap->link.active_tag; in sata_dwc_error_intr()
428 dev_err(ap->dev, in sata_dwc_error_intr()
434 clear_serror(ap); in sata_dwc_error_intr()
446 qc = ata_qc_from_tag(ap, tag); in sata_dwc_error_intr()
452 ata_port_abort(ap); in sata_dwc_error_intr()
466 struct ata_port *ap; in sata_dwc_isr() local
480 ap = host->ports[port]; in sata_dwc_isr()
481 hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_isr()
483 dev_dbg(ap->dev, "%s intpr=0x%08x active_tag=%d\n", __func__, intpr, in sata_dwc_isr()
484 ap->link.active_tag); in sata_dwc_isr()
488 sata_dwc_error_intr(ap, hsdev, intpr); in sata_dwc_isr()
498 dev_dbg(ap->dev, "%s: NEWFP tag=%d\n", __func__, tag); in sata_dwc_isr()
500 dev_warn(ap->dev, "CMD tag=%d not pending?\n", tag); in sata_dwc_isr()
504 qc = ata_qc_from_tag(ap, tag); in sata_dwc_isr()
506 dev_err(ap->dev, "failed to get qc"); in sata_dwc_isr()
515 trace_ata_bmdma_start(ap, &qc->tf, tag); in sata_dwc_isr()
516 qc->ap->link.active_tag = tag; in sata_dwc_isr()
522 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_isr()
527 if (ap->link.active_tag == ATA_TAG_POISON) in sata_dwc_isr()
530 tag = ap->link.active_tag; in sata_dwc_isr()
531 qc = ata_qc_from_tag(ap, tag); in sata_dwc_isr()
535 dev_err(ap->dev, in sata_dwc_isr()
538 ap->ops->sff_check_status(ap); in sata_dwc_isr()
542 status = ap->ops->sff_check_status(ap); in sata_dwc_isr()
544 qc->ap->link.active_tag = tag; in sata_dwc_isr()
548 dev_dbg(ap->dev, "interrupt ATA_ERR (0x%x)\n", status); in sata_dwc_isr()
549 sata_dwc_qc_complete(ap, qc); in sata_dwc_isr()
554 dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n", in sata_dwc_isr()
567 dev_err(ap->dev, in sata_dwc_isr()
574 sata_dwc_dma_xfer_complete(ap); in sata_dwc_isr()
576 ata_sff_hsm_move(ap, qc, status, 0); in sata_dwc_isr()
580 if (unlikely(sata_dwc_qc_complete(ap, qc))) in sata_dwc_isr()
596 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_isr()
600 dev_dbg(ap->dev, in sata_dwc_isr()
606 dev_warn(ap->dev, in sata_dwc_isr()
612 status = ap->ops->sff_check_status(ap); in sata_dwc_isr()
613 dev_dbg(ap->dev, "%s ATA status register=0x%x\n", __func__, status); in sata_dwc_isr()
623 qc = ata_qc_from_tag(ap, tag); in sata_dwc_isr()
625 dev_err(ap->dev, "failed to get qc"); in sata_dwc_isr()
631 qc->ap->link.active_tag = tag; in sata_dwc_isr()
636 dev_dbg(ap->dev, "%s ATA_ERR (0x%x)\n", __func__, in sata_dwc_isr()
638 sata_dwc_qc_complete(ap, qc); in sata_dwc_isr()
644 dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__, in sata_dwc_isr()
650 dev_warn(ap->dev, "%s: DMA not pending?\n", in sata_dwc_isr()
653 sata_dwc_dma_xfer_complete(ap); in sata_dwc_isr()
655 if (unlikely(sata_dwc_qc_complete(ap, qc))) in sata_dwc_isr()
661 ap->stats.idle_irq++; in sata_dwc_isr()
662 dev_warn(ap->dev, "STILL BUSY IRQ ata%d: irq trap\n", in sata_dwc_isr()
663 ap->print_id); in sata_dwc_isr()
673 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive2); in sata_dwc_isr()
675 dev_dbg(ap->dev, in sata_dwc_isr()
710 static void sata_dwc_dma_xfer_complete(struct ata_port *ap) in sata_dwc_dma_xfer_complete() argument
713 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_dma_xfer_complete()
714 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); in sata_dwc_dma_xfer_complete()
717 tag = ap->link.active_tag; in sata_dwc_dma_xfer_complete()
718 qc = ata_qc_from_tag(ap, tag); in sata_dwc_dma_xfer_complete()
720 dev_err(ap->dev, "failed to get qc"); in sata_dwc_dma_xfer_complete()
726 dev_err(ap->dev, in sata_dwc_dma_xfer_complete()
733 sata_dwc_qc_complete(ap, qc); in sata_dwc_dma_xfer_complete()
734 ap->link.active_tag = ATA_TAG_POISON; in sata_dwc_dma_xfer_complete()
736 sata_dwc_qc_complete(ap, qc); in sata_dwc_dma_xfer_complete()
740 static int sata_dwc_qc_complete(struct ata_port *ap, struct ata_queued_cmd *qc) in sata_dwc_qc_complete() argument
745 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); in sata_dwc_qc_complete()
746 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_qc_complete()
750 dev_err(ap->dev, "TX DMA PENDING\n"); in sata_dwc_qc_complete()
752 dev_err(ap->dev, "RX DMA PENDING\n"); in sata_dwc_qc_complete()
753 dev_dbg(ap->dev, in sata_dwc_qc_complete()
755 qc->tf.command, status, ap->print_id, qc->tf.protocol); in sata_dwc_qc_complete()
832 static int sata_dwc_port_start(struct ata_port *ap) in sata_dwc_port_start() argument
840 hsdev = HSDEV_FROM_AP(ap); in sata_dwc_port_start()
842 dev_dbg(ap->dev, "%s: port_no=%d\n", __func__, ap->port_no); in sata_dwc_port_start()
844 hsdev->host = ap->host; in sata_dwc_port_start()
845 pdev = ap->host->dev; in sata_dwc_port_start()
847 dev_err(ap->dev, "%s: no ap->host->dev\n", __func__); in sata_dwc_port_start()
871 ap->bmdma_prd = NULL; /* set these so libata doesn't use them */ in sata_dwc_port_start()
872 ap->bmdma_prd_dma = 0; in sata_dwc_port_start()
874 if (ap->port_no == 0) { in sata_dwc_port_start()
875 dev_dbg(ap->dev, "%s: clearing TXCHEN, RXCHEN in DMAC\n", in sata_dwc_port_start()
880 dev_dbg(ap->dev, "%s: setting burst size in DBTSR\n", in sata_dwc_port_start()
888 clear_serror(ap); in sata_dwc_port_start()
889 ap->private_data = hsdevp; in sata_dwc_port_start()
890 dev_dbg(ap->dev, "%s: done\n", __func__); in sata_dwc_port_start()
896 dev_dbg(ap->dev, "%s: fail. ap->id = %d\n", __func__, ap->print_id); in sata_dwc_port_start()
900 static void sata_dwc_port_stop(struct ata_port *ap) in sata_dwc_port_stop() argument
902 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_port_stop()
903 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); in sata_dwc_port_stop()
905 dev_dbg(ap->dev, "%s: ap->id = %d\n", __func__, ap->print_id); in sata_dwc_port_stop()
912 ap->private_data = NULL; in sata_dwc_port_stop()
917 * arguments : ata_port *ap, ata_taskfile *tf, u8 tag, u32 cmd_issued
922 static void sata_dwc_exec_command_by_tag(struct ata_port *ap, in sata_dwc_exec_command_by_tag() argument
926 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_exec_command_by_tag()
936 clear_serror(ap); in sata_dwc_exec_command_by_tag()
937 ata_sff_exec_command(ap, tf); in sata_dwc_exec_command_by_tag()
942 sata_dwc_exec_command_by_tag(qc->ap, &qc->tf, tag, in sata_dwc_bmdma_setup_by_tag()
961 struct ata_port *ap = qc->ap; in sata_dwc_bmdma_start_by_tag() local
962 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_bmdma_start_by_tag()
973 dev_err(ap->dev, in sata_dwc_bmdma_start_by_tag()
980 sata_dwc_scr_read(&ap->link, SCR_ERROR, ®); in sata_dwc_bmdma_start_by_tag()
982 dev_err(ap->dev, "%s: ****** SError=0x%08x ******\n", in sata_dwc_bmdma_start_by_tag()
1013 struct ata_port *ap = qc->ap; in sata_dwc_qc_issue() local
1014 struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); in sata_dwc_qc_issue()
1028 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_qc_issue()
1030 sata_dwc_scr_write(&ap->link, SCR_ACTIVE, sactive); in sata_dwc_qc_issue()
1032 trace_ata_tf_load(ap, &qc->tf); in sata_dwc_qc_issue()
1033 ap->ops->sff_tf_load(ap, &qc->tf); in sata_dwc_qc_issue()
1034 trace_ata_exec_command(ap, &qc->tf, tag); in sata_dwc_qc_issue()
1035 sata_dwc_exec_command_by_tag(ap, &qc->tf, tag, in sata_dwc_qc_issue()
1043 static void sata_dwc_error_handler(struct ata_port *ap) in sata_dwc_error_handler() argument
1045 ata_sff_error_handler(ap); in sata_dwc_error_handler()
1051 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(link->ap); in sata_dwc_hardreset()
1070 static void sata_dwc_dev_select(struct ata_port *ap, unsigned int device) in sata_dwc_dev_select() argument