aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-16 16:29:53 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-16 16:29:53 -0400
commit94c7fa0fcc89571b24c90e0a7545ad31aa390f24 (patch)
tree6414a32910ca6f089754f2daa053696c255f544f
parentcb824c32f1163a8004d0e2f484ded84255caebf4 (diff)
atiixp: DMA setup fixes
* Fix handling of unsupported/invalid modes in atiixp_set_dma_mode(). * ATI controllers allow separate PIO and DMA timings so remove programming of PIO modes from atiixp_set_dma_mode(). Also remove no longer needed atiixp_dma_2_pio() helper. * SWDMA timings are not programmed by atiixp_set_dma_mode() and if SWDMA mode is chosen atiixp_dma_host_on() erroneously enables UDMA, just disable support for SWDMA modes for now. * Enable support for MWDMA0 mode. * Bump driver version. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/pci/atiixp.c53
1 files changed, 5 insertions, 48 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 0eb97f021d39..14a61b1c80ac 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/atiixp.c Version 0.02 Jun 16 2007 2 * linux/drivers/ide/pci/atiixp.c Version 0.03 Aug 3 2007
3 * 3 *
4 * Copyright (C) 2003 ATI Inc. <hyu@ati.com> 4 * Copyright (C) 2003 ATI Inc. <hyu@ati.com>
5 * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz 5 * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz
@@ -47,43 +47,6 @@ static int save_mdma_mode[4];
47 47
48static DEFINE_SPINLOCK(atiixp_lock); 48static DEFINE_SPINLOCK(atiixp_lock);
49 49
50/**
51 * atiixp_dma_2_pio - return the PIO mode matching DMA
52 * @xfer_rate: transfer speed
53 *
54 * Returns the nearest equivalent PIO timing for the PIO or DMA
55 * mode requested by the controller.
56 */
57
58static u8 atiixp_dma_2_pio(u8 xfer_rate) {
59 switch(xfer_rate) {
60 case XFER_UDMA_6:
61 case XFER_UDMA_5:
62 case XFER_UDMA_4:
63 case XFER_UDMA_3:
64 case XFER_UDMA_2:
65 case XFER_UDMA_1:
66 case XFER_UDMA_0:
67 case XFER_MW_DMA_2:
68 case XFER_PIO_4:
69 return 4;
70 case XFER_MW_DMA_1:
71 case XFER_PIO_3:
72 return 3;
73 case XFER_SW_DMA_2:
74 case XFER_PIO_2:
75 return 2;
76 case XFER_MW_DMA_0:
77 case XFER_SW_DMA_1:
78 case XFER_SW_DMA_0:
79 case XFER_PIO_1:
80 case XFER_PIO_0:
81 case XFER_PIO_SLOW:
82 default:
83 return 0;
84 }
85}
86
87static void atiixp_dma_host_on(ide_drive_t *drive) 50static void atiixp_dma_host_on(ide_drive_t *drive)
88{ 51{
89 struct pci_dev *dev = drive->hwif->pci_dev; 52 struct pci_dev *dev = drive->hwif->pci_dev;
@@ -169,7 +132,9 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
169 int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; 132 int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8;
170 u32 tmp32; 133 u32 tmp32;
171 u16 tmp16; 134 u16 tmp16;
172 u8 pio; 135
136 if (speed < XFER_MW_DMA_0)
137 return;
173 138
174 spin_lock_irqsave(&atiixp_lock, flags); 139 spin_lock_irqsave(&atiixp_lock, flags);
175 140
@@ -191,13 +156,6 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
191 } 156 }
192 157
193 spin_unlock_irqrestore(&atiixp_lock, flags); 158 spin_unlock_irqrestore(&atiixp_lock, flags);
194
195 if (speed >= XFER_SW_DMA_0)
196 pio = atiixp_dma_2_pio(speed);
197 else
198 pio = speed - XFER_PIO_0;
199
200 atiixp_set_pio_mode(drive, pio);
201} 159}
202 160
203/** 161/**
@@ -249,8 +207,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
249 207
250 hwif->atapi_dma = 1; 208 hwif->atapi_dma = 1;
251 hwif->ultra_mask = 0x3f; 209 hwif->ultra_mask = 0x3f;
252 hwif->mwdma_mask = 0x06; 210 hwif->mwdma_mask = 0x07;
253 hwif->swdma_mask = 0x04;
254 211
255 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); 212 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
256 213