Lines Matching +full:pio +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
3 * pata_optidma.c - Opti DMA PATA for new ATA layer
6 * The Opti DMA controllers are related to the older PIO PCI controllers
11 * This driver should support Viper-N+, FireStar, FireStar Plus.
48 * optidma_pre_reset - probe begin
57 struct ata_port *ap = link->ap; in optidma_pre_reset()
58 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in optidma_pre_reset()
63 if (ap->port_no && !pci_test_config_bits(pdev, &optidma_enable_bits)) in optidma_pre_reset()
64 return -ENOENT; in optidma_pre_reset()
70 * optidma_unlock - unlock control registers
79 void __iomem *regio = ap->ioaddr.cmd_addr; in optidma_unlock()
88 * optidma_lock - issue temporary relock
91 * Re-lock the configuration register settings.
96 void __iomem *regio = ap->ioaddr.cmd_addr; in optidma_lock()
103 * optidma_mode_setup - set mode data
106 * @mode: Mode to set
108 * Called to do the DMA or PIO mode setup. Timing numbers are all
116 static void optidma_mode_setup(struct ata_port *ap, struct ata_device *adev, u8 mode) in optidma_mode_setup() argument
119 int pio = adev->pio_mode - XFER_PIO_0; in optidma_mode_setup() local
120 int dma = adev->dma_mode - XFER_MW_DMA_0; in optidma_mode_setup()
121 void __iomem *regio = ap->ioaddr.cmd_addr; in optidma_mode_setup()
138 /* Switch from IDE to control mode */ in optidma_mode_setup()
145 * need to look at slowest of PIO/DMA mode of either device in optidma_mode_setup()
148 if (mode >= XFER_MW_DMA_0) in optidma_mode_setup()
151 addr = addr_timing[pci_clock][pio]; in optidma_mode_setup()
159 pair_addr = addr_timing[pci_clock][pair->pio_mode - XFER_PIO_0]; in optidma_mode_setup()
166 iowrite8(adev->devno, regio + MISC_REG); in optidma_mode_setup()
168 if (mode < XFER_MW_DMA_0) { in optidma_mode_setup()
169 iowrite8(data_rec_timing[pci_clock][pio], regio + READ_REG); in optidma_mode_setup()
170 iowrite8(data_rec_timing[pci_clock][pio], regio + WRITE_REG); in optidma_mode_setup()
171 } else if (mode < XFER_UDMA_0) { in optidma_mode_setup()
176 iowrite8(addr | adev->devno, regio + MISC_REG); in optidma_mode_setup()
181 /* Switch back to IDE mode */ in optidma_mode_setup()
186 until we've done both sets of PIO/DMA timings */ in optidma_mode_setup()
190 * optiplus_mode_setup - DMA setup for Firestar Plus
193 * @mode: desired mode
195 * The Firestar plus has additional UDMA functionality for UDMA0-2 and
201 static void optiplus_mode_setup(struct ata_port *ap, struct ata_device *adev, u8 mode) in optiplus_mode_setup() argument
203 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in optiplus_mode_setup()
206 int dev2 = 2 * adev->devno; in optiplus_mode_setup()
207 int unit = 2 * ap->port_no + adev->devno; in optiplus_mode_setup()
208 int udma = mode - XFER_UDMA_0; in optiplus_mode_setup()
211 if (mode <= XFER_UDMA_0) { in optiplus_mode_setup()
213 optidma_mode_setup(ap, adev, adev->dma_mode); in optiplus_mode_setup()
216 if (ap->port_no) { in optiplus_mode_setup()
230 * optidma_set_pio_mode - PIO setup callback
234 * The libata core provides separate functions for handling PIO and
241 optidma_mode_setup(ap, adev, adev->pio_mode); in optidma_set_pio_mode()
245 * optidma_set_dma_mode - DMA setup callback
249 * The libata core provides separate functions for handling PIO and
256 optidma_mode_setup(ap, adev, adev->dma_mode); in optidma_set_dma_mode()
260 * optiplus_set_pio_mode - PIO setup callback
264 * The libata core provides separate functions for handling PIO and
271 optiplus_mode_setup(ap, adev, adev->pio_mode); in optiplus_set_pio_mode()
275 * optiplus_set_dma_mode - DMA setup callback
279 * The libata core provides separate functions for handling PIO and
286 optiplus_mode_setup(ap, adev, adev->dma_mode); in optiplus_set_dma_mode()
290 * optidma_make_bits43 - PCI setup helper
305 return adev->dma_mode - XFER_MW_DMA_0; in optidma_make_bits43()
306 return bits43[adev->pio_mode - XFER_PIO_0]; in optidma_make_bits43()
310 * optidma_set_mode - mode setup
321 struct ata_port *ap = link->ap; in optidma_set_mode()
323 int nybble = 4 * ap->port_no; in optidma_set_mode()
324 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in optidma_set_mode()
330 r |= (optidma_make_bits43(&link->device[0]) + in optidma_set_mode()
331 (optidma_make_bits43(&link->device[0]) << 2)) << nybble; in optidma_set_mode()
357 * optiplus_with_udma - Look for UDMA capable setup
377 /* Read the chipset system configuration to check our mode */ in optiplus_with_udma()
417 ata_print_version_once(&dev->dev, DRV_VERSION); in optidma_init_one()
454 MODULE_DESCRIPTION("low-level driver for Opti Firestar/Firestar Plus");