Lines Matching +full:udma +full:- +full:c
2 * Copyright (C) 2004 Red Hat
3 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
30 * - In pass through mode we do all the work you would expect
31 * - In smart mode the clocking set up is done by the controller generally
33 * - There are a few extra vendor commands that actually talk to the
44 * is a raid volume. Even more cute - the controller can do automated
49 * non UDMA devices restrict each others performance. It also has a
57 * - ATAPI UDMA is ok but not MWDMA it seems
58 * - RAID configuration ioctls
59 * - Move to libata once it grows up
83 u16 udma[2]; /* Cached UDMA values (per drive) */ member
104 * it821x_program - program the PIO/MWDMA registers
114 ide_hwif_t *hwif = drive->hwif; in it821x_program()
115 struct pci_dev *dev = to_pci_dev(hwif->dev); in it821x_program()
117 int channel = hwif->channel; in it821x_program()
121 if(itdev->clock_mode == ATA_66) in it821x_program()
130 * it821x_program_udma - program the UDMA registers
134 * Program the UDMA timing for this drive according to the
140 ide_hwif_t *hwif = drive->hwif; in it821x_program_udma()
141 struct pci_dev *dev = to_pci_dev(hwif->dev); in it821x_program_udma()
143 int channel = hwif->channel; in it821x_program_udma()
144 u8 unit = drive->dn & 1, conf; in it821x_program_udma()
146 /* Program UDMA timing bits */ in it821x_program_udma()
147 if(itdev->clock_mode == ATA_66) in it821x_program_udma()
152 if (itdev->timing10 == 0) in it821x_program_udma()
170 ide_hwif_t *hwif = drive->hwif; in it821x_clock_strategy()
171 struct pci_dev *dev = to_pci_dev(hwif->dev); in it821x_clock_strategy()
175 u8 unit = drive->dn & 1, v; in it821x_clock_strategy()
177 if(itdev->want[0][0] > itdev->want[1][0]) { in it821x_clock_strategy()
178 clock = itdev->want[0][1]; in it821x_clock_strategy()
179 altclock = itdev->want[1][1]; in it821x_clock_strategy()
181 clock = itdev->want[1][1]; in it821x_clock_strategy()
182 altclock = itdev->want[0][1]; in it821x_clock_strategy()
192 /* Nobody cares - keep the same clock */ in it821x_clock_strategy()
196 if(clock == itdev->clock_mode) in it821x_clock_strategy()
201 itdev->clock_mode = ATA_66; in it821x_clock_strategy()
203 itdev->clock_mode = ATA_50; in it821x_clock_strategy()
208 v &= ~(1 << (1 + hwif->channel)); in it821x_clock_strategy()
209 v |= sel << (1 + hwif->channel); in it821x_clock_strategy()
213 * Reprogram the UDMA/PIO of the pair drive for the switch in it821x_clock_strategy()
216 if(pair && itdev->udma[1-unit] != UDMA_OFF) { in it821x_clock_strategy()
217 it821x_program_udma(pair, itdev->udma[1-unit]); in it821x_clock_strategy()
218 it821x_program(pair, itdev->pio[1-unit]); in it821x_clock_strategy()
221 * Reprogram the UDMA/PIO of our drive for the switch. in it821x_clock_strategy()
224 if(itdev->udma[unit] != UDMA_OFF) { in it821x_clock_strategy()
225 it821x_program_udma(drive, itdev->udma[unit]); in it821x_clock_strategy()
226 it821x_program(drive, itdev->pio[unit]); in it821x_clock_strategy()
231 * it821x_set_pio_mode - set host controller for PIO mode
243 const u8 pio = drive->pio_mode - XFER_PIO_0; in it821x_set_pio_mode()
244 u8 unit = drive->dn & 1, set_pio = pio; in it821x_set_pio_mode()
256 u8 pair_pio = pair->pio_mode - XFER_PIO_0; in it821x_set_pio_mode()
262 /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ in it821x_set_pio_mode()
263 itdev->want[unit][1] = pio_want[set_pio]; in it821x_set_pio_mode()
264 itdev->want[unit][0] = 1; /* PIO is lowest priority */ in it821x_set_pio_mode()
265 itdev->pio[unit] = pio_timings[set_pio]; in it821x_set_pio_mode()
267 it821x_program(drive, itdev->pio[unit]); in it821x_set_pio_mode()
271 * it821x_tune_mwdma - tune a channel for MWDMA
283 ide_hwif_t *hwif = drive->hwif; in it821x_tune_mwdma()
284 struct pci_dev *dev = to_pci_dev(hwif->dev); in it821x_tune_mwdma()
286 u8 unit = drive->dn & 1, channel = hwif->channel, conf; in it821x_tune_mwdma()
291 itdev->want[unit][1] = mwdma_want[mode_wanted]; in it821x_tune_mwdma()
292 itdev->want[unit][0] = 2; /* MWDMA is low priority */ in it821x_tune_mwdma()
293 itdev->mwdma[unit] = dma[mode_wanted]; in it821x_tune_mwdma()
294 itdev->udma[unit] = UDMA_OFF; in it821x_tune_mwdma()
296 /* UDMA bits off - Revision 0x10 do them in pairs */ in it821x_tune_mwdma()
298 if (itdev->timing10) in it821x_tune_mwdma()
306 /* it821x_program(drive, itdev->mwdma[unit]); */ in it821x_tune_mwdma()
310 * it821x_tune_udma - tune a channel for UDMA
315 * controller when doing UDMA modes in pass through.
320 ide_hwif_t *hwif = drive->hwif; in it821x_tune_udma()
321 struct pci_dev *dev = to_pci_dev(hwif->dev); in it821x_tune_udma()
323 u8 unit = drive->dn & 1, channel = hwif->channel, conf; in it821x_tune_udma()
325 static u16 udma[] = { 0x4433, 0x4231, 0x3121, 0x2121, 0x1111, 0x2211, 0x1111 }; in it821x_tune_udma() local
328 itdev->want[unit][1] = udma_want[mode_wanted]; in it821x_tune_udma()
329 itdev->want[unit][0] = 3; /* UDMA is high priority */ in it821x_tune_udma()
330 itdev->mwdma[unit] = MWDMA_OFF; in it821x_tune_udma()
331 itdev->udma[unit] = udma[mode_wanted]; in it821x_tune_udma()
333 itdev->udma[unit] |= 0x8080; /* UDMA 5/6 select on */ in it821x_tune_udma()
335 /* UDMA on. Again revision 0x10 must do the pair */ in it821x_tune_udma()
337 if (itdev->timing10) in it821x_tune_udma()
344 it821x_program_udma(drive, itdev->udma[unit]); in it821x_tune_udma()
349 * it821x_dma_read - DMA hook
355 * timing value is loaded into the master and slave UDMA clock
363 ide_hwif_t *hwif = drive->hwif; in it821x_dma_start()
365 u8 unit = drive->dn & 1; in it821x_dma_start()
367 if(itdev->mwdma[unit] != MWDMA_OFF) in it821x_dma_start()
368 it821x_program(drive, itdev->mwdma[unit]); in it821x_dma_start()
369 else if(itdev->udma[unit] != UDMA_OFF && itdev->timing10) in it821x_dma_start()
370 it821x_program_udma(drive, itdev->udma[unit]); in it821x_dma_start()
375 * it821x_dma_write - DMA hook
385 ide_hwif_t *hwif = drive->hwif; in it821x_dma_end()
388 u8 unit = drive->dn & 1; in it821x_dma_end()
390 if(itdev->mwdma[unit] != MWDMA_OFF) in it821x_dma_end()
391 it821x_program(drive, itdev->pio[unit]); in it821x_dma_end()
396 * it821x_set_dma_mode - set host controller for DMA mode
405 const u8 speed = drive->dma_mode; in it821x_set_dma_mode()
413 it821x_tune_udma(drive, speed - XFER_UDMA_0); in it821x_set_dma_mode()
415 it821x_tune_mwdma(drive, speed - XFER_MW_DMA_0); in it821x_set_dma_mode()
419 * it821x_cable_detect - cable detection
434 * it821x_quirkproc - post init callback
444 struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif); in it821x_quirkproc()
445 u16 *id = drive->id; in it821x_quirkproc()
447 if (!itdev->smart) { in it821x_quirkproc()
454 drive->dev_flags |= IDE_DFLAG_UNMASK; in it821x_quirkproc()
474 drive->name, id[147] ? "Bootable " : "", in it821x_quirkproc()
495 drive->name); in it821x_quirkproc()
499 * Set MWDMA0 mode as enabled/support - just to tell in it821x_quirkproc()
505 drive->current_speed = XFER_MW_DMA_0; in it821x_quirkproc()
523 * init_hwif_it821x - set up hwif structs
533 struct pci_dev *dev = to_pci_dev(hwif->dev); in init_hwif_it821x()
535 struct it821x_dev *itdevs = host->host_priv; in init_hwif_it821x()
536 struct it821x_dev *idev = itdevs + hwif->channel; in init_hwif_it821x()
543 idev->smart = 1; in init_hwif_it821x()
544 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; in init_hwif_it821x()
547 hwif->rqsize = 256; in init_hwif_it821x()
551 if (conf & (1 << (1 + hwif->channel))) in init_hwif_it821x()
552 idev->clock_mode = ATA_50; in init_hwif_it821x()
554 idev->clock_mode = ATA_66; in init_hwif_it821x()
556 idev->want[0][1] = ATA_ANY; in init_hwif_it821x()
557 idev->want[1][1] = ATA_ANY; in init_hwif_it821x()
564 if (dev->revision == 0x10) { in init_hwif_it821x()
565 idev->timing10 = 1; in init_hwif_it821x()
566 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; in init_hwif_it821x()
567 if (idev->smart == 0) in init_hwif_it821x()
572 if (idev->smart == 0) { in init_hwif_it821x()
574 hwif->dma_ops = &it821x_pass_through_dma_ops; in init_hwif_it821x()
576 hwif->host_flags |= IDE_HFLAG_NO_SET_MODE; in init_hwif_it821x()
578 if (hwif->dma_base == 0) in init_hwif_it821x()
581 hwif->ultra_mask = ATA_UDMA6; in init_hwif_it821x()
582 hwif->mwdma_mask = ATA_MWDMA2; in init_hwif_it821x()
584 /* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */ in init_hwif_it821x()
585 if (idev->quirks & QUIRK_VORTEX86) { in init_hwif_it821x()
586 if (dev->revision == 0x11) in init_hwif_it821x()
587 hwif->ultra_mask = 0; in init_hwif_it821x()
626 /* it821x_set_{pio,dma}_mode() are only used in pass-through mode */
642 * it821x_init_one - pci layer discovery entry
658 return -ENOMEM; in it821x_init_one()
661 itdevs->quirks = id->driver_data; in it821x_init_one()
673 struct it821x_dev *itdevs = host->host_priv; in it821x_remove()