Lines Matching +full:4 +full:- +full:temp
1 // SPDX-License-Identifier: GPL-2.0-or-later
10 * Copyright (c) 2006-2007, 2011-2012 Freescale Semiconductor, Inc.
39 SATA_FSL_MAX_PRD_USABLE = SATA_FSL_MAX_PRD - 1,
47 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
51 * SATA-FSL host controller supports a max. of (15+1) direct PRDEs, and
84 * MPC837x has 2/4 controllers, one port per controller
96 ICC_MAX_INT_COUNT_THRESHOLD = ((1 << 5) - 1),
98 ICC_MAX_INT_TICKS_THRESHOLD = ((1 << 19) - 1),
103 * Host Controller command register set - per port
147 INT_ON_PHYRDY_CHG = (1 << 4),
169 IE_ON_PHYRDY_CHG = (1 << 4),
189 SERROR = 4,
199 TRANSSTATUS = 4,
209 /* TRANSCFG (transport-layer) configuration control */
211 TRANSCFG_RX_WATER_MARK = (1 << 4),
214 /* PHY (link-layer) configuration control */
221 * 4 Dwords per command slot, command header size == 64 Dwords.
247 u8 cfis[8 * 4];
248 u8 sfis[8 * 4];
250 u8 acmd[4 * 4];
251 u8 fill[4 * 4];
253 u32 prdt[SATA_FSL_MAX_PRD_DIRECT * 4];
254 u32 prdt_indirect[(SATA_FSL_MAX_PRD - SATA_FSL_MAX_PRD_DIRECT) * 4];
263 u8 fill[2 * 4];
269 * This is our per-port instance data.
279 * ata_port->host_set private data
294 struct sata_fsl_host_priv *host_priv = host->private_data; in fsl_sata_set_irq_coalescing()
295 void __iomem *hcr_base = host_priv->hcr_base; in fsl_sata_set_irq_coalescing()
309 spin_lock_irqsave(&host->lock, flags); in fsl_sata_set_irq_coalescing()
314 spin_unlock_irqrestore(&host->lock, flags); in fsl_sata_set_irq_coalescing()
316 dev_dbg(host->dev, "interrupt coalescing, count = 0x%x, ticks = %x\n", in fsl_sata_set_irq_coalescing()
318 dev_dbg(host->dev, "ICC register status: (hcr base: 0x%p) = 0x%x\n", in fsl_sata_set_irq_coalescing()
336 dev_err(dev, "fsl-sata: wrong parameter format.\n"); in fsl_sata_intr_coalescing_store()
337 return -EINVAL; in fsl_sata_intr_coalescing_store()
352 struct sata_fsl_host_priv *host_priv = host->private_data; in fsl_sata_rx_watermark_show()
353 void __iomem *csr_base = host_priv->csr_base; in fsl_sata_rx_watermark_show()
355 spin_lock_irqsave(&host->lock, flags); in fsl_sata_rx_watermark_show()
358 spin_unlock_irqrestore(&host->lock, flags); in fsl_sata_rx_watermark_show()
370 struct sata_fsl_host_priv *host_priv = host->private_data; in fsl_sata_rx_watermark_store()
371 void __iomem *csr_base = host_priv->csr_base; in fsl_sata_rx_watermark_store()
372 u32 temp; in fsl_sata_rx_watermark_store() local
375 dev_err(dev, "fsl-sata: wrong parameter format.\n"); in fsl_sata_rx_watermark_store()
376 return -EINVAL; in fsl_sata_rx_watermark_store()
379 spin_lock_irqsave(&host->lock, flags); in fsl_sata_rx_watermark_store()
380 temp = ioread32(csr_base + TRANSCFG); in fsl_sata_rx_watermark_store()
381 temp &= 0xffffffe0; in fsl_sata_rx_watermark_store()
382 iowrite32(temp | rx_watermark, csr_base + TRANSCFG); in fsl_sata_rx_watermark_store()
383 spin_unlock_irqrestore(&host->lock, flags); in fsl_sata_rx_watermark_store()
415 cmd_descriptor_address = pp->cmdentry_paddr + in sata_fsl_setup_cmd_hdr_entry()
420 pp->cmdslot[tag].cda = cpu_to_le32(cmd_descriptor_address); in sata_fsl_setup_cmd_hdr_entry()
421 pp->cmdslot[tag].prde_fis_len = in sata_fsl_setup_cmd_hdr_entry()
423 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); in sata_fsl_setup_cmd_hdr_entry()
424 pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F)); in sata_fsl_setup_cmd_hdr_entry()
427 le32_to_cpu(pp->cmdslot[tag].cda), in sata_fsl_setup_cmd_hdr_entry()
428 le32_to_cpu(pp->cmdslot[tag].prde_fis_len), in sata_fsl_setup_cmd_hdr_entry()
429 le32_to_cpu(pp->cmdslot[tag].ttl), in sata_fsl_setup_cmd_hdr_entry()
430 le32_to_cpu(pp->cmdslot[tag].desc_info)); in sata_fsl_setup_cmd_hdr_entry()
445 cmd_desc)->prdt; in sata_fsl_fill_sg()
455 for_each_sg(qc->sg, sg, qc->n_elem, si) { in sata_fsl_fill_sg()
461 ata_port_err(qc->ap, "s/g addr unaligned : 0x%llx\n", in sata_fsl_fill_sg()
464 ata_port_err(qc->ap, "s/g len unaligned : 0x%x\n", in sata_fsl_fill_sg()
467 if (num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1) && in sata_fsl_fill_sg()
470 prd->dba = cpu_to_le32(indirect_ext_segment_paddr); in sata_fsl_fill_sg()
477 prd->dba = cpu_to_le32(sg_addr); in sata_fsl_fill_sg()
478 prd->ddc_and_ext = cpu_to_le32(data_snoop | (sg_len & ~0x03)); in sata_fsl_fill_sg()
488 prd_ptr_to_indirect_ext->ddc_and_ext = in sata_fsl_fill_sg()
500 struct ata_port *ap = qc->ap; in sata_fsl_qc_prep()
501 struct sata_fsl_port_priv *pp = ap->private_data; in sata_fsl_qc_prep()
502 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_qc_prep()
503 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_qc_prep()
504 unsigned int tag = sata_fsl_tag(ap, qc->hw_tag, hcr_base); in sata_fsl_qc_prep()
511 cd = (struct command_desc *)pp->cmdentry + tag; in sata_fsl_qc_prep()
512 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; in sata_fsl_qc_prep()
514 ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *) &cd->cfis); in sata_fsl_qc_prep()
516 /* setup "ACMD - atapi command" in cmd. desc. if this is ATAPI cmd */ in sata_fsl_qc_prep()
517 if (ata_is_atapi(qc->tf.protocol)) { in sata_fsl_qc_prep()
519 memset(&cd->cdb, 0, sizeof(cd->cdb)); in sata_fsl_qc_prep()
520 memcpy(&cd->cdb, qc->cdb, qc->dev->cdb_len); in sata_fsl_qc_prep()
523 if (qc->flags & ATA_QCFLAG_DMAMAP) in sata_fsl_qc_prep()
526 host_priv->data_snoop); in sata_fsl_qc_prep()
528 if (qc->tf.protocol == ATA_PROT_NCQ) in sata_fsl_qc_prep()
542 struct ata_port *ap = qc->ap; in sata_fsl_qc_issue()
543 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_qc_issue()
544 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_qc_issue()
545 unsigned int tag = sata_fsl_tag(ap, qc->hw_tag, hcr_base); in sata_fsl_qc_issue()
552 iowrite32(qc->dev->link->pmp, CQPMP + hcr_base); in sata_fsl_qc_issue()
564 ioread32(COMMANDSTAT + host_priv->csr_base)); in sata_fsl_qc_issue()
571 struct sata_fsl_port_priv *pp = qc->ap->private_data; in sata_fsl_qc_fill_rtf()
572 struct sata_fsl_host_priv *host_priv = qc->ap->host->private_data; in sata_fsl_qc_fill_rtf()
573 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_qc_fill_rtf()
574 unsigned int tag = sata_fsl_tag(qc->ap, qc->hw_tag, hcr_base); in sata_fsl_qc_fill_rtf()
577 cd = pp->cmdentry + tag; in sata_fsl_qc_fill_rtf()
579 ata_tf_from_fis(cd->sfis, &qc->result_tf); in sata_fsl_qc_fill_rtf()
585 struct sata_fsl_host_priv *host_priv = link->ap->host->private_data; in sata_fsl_scr_write()
586 void __iomem *ssr_base = host_priv->ssr_base; in sata_fsl_scr_write()
597 return -EINVAL; in sata_fsl_scr_write()
602 iowrite32(val, ssr_base + (sc_reg * 4)); in sata_fsl_scr_write()
609 struct sata_fsl_host_priv *host_priv = link->ap->host->private_data; in sata_fsl_scr_read()
610 void __iomem *ssr_base = host_priv->ssr_base; in sata_fsl_scr_read()
621 return -EINVAL; in sata_fsl_scr_read()
626 *val = ioread32(ssr_base + (sc_reg * 4)); in sata_fsl_scr_read()
632 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_freeze()
633 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_freeze()
634 u32 temp; in sata_fsl_freeze() local
641 ioread32(host_priv->csr_base + COMMANDSTAT)); in sata_fsl_freeze()
644 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_freeze()
645 iowrite32((temp & ~0x3F), hcr_base + HCONTROL); in sata_fsl_freeze()
653 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_thaw()
654 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_thaw()
655 u32 temp; in sata_fsl_thaw() local
658 temp = ioread32(hcr_base + HSTATUS); in sata_fsl_thaw()
660 ata_port_dbg(ap, "pending IRQs = 0x%x\n", (temp & 0x3F)); in sata_fsl_thaw()
662 if (temp & 0x3F) in sata_fsl_thaw()
663 iowrite32((temp & 0x3F), hcr_base + HSTATUS); in sata_fsl_thaw()
666 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_thaw()
667 iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL); in sata_fsl_thaw()
675 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_pmp_attach()
676 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_pmp_attach()
677 u32 temp; in sata_fsl_pmp_attach() local
679 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_pmp_attach()
680 iowrite32((temp | HCONTROL_PMP_ATTACHED), hcr_base + HCONTROL); in sata_fsl_pmp_attach()
685 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_pmp_detach()
686 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_pmp_detach()
687 u32 temp; in sata_fsl_pmp_detach() local
689 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_pmp_detach()
690 temp &= ~HCONTROL_PMP_ATTACHED; in sata_fsl_pmp_detach()
691 iowrite32(temp, hcr_base + HCONTROL); in sata_fsl_pmp_detach()
694 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_pmp_detach()
695 iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL); in sata_fsl_pmp_detach()
701 struct device *dev = ap->host->dev; in sata_fsl_port_start()
705 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_port_start()
706 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_port_start()
707 u32 temp; in sata_fsl_port_start() local
711 return -ENOMEM; in sata_fsl_port_start()
717 return -ENOMEM; in sata_fsl_port_start()
720 pp->cmdslot = mem; in sata_fsl_port_start()
721 pp->cmdslot_paddr = mem_dma; in sata_fsl_port_start()
726 pp->cmdentry = mem; in sata_fsl_port_start()
727 pp->cmdentry_paddr = mem_dma; in sata_fsl_port_start()
729 ap->private_data = pp; in sata_fsl_port_start()
732 (unsigned long)pp->cmdslot_paddr, in sata_fsl_port_start()
733 (unsigned long)pp->cmdentry_paddr); in sata_fsl_port_start()
736 iowrite32(pp->cmdslot_paddr & 0xffffffff, hcr_base + CHBA); in sata_fsl_port_start()
739 * Now, we can bring the controller on-line & also initiate in sata_fsl_port_start()
740 * the COMINIT sequence, we simply return here and the boot-probing in sata_fsl_port_start()
741 * & device discovery process is re-initiated by libATA using a in sata_fsl_port_start()
746 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_port_start()
747 iowrite32((temp | HCONTROL_ONLINE_PHY_RST), hcr_base + HCONTROL); in sata_fsl_port_start()
758 struct device *dev = ap->host->dev; in sata_fsl_port_stop()
759 struct sata_fsl_port_priv *pp = ap->private_data; in sata_fsl_port_stop()
760 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_port_stop()
761 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_port_stop()
762 u32 temp; in sata_fsl_port_stop() local
765 * Force host controller to go off-line, aborting current operations in sata_fsl_port_stop()
767 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_port_stop()
768 temp &= ~HCONTROL_ONLINE_PHY_RST; in sata_fsl_port_stop()
769 temp |= HCONTROL_FORCE_OFFLINE; in sata_fsl_port_stop()
770 iowrite32(temp, hcr_base + HCONTROL); in sata_fsl_port_stop()
772 /* Poll for controller to go offline - should happen immediately */ in sata_fsl_port_stop()
775 ap->private_data = NULL; in sata_fsl_port_stop()
777 pp->cmdslot, pp->cmdslot_paddr); in sata_fsl_port_stop()
784 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_dev_classify()
785 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_dev_classify()
787 u32 temp; in sata_fsl_dev_classify() local
789 temp = ioread32(hcr_base + SIGNATURE); in sata_fsl_dev_classify()
794 tf.lbah = (temp >> 24) & 0xff; in sata_fsl_dev_classify()
795 tf.lbam = (temp >> 16) & 0xff; in sata_fsl_dev_classify()
796 tf.lbal = (temp >> 8) & 0xff; in sata_fsl_dev_classify()
797 tf.nsect = temp & 0xff; in sata_fsl_dev_classify()
805 struct ata_port *ap = link->ap; in sata_fsl_hardreset()
806 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_hardreset()
807 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_hardreset()
808 u32 temp; in sata_fsl_hardreset() local
814 * Force host controller to go off-line, aborting current operations in sata_fsl_hardreset()
816 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_hardreset()
817 temp &= ~HCONTROL_ONLINE_PHY_RST; in sata_fsl_hardreset()
818 iowrite32(temp, hcr_base + HCONTROL); in sata_fsl_hardreset()
821 temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, ONLINE, in sata_fsl_hardreset()
824 if (temp & ONLINE) { in sata_fsl_hardreset()
825 ata_port_err(ap, "Hardreset failed, not off-lined %d\n", i); in sata_fsl_hardreset()
837 ata_port_dbg(ap, "hardreset, controller off-lined\n" in sata_fsl_hardreset()
856 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_hardreset()
857 temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE); in sata_fsl_hardreset()
858 temp |= HCONTROL_PMP_ATTACHED; in sata_fsl_hardreset()
859 iowrite32(temp, hcr_base + HCONTROL); in sata_fsl_hardreset()
861 temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, 0, 1, 500); in sata_fsl_hardreset()
863 if (!(temp & ONLINE)) { in sata_fsl_hardreset()
864 ata_port_err(ap, "Hardreset failed, not on-lined\n"); in sata_fsl_hardreset()
868 ata_port_dbg(ap, "controller off-lined & on-lined\n" in sata_fsl_hardreset()
879 temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0, 1, 500); in sata_fsl_hardreset()
880 if ((!(temp & 0x10)) || ata_link_offline(link)) { in sata_fsl_hardreset()
891 temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0x10, in sata_fsl_hardreset()
892 500, jiffies_to_msecs(deadline - start_jiffies)); in sata_fsl_hardreset()
894 if ((temp & 0xFF) != 0x18) { in sata_fsl_hardreset()
900 jiffies_to_msecs(jiffies - start_jiffies)); in sata_fsl_hardreset()
907 * request libATA to perform follow-up softreset in sata_fsl_hardreset()
909 return -EAGAIN; in sata_fsl_hardreset()
912 return -EIO; in sata_fsl_hardreset()
918 struct ata_port *ap = link->ap; in sata_fsl_softreset()
919 struct sata_fsl_port_priv *pp = ap->private_data; in sata_fsl_softreset()
920 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_softreset()
921 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_softreset()
923 u32 temp; in sata_fsl_softreset() local
941 ata_tf_init(link->device, &tf); in sata_fsl_softreset()
942 cfis = (u8 *) &pp->cmdentry->cfis; in sata_fsl_softreset()
968 temp = ata_wait_register(ap, CQ + hcr_base, 0x1, 0x1, 1, 5000); in sata_fsl_softreset()
969 if (temp & 0x1) { in sata_fsl_softreset()
976 sata_fsl_scr_read(&ap->link, SCR_ERROR, &Serror); in sata_fsl_softreset()
1034 return -EIO; in sata_fsl_softreset()
1044 if (qc->flags & ATA_QCFLAG_EH) in sata_fsl_post_internal_cmd()
1045 qc->err_mask |= AC_ERR_OTHER; in sata_fsl_post_internal_cmd()
1047 if (qc->err_mask) { in sata_fsl_post_internal_cmd()
1055 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_error_intr()
1056 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_error_intr()
1068 link = &ap->link; in sata_fsl_error_intr()
1069 ehi = &link->eh_info; in sata_fsl_error_intr()
1076 sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError); in sata_fsl_error_intr()
1078 sata_fsl_scr_write(&ap->link, SCR_ERROR, SError); in sata_fsl_error_intr()
1085 ehi->err_mask |= AC_ERR_ATA_BUS; in sata_fsl_error_intr()
1086 ehi->action |= ATA_EH_SOFTRESET; in sata_fsl_error_intr()
1099 /* Setup a soft-reset EH action */ in sata_fsl_error_intr()
1122 if (ap->nr_pmp_links) { in sata_fsl_error_intr()
1129 dev_num = ffs(dereg) - 1; in sata_fsl_error_intr()
1130 if (dev_num < ap->nr_pmp_links && dereg != 0) { in sata_fsl_error_intr()
1131 link = &ap->pmp_link[dev_num]; in sata_fsl_error_intr()
1132 ehi = &link->eh_info; in sata_fsl_error_intr()
1133 qc = ata_qc_from_tag(ap, link->active_tag); in sata_fsl_error_intr()
1151 qc = ata_qc_from_tag(ap, link->active_tag); in sata_fsl_error_intr()
1162 qc->err_mask |= err_mask; in sata_fsl_error_intr()
1164 ehi->err_mask |= err_mask; in sata_fsl_error_intr()
1166 ehi->action |= action; in sata_fsl_error_intr()
1173 ata_link_abort(qc->dev->link); in sata_fsl_error_intr()
1181 struct sata_fsl_host_priv *host_priv = ap->host->private_data; in sata_fsl_host_intr()
1182 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_host_intr()
1191 sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError); in sata_fsl_host_intr()
1199 if (qc && ata_is_atapi(qc->tf.protocol)) { in sata_fsl_host_intr()
1211 sata_fsl_scr_write(&ap->link, SCR_ERROR, in sata_fsl_host_intr()
1239 ap->qc_active); in sata_fsl_host_intr()
1241 if (done_mask & ap->qc_active) { in sata_fsl_host_intr()
1259 } else if ((ap->qc_active & (1ULL << ATA_TAG_INTERNAL))) { in sata_fsl_host_intr()
1263 ata_port_dbg(ap, "completing non-ncq cmd, CC=0x%x\n", in sata_fsl_host_intr()
1281 struct sata_fsl_host_priv *host_priv = host->private_data; in sata_fsl_interrupt()
1282 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_interrupt()
1294 spin_lock(&host->lock); in sata_fsl_interrupt()
1298 ap = host->ports[0]; in sata_fsl_interrupt()
1302 dev_warn(host->dev, "interrupt on disabled port 0\n"); in sata_fsl_interrupt()
1308 spin_unlock(&host->lock); in sata_fsl_interrupt()
1319 struct sata_fsl_host_priv *host_priv = host->private_data; in sata_fsl_init_controller()
1320 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_init_controller()
1321 u32 temp; in sata_fsl_init_controller() local
1330 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_init_controller()
1331 iowrite32(temp & ~HCONTROL_LEGACY, hcr_base + HCONTROL); in sata_fsl_init_controller()
1334 temp = ioread32(hcr_base + HSTATUS); in sata_fsl_init_controller()
1335 if (temp & 0x3F) in sata_fsl_init_controller()
1336 iowrite32((temp & 0x3F), hcr_base + HSTATUS); in sata_fsl_init_controller()
1339 temp = ioread32(hcr_base + HCONTROL); in sata_fsl_init_controller()
1340 iowrite32((temp & ~0x3F), hcr_base + HCONTROL); in sata_fsl_init_controller()
1343 dev_dbg(host->dev, "icc = 0x%x\n", ioread32(hcr_base + ICC)); in sata_fsl_init_controller()
1358 * host controller will be brought on-line, during xx_port_start() in sata_fsl_init_controller()
1362 dev_dbg(host->dev, "HStatus = 0x%x HControl = 0x%x\n", in sata_fsl_init_controller()
1370 struct sata_fsl_host_priv *host_priv = host->private_data; in sata_fsl_host_stop()
1372 iounmap(host_priv->hcr_base); in sata_fsl_host_stop()
1377 * scsi mid-layer and libata interface structures
1424 int retval = -ENXIO; in sata_fsl_probe()
1431 u32 temp; in sata_fsl_probe() local
1436 dev_info(&ofdev->dev, "Sata FSL Platform/CSB Driver init\n"); in sata_fsl_probe()
1438 hcr_base = of_iomap(ofdev->dev.of_node, 0); in sata_fsl_probe()
1445 if (!of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc8315-sata")) { in sata_fsl_probe()
1446 temp = ioread32(csr_base + TRANSCFG); in sata_fsl_probe()
1447 temp = temp & 0xffffffe0; in sata_fsl_probe()
1448 iowrite32(temp | TRANSCFG_RX_WATER_MARK, csr_base + TRANSCFG); in sata_fsl_probe()
1451 dev_dbg(&ofdev->dev, "@reset i/o = 0x%x\n", in sata_fsl_probe()
1458 host_priv->hcr_base = hcr_base; in sata_fsl_probe()
1459 host_priv->ssr_base = ssr_base; in sata_fsl_probe()
1460 host_priv->csr_base = csr_base; in sata_fsl_probe()
1467 host_priv->irq = irq; in sata_fsl_probe()
1469 if (of_device_is_compatible(ofdev->dev.of_node, "fsl,pq-sata-v2")) in sata_fsl_probe()
1470 host_priv->data_snoop = DATA_SNOOP_ENABLE_V2; in sata_fsl_probe()
1472 host_priv->data_snoop = DATA_SNOOP_ENABLE_V1; in sata_fsl_probe()
1475 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); in sata_fsl_probe()
1477 retval = -ENOMEM; in sata_fsl_probe()
1481 /* host->iomap is not used currently */ in sata_fsl_probe()
1482 host->private_data = host_priv; in sata_fsl_probe()
1495 host_priv->intr_coalescing.show = fsl_sata_intr_coalescing_show; in sata_fsl_probe()
1496 host_priv->intr_coalescing.store = fsl_sata_intr_coalescing_store; in sata_fsl_probe()
1497 sysfs_attr_init(&host_priv->intr_coalescing.attr); in sata_fsl_probe()
1498 host_priv->intr_coalescing.attr.name = "intr_coalescing"; in sata_fsl_probe()
1499 host_priv->intr_coalescing.attr.mode = S_IRUGO | S_IWUSR; in sata_fsl_probe()
1500 retval = device_create_file(host->dev, &host_priv->intr_coalescing); in sata_fsl_probe()
1504 host_priv->rx_watermark.show = fsl_sata_rx_watermark_show; in sata_fsl_probe()
1505 host_priv->rx_watermark.store = fsl_sata_rx_watermark_store; in sata_fsl_probe()
1506 sysfs_attr_init(&host_priv->rx_watermark.attr); in sata_fsl_probe()
1507 host_priv->rx_watermark.attr.name = "rx_watermark"; in sata_fsl_probe()
1508 host_priv->rx_watermark.attr.mode = S_IRUGO | S_IWUSR; in sata_fsl_probe()
1509 retval = device_create_file(host->dev, &host_priv->rx_watermark); in sata_fsl_probe()
1511 device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); in sata_fsl_probe()
1532 struct sata_fsl_host_priv *host_priv = host->private_data; in sata_fsl_remove()
1534 device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); in sata_fsl_remove()
1535 device_remove_file(&ofdev->dev, &host_priv->rx_watermark); in sata_fsl_remove()
1552 struct sata_fsl_host_priv *host_priv = host->private_data; in sata_fsl_resume()
1554 void __iomem *hcr_base = host_priv->hcr_base; in sata_fsl_resume()
1555 struct ata_port *ap = host->ports[0]; in sata_fsl_resume()
1556 struct sata_fsl_port_priv *pp = ap->private_data; in sata_fsl_resume()
1560 dev_err(&op->dev, "Error initializing hardware\n"); in sata_fsl_resume()
1565 iowrite32(pp->cmdslot_paddr & 0xffffffff, hcr_base + CHBA); in sata_fsl_resume()
1579 { .compatible = "fsl,pq-sata", },
1580 { .compatible = "fsl,pq-sata-v2", },
1588 .name = "fsl-sata",