Lines Matching +full:udma +full:- +full:c
1 // SPDX-License-Identifier: GPL-2.0-only
9 * Copyright (c) 2000-2002 Vojtech Pavlik
10 * Copyright (c) 2007-2010 Bartlomiej Zolnierkiewicz
113 * via_set_speed - write timing registers
123 struct pci_dev *dev = to_pci_dev(hwif->dev); in via_set_speed()
125 struct via82cxxx_dev *vdev = host->host_priv; in via_set_speed()
128 if (~vdev->via_config->flags & VIA_BAD_AST) { in via_set_speed()
130 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); in via_set_speed()
134 pci_write_config_byte(dev, VIA_8BIT_TIMING + (1 - (dn >> 1)), in via_set_speed()
135 ((clamp_val(timing->act8b, 1, 16) - 1) << 4) | (clamp_val(timing->rec8b, 1, 16) - 1)); in via_set_speed()
137 pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), in via_set_speed()
138 ((clamp_val(timing->active, 1, 16) - 1) << 4) | (clamp_val(timing->recover, 1, 16) - 1)); in via_set_speed()
140 switch (vdev->via_config->udma_mask) { in via_set_speed()
141 case ATA_UDMA2: t = timing->udma ? (0xe0 | (clamp_val(timing->udma, 2, 5) - 2)) : 0x03; break; in via_set_speed()
142 case ATA_UDMA4: t = timing->udma ? (0xe8 | (clamp_val(timing->udma, 2, 9) - 2)) : 0x0f; break; in via_set_speed()
143 case ATA_UDMA5: t = timing->udma ? (0xe0 | (clamp_val(timing->udma, 2, 9) - 2)) : 0x07; break; in via_set_speed()
144 case ATA_UDMA6: t = timing->udma ? (0xe0 | (clamp_val(timing->udma, 2, 9) - 2)) : 0x07; break; in via_set_speed()
147 /* Set UDMA unless device is not UDMA capable */ in via_set_speed()
148 if (vdev->via_config->udma_mask) { in via_set_speed()
151 pci_read_config_byte(dev, VIA_UDMA_TIMING + 3 - dn, &udma_etc); in via_set_speed()
156 if (timing->udma) { in via_set_speed()
157 /* preserve 80-wire cable detection bit */ in via_set_speed()
162 pci_write_config_byte(dev, VIA_UDMA_TIMING + 3 - dn, udma_etc); in via_set_speed()
167 * via_set_drive - configure transfer mode
178 struct ide_host *host = dev_get_drvdata(hwif->dev); in via_set_drive()
179 struct via82cxxx_dev *vdev = host->host_priv; in via_set_drive()
182 const u8 speed = drive->dma_mode; in via_set_drive()
186 switch (vdev->via_config->udma_mask) { in via_set_drive()
197 ide_timing_compute(peer, peer->pio_mode, &p, T, UT); in via_set_drive()
201 via_set_speed(hwif, drive->dn, &t); in via_set_drive()
205 * via_set_pio_mode - set host controller for PIO mode
209 * A callback from the upper layers for PIO-only tuning.
214 drive->dma_mode = drive->pio_mode; in via_set_pio_mode()
223 via_config->id != PCI_DEVICE_ID_VIA_ANON; via_config++) in via_config_find()
225 !!(via_config->flags & VIA_BAD_ID), in via_config_find()
226 via_config->id, NULL))) { in via_config_find()
228 if ((*isa)->revision >= via_config->rev_min && in via_config_find()
229 (*isa)->revision <= via_config->rev_max) in via_config_find()
238 * Check and handle 80-wire cable presence
244 switch (vdev->via_config->udma_mask) { in via_cable_detect()
246 for (i = 24; i >= 0; i -= 8) in via_cable_detect()
252 * UDMA w/ < 3T/cycle in via_cable_detect()
254 vdev->via_80w |= (1 << (1 - (i >> 4))); in via_cable_detect()
259 for (i = 24; i >= 0; i -= 8) in via_cable_detect()
263 /* BIOS 80-wire bit or in via_cable_detect()
264 * UDMA w/ < 60ns/cycle in via_cable_detect()
266 vdev->via_80w |= (1 << (1 - (i >> 4))); in via_cable_detect()
271 for (i = 24; i >= 0; i -= 8) in via_cable_detect()
275 /* BIOS 80-wire bit or in via_cable_detect()
276 * UDMA w/ < 60ns/cycle in via_cable_detect()
278 vdev->via_80w |= (1 << (1 - (i >> 4))); in via_cable_detect()
285 * init_chipset_via82cxxx - initialization handler
295 struct via82cxxx_dev *vdev = host->host_priv; in init_chipset_via82cxxx()
296 struct via_isa_bridge *via_config = vdev->via_config; in init_chipset_via82cxxx()
307 if (via_config->udma_mask == ATA_UDMA4) { in init_chipset_via82cxxx()
310 } else if (via_config->flags & VIA_BAD_CLK66) { in init_chipset_via82cxxx()
328 if (via_config->flags & VIA_BAD_PREQ) { in init_chipset_via82cxxx()
334 if (via_config->flags & VIA_SET_FIFO) { in init_chipset_via82cxxx()
369 /* Arima W730-K8/Targa Visionary 811/... */ in via_cable_override()
370 if (pdev->subsystem_vendor == 0x161F && in via_cable_override()
371 pdev->subsystem_device == 0x2032) in via_cable_override()
379 struct pci_dev *pdev = to_pci_dev(hwif->dev); in via82cxxx_cable_detect()
381 struct via82cxxx_dev *vdev = host->host_priv; in via82cxxx_cable_detect()
386 if ((vdev->via_config->flags & VIA_SATA_PATA) && hwif->channel == 0) in via82cxxx_cable_detect()
389 if ((vdev->via_80w >> hwif->channel) & 1) in via82cxxx_cable_detect()
420 u8 idx = id->driver_data; in via_init_one()
434 pci_name(dev), via_config->name, isa->revision, in via_init_one()
435 via_config->udma_mask ? "U" : "MW", in via_init_one()
436 via_dma[via_config->udma_mask ? in via_init_one()
437 (fls(via_config->udma_mask) - 1) : 0]); in via_init_one()
466 if ((via_config->flags & VIA_NO_UNMASK) == 0) in via_init_one()
469 d.udma_mask = via_config->udma_mask; in via_init_one()
475 return -ENOMEM; in via_init_one()
478 vdev->via_config = via_config; in via_init_one()
490 struct via82cxxx_dev *vdev = host->host_priv; in via_remove()