// SPDX-License-Identifier: GPL-2.0-only /* * pata_opti.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc * * Based on * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 * * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) * * Authors: * Jaromir Koutek <[email protected]>, * Jan Harkes <[email protected]>, * Mark Lord <[email protected]> * Some parts of code are from ali14xx.c and from rz1000.c. * * Also consulted the FreeBSD prototype driver by Kevin Day to try * and resolve some confusions. Further documentation can be found in * Ralf Brown's interrupt list * * If you have other variants of the Opti range (Viper/Vendetta) please * try this driver with those PCI idents and report back. For the later * chips see the pata_optidma driver * */ #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 … enum { … }; /** * opti_pre_reset - probe begin * @link: ATA link * @deadline: deadline jiffies for the operation * * Set up cable type and use generic probe init */ static int opti_pre_reset(struct ata_link *link, unsigned long deadline) { … } /** * opti_write_reg - control register setup * @ap: ATA port * @val: value * @reg: control register number * * The Opti uses magic 'trapdoor' register accesses to do configuration * rather than using PCI space as other controllers do. The double inw * on the error register activates configuration mode. We can then write * the control register */ static void opti_write_reg(struct ata_port *ap, u8 val, int reg) { … } /** * opti_set_piomode - set initial PIO mode data * @ap: ATA interface * @adev: ATA device * * Called to do the PIO mode setup. Timing numbers are taken from * the FreeBSD driver then pre computed to keep the code clean. There * are two tables depending on the hardware clock speed. */ static void opti_set_piomode(struct ata_port *ap, struct ata_device *adev) { … } static const struct scsi_host_template opti_sht = …; static struct ata_port_operations opti_port_ops = …; static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) { … } static const struct pci_device_id opti[] = …; static struct pci_driver opti_pci_driver = …; module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, opti); MODULE_VERSION(…);