// 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 <miri@punknet.cz>, * Jan Harkes <jaharkes@cwi.nl>, * Mark Lord <mlord@pobox.com> * 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 *
*/
enum {
READ_REG = 0, /* index of Read cycle timing register */
WRITE_REG = 1, /* index of Write cycle timing register */
CNTRL_REG = 3, /* index of Control register */
STRAP_REG = 5, /* index of Strap register */
MISC_REG = 6 /* index of Miscellaneous register */
};
/** * opti_pre_reset - probe begin * @link: ATA link * @deadline: deadline jiffies for the operation * * Set up cable type and use generic probe init
*/
if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no])) return -ENOENT;
return ata_sff_prereset(link, 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
*/
/* These 3 unlock the control register access */
ioread16(regio + 1);
ioread16(regio + 1);
iowrite8(3, regio + 2);
/* Do the I/O */
iowrite8(val, regio + reg);
/* Relock */
iowrite8(0x83, regio + 2);
}
/** * 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.
*/
staticvoid opti_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ struct ata_device *pair = ata_dev_pair(adev); int clock; int pio = adev->pio_mode - XFER_PIO_0; void __iomem *regio = ap->ioaddr.cmd_addr;
u8 addr;
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.