• Home
  • Raw
  • Download

Lines Matching +full:drive +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Drive tuning added from Rebel.com's kernel sources
8 * -- Russell King (15/11/98) linux@arm.linux.org.uk
12 * -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org
14 * Copyright (C) 2006-2007,2009 MontaVista Software, Inc. <source@mvista.com>
40 * Convert a PIO mode and cycle time to the required on/off times
43 static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) in get_pio_timings() argument
49 cmd_on = (t->active + 29) / 30; in get_pio_timings()
50 cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30; in get_pio_timings()
58 if (ide_pio_need_iordy(drive, pio)) in get_pio_timings()
61 return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; in get_pio_timings()
65 * Configure the chipset for PIO mode.
67 static void sl82c105_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) in sl82c105_set_pio_mode() argument
69 struct pci_dev *dev = to_pci_dev(hwif->dev); in sl82c105_set_pio_mode()
70 unsigned long timings = (unsigned long)ide_get_drivedata(drive); in sl82c105_set_pio_mode()
71 int reg = 0x44 + drive->dn * 4; in sl82c105_set_pio_mode()
73 const u8 pio = drive->pio_mode - XFER_PIO_0; in sl82c105_set_pio_mode()
75 drv_ctrl = get_pio_timings(drive, pio); in sl82c105_set_pio_mode()
83 ide_set_drivedata(drive, (void *)timings); in sl82c105_set_pio_mode()
88 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, in sl82c105_set_pio_mode()
90 ide_pio_cycle_time(drive, pio), drv_ctrl); in sl82c105_set_pio_mode()
94 * Configure the chipset for DMA mode.
96 static void sl82c105_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) in sl82c105_set_dma_mode() argument
99 unsigned long timings = (unsigned long)ide_get_drivedata(drive); in sl82c105_set_dma_mode()
101 const u8 speed = drive->dma_mode; in sl82c105_set_dma_mode()
103 drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0]; in sl82c105_set_dma_mode()
111 ide_set_drivedata(drive, (void *)timings); in sl82c105_set_dma_mode()
116 struct pci_dev *dev = to_pci_dev(hwif->dev); in sl82c105_test_irq()
117 u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; in sl82c105_test_irq()
125 * The SL82C105 holds off all IDE interrupts while in DMA mode until
127 * when the drive wants to report an error condition).
145 * This function is called when the IDE timer expires, the drive
148 static void sl82c105_dma_lost_irq(ide_drive_t *drive) in sl82c105_dma_lost_irq() argument
150 ide_hwif_t *hwif = drive->hwif; in sl82c105_dma_lost_irq()
151 struct pci_dev *dev = to_pci_dev(hwif->dev); in sl82c105_dma_lost_irq()
152 u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; in sl82c105_dma_lost_irq()
158 * Check the raw interrupt from the drive. in sl82c105_dma_lost_irq()
162 printk(KERN_INFO "sl82c105: drive was requesting IRQ, " in sl82c105_dma_lost_irq()
166 * Was DMA enabled? If so, disable it - we're resetting the in sl82c105_dma_lost_irq()
167 * host. The IDE layer will be handling the drive for us. in sl82c105_dma_lost_irq()
169 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); in sl82c105_dma_lost_irq()
171 outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD); in sl82c105_dma_lost_irq()
186 static void sl82c105_dma_start(ide_drive_t *drive) in sl82c105_dma_start() argument
188 ide_hwif_t *hwif = drive->hwif; in sl82c105_dma_start()
189 struct pci_dev *dev = to_pci_dev(hwif->dev); in sl82c105_dma_start()
190 int reg = 0x44 + drive->dn * 4; in sl82c105_dma_start()
193 (unsigned long)ide_get_drivedata(drive) >> 16); in sl82c105_dma_start()
196 ide_dma_start(drive); in sl82c105_dma_start()
199 static void sl82c105_dma_clear(ide_drive_t *drive) in sl82c105_dma_clear() argument
201 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); in sl82c105_dma_clear()
206 static int sl82c105_dma_end(ide_drive_t *drive) in sl82c105_dma_end() argument
208 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); in sl82c105_dma_end()
209 int reg = 0x44 + drive->dn * 4; in sl82c105_dma_end()
210 int ret = ide_dma_end(drive); in sl82c105_dma_end()
213 (unsigned long)ide_get_drivedata(drive)); in sl82c105_dma_end()
219 * ATA reset will clear the 16 bits mode in the control
222 static void sl82c105_resetproc(ide_drive_t *drive) in sl82c105_resetproc() argument
224 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); in sl82c105_resetproc()
243 bridge = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), in sl82c105_bridge_revision()
244 dev->bus->number, in sl82c105_bridge_revision()
245 PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); in sl82c105_bridge_revision()
247 return -1; in sl82c105_bridge_revision()
252 if (bridge->vendor != PCI_VENDOR_ID_WINBOND || in sl82c105_bridge_revision()
253 bridge->device != PCI_DEVICE_ID_WINBOND_83C553 || in sl82c105_bridge_revision()
254 bridge->class >> 8 != PCI_CLASS_BRIDGE_ISA) { in sl82c105_bridge_revision()
256 return -1; in sl82c105_bridge_revision()
263 return bridge->revision; in sl82c105_bridge_revision()
269 * --BenH: It's arch fixup code that should enable channels that
272 * firmware or arch code. We still set both to 16 bits mode.
329 "revision %d, BM-DMA disabled\n", rev); in sl82c105_init_one()