Lines Matching +full:mode +full:- +full:recovery

1 // SPDX-License-Identifier: GPL-2.0-only
3 * pata_sis.c - SiS ATA driver
9 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org>
67 while (lap->device) { in sis_short_ata40()
68 if (lap->device == dev->device && in sis_short_ata40()
69 lap->subvendor == dev->subsystem_vendor && in sis_short_ata40()
70 lap->subdevice == dev->subsystem_device) in sis_short_ata40()
79 * sis_old_port_base - return PCI configuration base for dev
88 return 0x40 + (4 * adev->link->ap->port_no) + (2 * adev->devno); in sis_old_port_base()
92 * sis_port_base - return PCI configuration base for dev
101 struct ata_port *ap = adev->link->ap; in sis_port_base()
102 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_port_base()
111 return port + (8 * ap->port_no) + (4 * adev->devno); in sis_port_base()
115 * sis_133_cable_detect - check for 40/80 pin
124 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_133_cable_detect()
128 pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp); in sis_133_cable_detect()
135 * sis_66_cable_detect - check for 40/80 pin
144 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_66_cable_detect()
149 tmp >>= ap->port_no; in sis_66_cable_detect()
157 * sis_pre_reset - probe begin
171 struct ata_port *ap = link->ap; in sis_pre_reset()
172 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_pre_reset()
174 if (!pci_test_config_bits(pdev, &sis_enable_bits[ap->port_no])) in sis_pre_reset()
175 return -ENOENT; in sis_pre_reset()
185 * sis_set_fifo - Set RWP fifo bits for this device
196 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_set_fifo()
200 mask <<= (2 * ap->port_no); in sis_set_fifo()
201 mask <<= adev->devno; in sis_set_fifo()
208 if (adev->class == ATA_DEV_ATA) in sis_set_fifo()
214 * sis_old_set_piomode - Initialize host controller PATA PIO timings
218 * Set PIO mode for device, in host controller PCI config space. This
228 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_old_set_piomode()
231 int speed = adev->pio_mode - XFER_PIO_0; in sis_old_set_piomode()
234 static const u8 recovery[] = { 0x00, 0x06, 0x04, 0x03, 0x03 }; in sis_old_set_piomode() local
241 t1 &= ~0x0F; /* Clear active/recovery timings */ in sis_old_set_piomode()
245 t2 |= recovery[speed]; in sis_old_set_piomode()
252 * sis_100_set_piomode - Initialize host controller PATA PIO timings
256 * Set PIO mode for device, in host controller PCI config space. This
265 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_100_set_piomode()
267 int speed = adev->pio_mode - XFER_PIO_0; in sis_100_set_piomode()
277 * sis_133_set_piomode - Initialize host controller PATA PIO timings
281 * Set PIO mode for device, in host controller PCI config space. This
290 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_133_set_piomode()
293 int speed = adev->pio_mode - XFER_PIO_0; in sis_133_set_piomode()
296 0x28269000, /* Recovery << 24 | Act << 16 | Ini << 12 */ in sis_133_set_piomode()
303 0x1E1C6000, /* Recovery << 24 | Act << 16 | Ini << 12 */ in sis_133_set_piomode()
324 * sis_old_set_dmamode - Initialize host controller PATA DMA timings
328 * Set UDMA/MWDMA mode for device, in host controller PCI config space.
338 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_old_set_dmamode()
339 int speed = adev->dma_mode - XFER_MW_DMA_0; in sis_old_set_dmamode()
348 if (adev->dma_mode < XFER_UDMA_0) { in sis_old_set_dmamode()
349 /* bits 3-0 hold recovery timing bits 8-10 active timing and in sis_old_set_dmamode()
354 /* Bit 15 is UDMA on/off, bit 13-14 are cycle time */ in sis_old_set_dmamode()
355 speed = adev->dma_mode - XFER_UDMA_0; in sis_old_set_dmamode()
363 * sis_66_set_dmamode - Initialize host controller PATA DMA timings
367 * Set UDMA/MWDMA mode for device, in host controller PCI config space.
377 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_66_set_dmamode()
378 int speed = adev->dma_mode - XFER_MW_DMA_0; in sis_66_set_dmamode()
382 /* MWDMA 0-2 and UDMA 0-5 */ in sis_66_set_dmamode()
388 if (adev->dma_mode < XFER_UDMA_0) { in sis_66_set_dmamode()
389 /* bits 3-0 hold recovery timing bits 8-10 active timing and in sis_66_set_dmamode()
394 /* Bit 15 is UDMA on/off, bit 12-14 are cycle time */ in sis_66_set_dmamode()
395 speed = adev->dma_mode - XFER_UDMA_0; in sis_66_set_dmamode()
403 * sis_100_set_dmamode - Initialize host controller PATA DMA timings
407 * Set UDMA/MWDMA mode for device, in host controller PCI config space.
416 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_100_set_dmamode()
417 int speed = adev->dma_mode - XFER_MW_DMA_0; in sis_100_set_dmamode()
425 if (adev->dma_mode < XFER_UDMA_0) { in sis_100_set_dmamode()
428 /* Bit 7 is UDMA on/off, bit 0-3 are cycle time */ in sis_100_set_dmamode()
429 speed = adev->dma_mode - XFER_UDMA_0; in sis_100_set_dmamode()
437 * sis_133_early_set_dmamode - Initialize host controller PATA DMA timings
441 * Set UDMA/MWDMA mode for device, in host controller PCI config space.
450 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_133_early_set_dmamode()
451 int speed = adev->dma_mode - XFER_MW_DMA_0; in sis_133_early_set_dmamode()
459 if (adev->dma_mode < XFER_UDMA_0) { in sis_133_early_set_dmamode()
462 /* Bit 7 is UDMA on/off, bit 0-3 are cycle time */ in sis_133_early_set_dmamode()
463 speed = adev->dma_mode - XFER_UDMA_0; in sis_133_early_set_dmamode()
471 * sis_133_set_dmamode - Initialize host controller PATA DMA timings
475 * Set UDMA/MWDMA mode for device, in host controller PCI config space.
483 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_133_set_dmamode()
490 if (adev->dma_mode < XFER_UDMA_0) { in sis_133_set_dmamode()
491 /* Recovery << 24 | Act << 16 | Ini << 12, like PIO modes */ in sis_133_set_dmamode()
494 int speed = adev->dma_mode - XFER_MW_DMA_0; in sis_133_set_dmamode()
504 /* bits 4- cycle time 8 - cvs time */ in sis_133_set_dmamode()
507 int speed = adev->dma_mode - XFER_UDMA_0; in sis_133_set_dmamode()
521 * sis_133_mode_filter - mode selection filter
530 struct ata_port *ap = adev->link->ap; in sis_133_mode_filter()
531 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in sis_133_mode_filter()
659 if (sis->info == &sis_info133) { in sis_fixup()
669 if (sis->info == &sis_info133_early || sis->info == &sis_info100) { in sis_fixup()
679 if (sis->info == &sis_info66 || sis->info == &sis_info100_early) { in sis_fixup()
689 if (sis->info == &sis_info33) { in sis_fixup()
696 if (sis->info == &sis_info || sis->info == &sis_info33) { in sis_fixup()
697 /* force per drive recovery and active timings in sis_fixup()
709 * sis_init_one - Register SiS ATA PCI device with kernel services
713 * Called from kernel PCI layer. We probe for combined mode (sigh),
720 * Zero on success, or -ERRNO value.
778 ata_print_version_once(&pdev->dev, DRV_VERSION); in sis_init_one()
785 for (sets = &sis_chipsets[0]; sets->device; sets++) { in sis_init_one()
786 host = pci_get_device(PCI_VENDOR_ID_SI, sets->device, NULL); in sis_init_one()
789 if (sets->device == 0x630) { /* SIS630 */ in sis_init_one()
790 if (host->revision >= 0x30) /* 630 ET */ in sis_init_one()
813 dev_info(&pdev->dev, in sis_init_one()
818 dev_info(&pdev->dev, in sis_init_one()
846 lpc_bridge = pci_get_slot(pdev->bus, 0x10); /* Bus 0 Dev 2 Fn 0 */ in sis_init_one()
852 if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) { in sis_init_one()
864 return -ENODEV; in sis_init_one()
866 ppi[0] = chipset->info; in sis_init_one()
883 sis_fixup(pdev, host->private_data); in sis_reinit_one()
912 MODULE_DESCRIPTION("SCSI low-level driver for SiS ATA");