Lines Matching +full:flip +full:- +full:chip
1 // SPDX-License-Identifier: GPL-2.0-only
3 * pata_ns87415.c - NS87415 (and PARISC SUPERIO 87560) PATA
11 * This driver assumes the firmware has left the chip in a valid ST506
39 * ns87415_set_mode - Initialize host controller mode timings
45 * device. Because the chip is quite an old design we have to do this
54 struct pci_dev *dev = to_pci_dev(ap->host->dev); in ns87415_set_mode()
55 int unit = 2 * ap->port_no + adev->devno; in ns87415_set_mode()
63 /* Timing register format is 17 - low nybble read timing with in ns87415_set_mode()
64 the high nybble being 16 - x for recovery time in PCI clocks */ in ns87415_set_mode()
66 ata_timing_compute(adev, adev->pio_mode, &t, T, 0); in ns87415_set_mode()
68 clocking = 17 - clamp_val(t.active, 2, 17); in ns87415_set_mode()
69 clocking |= (16 - clamp_val(t.recover, 1, 16)) << 4; in ns87415_set_mode()
88 /* Flip the IORDY/DMA bits now we are sure the write buffers are in ns87415_set_mode()
97 * ns87415_set_piomode - Initialize host controller PATA PIO timings
109 ns87415_set_mode(ap, adev, adev->pio_mode); in ns87415_set_piomode()
113 * ns87415_bmdma_setup - Set up DMA
117 * rather than use the helper due to a chip erratum
122 struct ata_port *ap = qc->ap; in ns87415_bmdma_setup()
123 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); in ns87415_bmdma_setup()
128 iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); in ns87415_bmdma_setup()
130 /* specify data direction, triple-check start bit is clear */ in ns87415_bmdma_setup()
131 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ns87415_bmdma_setup()
134 place - which does save us an I/O bizarrely */ in ns87415_bmdma_setup()
138 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); in ns87415_bmdma_setup()
140 ap->ops->sff_exec_command(ap, &qc->tf); in ns87415_bmdma_setup()
144 * ns87415_bmdma_start - Begin DMA transfer
147 * Switch the timings for the chip and set up for a DMA transfer
156 ns87415_set_mode(qc->ap, qc->dev, qc->dev->dma_mode); in ns87415_bmdma_start()
161 * ns87415_bmdma_stop - End DMA transfer
170 ns87415_set_mode(qc->ap, qc->dev, qc->dev->pio_mode); in ns87415_bmdma_stop()
174 * ns87415_irq_clear - Clear interrupt
177 * Erratum: Due to a chip bug registers 02 and 0A bit 1 and 2 (the
183 void __iomem *mmio = ap->ioaddr.bmdma_addr; in ns87415_irq_clear()
192 * ns87415_check_atapi_dma - ATAPI DMA filter
201 return -EOPNOTSUPP; in ns87415_check_atapi_dma()
206 /* SUPERIO 87560 is a PoS chip that NatSem denies exists.
207 * Unfortunately, it's built-in on all Astro-based PA-RISC workstations
208 * which use the integrated NS87514 cell for CD-ROM support.
209 * i.e we have to support for CD-ROM installs.
220 * ns87560_read_buggy - workaround buggy Super I/O chip
223 * Work around chipset problems in the 87560 SuperIO chip
235 } while(retries-- > 0); in ns87560_read_buggy()
249 return ns87560_read_buggy(ap->ioaddr.status_addr); in ns87560_check_status()
253 * ns87560_tf_read - input device's ATA taskfile shadow registers
257 * Reads ATA taskfile registers for currently-selected device
265 struct ata_ioports *ioaddr = &ap->ioaddr; in ns87560_tf_read()
267 tf->status = ns87560_check_status(ap); in ns87560_tf_read()
268 tf->error = ioread8(ioaddr->error_addr); in ns87560_tf_read()
269 tf->nsect = ioread8(ioaddr->nsect_addr); in ns87560_tf_read()
270 tf->lbal = ioread8(ioaddr->lbal_addr); in ns87560_tf_read()
271 tf->lbam = ioread8(ioaddr->lbam_addr); in ns87560_tf_read()
272 tf->lbah = ioread8(ioaddr->lbah_addr); in ns87560_tf_read()
273 tf->device = ns87560_read_buggy(ioaddr->device_addr); in ns87560_tf_read()
275 if (tf->flags & ATA_TFLAG_LBA48) { in ns87560_tf_read()
276 iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); in ns87560_tf_read()
277 tf->hob_feature = ioread8(ioaddr->error_addr); in ns87560_tf_read()
278 tf->hob_nsect = ioread8(ioaddr->nsect_addr); in ns87560_tf_read()
279 tf->hob_lbal = ioread8(ioaddr->lbal_addr); in ns87560_tf_read()
280 tf->hob_lbam = ioread8(ioaddr->lbam_addr); in ns87560_tf_read()
281 tf->hob_lbah = ioread8(ioaddr->lbah_addr); in ns87560_tf_read()
282 iowrite8(tf->ctl, ioaddr->ctl_addr); in ns87560_tf_read()
283 ap->last_ctl = tf->ctl; in ns87560_tf_read()
297 return ns87560_read_buggy(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); in ns87560_bmdma_status()
336 * ns87415_init_one - Register 87415 ATA PCI device with kernel services
347 * Zero on success, or -ERRNO value.
368 if (PCI_SLOT(pdev->devfn) == 0x0E) in ns87415_init_one()
371 ata_print_version_once(&pdev->dev, DRV_VERSION); in ns87415_init_one()
419 MODULE_DESCRIPTION("ATA low-level driver for NS87415 controllers");