Lines Matching +full:dwc +full:- +full:ahci
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Synopsys DesignWare Cores (DWC) SATA host driver
39 #define DRV_NAME "sata-dwc"
58 /* DWC SATA Registers */
93 /* DWC SATA Register Operations */
128 struct ata_probe_ent *pe; /* ptr to probe-ent */
158 * Commonly used DWC SATA driver macros
160 #define HSDEV_FROM_HOST(host) ((struct sata_dwc_device *)(host)->private_data)
161 #define HSDEV_FROM_AP(ap) ((struct sata_dwc_device *)(ap)->host->private_data)
162 #define HSDEVP_FROM_AP(ap) ((struct sata_dwc_device_port *)(ap)->private_data)
163 #define HSDEV_FROM_QC(qc) ((struct sata_dwc_device *)(qc)->ap->host->private_data)
164 #define HSDEV_FROM_HSDEVP(p) ((struct sata_dwc_device *)(p)->hsdev)
187 #include <linux/platform_data/dma-dw.h>
201 if (dws->dma_dev != chan->device->dev) in sata_dwc_dma_filter()
204 chan->private = dws; in sata_dwc_dma_filter()
210 struct sata_dwc_device *hsdev = hsdevp->hsdev; in sata_dwc_dma_get_channel_old()
212 struct device *dev = hsdev->dev; in sata_dwc_dma_get_channel_old()
215 dws->dma_dev = dev; in sata_dwc_dma_get_channel_old()
221 hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp); in sata_dwc_dma_get_channel_old()
222 if (!hsdevp->chan) { in sata_dwc_dma_get_channel_old()
224 return -EAGAIN; in sata_dwc_dma_get_channel_old()
233 struct device *dev = &pdev->dev; in sata_dwc_dma_init_old()
234 struct device_node *np = dev->of_node; in sata_dwc_dma_init_old()
236 hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL); in sata_dwc_dma_init_old()
237 if (!hsdev->dma) in sata_dwc_dma_init_old()
238 return -ENOMEM; in sata_dwc_dma_init_old()
240 hsdev->dma->dev = dev; in sata_dwc_dma_init_old()
241 hsdev->dma->id = pdev->id; in sata_dwc_dma_init_old()
244 hsdev->dma->irq = irq_of_parse_and_map(np, 1); in sata_dwc_dma_init_old()
245 if (hsdev->dma->irq == NO_IRQ) { in sata_dwc_dma_init_old()
247 return -ENODEV; in sata_dwc_dma_init_old()
251 hsdev->dma->regs = devm_platform_ioremap_resource(pdev, 1); in sata_dwc_dma_init_old()
252 if (IS_ERR(hsdev->dma->regs)) in sata_dwc_dma_init_old()
253 return PTR_ERR(hsdev->dma->regs); in sata_dwc_dma_init_old()
256 return dw_dma_probe(hsdev->dma); in sata_dwc_dma_init_old()
261 if (!hsdev->dma) in sata_dwc_dma_exit_old()
264 dw_dma_remove(hsdev->dma); in sata_dwc_dma_exit_old()
297 struct ata_host *host = (struct ata_host *)hsdev->host; in dma_dwc_xfer_done()
303 spin_lock_irqsave(&host->lock, flags); in dma_dwc_xfer_done()
304 ap = host->ports[port]; in dma_dwc_xfer_done()
306 tag = ap->link.active_tag; in dma_dwc_xfer_done()
313 hsdevp->dma_interrupt_count++; in dma_dwc_xfer_done()
316 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) { in dma_dwc_xfer_done()
317 dev_err(ap->dev, "DMA not pending tag=0x%02x pending=%d\n", in dma_dwc_xfer_done()
318 tag, hsdevp->dma_pending[tag]); in dma_dwc_xfer_done()
321 if ((hsdevp->dma_interrupt_count % 2) == 0) in dma_dwc_xfer_done()
324 spin_unlock_irqrestore(&host->lock, flags); in dma_dwc_xfer_done()
329 struct ata_port *ap = qc->ap; in dma_dwc_xfer_setup()
335 if (qc->dma_dir == DMA_DEV_TO_MEM) { in dma_dwc_xfer_setup()
336 sconf.src_addr = hsdev->dmadr; in dma_dwc_xfer_setup()
339 sconf.dst_addr = hsdev->dmadr; in dma_dwc_xfer_setup()
343 sconf.direction = qc->dma_dir; in dma_dwc_xfer_setup()
349 dmaengine_slave_config(hsdevp->chan, &sconf); in dma_dwc_xfer_setup()
352 desc = dmaengine_prep_slave_sg(hsdevp->chan, qc->sg, qc->n_elem, in dma_dwc_xfer_setup()
353 qc->dma_dir, in dma_dwc_xfer_setup()
359 desc->callback = dma_dwc_xfer_done; in dma_dwc_xfer_setup()
360 desc->callback_param = hsdev; in dma_dwc_xfer_setup()
362 dev_dbg(hsdev->dev, "%s sg: 0x%p, count: %d addr: %pa\n", __func__, in dma_dwc_xfer_setup()
363 qc->sg, qc->n_elem, &hsdev->dmadr); in dma_dwc_xfer_setup()
371 dev_err(link->ap->dev, "%s: Incorrect SCR offset 0x%02x\n", in sata_dwc_scr_read()
373 return -EINVAL; in sata_dwc_scr_read()
376 *val = sata_dwc_readl(link->ap->ioaddr.scr_addr + (scr * 4)); in sata_dwc_scr_read()
377 dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=0x%08x\n", __func__, in sata_dwc_scr_read()
378 link->ap->print_id, scr, *val); in sata_dwc_scr_read()
385 dev_dbg(link->ap->dev, "%s: id=%d reg=%d val=0x%08x\n", __func__, in sata_dwc_scr_write()
386 link->ap->print_id, scr, val); in sata_dwc_scr_write()
388 dev_err(link->ap->dev, "%s: Incorrect SCR offset 0x%02x\n", in sata_dwc_scr_write()
390 return -EINVAL; in sata_dwc_scr_write()
392 sata_dwc_writel(link->ap->ioaddr.scr_addr + (scr * 4), val); in sata_dwc_scr_write()
400 sata_dwc_scr_read(&ap->link, SCR_ERROR, &val); in clear_serror()
401 sata_dwc_scr_write(&ap->link, SCR_ERROR, val); in clear_serror()
406 sata_dwc_writel(&hsdev->sata_dwc_regs->intpr, in clear_interrupt_bit()
407 sata_dwc_readl(&hsdev->sata_dwc_regs->intpr)); in clear_interrupt_bit()
415 /* See ahci.c */
420 struct ata_eh_info *ehi = &ap->link.eh_info; in sata_dwc_error_intr()
428 sata_dwc_scr_read(&ap->link, SCR_ERROR, &serror); in sata_dwc_error_intr()
429 status = ap->ops->sff_check_status(ap); in sata_dwc_error_intr()
431 tag = ap->link.active_tag; in sata_dwc_error_intr()
433 dev_err(ap->dev, in sata_dwc_error_intr()
435 __func__, serror, intpr, status, hsdevp->dma_interrupt_count, in sata_dwc_error_intr()
436 hsdevp->dma_pending[tag], hsdevp->cmd_issued[tag]); in sata_dwc_error_intr()
448 ehi->serror |= serror; in sata_dwc_error_intr()
449 ehi->action |= action; in sata_dwc_error_intr()
453 qc->err_mask |= err_mask; in sata_dwc_error_intr()
455 ehi->err_mask |= err_mask; in sata_dwc_error_intr()
463 * Return value : irqreturn_t - status of IRQ
478 hsdev->sactive_issued = 0; in sata_dwc_isr()
480 spin_lock_irqsave(&host->lock, flags); in sata_dwc_isr()
483 intpr = sata_dwc_readl(&hsdev->sata_dwc_regs->intpr); in sata_dwc_isr()
485 ap = host->ports[port]; in sata_dwc_isr()
488 dev_dbg(ap->dev, "%s intpr=0x%08x active_tag=%d\n", __func__, intpr, in sata_dwc_isr()
489 ap->link.active_tag); in sata_dwc_isr()
502 tag = (u8)(sata_dwc_readl(&hsdev->sata_dwc_regs->fptagr)); in sata_dwc_isr()
503 dev_dbg(ap->dev, "%s: NEWFP tag=%d\n", __func__, tag); in sata_dwc_isr()
504 if (hsdevp->cmd_issued[tag] != SATA_DWC_CMD_ISSUED_PEND) in sata_dwc_isr()
505 dev_warn(ap->dev, "CMD tag=%d not pending?\n", tag); in sata_dwc_isr()
507 hsdev->sactive_issued |= qcmd_tag_to_mask(tag); in sata_dwc_isr()
511 dev_err(ap->dev, "failed to get qc"); in sata_dwc_isr()
520 trace_ata_bmdma_start(ap, &qc->tf, tag); in sata_dwc_isr()
521 qc->ap->link.active_tag = tag; in sata_dwc_isr()
527 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_isr()
528 tag_mask = (hsdev->sactive_issued | sactive) ^ sactive; in sata_dwc_isr()
531 if (hsdev->sactive_issued == 0 && tag_mask == 0) { in sata_dwc_isr()
532 if (ap->link.active_tag == ATA_TAG_POISON) in sata_dwc_isr()
535 tag = ap->link.active_tag; in sata_dwc_isr()
539 if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { in sata_dwc_isr()
540 dev_err(ap->dev, in sata_dwc_isr()
543 ap->ops->sff_check_status(ap); in sata_dwc_isr()
547 status = ap->ops->sff_check_status(ap); in sata_dwc_isr()
549 qc->ap->link.active_tag = tag; in sata_dwc_isr()
550 hsdevp->cmd_issued[tag] = SATA_DWC_CMD_ISSUED_NOT; in sata_dwc_isr()
553 dev_dbg(ap->dev, "interrupt ATA_ERR (0x%x)\n", status); in sata_dwc_isr()
559 dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n", in sata_dwc_isr()
560 __func__, get_prot_descript(qc->tf.protocol)); in sata_dwc_isr()
562 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_isr()
569 hsdevp->dma_interrupt_count++; in sata_dwc_isr()
570 if (hsdevp->dma_pending[tag] == \ in sata_dwc_isr()
572 dev_err(ap->dev, in sata_dwc_isr()
575 hsdevp->dma_pending[tag]); in sata_dwc_isr()
578 if ((hsdevp->dma_interrupt_count % 2) == 0) in sata_dwc_isr()
580 } else if (ata_is_pio(qc->tf.protocol)) { in sata_dwc_isr()
601 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_isr()
602 tag_mask = (hsdev->sactive_issued | sactive) ^ sactive; in sata_dwc_isr()
604 if (sactive != 0 || hsdev->sactive_issued > 1 || tag_mask > 1) { in sata_dwc_isr()
605 dev_dbg(ap->dev, in sata_dwc_isr()
607 __func__, sactive, hsdev->sactive_issued, tag_mask); in sata_dwc_isr()
610 if ((tag_mask | hsdev->sactive_issued) != hsdev->sactive_issued) { in sata_dwc_isr()
611 dev_warn(ap->dev, in sata_dwc_isr()
613 sactive, hsdev->sactive_issued, tag_mask); in sata_dwc_isr()
617 status = ap->ops->sff_check_status(ap); in sata_dwc_isr()
618 dev_dbg(ap->dev, "%s ATA status register=0x%x\n", __func__, status); in sata_dwc_isr()
632 dev_err(ap->dev, "failed to get qc"); in sata_dwc_isr()
638 qc->ap->link.active_tag = tag; in sata_dwc_isr()
639 hsdevp->cmd_issued[tag] = SATA_DWC_CMD_ISSUED_NOT; in sata_dwc_isr()
643 dev_dbg(ap->dev, "%s ATA_ERR (0x%x)\n", __func__, in sata_dwc_isr()
651 dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__, in sata_dwc_isr()
652 get_prot_descript(qc->tf.protocol)); in sata_dwc_isr()
653 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_isr()
654 hsdevp->dma_interrupt_count++; in sata_dwc_isr()
655 if (hsdevp->dma_pending[tag] == \ in sata_dwc_isr()
657 dev_warn(ap->dev, "%s: DMA not pending?\n", in sata_dwc_isr()
659 if ((hsdevp->dma_interrupt_count % 2) == 0) in sata_dwc_isr()
668 ap->stats.idle_irq++; in sata_dwc_isr()
669 dev_warn(ap->dev, "STILL BUSY IRQ ata%d: irq trap\n", in sata_dwc_isr()
670 ap->print_id); in sata_dwc_isr()
677 * we were processing --we read status as part of processing a completed in sata_dwc_isr()
680 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive2); in sata_dwc_isr()
682 dev_dbg(ap->dev, in sata_dwc_isr()
683 "More completed - sactive=0x%x sactive2=0x%x\n", in sata_dwc_isr()
689 spin_unlock_irqrestore(&host->lock, flags); in sata_dwc_isr()
696 u32 dmacr = sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr); in sata_dwc_clear_dmacr()
698 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_RX) { in sata_dwc_clear_dmacr()
700 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, dmacr); in sata_dwc_clear_dmacr()
701 } else if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_TX) { in sata_dwc_clear_dmacr()
703 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, dmacr); in sata_dwc_clear_dmacr()
709 dev_err(hsdev->dev, in sata_dwc_clear_dmacr()
711 __func__, tag, hsdevp->dma_pending[tag], dmacr); in sata_dwc_clear_dmacr()
712 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_clear_dmacr()
724 tag = ap->link.active_tag; in sata_dwc_dma_xfer_complete()
727 dev_err(ap->dev, "failed to get qc"); in sata_dwc_dma_xfer_complete()
731 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_dma_xfer_complete()
732 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) { in sata_dwc_dma_xfer_complete()
733 dev_err(ap->dev, in sata_dwc_dma_xfer_complete()
736 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr)); in sata_dwc_dma_xfer_complete()
739 hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE; in sata_dwc_dma_xfer_complete()
741 ap->link.active_tag = ATA_TAG_POISON; in sata_dwc_dma_xfer_complete()
751 u8 tag = qc->hw_tag; in sata_dwc_qc_complete()
754 hsdev->sactive_queued = 0; in sata_dwc_qc_complete()
756 if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_TX) in sata_dwc_qc_complete()
757 dev_err(ap->dev, "TX DMA PENDING\n"); in sata_dwc_qc_complete()
758 else if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_RX) in sata_dwc_qc_complete()
759 dev_err(ap->dev, "RX DMA PENDING\n"); in sata_dwc_qc_complete()
760 dev_dbg(ap->dev, in sata_dwc_qc_complete()
762 qc->tf.command, status, ap->print_id, qc->tf.protocol); in sata_dwc_qc_complete()
766 hsdev->sactive_queued = hsdev->sactive_queued & mask; in sata_dwc_qc_complete()
767 hsdev->sactive_issued = hsdev->sactive_issued & mask; in sata_dwc_qc_complete()
775 sata_dwc_writel(&hsdev->sata_dwc_regs->intmr, in sata_dwc_enable_interrupts()
784 sata_dwc_writel(&hsdev->sata_dwc_regs->errmr, SATA_DWC_SERROR_ERR_BITS); in sata_dwc_enable_interrupts()
786 dev_dbg(hsdev->dev, "%s: INTMR = 0x%08x, ERRMR = 0x%08x\n", in sata_dwc_enable_interrupts()
787 __func__, sata_dwc_readl(&hsdev->sata_dwc_regs->intmr), in sata_dwc_enable_interrupts()
788 sata_dwc_readl(&hsdev->sata_dwc_regs->errmr)); in sata_dwc_enable_interrupts()
793 port->cmd_addr = base + 0x00; in sata_dwc_setup_port()
794 port->data_addr = base + 0x00; in sata_dwc_setup_port()
796 port->error_addr = base + 0x04; in sata_dwc_setup_port()
797 port->feature_addr = base + 0x04; in sata_dwc_setup_port()
799 port->nsect_addr = base + 0x08; in sata_dwc_setup_port()
801 port->lbal_addr = base + 0x0c; in sata_dwc_setup_port()
802 port->lbam_addr = base + 0x10; in sata_dwc_setup_port()
803 port->lbah_addr = base + 0x14; in sata_dwc_setup_port()
805 port->device_addr = base + 0x18; in sata_dwc_setup_port()
806 port->command_addr = base + 0x1c; in sata_dwc_setup_port()
807 port->status_addr = base + 0x1c; in sata_dwc_setup_port()
809 port->altstatus_addr = base + 0x20; in sata_dwc_setup_port()
810 port->ctl_addr = base + 0x20; in sata_dwc_setup_port()
815 struct sata_dwc_device *hsdev = hsdevp->hsdev; in sata_dwc_dma_get_channel()
816 struct device *dev = hsdev->dev; in sata_dwc_dma_get_channel()
819 if (!of_find_property(dev->of_node, "dmas", NULL)) in sata_dwc_dma_get_channel()
823 hsdevp->chan = dma_request_chan(dev, "sata-dma"); in sata_dwc_dma_get_channel()
824 if (IS_ERR(hsdevp->chan)) { in sata_dwc_dma_get_channel()
826 PTR_ERR(hsdevp->chan)); in sata_dwc_dma_get_channel()
827 return PTR_ERR(hsdevp->chan); in sata_dwc_dma_get_channel()
849 dev_dbg(ap->dev, "%s: port_no=%d\n", __func__, ap->port_no); in sata_dwc_port_start()
851 hsdev->host = ap->host; in sata_dwc_port_start()
852 pdev = ap->host->dev; in sata_dwc_port_start()
854 dev_err(ap->dev, "%s: no ap->host->dev\n", __func__); in sata_dwc_port_start()
855 err = -ENODEV; in sata_dwc_port_start()
862 err = -ENOMEM; in sata_dwc_port_start()
865 hsdevp->hsdev = hsdev; in sata_dwc_port_start()
871 err = phy_power_on(hsdev->phy); in sata_dwc_port_start()
876 hsdevp->cmd_issued[i] = SATA_DWC_CMD_ISSUED_NOT; in sata_dwc_port_start()
878 ap->bmdma_prd = NULL; /* set these so libata doesn't use them */ in sata_dwc_port_start()
879 ap->bmdma_prd_dma = 0; in sata_dwc_port_start()
881 if (ap->port_no == 0) { in sata_dwc_port_start()
882 dev_dbg(ap->dev, "%s: clearing TXCHEN, RXCHEN in DMAC\n", in sata_dwc_port_start()
884 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_port_start()
887 dev_dbg(ap->dev, "%s: setting burst size in DBTSR\n", in sata_dwc_port_start()
889 sata_dwc_writel(&hsdev->sata_dwc_regs->dbtsr, in sata_dwc_port_start()
896 ap->private_data = hsdevp; in sata_dwc_port_start()
897 dev_dbg(ap->dev, "%s: done\n", __func__); in sata_dwc_port_start()
903 dev_dbg(ap->dev, "%s: fail. ap->id = %d\n", __func__, ap->print_id); in sata_dwc_port_start()
912 dev_dbg(ap->dev, "%s: ap->id = %d\n", __func__, ap->print_id); in sata_dwc_port_stop()
914 dmaengine_terminate_sync(hsdevp->chan); in sata_dwc_port_stop()
915 dma_release_channel(hsdevp->chan); in sata_dwc_port_stop()
916 phy_power_off(hsdev->phy); in sata_dwc_port_stop()
919 ap->private_data = NULL; in sata_dwc_port_stop()
935 hsdevp->cmd_issued[tag] = cmd_issued; in sata_dwc_exec_command_by_tag()
949 sata_dwc_exec_command_by_tag(qc->ap, &qc->tf, tag, in sata_dwc_bmdma_setup_by_tag()
955 u8 tag = qc->hw_tag; in sata_dwc_bmdma_setup()
957 if (!ata_is_ncq(qc->tf.protocol)) in sata_dwc_bmdma_setup()
968 struct ata_port *ap = qc->ap; in sata_dwc_bmdma_start_by_tag()
970 struct dma_async_tx_descriptor *desc = hsdevp->desc[tag]; in sata_dwc_bmdma_start_by_tag()
971 int dir = qc->dma_dir; in sata_dwc_bmdma_start_by_tag()
973 if (hsdevp->cmd_issued[tag] != SATA_DWC_CMD_ISSUED_NOT) { in sata_dwc_bmdma_start_by_tag()
976 hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_TX; in sata_dwc_bmdma_start_by_tag()
978 hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_RX; in sata_dwc_bmdma_start_by_tag()
980 dev_err(ap->dev, in sata_dwc_bmdma_start_by_tag()
982 __func__, hsdevp->cmd_issued[tag], tag); in sata_dwc_bmdma_start_by_tag()
987 sata_dwc_scr_read(&ap->link, SCR_ERROR, ®); in sata_dwc_bmdma_start_by_tag()
989 dev_err(ap->dev, "%s: ****** SError=0x%08x ******\n", in sata_dwc_bmdma_start_by_tag()
994 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_bmdma_start_by_tag()
997 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_bmdma_start_by_tag()
1002 dma_async_issue_pending(hsdevp->chan); in sata_dwc_bmdma_start_by_tag()
1008 u8 tag = qc->hw_tag; in sata_dwc_bmdma_start()
1010 if (!ata_is_ncq(qc->tf.protocol)) in sata_dwc_bmdma_start()
1019 u8 tag = qc->hw_tag; in sata_dwc_qc_issue()
1020 struct ata_port *ap = qc->ap; in sata_dwc_qc_issue()
1023 if (!ata_is_ncq(qc->tf.protocol)) in sata_dwc_qc_issue()
1026 if (ata_is_dma(qc->tf.protocol)) { in sata_dwc_qc_issue()
1027 hsdevp->desc[tag] = dma_dwc_xfer_setup(qc); in sata_dwc_qc_issue()
1028 if (!hsdevp->desc[tag]) in sata_dwc_qc_issue()
1031 hsdevp->desc[tag] = NULL; in sata_dwc_qc_issue()
1034 if (ata_is_ncq(qc->tf.protocol)) { in sata_dwc_qc_issue()
1035 sata_dwc_scr_read(&ap->link, SCR_ACTIVE, &sactive); in sata_dwc_qc_issue()
1037 sata_dwc_scr_write(&ap->link, SCR_ACTIVE, sactive); in sata_dwc_qc_issue()
1039 trace_ata_tf_load(ap, &qc->tf); in sata_dwc_qc_issue()
1040 ap->ops->sff_tf_load(ap, &qc->tf); in sata_dwc_qc_issue()
1041 trace_ata_exec_command(ap, &qc->tf, tag); in sata_dwc_qc_issue()
1042 sata_dwc_exec_command_by_tag(ap, &qc->tf, tag, in sata_dwc_qc_issue()
1058 struct sata_dwc_device *hsdev = HSDEV_FROM_AP(link->ap); in sata_dwc_hardreset()
1066 sata_dwc_writel(&hsdev->sata_dwc_regs->dmacr, in sata_dwc_hardreset()
1070 sata_dwc_writel(&hsdev->sata_dwc_regs->dbtsr, in sata_dwc_hardreset()
1079 /* SATA DWC is master only */ in sata_dwc_dev_select()
1083 * scsi mid-layer and libata interface structures
1088 * test-only: Currently this driver doesn't handle NCQ
1097 * that a DMA burst will cross that boundary -- this results in an
1134 struct device *dev = &ofdev->dev; in sata_dwc_probe()
1135 struct device_node *np = dev->of_node; in sata_dwc_probe()
1147 /* Allocate DWC SATA device */ in sata_dwc_probe()
1151 return -ENOMEM; in sata_dwc_probe()
1153 host->private_data = hsdev; in sata_dwc_probe()
1161 /* Synopsys DWC SATA specific Registers */ in sata_dwc_probe()
1162 hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET; in sata_dwc_probe()
1163 hsdev->dmadr = res->start + SATA_DWC_REG_OFFSET + offsetof(struct sata_dwc_regs, dmadr); in sata_dwc_probe()
1166 host->ports[0]->ioaddr.cmd_addr = base; in sata_dwc_probe()
1167 host->ports[0]->ioaddr.scr_addr = base + SATA_DWC_SCR_OFFSET; in sata_dwc_probe()
1168 sata_dwc_setup_port(&host->ports[0]->ioaddr, base); in sata_dwc_probe()
1171 idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr); in sata_dwc_probe()
1172 versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr); in sata_dwc_probe()
1176 hsdev->dev = dev; in sata_dwc_probe()
1185 return -ENODEV; in sata_dwc_probe()
1196 hsdev->phy = devm_phy_optional_get(dev, "sata-phy"); in sata_dwc_probe()
1197 if (IS_ERR(hsdev->phy)) in sata_dwc_probe()
1198 return PTR_ERR(hsdev->phy); in sata_dwc_probe()
1200 err = phy_init(hsdev->phy); in sata_dwc_probe()
1216 phy_exit(hsdev->phy); in sata_dwc_probe()
1222 struct device *dev = &ofdev->dev; in sata_dwc_remove()
1224 struct sata_dwc_device *hsdev = host->private_data; in sata_dwc_remove()
1228 phy_exit(hsdev->phy); in sata_dwc_remove()
1240 { .compatible = "amcc,sata-460ex", },