/* * 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 <[email protected]> * Copyright (C) 2003 Red Hat <[email protected]> * * 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. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #define DRV_NAME … #define DRV_VERSION … #define SIL680_MMIO_BAR … /** * 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. */ static int sil680_selreg(struct ata_port *ap, int r) { … } /** * 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. */ static int sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r) { … } /** * sil680_cable_detect - cable detection * @ap: ATA port * * Perform cable detection. The SIL680 stores this in PCI config * space for us. */ static int sil680_cable_detect(struct ata_port *ap) { … } /** * 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. */ static void sil680_set_piomode(struct ata_port *ap, struct ata_device *adev) { … } /** * 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. */ static void sil680_set_dmamode(struct ata_port *ap, struct ata_device *adev) { … } /** * 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) */ static void sil680_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) { … } static bool sil680_sff_irq_check(struct ata_port *ap) { … } static const struct scsi_host_template sil680_sht = …; static struct ata_port_operations sil680_port_ops = …; /** * 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. */ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio) { … } static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) { … } #ifdef CONFIG_PM_SLEEP static int sil680_reinit_one(struct pci_dev *pdev) { … } #endif static const struct pci_device_id sil680[] = …; static struct pci_driver sil680_pci_driver = …; module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, sil680); MODULE_VERSION(…);