Lines Matching +full:dwc +full:- +full:ahci

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Synopsys DesignWare Cores (DWC) SATA host driver
38 #define DRV_NAME "sata-dwc"
53 /* DWC SATA Registers */
88 /* DWC SATA Register Operations */
123 struct ata_probe_ent *pe; /* ptr to probe-ent */
153 * Commonly used DWC SATA driver macros
155 #define HSDEV_FROM_HOST(host) ((struct sata_dwc_device *)(host)->private_data)
156 #define HSDEV_FROM_AP(ap) ((struct sata_dwc_device *)(ap)->host->private_data)
157 #define HSDEVP_FROM_AP(ap) ((struct sata_dwc_device_port *)(ap)->private_data)
158 #define HSDEV_FROM_QC(qc) ((struct sata_dwc_device *)(qc)->ap->host->private_data)
159 #define HSDEV_FROM_HSDEVP(p) ((struct sata_dwc_device *)(p)->hsdev)
182 #include <linux/platform_data/dma-dw.h>
196 if (dws->dma_dev != chan->device->dev) in sata_dwc_dma_filter()
199 chan->private = dws; in sata_dwc_dma_filter()
205 struct sata_dwc_device *hsdev = hsdevp->hsdev; in sata_dwc_dma_get_channel_old()
207 struct device *dev = hsdev->dev; in sata_dwc_dma_get_channel_old()
210 dws->dma_dev = dev; in sata_dwc_dma_get_channel_old()
216 hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp); in sata_dwc_dma_get_channel_old()
217 if (!hsdevp->chan) { in sata_dwc_dma_get_channel_old()
219 return -EAGAIN; in sata_dwc_dma_get_channel_old()
228 struct device *dev = &pdev->dev; in sata_dwc_dma_init_old()
229 struct device_node *np = dev->of_node; in sata_dwc_dma_init_old()
231 hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL); in sata_dwc_dma_init_old()
232 if (!hsdev->dma) in sata_dwc_dma_init_old()
233 return -ENOMEM; in sata_dwc_dma_init_old()
235 hsdev->dma->dev = dev; in sata_dwc_dma_init_old()
236 hsdev->dma->id = pdev->id; in sata_dwc_dma_init_old()
239 hsdev->dma->irq = irq_of_parse_and_map(np, 1); in sata_dwc_dma_init_old()
240 if (!hsdev->dma->irq) { in sata_dwc_dma_init_old()
242 return -ENODEV; in sata_dwc_dma_init_old()
246 hsdev->dma->regs = devm_platform_ioremap_resource(pdev, 1); in sata_dwc_dma_init_old()
247 if (IS_ERR(hsdev->dma->regs)) in sata_dwc_dma_init_old()
248 return PTR_ERR(hsdev->dma->regs); in sata_dwc_dma_init_old()
251 return dw_dma_probe(hsdev->dma); in sata_dwc_dma_init_old()
256 if (!hsdev->dma) in sata_dwc_dma_exit_old()
259 dw_dma_remove(hsdev->dma); in sata_dwc_dma_exit_old()
292 struct ata_host *host = (struct ata_host *)hsdev->host; in dma_dwc_xfer_done()
298 spin_lock_irqsave(&host->lock, flags); in dma_dwc_xfer_done()
299 ap = host->ports[port]; in dma_dwc_xfer_done()
301 tag = ap->link.active_tag; in dma_dwc_xfer_done()
308 hsdevp->dma_interrupt_count++; in dma_dwc_xfer_done()
311 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) { in dma_dwc_xfer_done()
312 dev_err(ap->dev, "DMA not pending tag=0x%02x pending=%d\n", in dma_dwc_xfer_done()
313 tag, hsdevp->dma_pending[tag]); in dma_dwc_xfer_done()
316 if ((hsdevp->dma_interrupt_count % 2) == 0) in dma_dwc_xfer_done()
319 spin_unlock_irqrestore(&host->lock, flags); in dma_dwc_xfer_done()
324 struct ata_port *ap = qc->ap; in dma_dwc_xfer_setup()
330 if (qc->dma_dir == DMA_DEV_TO_MEM) { in dma_dwc_xfer_setup()
331 sconf.src_addr = hsdev->dmadr; in dma_dwc_xfer_setup()
334 sconf.dst_addr = hsdev->dmadr; in dma_dwc_xfer_setup()
338 sconf.direction = qc->dma_dir; in dma_dwc_xfer_setup()
344 dmaengine_slave_config(hsdevp->chan, &sconf); in dma_dwc_xfer_setup()
347 desc = dmaengine_prep_slave_sg(hsdevp->chan, qc->sg, qc->n_elem, in dma_dwc_xfer_setup()
348 qc->dma_dir, in dma_dwc_xfer_setup()
354 desc->callback = dma_dwc_xfer_done; in dma_dwc_xfer_setup()
355 desc->callback_param = hsdev; in dma_dwc_xfer_setup()
357 dev_dbg(hsdev->dev, "%s sg: 0x%p, count: %d addr: %pa\n", __func__, in dma_dwc_xfer_setup()
358 qc->sg, qc->n_elem, &hsdev->dmadr); in dma_dwc_xfer_setup()
366 dev_err(link->ap->dev, "%s: Incorrect SCR offset 0x%02x\n", in sata_dwc_scr_read()
368 return -EINVAL; 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()
385 return -EINVAL; in sata_dwc_scr_write()
387 sata_dwc_writel(link->ap->ioaddr.scr_addr + (scr * 4), val); in sata_dwc_scr_write()
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()
401 sata_dwc_writel(&hsdev->sata_dwc_regs->intpr, in clear_interrupt_bit()
402 sata_dwc_readl(&hsdev->sata_dwc_regs->intpr)); in clear_interrupt_bit()
410 /* See ahci.c */
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()
430 __func__, serror, intpr, status, hsdevp->dma_interrupt_count, in sata_dwc_error_intr()
431 hsdevp->dma_pending[tag], hsdevp->cmd_issued[tag]); in sata_dwc_error_intr()
443 ehi->serror |= serror; in sata_dwc_error_intr()
444 ehi->action |= action; in sata_dwc_error_intr()
448 qc->err_mask |= err_mask; in sata_dwc_error_intr()
450 ehi->err_mask |= err_mask; in sata_dwc_error_intr()
458 * Return value : irqreturn_t - status of IRQ
473 hsdev->sactive_issued = 0; in sata_dwc_isr()
475 spin_lock_irqsave(&host->lock, flags); in sata_dwc_isr()
478 intpr = sata_dwc_readl(&hsdev->sata_dwc_regs->intpr); in sata_dwc_isr()
480 ap = host->ports[port]; 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()
497 tag = (u8)(sata_dwc_readl(&hsdev->sata_dwc_regs->fptagr)); in sata_dwc_isr()
498 dev_dbg(ap->dev, "%s: NEWFP tag=%d\n", __func__, tag); in sata_dwc_isr()
499 if (hsdevp->cmd_issued[tag] != SATA_DWC_CMD_ISSUED_PEND) in sata_dwc_isr()
500 dev_warn(ap->dev, "CMD tag=%d not pending?\n", tag); in sata_dwc_isr()
502 hsdev->sactive_issued |= qcmd_tag_to_mask(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()
523 tag_mask = (hsdev->sactive_issued | sactive) ^ sactive; in sata_dwc_isr()
526 if (hsdev->sactive_issued == 0 && tag_mask == 0) { 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()
534 if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { 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()
545 hsdevp->cmd_issued[tag] = SATA_DWC_CMD_ISSUED_NOT; in sata_dwc_isr()
548 dev_dbg(ap->dev, "interrupt ATA_ERR (0x%x)\n", status); in sata_dwc_isr()
554 dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n", in sata_dwc_isr()
555 __func__, get_prot_descript(qc->tf.protocol)); in sata_dwc_isr()
557 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_isr()
564 hsdevp->dma_interrupt_count++; in sata_dwc_isr()
565 if (hsdevp->dma_pending[tag] == \ in sata_dwc_isr()
567 dev_err(ap->dev, in sata_dwc_isr()
570 hsdevp->dma_pending[tag]); in sata_dwc_isr()
573 if ((hsdevp->dma_interrupt_count % 2) == 0) in sata_dwc_isr()
575 } else if (ata_is_pio(qc->tf.protocol)) { in sata_dwc_isr()
596 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_isr()
597 tag_mask = (hsdev->sactive_issued | sactive) ^ sactive; in sata_dwc_isr()
599 if (sactive != 0 || hsdev->sactive_issued > 1 || tag_mask > 1) { in sata_dwc_isr()
600 dev_dbg(ap->dev, in sata_dwc_isr()
602 __func__, sactive, hsdev->sactive_issued, tag_mask); in sata_dwc_isr()
605 if ((tag_mask | hsdev->sactive_issued) != hsdev->sactive_issued) { in sata_dwc_isr()
606 dev_warn(ap->dev, in sata_dwc_isr()
608 sactive, hsdev->sactive_issued, tag_mask); 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()
625 dev_err(ap->dev, "failed to get qc"); in sata_dwc_isr()
631 qc->ap->link.active_tag = tag; in sata_dwc_isr()
632 hsdevp->cmd_issued[tag] = SATA_DWC_CMD_ISSUED_NOT; in sata_dwc_isr()
636 dev_dbg(ap->dev, "%s ATA_ERR (0x%x)\n", __func__, in sata_dwc_isr()
644 dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__, in sata_dwc_isr()
645 get_prot_descript(qc->tf.protocol)); in sata_dwc_isr()
646 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_isr()
647 hsdevp->dma_interrupt_count++; in sata_dwc_isr()
648 if (hsdevp->dma_pending[tag] == \ in sata_dwc_isr()
650 dev_warn(ap->dev, "%s: DMA not pending?\n", in sata_dwc_isr()
652 if ((hsdevp->dma_interrupt_count % 2) == 0) 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()
670 * we were processing --we read status as part of processing a completed 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()
676 "More completed - sactive=0x%x sactive2=0x%x\n", in sata_dwc_isr()
682 spin_unlock_irqrestore(&host->lock, flags); in sata_dwc_isr()
689 u32 dmacr = sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr); in sata_dwc_clear_dmacr()
691 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_RX) { in sata_dwc_clear_dmacr()
693 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, dmacr); in sata_dwc_clear_dmacr()
694 } else if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_TX) { in sata_dwc_clear_dmacr()
696 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, dmacr); in sata_dwc_clear_dmacr()
702 dev_err(hsdev->dev, in sata_dwc_clear_dmacr()
704 __func__, tag, hsdevp->dma_pending[tag], dmacr); in sata_dwc_clear_dmacr()
705 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_clear_dmacr()
717 tag = ap->link.active_tag; in sata_dwc_dma_xfer_complete()
720 dev_err(ap->dev, "failed to get qc"); in sata_dwc_dma_xfer_complete()
724 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_dma_xfer_complete()
725 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) { in sata_dwc_dma_xfer_complete()
726 dev_err(ap->dev, in sata_dwc_dma_xfer_complete()
729 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr)); in sata_dwc_dma_xfer_complete()
732 hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE; in sata_dwc_dma_xfer_complete()
734 ap->link.active_tag = ATA_TAG_POISON; in sata_dwc_dma_xfer_complete()
744 u8 tag = qc->hw_tag; in sata_dwc_qc_complete()
747 hsdev->sactive_queued = 0; in sata_dwc_qc_complete()
749 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_TX) in sata_dwc_qc_complete()
750 dev_err(ap->dev, "TX DMA PENDING\n"); in sata_dwc_qc_complete()
751 else if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_RX) 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()
759 hsdev->sactive_queued = hsdev->sactive_queued & mask; in sata_dwc_qc_complete()
760 hsdev->sactive_issued = hsdev->sactive_issued & mask; in sata_dwc_qc_complete()
768 sata_dwc_writel(&hsdev->sata_dwc_regs->intmr, in sata_dwc_enable_interrupts()
777 sata_dwc_writel(&hsdev->sata_dwc_regs->errmr, SATA_DWC_SERROR_ERR_BITS); in sata_dwc_enable_interrupts()
779 dev_dbg(hsdev->dev, "%s: INTMR = 0x%08x, ERRMR = 0x%08x\n", in sata_dwc_enable_interrupts()
780 __func__, sata_dwc_readl(&hsdev->sata_dwc_regs->intmr), in sata_dwc_enable_interrupts()
781 sata_dwc_readl(&hsdev->sata_dwc_regs->errmr)); in sata_dwc_enable_interrupts()
786 port->cmd_addr = base + 0x00; in sata_dwc_setup_port()
787 port->data_addr = base + 0x00; in sata_dwc_setup_port()
789 port->error_addr = base + 0x04; in sata_dwc_setup_port()
790 port->feature_addr = base + 0x04; in sata_dwc_setup_port()
792 port->nsect_addr = base + 0x08; in sata_dwc_setup_port()
794 port->lbal_addr = base + 0x0c; in sata_dwc_setup_port()
795 port->lbam_addr = base + 0x10; in sata_dwc_setup_port()
796 port->lbah_addr = base + 0x14; in sata_dwc_setup_port()
798 port->device_addr = base + 0x18; in sata_dwc_setup_port()
799 port->command_addr = base + 0x1c; in sata_dwc_setup_port()
800 port->status_addr = base + 0x1c; in sata_dwc_setup_port()
802 port->altstatus_addr = base + 0x20; in sata_dwc_setup_port()
803 port->ctl_addr = base + 0x20; in sata_dwc_setup_port()
808 struct sata_dwc_device *hsdev = hsdevp->hsdev; in sata_dwc_dma_get_channel()
809 struct device *dev = hsdev->dev; in sata_dwc_dma_get_channel()
812 if (!of_property_present(dev->of_node, "dmas")) in sata_dwc_dma_get_channel()
816 hsdevp->chan = dma_request_chan(dev, "sata-dma"); in sata_dwc_dma_get_channel()
817 if (IS_ERR(hsdevp->chan)) { in sata_dwc_dma_get_channel()
819 PTR_ERR(hsdevp->chan)); in sata_dwc_dma_get_channel()
820 return PTR_ERR(hsdevp->chan); in sata_dwc_dma_get_channel()
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()
848 err = -ENODEV; in sata_dwc_port_start()
855 err = -ENOMEM; in sata_dwc_port_start()
858 hsdevp->hsdev = hsdev; in sata_dwc_port_start()
864 err = phy_power_on(hsdev->phy); in sata_dwc_port_start()
869 hsdevp->cmd_issued[i] = SATA_DWC_CMD_ISSUED_NOT; 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()
877 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_port_start()
880 dev_dbg(ap->dev, "%s: setting burst size in DBTSR\n", in sata_dwc_port_start()
882 sata_dwc_writel(&hsdev->sata_dwc_regs->dbtsr, 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()
905 dev_dbg(ap->dev, "%s: ap->id = %d\n", __func__, ap->print_id); in sata_dwc_port_stop()
907 dmaengine_terminate_sync(hsdevp->chan); in sata_dwc_port_stop()
908 dma_release_channel(hsdevp->chan); in sata_dwc_port_stop()
909 phy_power_off(hsdev->phy); in sata_dwc_port_stop()
912 ap->private_data = NULL; in sata_dwc_port_stop()
928 hsdevp->cmd_issued[tag] = cmd_issued; 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()
948 u8 tag = qc->hw_tag; in sata_dwc_bmdma_setup()
950 if (!ata_is_ncq(qc->tf.protocol)) in sata_dwc_bmdma_setup()
961 struct ata_port *ap = qc->ap; in sata_dwc_bmdma_start_by_tag()
963 struct dma_async_tx_descriptor *desc = hsdevp->desc[tag]; in sata_dwc_bmdma_start_by_tag()
964 int dir = qc->dma_dir; in sata_dwc_bmdma_start_by_tag()
966 if (hsdevp->cmd_issued[tag] != SATA_DWC_CMD_ISSUED_NOT) { in sata_dwc_bmdma_start_by_tag()
969 hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_TX; in sata_dwc_bmdma_start_by_tag()
971 hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_RX; in sata_dwc_bmdma_start_by_tag()
973 dev_err(ap->dev, in sata_dwc_bmdma_start_by_tag()
975 __func__, hsdevp->cmd_issued[tag], tag); in sata_dwc_bmdma_start_by_tag()
980 sata_dwc_scr_read(&ap->link, SCR_ERROR, &reg); in sata_dwc_bmdma_start_by_tag()
982 dev_err(ap->dev, "%s: ****** SError=0x%08x ******\n", in sata_dwc_bmdma_start_by_tag()
987 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_bmdma_start_by_tag()
990 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_bmdma_start_by_tag()
995 dma_async_issue_pending(hsdevp->chan); in sata_dwc_bmdma_start_by_tag()
1001 u8 tag = qc->hw_tag; in sata_dwc_bmdma_start()
1003 if (!ata_is_ncq(qc->tf.protocol)) in sata_dwc_bmdma_start()
1012 u8 tag = qc->hw_tag; in sata_dwc_qc_issue()
1013 struct ata_port *ap = qc->ap; in sata_dwc_qc_issue()
1016 if (!ata_is_ncq(qc->tf.protocol)) in sata_dwc_qc_issue()
1019 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_qc_issue()
1020 hsdevp->desc[tag] = dma_dwc_xfer_setup(qc); in sata_dwc_qc_issue()
1021 if (!hsdevp->desc[tag]) in sata_dwc_qc_issue()
1024 hsdevp->desc[tag] = NULL; in sata_dwc_qc_issue()
1027 if (ata_is_ncq(qc->tf.protocol)) { 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()
1051 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(link->ap); in sata_dwc_hardreset()
1059 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_hardreset()
1063 sata_dwc_writel(&hsdev->sata_dwc_regs->dbtsr, in sata_dwc_hardreset()
1072 /* SATA DWC is master only */ in sata_dwc_dev_select()
1076 * scsi mid-layer and libata interface structures
1081 * test-only: Currently this driver doesn't handle NCQ
1090 * that a DMA burst will cross that boundary -- this results in an
1127 struct device *dev = &ofdev->dev; in sata_dwc_probe()
1128 struct device_node *np = dev->of_node; in sata_dwc_probe()
1140 /* Allocate DWC SATA device */ in sata_dwc_probe()
1144 return -ENOMEM; in sata_dwc_probe()
1146 host->private_data = hsdev; in sata_dwc_probe()
1154 /* Synopsys DWC SATA specific Registers */ in sata_dwc_probe()
1155 hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET; in sata_dwc_probe()
1156 hsdev->dmadr = res->start + SATA_DWC_REG_OFFSET + offsetof(struct sata_dwc_regs, dmadr); in sata_dwc_probe()
1159 host->ports[0]->ioaddr.cmd_addr = base; in sata_dwc_probe()
1160 host->ports[0]->ioaddr.scr_addr = base + SATA_DWC_SCR_OFFSET; in sata_dwc_probe()
1161 sata_dwc_setup_port(&host->ports[0]->ioaddr, base); in sata_dwc_probe()
1164 idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr); in sata_dwc_probe()
1165 versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr); in sata_dwc_probe()
1169 hsdev->dev = dev; in sata_dwc_probe()
1178 return -ENODEV; in sata_dwc_probe()
1189 hsdev->phy = devm_phy_optional_get(dev, "sata-phy"); in sata_dwc_probe()
1190 if (IS_ERR(hsdev->phy)) in sata_dwc_probe()
1191 return PTR_ERR(hsdev->phy); in sata_dwc_probe()
1193 err = phy_init(hsdev->phy); in sata_dwc_probe()
1209 phy_exit(hsdev->phy); in sata_dwc_probe()
1215 struct device *dev = &ofdev->dev; in sata_dwc_remove()
1217 struct sata_dwc_device *hsdev = host->private_data; in sata_dwc_remove()
1221 phy_exit(hsdev->phy); in sata_dwc_remove()
1232 { .compatible = "amcc,sata-460ex", },