Lines Matching +full:fixed +full:- +full:mmio +full:- +full:clock

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sata_sx4.c - Promise SATA
6 * Please ALWAYS copy linux-ide@vger.kernel.org
9 * Copyright 2003-2004 Red Hat, Inc.
12 * as Documentation/driver-api/libata.rst
19 -------------------
29 PATA<->SATA bridges exist on SX4 boards, external to the
34 submitted and waited-on as a single unit), and an optional
39 transactions into a fixed DIMM memory space, from where an ATA
60 This is a very slow, lock-step way of doing things that can
132 PDC_HDMA_Q_MASK = (PDC_MAX_HDMA - 1),
141 PDC_I2C_WRITE = 0, /* master -> slave */
142 PDC_I2C_READ = (1 << 6), /* master <- slave */
146 PDC_I2C_NO_ACK = (1 << 20), /* slave no-ack addr */
285 struct device *dev = ap->host->dev; in pdc_port_start()
290 return -ENOMEM; in pdc_port_start()
292 pp->pkt = dmam_alloc_coherent(dev, 128, &pp->pkt_dma, GFP_KERNEL); in pdc_port_start()
293 if (!pp->pkt) in pdc_port_start()
294 return -ENOMEM; in pdc_port_start()
296 ap->private_data = pp; in pdc_port_start()
348 if ((tf->protocol == ATA_PROT_DMA) && (!(tf->flags & ATA_TFLAG_WRITE))) in pdc20621_ata_pkt()
350 else if (tf->protocol == ATA_PROT_NODATA) in pdc20621_ata_pkt()
358 /* dimm dma S/G, and next-pkt */ in pdc20621_ata_pkt()
360 if (tf->protocol == ATA_PROT_NODATA) in pdc20621_ata_pkt()
378 buf[i++] = tf->ctl; in pdc20621_ata_pkt()
402 if ((tf->protocol == ATA_PROT_DMA) && (!(tf->flags & ATA_TFLAG_WRITE))) in pdc20621_host_pkt()
417 struct ata_port *ap = qc->ap; in pdc20621_dma_prep()
418 struct pdc_port_priv *pp = ap->private_data; in pdc20621_dma_prep()
419 void __iomem *mmio = ap->host->iomap[PDC_MMIO_BAR]; in pdc20621_dma_prep() local
420 void __iomem *dimm_mmio = ap->host->iomap[PDC_DIMM_BAR]; in pdc20621_dma_prep()
421 unsigned int portno = ap->port_no; in pdc20621_dma_prep()
423 __le32 *buf = (__le32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ]; in pdc20621_dma_prep()
425 WARN_ON(!(qc->flags & ATA_QCFLAG_DMAMAP)); in pdc20621_dma_prep()
427 /* hard-code chip #0 */ in pdc20621_dma_prep()
428 mmio += PDC_CHIP0_OFS; in pdc20621_dma_prep()
434 for_each_sg(qc->sg, sg, qc->n_elem, si) { in pdc20621_dma_prep()
439 buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT); in pdc20621_dma_prep()
445 pdc20621_host_sg(&pp->dimm_buf[0], portno, total_len); in pdc20621_dma_prep()
446 pdc20621_host_pkt(&qc->tf, &pp->dimm_buf[0], portno); in pdc20621_dma_prep()
448 pdc20621_ata_sg(&pp->dimm_buf[0], portno, total_len); in pdc20621_dma_prep()
449 i = pdc20621_ata_pkt(&qc->tf, qc->dev->devno, &pp->dimm_buf[0], portno); in pdc20621_dma_prep()
451 if (qc->tf.flags & ATA_TFLAG_LBA48) in pdc20621_dma_prep()
452 i = pdc_prep_lba48(&qc->tf, &pp->dimm_buf[0], i); in pdc20621_dma_prep()
454 i = pdc_prep_lba28(&qc->tf, &pp->dimm_buf[0], i); in pdc20621_dma_prep()
456 pdc_pkt_footer(&qc->tf, &pp->dimm_buf[0], i); in pdc20621_dma_prep()
458 /* copy three S/G tables and two packets to DIMM MMIO window */ in pdc20621_dma_prep()
460 &pp->dimm_buf, PDC_DIMM_HEADER_SZ); in pdc20621_dma_prep()
463 &pp->dimm_buf[PDC_DIMM_HEADER_SZ], sgt_len); in pdc20621_dma_prep()
466 writel(0x00000001, mmio + PDC_20621_GENERAL_CTL); in pdc20621_dma_prep()
468 readl(dimm_mmio); /* MMIO PCI posting flush */ in pdc20621_dma_prep()
470 ata_port_dbg(ap, "ata pkt buf ofs %u, prd size %u, mmio copied\n", in pdc20621_dma_prep()
476 struct ata_port *ap = qc->ap; in pdc20621_nodata_prep()
477 struct pdc_port_priv *pp = ap->private_data; in pdc20621_nodata_prep()
478 void __iomem *mmio = ap->host->iomap[PDC_MMIO_BAR]; in pdc20621_nodata_prep() local
479 void __iomem *dimm_mmio = ap->host->iomap[PDC_DIMM_BAR]; in pdc20621_nodata_prep()
480 unsigned int portno = ap->port_no; in pdc20621_nodata_prep()
483 /* hard-code chip #0 */ in pdc20621_nodata_prep()
484 mmio += PDC_CHIP0_OFS; in pdc20621_nodata_prep()
486 i = pdc20621_ata_pkt(&qc->tf, qc->dev->devno, &pp->dimm_buf[0], portno); in pdc20621_nodata_prep()
488 if (qc->tf.flags & ATA_TFLAG_LBA48) in pdc20621_nodata_prep()
489 i = pdc_prep_lba48(&qc->tf, &pp->dimm_buf[0], i); in pdc20621_nodata_prep()
491 i = pdc_prep_lba28(&qc->tf, &pp->dimm_buf[0], i); in pdc20621_nodata_prep()
493 pdc_pkt_footer(&qc->tf, &pp->dimm_buf[0], i); in pdc20621_nodata_prep()
495 /* copy three S/G tables and two packets to DIMM MMIO window */ in pdc20621_nodata_prep()
497 &pp->dimm_buf, PDC_DIMM_HEADER_SZ); in pdc20621_nodata_prep()
500 writel(0x00000001, mmio + PDC_20621_GENERAL_CTL); in pdc20621_nodata_prep()
502 readl(dimm_mmio); /* MMIO PCI posting flush */ in pdc20621_nodata_prep()
504 ata_port_dbg(ap, "ata pkt buf ofs %u, mmio copied\n", i); in pdc20621_nodata_prep()
509 switch (qc->tf.protocol) { in pdc20621_qc_prep()
527 struct ata_port *ap = qc->ap; in __pdc20621_push_hdma()
528 struct ata_host *host = ap->host; in __pdc20621_push_hdma()
529 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in __pdc20621_push_hdma() local
531 /* hard-code chip #0 */ in __pdc20621_push_hdma()
532 mmio += PDC_CHIP0_OFS; in __pdc20621_push_hdma()
534 writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4)); in __pdc20621_push_hdma()
535 readl(mmio + PDC_20621_SEQCTL + (seq * 4)); /* flush */ in __pdc20621_push_hdma()
537 writel(pkt_ofs, mmio + PDC_HDMA_PKT_SUBMIT); in __pdc20621_push_hdma()
538 readl(mmio + PDC_HDMA_PKT_SUBMIT); /* flush */ in __pdc20621_push_hdma()
545 struct ata_port *ap = qc->ap; in pdc20621_push_hdma()
546 struct pdc_host_priv *pp = ap->host->private_data; in pdc20621_push_hdma()
547 unsigned int idx = pp->hdma_prod & PDC_HDMA_Q_MASK; in pdc20621_push_hdma()
549 if (!pp->doing_hdma) { in pdc20621_push_hdma()
551 pp->doing_hdma = 1; in pdc20621_push_hdma()
555 pp->hdma[idx].qc = qc; in pdc20621_push_hdma()
556 pp->hdma[idx].seq = seq; in pdc20621_push_hdma()
557 pp->hdma[idx].pkt_ofs = pkt_ofs; in pdc20621_push_hdma()
558 pp->hdma_prod++; in pdc20621_push_hdma()
563 struct ata_port *ap = qc->ap; in pdc20621_pop_hdma()
564 struct pdc_host_priv *pp = ap->host->private_data; in pdc20621_pop_hdma()
565 unsigned int idx = pp->hdma_cons & PDC_HDMA_Q_MASK; in pdc20621_pop_hdma()
568 if (pp->hdma_prod == pp->hdma_cons) { in pdc20621_pop_hdma()
569 pp->doing_hdma = 0; in pdc20621_pop_hdma()
573 __pdc20621_push_hdma(pp->hdma[idx].qc, pp->hdma[idx].seq, in pdc20621_pop_hdma()
574 pp->hdma[idx].pkt_ofs); in pdc20621_pop_hdma()
575 pp->hdma_cons++; in pdc20621_pop_hdma()
580 struct ata_port *ap = qc->ap; in pdc20621_dump_hdma()
581 unsigned int port_no = ap->port_no; in pdc20621_dump_hdma()
582 void __iomem *dimm_mmio = ap->host->iomap[PDC_DIMM_BAR]; in pdc20621_dump_hdma()
594 struct ata_port *ap = qc->ap; in pdc20621_packet_start()
595 struct ata_host *host = ap->host; in pdc20621_packet_start()
596 unsigned int port_no = ap->port_no; in pdc20621_packet_start()
597 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_packet_start() local
598 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); in pdc20621_packet_start()
602 /* hard-code chip #0 */ in pdc20621_packet_start()
603 mmio += PDC_CHIP0_OFS; in pdc20621_packet_start()
610 if (rw && qc->tf.protocol == ATA_PROT_DMA) { in pdc20621_packet_start()
620 writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4)); in pdc20621_packet_start()
621 readl(mmio + PDC_20621_SEQCTL + (seq * 4)); /* flush */ in pdc20621_packet_start()
624 ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); in pdc20621_packet_start()
625 readl(ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); in pdc20621_packet_start()
635 switch (qc->tf.protocol) { in pdc20621_qc_issue()
637 if (qc->tf.flags & ATA_TFLAG_POLLING) in pdc20621_qc_issue()
658 void __iomem *mmio) in pdc20621_host_intr() argument
660 unsigned int port_no = ap->port_no; in pdc20621_host_intr()
666 if ((qc->tf.protocol == ATA_PROT_DMA) && /* read */ in pdc20621_host_intr()
667 (!(qc->tf.flags & ATA_TFLAG_WRITE))) { in pdc20621_host_intr()
669 /* step two - DMA from DIMM to host */ in pdc20621_host_intr()
672 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); in pdc20621_host_intr()
674 qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); in pdc20621_host_intr()
679 /* step one - exec ATA command */ in pdc20621_host_intr()
683 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); in pdc20621_host_intr()
692 } else if (qc->tf.protocol == ATA_PROT_DMA) { /* write */ in pdc20621_host_intr()
694 /* step one - DMA from host to DIMM */ in pdc20621_host_intr()
698 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); in pdc20621_host_intr()
701 writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4)); in pdc20621_host_intr()
702 readl(mmio + PDC_20621_SEQCTL + (seq * 4)); in pdc20621_host_intr()
704 ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); in pdc20621_host_intr()
705 readl(ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); in pdc20621_host_intr()
708 /* step two - execute ATA command */ in pdc20621_host_intr()
711 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); in pdc20621_host_intr()
713 qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); in pdc20621_host_intr()
720 } else if (qc->tf.protocol == ATA_PROT_NODATA) { in pdc20621_host_intr()
724 qc->err_mask |= ac_err_mask(status); in pdc20621_host_intr()
729 ap->stats.idle_irq++; in pdc20621_host_intr()
737 ioread8(ap->ioaddr.status_addr); in pdc20621_irq_clear()
749 if (!host || !host->iomap[PDC_MMIO_BAR]) in pdc20621_interrupt()
752 mmio_base = host->iomap[PDC_MMIO_BAR]; in pdc20621_interrupt()
765 spin_lock(&host->lock); in pdc20621_interrupt()
768 port_no = i - 1; in pdc20621_interrupt()
770 port_no -= 4; in pdc20621_interrupt()
771 if (port_no >= host->n_ports) in pdc20621_interrupt()
774 ap = host->ports[port_no]; in pdc20621_interrupt()
781 qc = ata_qc_from_tag(ap, ap->link.active_tag); in pdc20621_interrupt()
782 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) in pdc20621_interrupt()
788 spin_unlock(&host->lock); in pdc20621_interrupt()
795 void __iomem *mmio = ap->ioaddr.cmd_addr; in pdc_freeze() local
800 tmp = readl(mmio + PDC_CTLSTAT); in pdc_freeze()
803 writel(tmp, mmio + PDC_CTLSTAT); in pdc_freeze()
804 readl(mmio + PDC_CTLSTAT); /* flush */ in pdc_freeze()
809 void __iomem *mmio = ap->ioaddr.cmd_addr; in pdc_thaw() local
815 ioread8(ap->ioaddr.status_addr); in pdc_thaw()
818 tmp = readl(mmio + PDC_CTLSTAT); in pdc_thaw()
820 writel(tmp, mmio + PDC_CTLSTAT); in pdc_thaw()
821 readl(mmio + PDC_CTLSTAT); /* flush */ in pdc_thaw()
826 void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; in pdc_reset_port() local
832 for (i = 11; i > 0; i--) { in pdc_reset_port()
833 tmp = readl(mmio); in pdc_reset_port()
840 writel(tmp, mmio); in pdc_reset_port()
844 writel(tmp, mmio); in pdc_reset_port()
845 readl(mmio); /* flush */ in pdc_reset_port()
851 pdc_reset_port(link->ap); in pdc_softreset()
865 struct ata_port *ap = qc->ap; in pdc_post_internal_cmd()
868 if (qc->flags & ATA_QCFLAG_EH) in pdc_post_internal_cmd()
874 u8 *scsicmd = qc->scsicmd->cmnd; in pdc_check_atapi_dma()
889 /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */ in pdc_check_atapi_dma()
904 WARN_ON(tf->protocol == ATA_PROT_DMA || in pdc_tf_load_mmio()
905 tf->protocol == ATAPI_PROT_DMA); in pdc_tf_load_mmio()
912 WARN_ON(tf->protocol == ATA_PROT_DMA || in pdc_exec_command_mmio()
913 tf->protocol == ATAPI_PROT_DMA); in pdc_exec_command_mmio()
920 port->cmd_addr = base; in pdc_sata_setup_port()
921 port->data_addr = base; in pdc_sata_setup_port()
922 port->feature_addr = in pdc_sata_setup_port()
923 port->error_addr = base + 0x4; in pdc_sata_setup_port()
924 port->nsect_addr = base + 0x8; in pdc_sata_setup_port()
925 port->lbal_addr = base + 0xc; in pdc_sata_setup_port()
926 port->lbam_addr = base + 0x10; in pdc_sata_setup_port()
927 port->lbah_addr = base + 0x14; in pdc_sata_setup_port()
928 port->device_addr = base + 0x18; in pdc_sata_setup_port()
929 port->command_addr = in pdc_sata_setup_port()
930 port->status_addr = base + 0x1c; in pdc_sata_setup_port()
931 port->altstatus_addr = in pdc_sata_setup_port()
932 port->ctl_addr = base + 0x38; in pdc_sata_setup_port()
943 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_get_from_dimm() local
944 void __iomem *dimm_mmio = host->iomap[PDC_DIMM_BAR]; in pdc20621_get_from_dimm()
946 /* hard-code chip #0 */ in pdc20621_get_from_dimm()
947 mmio += PDC_CHIP0_OFS; in pdc20621_get_from_dimm()
953 writel(0x01, mmio + PDC_GENERAL_CTLR); in pdc20621_get_from_dimm()
954 readl(mmio + PDC_GENERAL_CTLR); in pdc20621_get_from_dimm()
955 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_get_from_dimm()
956 readl(mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_get_from_dimm()
958 offset -= (idx * window_size); in pdc20621_get_from_dimm()
960 dist = min(size, window_size - offset); in pdc20621_get_from_dimm()
964 size -= dist; in pdc20621_get_from_dimm()
966 writel(0x01, mmio + PDC_GENERAL_CTLR); in pdc20621_get_from_dimm()
967 readl(mmio + PDC_GENERAL_CTLR); in pdc20621_get_from_dimm()
968 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_get_from_dimm()
969 readl(mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_get_from_dimm()
972 size -= window_size; in pdc20621_get_from_dimm()
977 writel(0x01, mmio + PDC_GENERAL_CTLR); in pdc20621_get_from_dimm()
978 readl(mmio + PDC_GENERAL_CTLR); in pdc20621_get_from_dimm()
979 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_get_from_dimm()
980 readl(mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_get_from_dimm()
993 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_put_to_dimm() local
994 void __iomem *dimm_mmio = host->iomap[PDC_DIMM_BAR]; in pdc20621_put_to_dimm()
996 /* hard-code chip #0 */ in pdc20621_put_to_dimm()
997 mmio += PDC_CHIP0_OFS; in pdc20621_put_to_dimm()
1003 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_put_to_dimm()
1004 readl(mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_put_to_dimm()
1005 offset -= (idx * window_size); in pdc20621_put_to_dimm()
1007 dist = min(size, window_size - offset); in pdc20621_put_to_dimm()
1009 writel(0x01, mmio + PDC_GENERAL_CTLR); in pdc20621_put_to_dimm()
1010 readl(mmio + PDC_GENERAL_CTLR); in pdc20621_put_to_dimm()
1013 size -= dist; in pdc20621_put_to_dimm()
1015 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_put_to_dimm()
1016 readl(mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_put_to_dimm()
1018 writel(0x01, mmio + PDC_GENERAL_CTLR); in pdc20621_put_to_dimm()
1019 readl(mmio + PDC_GENERAL_CTLR); in pdc20621_put_to_dimm()
1021 size -= window_size; in pdc20621_put_to_dimm()
1026 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_put_to_dimm()
1027 readl(mmio + PDC_DIMM_WINDOW_CTLR); in pdc20621_put_to_dimm()
1029 writel(0x01, mmio + PDC_GENERAL_CTLR); in pdc20621_put_to_dimm()
1030 readl(mmio + PDC_GENERAL_CTLR); in pdc20621_put_to_dimm()
1038 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_i2c_read() local
1043 /* hard-code chip #0 */ in pdc20621_i2c_read()
1044 mmio += PDC_CHIP0_OFS; in pdc20621_i2c_read()
1050 writel(i2creg, mmio + PDC_I2C_ADDR_DATA); in pdc20621_i2c_read()
1051 readl(mmio + PDC_I2C_ADDR_DATA); in pdc20621_i2c_read()
1055 mmio + PDC_I2C_CONTROL); in pdc20621_i2c_read()
1058 status = readl(mmio + PDC_I2C_CONTROL); in pdc20621_i2c_read()
1060 status = readl(mmio + PDC_I2C_ADDR_DATA); in pdc20621_i2c_read()
1097 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_prog_dimm0() local
1116 /* hard-code chip #0 */ in pdc20621_prog_dimm0()
1117 mmio += PDC_CHIP0_OFS; in pdc20621_prog_dimm0()
1124 data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4); in pdc20621_prog_dimm0()
1126 ((((spd0[27] + 9) / 10) - 1) << 8) ; in pdc20621_prog_dimm0()
1128 ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; in pdc20621_prog_dimm0()
1129 data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12; in pdc20621_prog_dimm0()
1147 data |= (((size / 16) - 1) << 16); in pdc20621_prog_dimm0()
1150 writel(data, mmio + PDC_DIMM0_CONTROL); in pdc20621_prog_dimm0()
1151 readl(mmio + PDC_DIMM0_CONTROL); in pdc20621_prog_dimm0()
1160 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_prog_dimm_global() local
1162 /* hard-code chip #0 */ in pdc20621_prog_dimm_global()
1163 mmio += PDC_CHIP0_OFS; in pdc20621_prog_dimm_global()
1168 DIMM Data/Control Output Driving Selection (bit12 - bit15) in pdc20621_prog_dimm_global()
1173 writel(data, mmio + PDC_SDRAM_CONTROL); in pdc20621_prog_dimm_global()
1174 readl(mmio + PDC_SDRAM_CONTROL); in pdc20621_prog_dimm_global()
1179 dev_err(host->dev, in pdc20621_prog_dimm_global()
1186 writel(data, mmio + PDC_SDRAM_CONTROL); in pdc20621_prog_dimm_global()
1187 readl(mmio + PDC_SDRAM_CONTROL); in pdc20621_prog_dimm_global()
1188 dev_err(host->dev, "Local DIMM ECC Enabled\n"); in pdc20621_prog_dimm_global()
1194 writel(data, mmio + PDC_SDRAM_CONTROL); in pdc20621_prog_dimm_global()
1198 data = readl(mmio + PDC_SDRAM_CONTROL); in pdc20621_prog_dimm_global()
1216 u32 clock = 0; in pdc20621_dimm_init() local
1218 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc20621_dimm_init() local
1220 /* hard-code chip #0 */ in pdc20621_dimm_init()
1221 mmio += PDC_CHIP0_OFS; in pdc20621_dimm_init()
1226 writel(0xffffffff, mmio + PDC_TIME_PERIOD); in pdc20621_dimm_init()
1227 time_period = readl(mmio + PDC_TIME_PERIOD); in pdc20621_dimm_init()
1228 dev_dbg(host->dev, "Time Period Register (0x40): 0x%x\n", time_period); in pdc20621_dimm_init()
1231 writel(PDC_TIMER_DEFAULT, mmio + PDC_TIME_CONTROL); in pdc20621_dimm_init()
1232 readl(mmio + PDC_TIME_CONTROL); in pdc20621_dimm_init()
1239 clock cycle. in pdc20621_dimm_init()
1242 tcount = readl(mmio + PDC_TIME_COUNTER); in pdc20621_dimm_init()
1243 dev_dbg(host->dev, "Time Counter Register (0x44): 0x%x\n", tcount); in pdc20621_dimm_init()
1246 If SX4 is on PCI-X bus, after 3 seconds, the timer counter in pdc20621_dimm_init()
1247 register should be >= (0xffffffff - 3x10^8). in pdc20621_dimm_init()
1250 ticks = (time_period - tcount); in pdc20621_dimm_init()
1251 dev_dbg(host->dev, "Num counters 0x%x (%d)\n", ticks, ticks); in pdc20621_dimm_init()
1253 clock = (ticks / 300000); in pdc20621_dimm_init()
1254 dev_dbg(host->dev, "10 * Internal clk = 0x%x (%d)\n", in pdc20621_dimm_init()
1255 clock, clock); in pdc20621_dimm_init()
1257 clock = (clock * 33); in pdc20621_dimm_init()
1258 dev_dbg(host->dev, "10 * Internal clk * 33 = 0x%x (%d)\n", in pdc20621_dimm_init()
1259 clock, clock); in pdc20621_dimm_init()
1262 fparam = (1400000 / clock) - 2; in pdc20621_dimm_init()
1263 dev_dbg(host->dev, "PLL F Param: 0x%x (%d)\n", fparam, fparam); in pdc20621_dimm_init()
1271 dev_dbg(host->dev, "pci_status: 0x%x\n", pci_status); in pdc20621_dimm_init()
1272 writel(pci_status, mmio + PDC_CTL_STATUS); in pdc20621_dimm_init()
1273 readl(mmio + PDC_CTL_STATUS); in pdc20621_dimm_init()
1280 dev_err(host->dev, "Detect Local DIMM Fail\n"); in pdc20621_dimm_init()
1283 dev_dbg(host->dev, "Local DIMM Speed = %d\n", speed); in pdc20621_dimm_init()
1287 dev_dbg(host->dev, "Local DIMM Size = %dMB\n", size); in pdc20621_dimm_init()
1291 dev_err(host->dev, in pdc20621_dimm_init()
1310 dev_info(host->dev, "DIMM test pattern 1: %x, %x, %s\n", test_parttern2[0], in pdc20621_dimm_init()
1314 dev_info(host->dev, "DIMM test pattern 2: %x, %x, %s\n", in pdc20621_dimm_init()
1320 dev_info(host->dev, "DIMM test pattern 3: %x, %x, %s\n", in pdc20621_dimm_init()
1329 dev_err(host->dev, in pdc20621_dimm_init()
1336 dev_dbg(host->dev, "Start ECC initialization\n"); in pdc20621_dimm_init()
1348 dev_dbg(host->dev, "Finish ECC initialization\n"); in pdc20621_dimm_init()
1357 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; in pdc_20621_init() local
1359 /* hard-code chip #0 */ in pdc_20621_init()
1360 mmio += PDC_CHIP0_OFS; in pdc_20621_init()
1365 tmp = readl(mmio + PDC_20621_DIMM_WINDOW) & 0xffff0000; in pdc_20621_init()
1367 writel(tmp, mmio + PDC_20621_DIMM_WINDOW); in pdc_20621_init()
1372 tmp = readl(mmio + PDC_HDMA_CTLSTAT); in pdc_20621_init()
1374 writel(tmp, mmio + PDC_HDMA_CTLSTAT); in pdc_20621_init()
1375 readl(mmio + PDC_HDMA_CTLSTAT); /* flush */ in pdc_20621_init()
1379 tmp = readl(mmio + PDC_HDMA_CTLSTAT); in pdc_20621_init()
1381 writel(tmp, mmio + PDC_HDMA_CTLSTAT); in pdc_20621_init()
1382 readl(mmio + PDC_HDMA_CTLSTAT); /* flush */ in pdc_20621_init()
1389 { &pdc_port_info[ent->driver_data], NULL }; in pdc_sata_init_one()
1394 ata_print_version_once(&pdev->dev, DRV_VERSION); in pdc_sata_init_one()
1397 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4); in pdc_sata_init_one()
1398 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); in pdc_sata_init_one()
1400 return -ENOMEM; in pdc_sata_init_one()
1402 host->private_data = hpriv; in pdc_sata_init_one()
1411 if (rc == -EBUSY) in pdc_sata_init_one()
1415 host->iomap = pcim_iomap_table(pdev); in pdc_sata_init_one()
1418 struct ata_port *ap = host->ports[i]; in pdc_sata_init_one()
1419 void __iomem *base = host->iomap[PDC_MMIO_BAR] + PDC_CHIP0_OFS; in pdc_sata_init_one()
1422 pdc_sata_setup_port(&ap->ioaddr, base + offset); in pdc_sata_init_one()
1424 ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); in pdc_sata_init_one()
1425 ata_port_pbar_desc(ap, PDC_DIMM_BAR, -1, "dimm"); in pdc_sata_init_one()
1430 rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); in pdc_sata_init_one()
1435 return -ENOMEM; in pdc_sata_init_one()
1439 return ata_host_activate(host, pdev->irq, pdc20621_interrupt, in pdc_sata_init_one()
1446 MODULE_DESCRIPTION("Promise SATA low-level driver");