aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/sl82c105.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2006-12-08 05:40:01 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:29:03 -0500
commitdd607d23ff4cc004da2986d0b264a972c6a2da3e (patch)
tree5845b66acd8b2b6e9a1dc7d5964d5aaa3d00b669 /drivers/ide/pci/sl82c105.c
parentb10a06866600d1eda9e72ff328999e70f077fb3a (diff)
[PATCH] sl82c105: straighten up IDE control/status register caching
Straighten up the IDE control/status register caching -- you *really* can't cache the shared register per-channel and hope that it won't get out ouf sync. Set the PIO fallback mode to PIO0 for the slave drive as well as master -- there was no point in having them different (most probably a resutl of typo). Do a bit of reformat and cleanup while at it... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ide/pci/sl82c105.c')
-rw-r--r--drivers/ide/pci/sl82c105.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 0b4b60498515..5afefe8692fe 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -299,14 +299,14 @@ static void sl82c105_selectproc(ide_drive_t *drive)
299 //DBG(("sl82c105_selectproc(drive:%s)\n", drive->name)); 299 //DBG(("sl82c105_selectproc(drive:%s)\n", drive->name));
300 300
301 mask = hwif->channel ? CTRL_P1F16 : CTRL_P0F16; 301 mask = hwif->channel ? CTRL_P1F16 : CTRL_P0F16;
302 old = val = *((u32 *)&hwif->hwif_data); 302 old = val = (u32)pci_get_drvdata(dev);
303 if (drive->using_dma) 303 if (drive->using_dma)
304 val &= ~mask; 304 val &= ~mask;
305 else 305 else
306 val |= mask; 306 val |= mask;
307 if (old != val) { 307 if (old != val) {
308 pci_write_config_dword(dev, 0x40, val); 308 pci_write_config_dword(dev, 0x40, val);
309 *((u32 *)&hwif->hwif_data) = val; 309 pci_set_drvdata(dev, (void *)val);
310 } 310 }
311} 311}
312 312
@@ -316,14 +316,13 @@ static void sl82c105_selectproc(ide_drive_t *drive)
316 */ 316 */
317static void sl82c105_resetproc(ide_drive_t *drive) 317static void sl82c105_resetproc(ide_drive_t *drive)
318{ 318{
319 ide_hwif_t *hwif = HWIF(drive); 319 struct pci_dev *dev = HWIF(drive)->pci_dev;
320 struct pci_dev *dev = hwif->pci_dev;
321 u32 val; 320 u32 val;
322 321
323 DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); 322 DBG(("sl82c105_resetproc(drive:%s)\n", drive->name));
324 323
325 pci_read_config_dword(dev, 0x40, &val); 324 pci_read_config_dword(dev, 0x40, &val);
326 *((u32 *)&hwif->hwif_data) = val; 325 pci_set_drvdata(dev, (void *)val);
327} 326}
328 327
329/* 328/*
@@ -394,6 +393,7 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c
394 pci_read_config_dword(dev, 0x40, &val); 393 pci_read_config_dword(dev, 0x40, &val);
395 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 394 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16;
396 pci_write_config_dword(dev, 0x40, val); 395 pci_write_config_dword(dev, 0x40, val);
396 pci_set_drvdata(dev, (void *)val);
397 397
398 return dev->irq; 398 return dev->irq;
399} 399}
@@ -404,30 +404,25 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c
404 404
405static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) 405static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
406{ 406{
407 struct pci_dev *dev = hwif->pci_dev;
408 unsigned int rev; 407 unsigned int rev;
409 u8 dma_state; 408 u8 dma_state;
410 u32 val; 409
411
412 DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); 410 DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index));
413 411
414 hwif->tuneproc = tune_sl82c105; 412 hwif->tuneproc = tune_sl82c105;
415 hwif->selectproc = sl82c105_selectproc; 413 hwif->selectproc = sl82c105_selectproc;
416 hwif->resetproc = sl82c105_resetproc; 414 hwif->resetproc = sl82c105_resetproc;
417 415
418 /* Default to PIO 0 for fallback unless tuned otherwise, 416 /*
419 * we always autotune PIO, this is done before DMA is 417 * Default to PIO 0 for fallback unless tuned otherwise.
420 * checked, so there is no risk of accidentally disabling 418 * We always autotune PIO, this is done before DMA is checked,
421 * DMA 419 * so there's no risk of accidentally disabling DMA
422 */ 420 */
423 hwif->drives[0].pio_speed = XFER_PIO_0; 421 hwif->drives[0].pio_speed = XFER_PIO_0;
424 hwif->drives[0].autotune = 1; 422 hwif->drives[0].autotune = 1;
425 hwif->drives[1].pio_speed = XFER_PIO_1; 423 hwif->drives[1].pio_speed = XFER_PIO_0;
426 hwif->drives[1].autotune = 1; 424 hwif->drives[1].autotune = 1;
427 425
428 pci_read_config_dword(dev, 0x40, &val);
429 *((u32 *)&hwif->hwif_data) = val;
430
431 hwif->atapi_dma = 0; 426 hwif->atapi_dma = 0;
432 hwif->mwdma_mask = 0; 427 hwif->mwdma_mask = 0;
433 hwif->swdma_mask = 0; 428 hwif->swdma_mask = 0;