Lines Matching +full:broken +full:- +full:udma

1 // SPDX-License-Identifier: GPL-2.0-only
3 * pata_amd.c - AMD PATA for new ATA layer
4 * (C) 2005-2006 Red Hat Inc
6 * Based on pata-sil680. Errata information is taken from data sheets
8 * claimed by sata-nv.c.
30 * timing_setup - shared timing computation and load
49 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
51 int dn = ap->port_no * 2 + adev->devno;
63 dev_err(&pdev->dev, "unknown mode %d\n", speed);
70 ata_timing_compute(peer, peer->dma_mode, &apeer, T, UT);
73 ata_timing_compute(peer, peer->pio_mode, &apeer, T, UT);
77 if (speed == XFER_UDMA_5 && amd_clock <= 33333) at.udma = 1;
78 if (speed == XFER_UDMA_6 && amd_clock <= 33333) at.udma = 15;
86 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(at.setup, 1, 4) - 1) << ((3 - dn) << 1));
90 pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)),
91 ((clamp_val(at.act8b, 1, 16) - 1) << 4) | (clamp_val(at.rec8b, 1, 16) - 1));
94 pci_write_config_byte(pdev, offset + 0x08 + (3 - dn),
95 ((clamp_val(at.active, 1, 16) - 1) << 4) | (clamp_val(at.recover, 1, 16) - 1));
99 t = at.udma ? (0xc0 | (clamp_val(at.udma, 2, 5) - 2)) : 0x03;
103 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 2, 10)]) : 0x03;
107 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 10)]) : 0x03;
111 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 15)]) : 0x03;
118 /* UDMA timing */
119 if (at.udma)
120 pci_write_config_byte(pdev, offset + 0x10 + (3 - dn), t);
124 * amd_pre_reset - perform reset handling
139 struct ata_port *ap = link->ap;
140 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
142 if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no]))
143 return -ENOENT;
149 * amd_cable_detect - report cable type
158 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
162 if (ata66 & bitmask[ap->port_no])
168 * amd_fifo_setup - set the PIO FIFO for ATA/ATAPI
180 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
182 u8 fifo = fifobit[ap->port_no];
186 ata_for_each_dev(adev, &ap->link, ENABLED) {
187 if (adev->class == ATA_DEV_ATAPI)
190 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) /* FIFO is broken */
193 /* On the later chips the read prefetch bits become no-op bits */
195 r &= ~fifobit[ap->port_no];
201 * amd33_set_piomode - set initial PIO mode data
211 timing_setup(ap, adev, 0x40, adev->pio_mode, 1);
217 timing_setup(ap, adev, 0x40, adev->pio_mode, 2);
223 timing_setup(ap, adev, 0x40, adev->pio_mode, 3);
229 timing_setup(ap, adev, 0x40, adev->pio_mode, 4);
233 * amd33_set_dmamode - set initial DMA mode data
237 * Program the MWDMA/UDMA modes for the AMD and Nvidia
243 timing_setup(ap, adev, 0x40, adev->dma_mode, 1);
248 timing_setup(ap, adev, 0x40, adev->dma_mode, 2);
253 timing_setup(ap, adev, 0x40, adev->dma_mode, 3);
258 timing_setup(ap, adev, 0x40, adev->dma_mode, 4);
261 /* Both host-side and drive-side detection results are worthless on NV
273 struct ata_port *ap = dev->link->ap;
275 u32 saved_udma, udma;
280 udma = saved_udma = (unsigned long)ap->host->private_data;
282 if (ap->port_no == 0)
283 udma >>= 16;
284 if (dev->devno == 0)
285 udma >>= 8;
287 if ((udma & 0xc0) == 0xc0)
288 bios_limit = ata_pack_xfermask(0, 0, udma_mask_map[udma & 0x7]);
296 gtm->drive[0].dma, gtm->drive[1].dma, gtm->flags);
314 "nv_mode_filter: 0x%x&0x%x->0x%x, BIOS=0x%x (0x%x) ACPI=0x%x%s\n",
322 * nv_pre_reset - cable detection
337 struct ata_port *ap = link->ap;
338 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
340 if (!pci_test_config_bits(pdev, &nv_enable_bits[ap->port_no]))
341 return -ENOENT;
347 * nv100_set_piomode - set initial PIO mode data
356 timing_setup(ap, adev, 0x50, adev->pio_mode, 3);
361 timing_setup(ap, adev, 0x50, adev->pio_mode, 4);
365 * nv100_set_dmamode - set initial DMA mode data
369 * Program the MWDMA/UDMA modes for the AMD and Nvidia
375 timing_setup(ap, adev, 0x50, adev->dma_mode, 3);
380 timing_setup(ap, adev, 0x50, adev->dma_mode, 4);
385 u32 udma = (unsigned long)host->private_data;
388 pci_write_config_dword(to_pci_dev(host->dev), 0x60, udma);
451 /* Disable the FIFO, the FIFO logic will re-enable it as
461 { /* 0: AMD 7401 - no swdma */
468 { /* 1: Early AMD7409 - no swdma */
496 { /* 5: AMD 8111 - no swdma */
503 { /* 6: AMD 8111 UDMA 100 (Serenade) - no swdma */
517 { /* 8: Nvidia Nforce2 and later - no swdma */
533 int type = id->driver_data;
538 ata_print_version_once(&pdev->dev, DRV_VERSION);
547 if (type == 1 && pdev->revision > 0x7)
551 if (type == 5 && pdev->subsystem_vendor == PCI_VENDOR_ID_AMD &&
552 pdev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
553 type = 6; /* UDMA 100 only */
556 * Okay, type is determined now. Apply type-specific workarounds.
562 if (pdev->vendor == PCI_VENDOR_ID_AMD)
565 * cache BIOS programmed UDMA mode.
568 u32 udma;
570 pci_read_config_dword(pdev, 0x60, &udma);
571 hpriv = (void *)(unsigned long)udma;
588 if (pdev->vendor == PCI_VENDOR_ID_AMD) {
590 if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7409 ||
591 pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
639 MODULE_DESCRIPTION("low-level driver for AMD and Nvidia PATA IDE");