Lines Matching +full:host +full:- +full:port

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>
42 u16 device; /* PCI host ID */
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
82 * Returns the base of the PCI configuration registers for this port
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
95 * Returns the base of the PCI configuration registers for this port
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()
103 int port = 0x40; in sis_port_base() local
109 port = 0x70; 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
116 * @ap: Port
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
136 * @ap: Port
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
167 { 0x4aU, 1U, 0x02UL, 0x02UL }, /* port 0 */ in sis_pre_reset()
168 { 0x4aU, 1U, 0x04UL, 0x04UL }, /* port 1 */ in sis_pre_reset()
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
186 * @ap: Port
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
215 * @ap: Port whose timings we are configuring
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()
229 int port = sis_old_port_base(adev); in sis_old_set_piomode() local
231 int speed = adev->pio_mode - XFER_PIO_0; in sis_old_set_piomode()
238 pci_read_config_byte(pdev, port, &t1); in sis_old_set_piomode()
239 pci_read_config_byte(pdev, port + 1, &t2); in sis_old_set_piomode()
247 pci_write_config_byte(pdev, port, t1); in sis_old_set_piomode()
248 pci_write_config_byte(pdev, port + 1, t2); in sis_old_set_piomode()
252 * sis_100_set_piomode - Initialize host controller PATA PIO timings
253 * @ap: Port whose timings we are configuring
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()
266 int port = sis_old_port_base(adev); in sis_100_set_piomode() local
267 int speed = adev->pio_mode - XFER_PIO_0; in sis_100_set_piomode()
273 pci_write_config_byte(pdev, port, actrec[speed]); in sis_100_set_piomode()
277 * sis_133_set_piomode - Initialize host controller PATA PIO timings
278 * @ap: Port whose timings we are configuring
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()
291 int port; in sis_133_set_piomode() local
293 int speed = adev->pio_mode - XFER_PIO_0; in sis_133_set_piomode()
312 port = sis_port_base(adev); in sis_133_set_piomode()
313 pci_read_config_dword(pdev, port, &t1); in sis_133_set_piomode()
320 pci_write_config_byte(pdev, port, t1); in sis_133_set_piomode()
324 * sis_old_set_dmamode - Initialize host controller PATA DMA timings
325 * @ap: Port whose timings we are configuring
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
364 * @ap: Port whose timings we are configuring
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
404 * @ap: Port whose timings we are configuring
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
438 * @ap: Port whose timings we are configuring
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
472 * @ap: Port whose timings we are configuring
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()
484 int port; in sis_133_set_dmamode() local
487 port = sis_port_base(adev); in sis_133_set_dmamode()
488 pci_read_config_dword(pdev, port, &t1); in sis_133_set_dmamode()
490 if (adev->dma_mode < XFER_UDMA_0) { 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()
517 pci_write_config_dword(pdev, port, t1); 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()
532 int port = sis_port_base(adev); in sis_133_mode_filter() local
535 pci_read_config_dword(pdev, port, &t1); 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()
709 * sis_init_one - Register SiS ATA PCI device with kernel services
720 * Zero on success, or -ERRNO value.
726 struct pci_dev *host = NULL; in sis_init_one() local
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()
787 if (host != 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()
860 pci_dev_put(host); in sis_init_one()
864 return -ENODEV; in sis_init_one()
866 ppi[0] = chipset->info; in sis_init_one()
876 struct ata_host *host = pci_get_drvdata(pdev); in sis_reinit_one() local
883 sis_fixup(pdev, host->private_data); in sis_reinit_one()
885 ata_host_resume(host); in sis_reinit_one()
912 MODULE_DESCRIPTION("SCSI low-level driver for SiS ATA");