// SPDX-License-Identifier: GPL-2.0-only /* * pata-cs5530.c - CS5530 PATA for new ATA layer * (C) 2005 Red Hat Inc * * based upon cs5530.c by Mark Lord. * * Loosely based on the piix & svwks drivers. * * Documentation: * Available from AMD web site.
*/
/** * cs5530_set_piomode - PIO setup * @ap: ATA interface * @adev: device on the interface * * Set our PIO requirements. This is fairly simple on the CS5530 * chips.
*/
/** * cs5530_set_dmamode - DMA timing setup * @ap: ATA interface * @adev: Device being configured * * We cannot mix MWDMA and UDMA without reloading timings each switch * master to slave. We track the last DMA setup in order to minimise * reloads.
*/
/* Find out which table to use */
tuning = ioread32(base + 0x04);
switch(adev->dma_mode) { case XFER_UDMA_0:
timing = 0x00921250;break; case XFER_UDMA_1:
timing = 0x00911140;break; case XFER_UDMA_2:
timing = 0x00911030;break; case XFER_MW_DMA_0:
timing = 0x00077771;break; case XFER_MW_DMA_1:
timing = 0x00012121;break; case XFER_MW_DMA_2:
timing = 0x00002020;break; default:
BUG();
} /* Merge in the PIO format bit */
timing |= (tuning & 0x80000000UL); if (adev->devno == 0) /* Master */
iowrite32(timing, base + 0x04); else { if (timing & 0x00100000)
tuning |= 0x00100000; /* UDMA for both */ else
tuning &= ~0x00100000; /* MWDMA for both */
iowrite32(tuning, base + 0x04);
iowrite32(timing, base + 0x0C);
}
/* Set the DMA capable bit in the BMDMA area */
reg = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
reg |= (1 << (5 + adev->devno));
iowrite8(reg, ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
/* Remember the last DMA setup we did */
ap->private_data = adev;
}
/** * cs5530_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap * this interface so that we can load the correct ATA timings if * necessary. Specifically we have a problem that there is only * one MWDMA/UDMA bit.
*/
/* See if the DMA settings could be wrong */ if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { /* Maybe, but do the channels match MWDMA/UDMA ? */ if ((ata_using_udma(adev) && !ata_using_udma(prev)) ||
(ata_using_udma(prev) && !ata_using_udma(adev))) /* Switch the mode bits */
cs5530_set_dmamode(ap, adev);
}
/* * Set PCI CacheLineSize to 16-bytes: * --> Write 0x04 into 8-bit PCI CACHELINESIZE reg of function 0 of the cs5530 * * Note: This value is constant because the 5530 is only a Geode companion
*/
/* * Disable trapping of UDMA register accesses (Win98 hack): * --> Write 0x5006 into 16-bit reg at offset 0xd0 of function 0 of the cs5530
*/
pci_write_config_word(cs5530_0, 0xd0, 0x5006);
/* * Bit-1 at 0x40 enables MemoryWriteAndInvalidate on internal X-bus: * The other settings are what is necessary to get the register * into a sane state for IDE DMA operation.
*/
pci_write_config_byte(master_0, 0x40, 0x1e);
/* * Set max PCI burst size (16-bytes seems to work best): * 16bytes: set bit-1 at 0x41 (reg value of 0x16) * all others: clear bit-1 at 0x41, and do: * 128bytes: OR 0x00 at 0x41 * 256bytes: OR 0x04 at 0x41 * 512bytes: OR 0x08 at 0x41 * 1024bytes: OR 0x0c at 0x41
*/
pci_write_config_byte(master_0, 0x41, 0x14);
/* * These settings are necessary to get the chip * into a sane state for IDE DMA operation.
*/
/** * cs5530_init_one - Initialise a CS5530 * @pdev: PCI device * @id: Entry in match table * * Install a driver for the newly found CS5530 companion chip. Most of * this is just housekeeping. We have to set the chip up correctly and * turn off various bits of emulation magic.
*/
staticint cs5530_init_one(struct pci_dev *pdev, conststruct pci_device_id *id)
{ staticconststruct ata_port_info info = {
.flags = ATA_FLAG_SLAVE_POSS,
.pio_mask = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
.udma_mask = ATA_UDMA2,
.port_ops = &cs5530_port_ops
}; /* The docking connector doesn't do UDMA, and it seems not MWDMA */ staticconststruct ata_port_info info_palmax_secondary = {
.flags = ATA_FLAG_SLAVE_POSS,
.pio_mask = ATA_PIO4,
.port_ops = &cs5530_port_ops
}; conststruct ata_port_info *ppi[] = { &info, NULL }; int rc;
rc = pcim_enable_device(pdev); if (rc) return rc;
/* Chip initialisation */ if (cs5530_init_chip()) return -ENODEV;
if (cs5530_is_palmax())
ppi[1] = &info_palmax_secondary;
/* Now kick off ATA set up */ return ata_pci_bmdma_init_one(pdev, ppi, &cs5530_sht, NULL, 0);
}
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.