/* * pata_sil680.c - SIL680 PATA for new ATA layer * (C) 2005 Red Hat Inc * * based upon * * linux/drivers/ide/pci/siimage.c Version 1.07 Nov 30, 2003 * * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 2003 Red Hat <alan@redhat.com> * * May be copied or modified under the terms of the GNU General Public License * * Documentation publicly available. * * If you have strange problems with nVidia chipset systems please * see the SI support documentation and update your system BIOS * if necessary * * TODO * If we know all our devices are LBA28 (or LBA28 sized) we could use * the command fifo mode.
*/
/** * sil680_selreg - return register base * @ap: ATA interface * @r: config offset * * Turn a config register offset into the right address in PCI space * to access the control register in question. * * Thankfully this is a configuration operation so isn't performance * criticial.
*/
/** * sil680_seldev - return register base * @ap: ATA interface * @adev: ATA device * @r: config offset * * Turn a config register offset into the right address in PCI space * to access the control register in question including accounting for * the unit shift.
*/
/** * sil680_set_piomode - set PIO mode data * @ap: ATA interface * @adev: ATA device * * Program the SIL680 registers for PIO mode. Note that the task speed * registers are shared between the devices so we must pick the lowest * mode for command work.
*/
/** * sil680_set_dmamode - set DMA mode data * @ap: ATA interface * @adev: ATA device * * Program the MWDMA/UDMA modes for the sil680 chipset. * * The MWDMA mode values are pulled from a lookup table * while the chipset uses mode number for UDMA.
*/
/** * sil680_sff_exec_command - issue ATA command to host controller * @ap: port to which command is being issued * @tf: ATA taskfile register set * * Issues ATA command, with proper synchronization with interrupt * handler / other threads. Use our MMIO space for PCI posting to avoid * a hideously slow cycle all the way to the device. * * LOCKING: * spin_lock_irqsave(host lock)
*/ staticvoid sil680_sff_exec_command(struct ata_port *ap, conststruct ata_taskfile *tf)
{
iowrite8(tf->command, ap->ioaddr.command_addr);
ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
}
/** * sil680_init_chip - chip setup * @pdev: PCI device * @try_mmio: Indicates to caller whether MMIO should be attempted * * Perform all the chip setup which must be done both when the device * is powered up on boot and when we resume in case we resumed from RAM. * Returns the final clock settings.
*/
switch (tmpbyte & 0x30) { case 0x00: /* 133 clock attempt to force it on */
pci_write_config_byte(pdev, 0x8A, tmpbyte|0x10); break; case 0x30: /* if clocking is disabled */ /* 133 clock attempt to force it on */
pci_write_config_byte(pdev, 0x8A, tmpbyte & ~0x20); break; case 0x10: /* 133 already */ break; case 0x20: /* BIOS set PCI x2 clocking */ break;
}
switch (tmpbyte & 0x30) { case 0x00:
dev_info(&pdev->dev, "sil680: 100MHz clock.\n"); break; case 0x10:
dev_info(&pdev->dev, "sil680: 133MHz clock.\n"); break; case 0x20:
dev_info(&pdev->dev, "sil680: Using PCI clock.\n"); break; /* This last case is _NOT_ ok */ case 0x30:
dev_err(&pdev->dev, "sil680: Clock disabled ?\n");
} return tmpbyte & 0x30;
}
switch (sil680_init_chip(pdev, &try_mmio)) { case 0:
ppi[0] = &info_slow; break; case 0x30: return -ENODEV;
}
if (!try_mmio) goto use_ioports;
/* Try to acquire MMIO resources and fallback to PIO if * that fails
*/
rc = pcim_iomap_regions(pdev, 1 << SIL680_MMIO_BAR, DRV_NAME); if (rc) goto use_ioports;
/* Allocate host and set it up */
host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2); if (!host) return -ENOMEM;
host->iomap = pcim_iomap_table(pdev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.