// SPDX-License-Identifier: GPL-2.0-only /* * pata_artop.c - ARTOP ATA controller driver * * (C) 2006 Red Hat * (C) 2007,2011 Bartlomiej Zolnierkiewicz * * Based in part on drivers/ide/pci/aec62xx.c * Copyright (C) 1999-2002 Andre Hedrick <[email protected]> * 865/865R fixes for Macintosh card version from a patch to the old * driver by Thibaut VARENE <[email protected]> * When setting the PCI latency we must set 0x80 or higher for burst * performance Alessandro Zummo <[email protected]> * * TODO * Investigate no_dsc on 850R * Clock detect */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <linux/device.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #include <linux/ata.h> #define DRV_NAME … #define DRV_VERSION … /* * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we * get PCI bus speed functionality we leave this as 0. Its a variable * for when we get the functionality and also for folks wanting to * test stuff. */ static int clock = …; /** * artop62x0_pre_reset - probe begin * @link: link * @deadline: deadline jiffies for the operation * * Nothing complicated needed here. */ static int artop62x0_pre_reset(struct ata_link *link, unsigned long deadline) { … } /** * artop6260_cable_detect - identify cable type * @ap: Port * * Identify the cable type for the ARTOP interface in question */ static int artop6260_cable_detect(struct ata_port *ap) { … } /** * artop6210_load_piomode - Load a set of PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device * @pio: PIO mode * * Set PIO mode for device, in host controller PCI config space. This * is used both to set PIO timings in PIO mode and also to set the * matching PIO clocking for UDMA, as well as the MWDMA timings. * * LOCKING: * None (inherited from caller). */ static void artop6210_load_piomode(struct ata_port *ap, struct ata_device *adev, unsigned int pio) { … } /** * artop6210_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring * * Set PIO mode for device, in host controller PCI config space. For * ARTOP we must also clear the UDMA bits if we are not doing UDMA. In * the event UDMA is used the later call to set_dmamode will set the * bits as required. * * LOCKING: * None (inherited from caller). */ static void artop6210_set_piomode(struct ata_port *ap, struct ata_device *adev) { … } /** * artop6260_load_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring * @pio: PIO mode * * Set PIO mode for device, in host controller PCI config space. The * ARTOP6260 and relatives store the timing data differently. * * LOCKING: * None (inherited from caller). */ static void artop6260_load_piomode (struct ata_port *ap, struct ata_device *adev, unsigned int pio) { … } /** * artop6260_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring * * Set PIO mode for device, in host controller PCI config space. For * ARTOP we must also clear the UDMA bits if we are not doing UDMA. In * the event UDMA is used the later call to set_dmamode will set the * bits as required. * * LOCKING: * None (inherited from caller). */ static void artop6260_set_piomode(struct ata_port *ap, struct ata_device *adev) { … } /** * artop6210_set_dmamode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device whose timings we are configuring * * Set DMA mode for device, in host controller PCI config space. * * LOCKING: * None (inherited from caller). */ static void artop6210_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * artop6260_set_dmamode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring * * Set DMA mode for device, in host controller PCI config space. The * ARTOP6260 and relatives store the timing data differently. * * LOCKING: * None (inherited from caller). */ static void artop6260_set_dmamode (struct ata_port *ap, struct ata_device *adev) { … } /** * artop6210_qc_defer - implement serialization * @qc: command * * Issue commands per host on this chip. */ static int artop6210_qc_defer(struct ata_queued_cmd *qc) { … } static const struct scsi_host_template artop_sht = …; static struct ata_port_operations artop6210_ops = …; static struct ata_port_operations artop6260_ops = …; static void atp8xx_fixup(struct pci_dev *pdev) { … } /** * artop_init_one - Register ARTOP ATA PCI device with kernel services * @pdev: PCI device to register * @id: PCI device ID * * Called from kernel PCI layer. * * LOCKING: * Inherited from PCI layer (may sleep). * * RETURNS: * Zero on success, or -ERRNO value. */ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) { … } static const struct pci_device_id artop_pci_tbl[] = …; #ifdef CONFIG_PM_SLEEP static int atp8xx_reinit_one(struct pci_dev *pdev) { … } #endif static struct pci_driver artop_pci_driver = …; module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, artop_pci_tbl); MODULE_VERSION(…);