Lines Matching +full:udma +full:- +full:p
1 // SPDX-License-Identifier: GPL-2.0-only
3 * pata_via.c - VIA PATA for new ATA layer
4 * (C) 2005-2006 Red Hat Inc
10 * VIA VT82C561 - early design, uses ata_generic currently
11 * VIA VT82C576 - MWDMA, 33Mhz
12 * VIA VT82C586 - MWDMA, 33Mhz
13 * VIA VT82C586a - Added UDMA to 33Mhz
14 * VIA VT82C586b - UDMA33
15 * VIA VT82C596a - Nonfunctional UDMA66
16 * VIA VT82C596b - Working UDMA66
17 * VIA VT82C686 - Nonfunctional UDMA66
18 * VIA VT82C686a - Working UDMA66
19 * VIA VT82C686b - Updated to UDMA100
20 * VIA VT8231 - UDMA100
21 * VIA VT8233 - UDMA100
22 * VIA VT8233a - UDMA133
23 * VIA VT8233c - UDMA100
24 * VIA VT8235 - UDMA133
25 * VIA VT8237 - UDMA133
26 * VIA VT8237A - UDMA133
27 * VIA VT8237S - UDMA133
28 * VIA VT8251 - UDMA133
47 * Copyright (c) 2000-2002 Vojtech Pavlik
162 /* Arima W730-K8/Targa Visionary 811/... */ in via_cable_override()
163 if (pdev->subsystem_vendor == 0x161F && pdev->subsystem_device == 0x2032) in via_cable_override()
170 * via_cable_detect - cable detection
175 * BIOS. If you are using an 8235 in a non-PC configuration you
182 const struct via_isa_bridge *config = ap->host->private_data; in via_cable_detect()
183 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in via_cable_detect()
189 if ((config->flags & VIA_SATA_PATA) && ap->port_no == 0) in via_cable_detect()
193 if (config->udma_mask < ATA_UDMA4) in via_cable_detect()
195 /* UDMA 66 chips have only drive side logic */ in via_cable_detect()
196 else if (config->udma_mask < ATA_UDMA5) in via_cable_detect()
198 /* UDMA 100 or later */ in via_cable_detect()
202 if (ata66 & (0x10100000 >> (16 * ap->port_no))) in via_cable_detect()
213 struct ata_port *ap = link->ap; in via_pre_reset()
214 const struct via_isa_bridge *config = ap->host->private_data; in via_pre_reset()
216 if (!(config->flags & VIA_NO_ENABLES)) { in via_pre_reset()
221 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in via_pre_reset()
222 if (!pci_test_config_bits(pdev, &via_enable_bits[ap->port_no])) in via_pre_reset()
223 return -ENOENT; in via_pre_reset()
231 * via_do_set_mode - set transfer mode data
236 * @udma_type: UDMA mode/format of registers
248 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in via_do_set_mode()
250 struct ata_timing t, p; in via_do_set_mode() local
255 int offset = 3 - (2*ap->port_no) - adev->devno; in via_do_set_mode()
271 if (peer->pio_mode) { in via_do_set_mode()
272 ata_timing_compute(peer, peer->pio_mode, &p, T, UT); in via_do_set_mode()
273 ata_timing_merge(&p, &t, &t, ATA_TIMING_8BIT); in via_do_set_mode()
284 setup |= (clamp_val(t.setup, 1, 4) - 1) << shift; in via_do_set_mode()
289 pci_write_config_byte(pdev, 0x4F - ap->port_no, in via_do_set_mode()
290 ((clamp_val(t.act8b, 1, 16) - 1) << 4) | (clamp_val(t.rec8b, 1, 16) - 1)); in via_do_set_mode()
292 ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); in via_do_set_mode()
294 /* Load the UDMA bits according to type */ in via_do_set_mode()
298 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; in via_do_set_mode()
301 ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; in via_do_set_mode()
304 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; in via_do_set_mode()
307 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; in via_do_set_mode()
311 /* Set UDMA unless device is not UDMA capable */ in via_do_set_mode()
320 if (t.udma) { in via_do_set_mode()
321 /* preserve 80-wire cable detection bit */ in via_do_set_mode()
332 const struct via_isa_bridge *config = ap->host->private_data; in via_set_piomode()
333 int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; in via_set_piomode()
335 via_do_set_mode(ap, adev, adev->pio_mode, set_ast, config->udma_mask); in via_set_piomode()
340 const struct via_isa_bridge *config = ap->host->private_data; in via_set_dmamode()
341 int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; in via_set_dmamode()
343 via_do_set_mode(ap, adev, adev->dma_mode, set_ast, config->udma_mask); in via_set_dmamode()
347 * via_mode_filter - filter buggy device/mode pairs
357 struct ata_host *host = dev->link->ap->host; in via_mode_filter()
358 const struct via_isa_bridge *config = host->private_data; in via_mode_filter()
361 if (config->id == PCI_DEVICE_ID_VIA_82C586_0) { in via_mode_filter()
362 ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); in via_mode_filter()
363 if (strcmp(model_num, "TS64GSSD25-M") == 0) { in via_mode_filter()
365 "disabling UDMA mode due to reported lockups with this device\n"); in via_mode_filter()
370 if (dev->class == ATA_DEV_ATAPI && in via_mode_filter()
380 * via_tf_load - send taskfile registers to host controller
392 struct ata_ioports *ioaddr = &ap->ioaddr; in via_tf_load()
393 struct via_port *vp = ap->private_data; in via_tf_load()
394 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; in via_tf_load()
397 if (tf->ctl != ap->last_ctl) { in via_tf_load()
398 iowrite8(tf->ctl, ioaddr->ctl_addr); in via_tf_load()
399 ap->last_ctl = tf->ctl; in via_tf_load()
404 if (tf->flags & ATA_TFLAG_DEVICE) { in via_tf_load()
405 iowrite8(tf->device, ioaddr->device_addr); in via_tf_load()
406 vp->cached_device = tf->device; in via_tf_load()
408 iowrite8(vp->cached_device, ioaddr->device_addr); in via_tf_load()
410 if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { in via_tf_load()
411 WARN_ON_ONCE(!ioaddr->ctl_addr); in via_tf_load()
412 iowrite8(tf->hob_feature, ioaddr->feature_addr); in via_tf_load()
413 iowrite8(tf->hob_nsect, ioaddr->nsect_addr); in via_tf_load()
414 iowrite8(tf->hob_lbal, ioaddr->lbal_addr); in via_tf_load()
415 iowrite8(tf->hob_lbam, ioaddr->lbam_addr); in via_tf_load()
416 iowrite8(tf->hob_lbah, ioaddr->lbah_addr); in via_tf_load()
420 iowrite8(tf->feature, ioaddr->feature_addr); in via_tf_load()
421 iowrite8(tf->nsect, ioaddr->nsect_addr); in via_tf_load()
422 iowrite8(tf->lbal, ioaddr->lbal_addr); in via_tf_load()
423 iowrite8(tf->lbam, ioaddr->lbam_addr); in via_tf_load()
424 iowrite8(tf->lbah, ioaddr->lbah_addr); in via_tf_load()
433 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in via_port_start()
439 vp = devm_kzalloc(&pdev->dev, sizeof(struct via_port), GFP_KERNEL); in via_port_start()
441 return -ENOMEM; in via_port_start()
442 ap->private_data = vp; in via_port_start()
467 * via_config_fifo - set up the FIFO
505 via_config_fifo(pdev, config->flags); in via_fixup()
507 if (config->udma_mask == ATA_UDMA4) { in via_fixup()
513 if (config->flags & VIA_BAD_CLK66) { in via_fixup()
522 * via_init_one - discovery callback
532 /* Early VIA without UDMA support */ in via_init_one()
546 /* VIA UDMA 33 devices (and borked 66) */ in via_init_one()
554 /* VIA UDMA 66 devices */ in via_init_one()
562 /* VIA UDMA 100 devices */ in via_init_one()
582 unsigned long flags = id->driver_data; in via_init_one()
585 ata_print_version_once(&pdev->dev, DRV_VERSION); in via_init_one()
596 for (config = via_isa_bridges; config->id != PCI_DEVICE_ID_VIA_ANON; in via_init_one()
599 !!(config->flags & VIA_BAD_ID), in via_init_one()
600 config->id, NULL))) { in via_init_one()
601 u8 rev = isa->revision; in via_init_one()
604 if ((id->device == 0x0415 || id->device == 0x3164) && in via_init_one()
605 (config->id != id->device)) in via_init_one()
608 if (rev >= config->rev_min && rev <= config->rev_max) in via_init_one()
612 if (!(config->flags & VIA_NO_ENABLES)) { in via_init_one()
617 return -ENODEV; in via_init_one()
621 switch (config->udma_mask) { in via_init_one()
623 if (config->flags & VIA_NO_UNMASK) in via_init_one()
642 return -ENODEV; in via_init_one()
653 * via_reinit_one - reinit after resume
671 via_fixup(pdev, host->private_data); in via_reinit_one()
705 MODULE_DESCRIPTION("low-level driver for VIA PATA");