aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_serverworks.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-11-05 10:04:40 -0500
committerJeff Garzik <jeff@garzik.org>2007-11-05 18:08:46 -0500
commit36beb82390235236c60eb97ca526b1cad97e2df3 (patch)
treeb109c9cd0fc5bb5f49cf8da22d84b874111a233e /drivers/ata/pata_serverworks.c
parent152af05cc85119d294b977ab4de07a781795c298 (diff)
pata_serverworks: Fix problem with some drive combinations
The driver used the channel not the device number for deciding where to load some timing parameters. Also change so that we clear the UDMA field as the old driver did. Not believed neccessary but does no harm. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_serverworks.c')
-rw-r--r--drivers/ata/pata_serverworks.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index df68806df4be..8bed88873720 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -274,28 +274,27 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev
274{ 274{
275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 }; 275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 };
276 int offset = 1 + 2 * ap->port_no - adev->devno; 276 int offset = 1 + 2 * ap->port_no - adev->devno;
277 int devbits = (2 * ap->port_no + adev->devno); 277 int devbits = 2 * ap->port_no + adev->devno;
278 u8 ultra; 278 u8 ultra;
279 u8 ultra_cfg; 279 u8 ultra_cfg;
280 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 280 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
281 281
282 pci_read_config_byte(pdev, 0x54, &ultra_cfg); 282 pci_read_config_byte(pdev, 0x54, &ultra_cfg);
283 pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
284 ultra &= ~(0x0F << (adev->devno * 4));
283 285
284 if (adev->dma_mode >= XFER_UDMA_0) { 286 if (adev->dma_mode >= XFER_UDMA_0) {
285 pci_write_config_byte(pdev, 0x44 + offset, 0x20); 287 pci_write_config_byte(pdev, 0x44 + offset, 0x20);
286 288
287 pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
288 ultra &= ~(0x0F << (ap->port_no * 4));
289 ultra |= (adev->dma_mode - XFER_UDMA_0) 289 ultra |= (adev->dma_mode - XFER_UDMA_0)
290 << (ap->port_no * 4); 290 << (adev->devno * 4);
291 pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
292
293 ultra_cfg |= (1 << devbits); 291 ultra_cfg |= (1 << devbits);
294 } else { 292 } else {
295 pci_write_config_byte(pdev, 0x44 + offset, 293 pci_write_config_byte(pdev, 0x44 + offset,
296 dma_mode[adev->dma_mode - XFER_MW_DMA_0]); 294 dma_mode[adev->dma_mode - XFER_MW_DMA_0]);
297 ultra_cfg &= ~(1 << devbits); 295 ultra_cfg &= ~(1 << devbits);
298 } 296 }
297 pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
299 pci_write_config_byte(pdev, 0x54, ultra_cfg); 298 pci_write_config_byte(pdev, 0x54, ultra_cfg);
300} 299}
301 300