/* * pata_hpt3x3 - HPT3x3 driver * (c) Copyright 2005-2006 Red Hat * * Was pata_hpt34x but the naming was confusing as it supported the * 343 and 363 so it has been renamed. * * Based on: * linux/drivers/ide/pci/hpt34x.c Version 0.40 Sept 10, 2002 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> * * May be copied or modified under the terms of the GNU General Public * License
*/
/** * hpt3x3_set_piomode - PIO setup * @ap: ATA interface * @adev: device on the interface * * Set our PIO requirements. This is fairly simple on the HPT3x3 as * all we have to do is clear the MWDMA and UDMA bits then load the * mode number.
*/
#ifdefined(CONFIG_PATA_HPT3X3_DMA) /** * hpt3x3_set_dmamode - DMA timing setup * @ap: ATA interface * @adev: Device being configured * * Set up the channel for MWDMA or UDMA modes. Much the same as with * PIO, load the mode number and then set MWDMA or UDMA flag. * * 0x44 : bit 0-2 master mode, 3-5 slave mode, etc * 0x48 : bit 4/0 DMA/UDMA bit 5/1 for slave etc
*/
/** * hpt3x3_freeze - DMA workaround * @ap: port to freeze * * When freezing an HPT3x3 we must stop any pending DMA before * writing to the control register or the chip will hang
*/
/** * hpt3x3_bmdma_setup - DMA workaround * @qc: Queued command * * When issuing BMDMA we must clean up the error/active bits in * software on this device
*/
/** * hpt3x3_init_chipset - chip setup * @dev: PCI device * * Perform the setup required at boot and on resume.
*/
staticvoid hpt3x3_init_chipset(struct pci_dev *dev)
{
u16 cmd; /* Initialize the board */
pci_write_config_word(dev, 0x80, 0x00); /* Check if it is a 343 or a 363. 363 has COMMAND_MEMORY set */
pci_read_config_word(dev, PCI_COMMAND, &cmd); if (cmd & PCI_COMMAND_MEMORY)
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0); else
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
}
/** * hpt3x3_init_one - Initialise an HPT343/363 * @pdev: PCI device * @id: Entry in match table * * Perform basic initialisation. We set the device up so we access all * ports via BAR4. This is necessary to work around errata.
*/
host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2); if (!host) return -ENOMEM; /* acquire resources and fill host */
rc = pcim_enable_device(pdev); if (rc) return rc;
/* Everything is relative to BAR4 if we set up this way */
rc = pcim_iomap_regions(pdev, 1 << 4, DRV_NAME); if (rc == -EBUSY)
pcim_pin_device(pdev); if (rc) return rc;
host->iomap = pcim_iomap_table(pdev);
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); if (rc) return rc;
base = host->iomap[4]; /* Bus mastering base */
for (i = 0; i < host->n_ports; i++) { struct ata_port *ap = host->ports[i]; struct ata_ioports *ioaddr = &ap->ioaddr;
ioaddr->cmd_addr = base + offset_cmd[i];
ioaddr->altstatus_addr =
ioaddr->ctl_addr = base + offset_ctl[i];
ioaddr->scr_addr = NULL;
ata_sff_std_ports(ioaddr);
ioaddr->bmdma_addr = base + 8 * i;
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.