aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/siimage.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:54:01 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:54:01 -0400
commitffe5415c3d6138aff412af7e455b3df4d53c0aa0 (patch)
treed71fc51b67a4dd5541b83defd56981ed82715220 /drivers/ide/pci/siimage.c
parent326d72f437b0a9216290ad8f10817e1e363fd813 (diff)
siimage: fix ->set_pio_mode method to select PIO data transfer
* Remember to select PIO data transfer (with IORDY monitored) in sil_tune_pio() (->set_pio_mode method) so the controller is always programmed correctly for PIO transfers (this is important if DMA is not going to be used). * Don't set DMA/UDMA timings for PIO modes in siimage_tune_chipset(). * Bump driver version. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/siimage.c')
-rw-r--r--drivers/ide/pci/siimage.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index e07c991d91b9..c526c70d65a4 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.15 Jun 29 2007 2 * linux/drivers/ide/pci/siimage.c Version 1.16 Jul 13 2007
3 * 3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
@@ -185,7 +185,12 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio)
185 u16 speedp = 0; 185 u16 speedp = 0;
186 unsigned long addr = siimage_seldev(drive, 0x04); 186 unsigned long addr = siimage_seldev(drive, 0x04);
187 unsigned long tfaddr = siimage_selreg(hwif, 0x02); 187 unsigned long tfaddr = siimage_selreg(hwif, 0x02);
188 unsigned long base = (unsigned long)hwif->hwif_data;
188 u8 tf_pio = pio; 189 u8 tf_pio = pio;
190 u8 addr_mask = hwif->channel ? (hwif->mmio ? 0xF4 : 0x84)
191 : (hwif->mmio ? 0xB4 : 0x80);
192 u8 mode = 0;
193 u8 unit = drive->select.b.unit;
189 194
190 /* trim *taskfile* PIO to the slowest of the master/slave */ 195 /* trim *taskfile* PIO to the slowest of the master/slave */
191 if (pair->present) { 196 if (pair->present) {
@@ -207,6 +212,11 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio)
207 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2); 212 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2);
208 else 213 else
209 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2); 214 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2);
215
216 mode = hwif->INB(base + addr_mask);
217 mode &= ~(unit ? 0x30 : 0x03);
218 mode |= (unit ? 0x10 : 0x01);
219 hwif->OUTB(mode, base + addr_mask);
210 } else { 220 } else {
211 pci_write_config_word(hwif->pci_dev, addr, speedp); 221 pci_write_config_word(hwif->pci_dev, addr, speedp);
212 pci_write_config_word(hwif->pci_dev, tfaddr, speedt); 222 pci_write_config_word(hwif->pci_dev, tfaddr, speedt);
@@ -216,6 +226,11 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio)
216 if (pio > 2) 226 if (pio > 2)
217 speedp |= 0x200; 227 speedp |= 0x200;
218 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); 228 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp);
229
230 pci_read_config_byte(hwif->pci_dev, addr_mask, &mode);
231 mode &= ~(unit ? 0x30 : 0x03);
232 mode |= (unit ? 0x10 : 0x01);
233 pci_write_config_byte(hwif->pci_dev, addr_mask, mode);
219 } 234 }
220} 235}
221 236
@@ -275,8 +290,7 @@ static int siimage_tune_chipset(ide_drive_t *drive, const u8 speed)
275 case XFER_PIO_1: 290 case XFER_PIO_1:
276 case XFER_PIO_0: 291 case XFER_PIO_0:
277 sil_tune_pio(drive, speed - XFER_PIO_0); 292 sil_tune_pio(drive, speed - XFER_PIO_0);
278 mode |= ((unit) ? 0x10 : 0x01); 293 return ide_config_drive_speed(drive, speed);
279 break;
280 case XFER_MW_DMA_2: 294 case XFER_MW_DMA_2:
281 case XFER_MW_DMA_1: 295 case XFER_MW_DMA_1:
282 case XFER_MW_DMA_0: 296 case XFER_MW_DMA_0: