diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-io.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-lib.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-timing.h | 8 | ||||
-rw-r--r-- | drivers/ide/pci/pdc202xx_old.c | 40 | ||||
-rw-r--r-- | drivers/ide/pci/piix.c | 12 |
5 files changed, 21 insertions, 45 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 05ba8e01e635..935cb2583770 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -959,7 +959,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
959 | printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); | 959 | printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); |
960 | SELECT_DRIVE(drive); | 960 | SELECT_DRIVE(drive); |
961 | HWIF(drive)->OUTB(8, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]); | 961 | HWIF(drive)->OUTB(8, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]); |
962 | rc = ide_wait_not_busy(HWIF(drive), 10000); | 962 | rc = ide_wait_not_busy(HWIF(drive), 100000); |
963 | if (rc) | 963 | if (rc) |
964 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); | 964 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); |
965 | } | 965 | } |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 16a143133f93..7ddb11828731 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -485,7 +485,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
485 | unsigned long flags; | 485 | unsigned long flags; |
486 | u8 err = 0; | 486 | u8 err = 0; |
487 | 487 | ||
488 | local_irq_set(flags); | 488 | local_irq_save(flags); |
489 | printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); | 489 | printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); |
490 | if (stat & BUSY_STAT) | 490 | if (stat & BUSY_STAT) |
491 | printk("Busy "); | 491 | printk("Busy "); |
@@ -567,7 +567,7 @@ static u8 ide_dump_atapi_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
567 | 567 | ||
568 | status.all = stat; | 568 | status.all = stat; |
569 | error.all = 0; | 569 | error.all = 0; |
570 | local_irq_set(flags); | 570 | local_irq_save(flags); |
571 | printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); | 571 | printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); |
572 | if (status.b.bsy) | 572 | if (status.b.bsy) |
573 | printk("Busy "); | 573 | printk("Busy "); |
diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h index 2fcfac6e967a..c0864b1e9228 100644 --- a/drivers/ide/ide-timing.h +++ b/drivers/ide/ide-timing.h | |||
@@ -220,6 +220,12 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing | |||
220 | return -EINVAL; | 220 | return -EINVAL; |
221 | 221 | ||
222 | /* | 222 | /* |
223 | * Copy the timing from the table. | ||
224 | */ | ||
225 | |||
226 | *t = *s; | ||
227 | |||
228 | /* | ||
223 | * If the drive is an EIDE drive, it can tell us it needs extended | 229 | * If the drive is an EIDE drive, it can tell us it needs extended |
224 | * PIO/MWDMA cycle timing. | 230 | * PIO/MWDMA cycle timing. |
225 | */ | 231 | */ |
@@ -247,7 +253,7 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing | |||
247 | * Convert the timing to bus clock counts. | 253 | * Convert the timing to bus clock counts. |
248 | */ | 254 | */ |
249 | 255 | ||
250 | ide_timing_quantize(s, t, T, UT); | 256 | ide_timing_quantize(t, t, T, UT); |
251 | 257 | ||
252 | /* | 258 | /* |
253 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T | 259 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 7ce5bf783688..22d17548ecdb 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -370,7 +370,6 @@ chipset_is_set: | |||
370 | if (!(speed)) { | 370 | if (!(speed)) { |
371 | /* restore original pci-config space */ | 371 | /* restore original pci-config space */ |
372 | pci_write_config_dword(dev, drive_pci, drive_conf); | 372 | pci_write_config_dword(dev, drive_pci, drive_conf); |
373 | hwif->tuneproc(drive, 5); | ||
374 | return 0; | 373 | return 0; |
375 | } | 374 | } |
376 | 375 | ||
@@ -415,8 +414,6 @@ static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) | |||
415 | if (drive->addressing == 1) { | 414 | if (drive->addressing == 1) { |
416 | struct request *rq = HWGROUP(drive)->rq; | 415 | struct request *rq = HWGROUP(drive)->rq; |
417 | ide_hwif_t *hwif = HWIF(drive); | 416 | ide_hwif_t *hwif = HWIF(drive); |
418 | // struct pci_dev *dev = hwif->pci_dev; | ||
419 | // unsgned long high_16 = pci_resource_start(dev, 4); | ||
420 | unsigned long high_16 = hwif->dma_master; | 417 | unsigned long high_16 = hwif->dma_master; |
421 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); | 418 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); |
422 | u32 word_count = 0; | 419 | u32 word_count = 0; |
@@ -436,7 +433,6 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive) | |||
436 | { | 433 | { |
437 | if (drive->addressing == 1) { | 434 | if (drive->addressing == 1) { |
438 | ide_hwif_t *hwif = HWIF(drive); | 435 | ide_hwif_t *hwif = HWIF(drive); |
439 | // unsigned long high_16 = pci_resource_start(hwif->pci_dev, 4); | ||
440 | unsigned long high_16 = hwif->dma_master; | 436 | unsigned long high_16 = hwif->dma_master; |
441 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); | 437 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); |
442 | u8 clock = 0; | 438 | u8 clock = 0; |
@@ -453,8 +449,6 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive) | |||
453 | static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive) | 449 | static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive) |
454 | { | 450 | { |
455 | ide_hwif_t *hwif = HWIF(drive); | 451 | ide_hwif_t *hwif = HWIF(drive); |
456 | // struct pci_dev *dev = hwif->pci_dev; | ||
457 | // unsigned long high_16 = pci_resource_start(dev, 4); | ||
458 | unsigned long high_16 = hwif->dma_master; | 452 | unsigned long high_16 = hwif->dma_master; |
459 | u8 dma_stat = hwif->INB(hwif->dma_status); | 453 | u8 dma_stat = hwif->INB(hwif->dma_status); |
460 | u8 sc1d = hwif->INB((high_16 + 0x001d)); | 454 | u8 sc1d = hwif->INB((high_16 + 0x001d)); |
@@ -492,12 +486,7 @@ static int pdc202xx_ide_dma_timeout(ide_drive_t *drive) | |||
492 | 486 | ||
493 | static void pdc202xx_reset_host (ide_hwif_t *hwif) | 487 | static void pdc202xx_reset_host (ide_hwif_t *hwif) |
494 | { | 488 | { |
495 | #ifdef CONFIG_BLK_DEV_IDEDMA | ||
496 | // unsigned long high_16 = hwif->dma_base - (8*(hwif->channel)); | ||
497 | unsigned long high_16 = hwif->dma_master; | 489 | unsigned long high_16 = hwif->dma_master; |
498 | #else /* !CONFIG_BLK_DEV_IDEDMA */ | ||
499 | unsigned long high_16 = pci_resource_start(hwif->pci_dev, 4); | ||
500 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | ||
501 | u8 udma_speed_flag = hwif->INB(high_16|0x001f); | 490 | u8 udma_speed_flag = hwif->INB(high_16|0x001f); |
502 | 491 | ||
503 | hwif->OUTB((udma_speed_flag | 0x10), (high_16|0x001f)); | 492 | hwif->OUTB((udma_speed_flag | 0x10), (high_16|0x001f)); |
@@ -550,31 +539,6 @@ static void pdc202xx_reset (ide_drive_t *drive) | |||
550 | #endif | 539 | #endif |
551 | } | 540 | } |
552 | 541 | ||
553 | /* | ||
554 | * Since SUN Cobalt is attempting to do this operation, I should disclose | ||
555 | * this has been a long time ago Thu Jul 27 16:40:57 2000 was the patch date | ||
556 | * HOTSWAP ATA Infrastructure. | ||
557 | */ | ||
558 | static int pdc202xx_tristate (ide_drive_t * drive, int state) | ||
559 | { | ||
560 | ide_hwif_t *hwif = HWIF(drive); | ||
561 | // unsigned long high_16 = hwif->dma_base - (8*(hwif->channel)); | ||
562 | unsigned long high_16 = hwif->dma_master; | ||
563 | u8 sc1f = hwif->INB(high_16|0x001f); | ||
564 | |||
565 | if (!hwif) | ||
566 | return -EINVAL; | ||
567 | |||
568 | // hwif->bus_state = state; | ||
569 | |||
570 | if (state) { | ||
571 | hwif->OUTB(sc1f | 0x08, (high_16|0x001f)); | ||
572 | } else { | ||
573 | hwif->OUTB(sc1f & ~0x08, (high_16|0x001f)); | ||
574 | } | ||
575 | return 0; | ||
576 | } | ||
577 | |||
578 | static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) | 542 | static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) |
579 | { | 543 | { |
580 | if (dev->resource[PCI_ROM_RESOURCE].start) { | 544 | if (dev->resource[PCI_ROM_RESOURCE].start) { |
@@ -624,10 +588,8 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | |||
624 | hwif->tuneproc = &config_chipset_for_pio; | 588 | hwif->tuneproc = &config_chipset_for_pio; |
625 | hwif->quirkproc = &pdc202xx_quirkproc; | 589 | hwif->quirkproc = &pdc202xx_quirkproc; |
626 | 590 | ||
627 | if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) { | 591 | if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) |
628 | hwif->busproc = &pdc202xx_tristate; | ||
629 | hwif->resetproc = &pdc202xx_reset; | 592 | hwif->resetproc = &pdc202xx_reset; |
630 | } | ||
631 | 593 | ||
632 | hwif->speedproc = &pdc202xx_tune_chipset; | 594 | hwif->speedproc = &pdc202xx_tune_chipset; |
633 | 595 | ||
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index e9b83e1a3028..7fac6f57b5d6 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -222,6 +222,8 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
222 | unsigned long flags; | 222 | unsigned long flags; |
223 | u16 master_data; | 223 | u16 master_data; |
224 | u8 slave_data; | 224 | u8 slave_data; |
225 | static DEFINE_SPINLOCK(tune_lock); | ||
226 | |||
225 | /* ISP RTC */ | 227 | /* ISP RTC */ |
226 | u8 timings[][2] = { { 0, 0 }, | 228 | u8 timings[][2] = { { 0, 0 }, |
227 | { 0, 0 }, | 229 | { 0, 0 }, |
@@ -230,7 +232,13 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
230 | { 2, 3 }, }; | 232 | { 2, 3 }, }; |
231 | 233 | ||
232 | pio = ide_get_best_pio_mode(drive, pio, 5, NULL); | 234 | pio = ide_get_best_pio_mode(drive, pio, 5, NULL); |
233 | spin_lock_irqsave(&ide_lock, flags); | 235 | |
236 | /* | ||
237 | * Master vs slave is synchronized above us but the slave register is | ||
238 | * shared by the two hwifs so the corner case of two slave timeouts in | ||
239 | * parallel must be locked. | ||
240 | */ | ||
241 | spin_lock_irqsave(&tune_lock, flags); | ||
234 | pci_read_config_word(dev, master_port, &master_data); | 242 | pci_read_config_word(dev, master_port, &master_data); |
235 | if (is_slave) { | 243 | if (is_slave) { |
236 | master_data = master_data | 0x4000; | 244 | master_data = master_data | 0x4000; |
@@ -250,7 +258,7 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
250 | pci_write_config_word(dev, master_port, master_data); | 258 | pci_write_config_word(dev, master_port, master_data); |
251 | if (is_slave) | 259 | if (is_slave) |
252 | pci_write_config_byte(dev, slave_port, slave_data); | 260 | pci_write_config_byte(dev, slave_port, slave_data); |
253 | spin_unlock_irqrestore(&ide_lock, flags); | 261 | spin_unlock_irqrestore(&tune_lock, flags); |
254 | } | 262 | } |
255 | 263 | ||
256 | /** | 264 | /** |