aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/Kconfig54
-rw-r--r--drivers/ide/Makefile1
-rw-r--r--drivers/ide/arm/icside.c13
-rw-r--r--drivers/ide/ide-cd.c9
-rw-r--r--drivers/ide/ide-dma.c2
-rw-r--r--drivers/ide/ide-io.c38
-rw-r--r--drivers/ide/ide-iops.c13
-rw-r--r--drivers/ide/ide.c43
-rw-r--r--drivers/ide/mips/au1xxx-ide.c3
-rw-r--r--drivers/ide/pci/Makefile1
-rw-r--r--drivers/ide/pci/cmd64x.c45
-rw-r--r--drivers/ide/pci/jmicron.c29
-rw-r--r--drivers/ide/pci/pdc202xx_new.c3
-rw-r--r--drivers/ide/pci/scc_pata.c (renamed from drivers/ide/ppc/scc_pata.c)0
-rw-r--r--drivers/ide/setup-pci.c5
15 files changed, 141 insertions, 118 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 5d134bb75ba1..ca2e4f830c39 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA
103 ---help--- 103 ---help---
104 There are two drivers for Serial ATA controllers. 104 There are two drivers for Serial ATA controllers.
105 105
106 The main driver, "libata", exists inside the SCSI subsystem 106 The main driver, "libata", uses the SCSI subsystem
107 and supports most modern SATA controllers. 107 and supports most modern SATA controllers. In order to use it
108 you may take a look at "Serial ATA (prod) and Parallel ATA
109 (experimental) drivers".
108 110
109 The IDE driver (which you are currently configuring) supports 111 The IDE driver (which you are currently configuring) supports
110 a few first-generation SATA controllers. 112 a few first-generation SATA controllers.
@@ -434,24 +436,8 @@ config BLK_DEV_IDEDMA_FORCED
434 436
435 Generally say N here. 437 Generally say N here.
436 438
437config IDEDMA_PCI_AUTO
438 bool "Use PCI DMA by default when available"
439 ---help---
440 Prior to kernel version 2.1.112, Linux used to automatically use
441 DMA for IDE drives and chipsets which support it. Due to concerns
442 about a couple of cases where buggy hardware may have caused damage,
443 the default is now to NOT use DMA automatically. To revert to the
444 previous behaviour, say Y to this question.
445
446 If you suspect your hardware is at all flakey, say N here.
447 Do NOT email the IDE kernel people regarding this issue!
448
449 It is normally safe to answer Y to this question unless your
450 motherboard uses a VIA VP2 chipset, in which case you should say N.
451
452config IDEDMA_ONLYDISK 439config IDEDMA_ONLYDISK
453 bool "Enable DMA only for disks " 440 bool "Enable DMA only for disks "
454 depends on IDEDMA_PCI_AUTO
455 help 441 help
456 This is used if you know your ATAPI Devices are going to fail DMA 442 This is used if you know your ATAPI Devices are going to fail DMA
457 Transfers. 443 Transfers.
@@ -769,6 +755,14 @@ config BLK_DEV_TC86C001
769 help 755 help
770 This driver adds support for Toshiba TC86C001 GOKU-S chip. 756 This driver adds support for Toshiba TC86C001 GOKU-S chip.
771 757
758config BLK_DEV_CELLEB
759 tristate "Toshiba's Cell Reference Set IDE support"
760 depends on PPC_CELLEB
761 help
762 This driver provides support for the built-in IDE controller on
763 Toshiba Cell Reference Board.
764 If unsure, say Y.
765
772endif 766endif
773 767
774config BLK_DEV_IDE_PMAC 768config BLK_DEV_IDE_PMAC
@@ -800,14 +794,6 @@ config BLK_DEV_IDEDMA_PMAC
800 to transfer data to and from memory. Saying Y is safe and improves 794 to transfer data to and from memory. Saying Y is safe and improves
801 performance. 795 performance.
802 796
803config BLK_DEV_IDE_CELLEB
804 bool "Toshiba's Cell Reference Set IDE support"
805 depends on PPC_CELLEB
806 help
807 This driver provides support for the built-in IDE controller on
808 Toshiba Cell Reference Board.
809 If unsure, say Y.
810
811config BLK_DEV_IDE_SWARM 797config BLK_DEV_IDE_SWARM
812 tristate "IDE for Sibyte evaluation boards" 798 tristate "IDE for Sibyte evaluation boards"
813 depends on SIBYTE_SB1xxx_SOC 799 depends on SIBYTE_SB1xxx_SOC
@@ -851,19 +837,6 @@ config BLK_DEV_IDEDMA_ICS
851 Say Y here if you want to add DMA (Direct Memory Access) support to 837 Say Y here if you want to add DMA (Direct Memory Access) support to
852 the ICS IDE driver. 838 the ICS IDE driver.
853 839
854config IDEDMA_ICS_AUTO
855 bool "Use ICS DMA by default"
856 depends on BLK_DEV_IDEDMA_ICS
857 help
858 Prior to kernel version 2.1.112, Linux used to automatically use
859 DMA for IDE drives and chipsets which support it. Due to concerns
860 about a couple of cases where buggy hardware may have caused damage,
861 the default is now to NOT use DMA automatically. To revert to the
862 previous behaviour, say Y to this question.
863
864 If you suspect your hardware is at all flakey, say N here.
865 Do NOT email the IDE kernel people regarding this issue!
866
867config BLK_DEV_IDE_RAPIDE 840config BLK_DEV_IDE_RAPIDE
868 tristate "RapIDE interface support" 841 tristate "RapIDE interface support"
869 depends on ARM && ARCH_ACORN 842 depends on ARM && ARCH_ACORN
@@ -1086,9 +1059,6 @@ config IDEDMA_IVB
1086 1059
1087 It is normally safe to answer Y; however, the default is N. 1060 It is normally safe to answer Y; however, the default is N.
1088 1061
1089config IDEDMA_AUTO
1090 def_bool IDEDMA_PCI_AUTO || IDEDMA_ICS_AUTO
1091
1092endif 1062endif
1093 1063
1094config BLK_DEV_HD_ONLY 1064config BLK_DEV_HD_ONLY
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 28feedfbd21d..d9f029e8ff74 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -37,7 +37,6 @@ ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o
37# built-in only drivers from ppc/ 37# built-in only drivers from ppc/
38ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o 38ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o 39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
40ide-core-$(CONFIG_BLK_DEV_IDE_CELLEB) += ppc/scc_pata.o
41 40
42# built-in only drivers from h8300/ 41# built-in only drivers from h8300/
43ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o 42ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 40e5c66b81ce..e2953fc1fafb 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -196,11 +196,6 @@ static void icside_maskproc(ide_drive_t *drive, int mask)
196} 196}
197 197
198#ifdef CONFIG_BLK_DEV_IDEDMA_ICS 198#ifdef CONFIG_BLK_DEV_IDEDMA_ICS
199
200#ifndef CONFIG_IDEDMA_ICS_AUTO
201#warning CONFIG_IDEDMA_ICS_AUTO=n support is obsolete, and will be removed soon.
202#endif
203
204/* 199/*
205 * SG-DMA support. 200 * SG-DMA support.
206 * 201 *
@@ -474,12 +469,6 @@ static int icside_dma_lostirq(ide_drive_t *drive)
474 469
475static void icside_dma_init(ide_hwif_t *hwif) 470static void icside_dma_init(ide_hwif_t *hwif)
476{ 471{
477 int autodma = 0;
478
479#ifdef CONFIG_IDEDMA_ICS_AUTO
480 autodma = 1;
481#endif
482
483 printk(" %s: SG-DMA", hwif->name); 472 printk(" %s: SG-DMA", hwif->name);
484 473
485 hwif->atapi_dma = 1; 474 hwif->atapi_dma = 1;
@@ -489,7 +478,7 @@ static void icside_dma_init(ide_hwif_t *hwif)
489 hwif->dmatable_cpu = NULL; 478 hwif->dmatable_cpu = NULL;
490 hwif->dmatable_dma = 0; 479 hwif->dmatable_dma = 0;
491 hwif->speedproc = icside_set_speed; 480 hwif->speedproc = icside_set_speed;
492 hwif->autodma = autodma; 481 hwif->autodma = 1;
493 482
494 hwif->ide_dma_check = icside_dma_check; 483 hwif->ide_dma_check = icside_dma_check;
495 hwif->dma_host_off = icside_dma_host_off; 484 hwif->dma_host_off = icside_dma_host_off;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 45a928c058cf..638becda81c6 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -735,6 +735,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
735 cdrom_saw_media_change (drive); 735 cdrom_saw_media_change (drive);
736 /*printk("%s: media changed\n",drive->name);*/ 736 /*printk("%s: media changed\n",drive->name);*/
737 return 0; 737 return 0;
738 } else if ((sense_key == ILLEGAL_REQUEST) &&
739 (rq->cmd[0] == GPCMD_START_STOP_UNIT)) {
740 /*
741 * Don't print error message for this condition--
742 * SFF8090i indicates that 5/24/00 is the correct
743 * response to a request to close the tray if the
744 * drive doesn't have that capability.
745 * cdrom_log_sense() knows this!
746 */
738 } else if (!(rq->cmd_flags & REQ_QUIET)) { 747 } else if (!(rq->cmd_flags & REQ_QUIET)) {
739 /* Otherwise, print an error. */ 748 /* Otherwise, print an error. */
740 ide_dump_status(drive, "packet command error", stat); 749 ide_dump_status(drive, "packet command error", stat);
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 08e7cd043bcc..fd213088b06b 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -767,7 +767,7 @@ int ide_set_dma(ide_drive_t *drive)
767 switch(rc) { 767 switch(rc) {
768 case -1: /* DMA needs to be disabled */ 768 case -1: /* DMA needs to be disabled */
769 hwif->dma_off_quietly(drive); 769 hwif->dma_off_quietly(drive);
770 return 0; 770 return -1;
771 case 0: /* DMA needs to be enabled */ 771 case 0: /* DMA needs to be enabled */
772 return hwif->ide_dma_on(drive); 772 return hwif->ide_dma_on(drive);
773 case 1: /* DMA setting cannot be changed */ 773 case 1: /* DMA setting cannot be changed */
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c193553f6fe7..8670112f1d39 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
519 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) 519 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
520 try_to_flush_leftover_data(drive); 520 try_to_flush_leftover_data(drive);
521 521
522 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
523 ide_kill_rq(drive, rq);
524 return ide_stopped;
525 }
526
522 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) 527 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
523 /* force an abort */ 528 rq->errors |= ERROR_RESET;
524 hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
525 529
526 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) 530 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
527 ide_kill_rq(drive, rq);
528 else {
529 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
530 ++rq->errors;
531 return ide_do_reset(drive);
532 }
533 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
534 drive->special.b.recalibrate = 1;
535 ++rq->errors; 531 ++rq->errors;
532 return ide_do_reset(drive);
536 } 533 }
534
535 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
536 drive->special.b.recalibrate = 1;
537
538 ++rq->errors;
539
537 return ide_stopped; 540 return ide_stopped;
538} 541}
539 542
@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
1025 if (!drive->special.all) { 1028 if (!drive->special.all) {
1026 ide_driver_t *drv; 1029 ide_driver_t *drv;
1027 1030
1031 /*
1032 * We reset the drive so we need to issue a SETFEATURES.
1033 * Do it _after_ do_special() restored device parameters.
1034 */
1035 if (drive->current_speed == 0xff)
1036 ide_config_drive_speed(drive, drive->desired_speed);
1037
1028 if (rq->cmd_type == REQ_TYPE_ATA_CMD || 1038 if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
1029 rq->cmd_type == REQ_TYPE_ATA_TASK || 1039 rq->cmd_type == REQ_TYPE_ATA_TASK ||
1030 rq->cmd_type == REQ_TYPE_ATA_TASKFILE) 1040 rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
@@ -1216,6 +1226,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1216#endif 1226#endif
1217 /* so that ide_timer_expiry knows what to do */ 1227 /* so that ide_timer_expiry knows what to do */
1218 hwgroup->sleeping = 1; 1228 hwgroup->sleeping = 1;
1229 hwgroup->req_gen_timer = hwgroup->req_gen;
1219 mod_timer(&hwgroup->timer, sleep); 1230 mod_timer(&hwgroup->timer, sleep);
1220 /* we purposely leave hwgroup->busy==1 1231 /* we purposely leave hwgroup->busy==1
1221 * while sleeping */ 1232 * while sleeping */
@@ -1401,7 +1412,8 @@ void ide_timer_expiry (unsigned long data)
1401 1412
1402 spin_lock_irqsave(&ide_lock, flags); 1413 spin_lock_irqsave(&ide_lock, flags);
1403 1414
1404 if ((handler = hwgroup->handler) == NULL) { 1415 if (((handler = hwgroup->handler) == NULL) ||
1416 (hwgroup->req_gen != hwgroup->req_gen_timer)) {
1405 /* 1417 /*
1406 * Either a marginal timeout occurred 1418 * Either a marginal timeout occurred
1407 * (got the interrupt just as timer expired), 1419 * (got the interrupt just as timer expired),
@@ -1429,6 +1441,7 @@ void ide_timer_expiry (unsigned long data)
1429 if ((wait = expiry(drive)) > 0) { 1441 if ((wait = expiry(drive)) > 0) {
1430 /* reset timer */ 1442 /* reset timer */
1431 hwgroup->timer.expires = jiffies + wait; 1443 hwgroup->timer.expires = jiffies + wait;
1444 hwgroup->req_gen_timer = hwgroup->req_gen;
1432 add_timer(&hwgroup->timer); 1445 add_timer(&hwgroup->timer);
1433 spin_unlock_irqrestore(&ide_lock, flags); 1446 spin_unlock_irqrestore(&ide_lock, flags);
1434 return; 1447 return;
@@ -1643,6 +1656,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
1643 printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); 1656 printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name);
1644 } 1657 }
1645 hwgroup->handler = NULL; 1658 hwgroup->handler = NULL;
1659 hwgroup->req_gen++;
1646 del_timer(&hwgroup->timer); 1660 del_timer(&hwgroup->timer);
1647 spin_unlock(&ide_lock); 1661 spin_unlock(&ide_lock);
1648 1662
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index bd513f5a2323..3caa176b3155 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
583 if(!(drive->id->hw_config & 0x4000)) 583 if(!(drive->id->hw_config & 0x4000))
584 return 0; 584 return 0;
585#endif /* CONFIG_IDEDMA_IVB */ 585#endif /* CONFIG_IDEDMA_IVB */
586 if (!(drive->id->hw_config & 0x2000)) 586 /*
587 return 0; 587 * FIXME:
588 * - change master/slave IDENTIFY order
589 * - force bit13 (80c cable present) check
590 * (unless the slave device is pre-ATA3)
591 */
588 return 1; 592 return 1;
589} 593}
590 594
@@ -885,6 +889,7 @@ static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
885 hwgroup->handler = handler; 889 hwgroup->handler = handler;
886 hwgroup->expiry = expiry; 890 hwgroup->expiry = expiry;
887 hwgroup->timer.expires = jiffies + timeout; 891 hwgroup->timer.expires = jiffies + timeout;
892 hwgroup->req_gen_timer = hwgroup->req_gen;
888 add_timer(&hwgroup->timer); 893 add_timer(&hwgroup->timer);
889} 894}
890 895
@@ -925,6 +930,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha
925 hwgroup->handler = handler; 930 hwgroup->handler = handler;
926 hwgroup->expiry = expiry; 931 hwgroup->expiry = expiry;
927 hwgroup->timer.expires = jiffies + timeout; 932 hwgroup->timer.expires = jiffies + timeout;
933 hwgroup->req_gen_timer = hwgroup->req_gen;
928 add_timer(&hwgroup->timer); 934 add_timer(&hwgroup->timer);
929 hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); 935 hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG);
930 /* Drive takes 400nS to respond, we must avoid the IRQ being 936 /* Drive takes 400nS to respond, we must avoid the IRQ being
@@ -1090,6 +1096,9 @@ static void pre_reset(ide_drive_t *drive)
1090 if (HWIF(drive)->pre_reset != NULL) 1096 if (HWIF(drive)->pre_reset != NULL)
1091 HWIF(drive)->pre_reset(drive); 1097 HWIF(drive)->pre_reset(drive);
1092 1098
1099 if (drive->current_speed != 0xff)
1100 drive->desired_speed = drive->current_speed;
1101 drive->current_speed = 0xff;
1093} 1102}
1094 1103
1095/* 1104/*
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index dfbd74458522..ae5bf2be6f52 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -177,11 +177,7 @@ DECLARE_MUTEX(ide_cfg_sem);
177static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ 177static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
178#endif 178#endif
179 179
180#ifdef CONFIG_IDEDMA_AUTO
181int noautodma = 0; 180int noautodma = 0;
182#else
183int noautodma = 1;
184#endif
185 181
186EXPORT_SYMBOL(noautodma); 182EXPORT_SYMBOL(noautodma);
187 183
@@ -1128,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg)
1128static int set_using_dma (ide_drive_t *drive, int arg) 1124static int set_using_dma (ide_drive_t *drive, int arg)
1129{ 1125{
1130#ifdef CONFIG_BLK_DEV_IDEDMA 1126#ifdef CONFIG_BLK_DEV_IDEDMA
1127 ide_hwif_t *hwif = drive->hwif;
1128 int err = -EPERM;
1129
1131 if (!drive->id || !(drive->id->capability & 1)) 1130 if (!drive->id || !(drive->id->capability & 1))
1132 return -EPERM; 1131 goto out;
1133 if (HWIF(drive)->ide_dma_check == NULL) 1132
1134 return -EPERM; 1133 if (hwif->ide_dma_check == NULL)
1134 goto out;
1135
1136 err = -EBUSY;
1137 if (ide_spin_wait_hwgroup(drive))
1138 goto out;
1139 /*
1140 * set ->busy flag, unlock and let it ride
1141 */
1142 hwif->hwgroup->busy = 1;
1143 spin_unlock_irq(&ide_lock);
1144
1145 err = 0;
1146
1135 if (arg) { 1147 if (arg) {
1136 if (ide_set_dma(drive)) 1148 if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
1137 return -EIO; 1149 err = -EIO;
1138 if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
1139 } else 1150 } else
1140 ide_dma_off(drive); 1151 ide_dma_off(drive);
1141 return 0; 1152
1153 /*
1154 * lock, clear ->busy flag and unlock before leaving
1155 */
1156 spin_lock_irq(&ide_lock);
1157 hwif->hwgroup->busy = 0;
1158 spin_unlock_irq(&ide_lock);
1159out:
1160 return err;
1142#else 1161#else
1143 return -EPERM; 1162 return -EPERM;
1144#endif 1163#endif
@@ -1943,6 +1962,8 @@ static char *media_string(ide_drive_t *drive)
1943 return "tape"; 1962 return "tape";
1944 case ide_floppy: 1963 case ide_floppy:
1945 return "floppy"; 1964 return "floppy";
1965 case ide_optical:
1966 return "optical";
1946 default: 1967 default:
1947 return "UNKNOWN"; 1968 return "UNKNOWN";
1948 } 1969 }
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index b2dc028dc8ca..d54d9fe92a7d 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -639,6 +639,7 @@ static int au_ide_probe(struct device *dev)
639 _auide_hwif *ahwif = &auide_hwif; 639 _auide_hwif *ahwif = &auide_hwif;
640 ide_hwif_t *hwif; 640 ide_hwif_t *hwif;
641 struct resource *res; 641 struct resource *res;
642 hw_regs_t *hw;
642 int ret = 0; 643 int ret = 0;
643 644
644#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 645#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
@@ -681,7 +682,7 @@ static int au_ide_probe(struct device *dev)
681 /* FIXME: This might possibly break PCMCIA IDE devices */ 682 /* FIXME: This might possibly break PCMCIA IDE devices */
682 683
683 hwif = &ide_hwifs[pdev->id]; 684 hwif = &ide_hwifs[pdev->id];
684 hw_regs_t *hw = &hwif->hw; 685 hw = &hwif->hw;
685 hwif->irq = hw->irq = ahwif->irq; 686 hwif->irq = hw->irq = ahwif->irq;
686 hwif->chipset = ide_au1xxx; 687 hwif->chipset = ide_au1xxx;
687 688
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile
index 6591ff4753cb..95d1ea8f1f14 100644
--- a/drivers/ide/pci/Makefile
+++ b/drivers/ide/pci/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_BLK_DEV_AEC62XX) += aec62xx.o
3obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o 3obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o
4obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o 4obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o
5obj-$(CONFIG_BLK_DEV_ATIIXP) += atiixp.o 5obj-$(CONFIG_BLK_DEV_ATIIXP) += atiixp.o
6obj-$(CONFIG_BLK_DEV_CELLEB) += scc_pata.o
6obj-$(CONFIG_BLK_DEV_CMD64X) += cmd64x.o 7obj-$(CONFIG_BLK_DEV_CMD64X) += cmd64x.o
7obj-$(CONFIG_BLK_DEV_CS5520) += cs5520.o 8obj-$(CONFIG_BLK_DEV_CS5520) += cs5520.o
8obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o 9obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index b0d4825c56a9..561197f7b5bb 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,6 +1,6 @@
1/* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 1/* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16
2 * 2 *
3 * linux/drivers/ide/pci/cmd64x.c Version 1.41 Feb 3, 2007 3 * linux/drivers/ide/pci/cmd64x.c Version 1.42 Feb 8, 2007
4 * 4 *
5 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 5 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
6 * Note, this driver is not used at all on other systems because 6 * Note, this driver is not used at all on other systems because
@@ -189,6 +189,11 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count)
189 189
190#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ 190#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */
191 191
192static u8 quantize_timing(int timing, int quant)
193{
194 return (timing + quant - 1) / quant;
195}
196
192/* 197/*
193 * This routine writes the prepared setup/active/recovery counts 198 * This routine writes the prepared setup/active/recovery counts
194 * for a drive into the cmd646 chipset registers to active them. 199 * for a drive into the cmd646 chipset registers to active them.
@@ -268,47 +273,37 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ
268 */ 273 */
269static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) 274static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted)
270{ 275{
271 int setup_time, active_time, recovery_time; 276 int setup_time, active_time, cycle_time;
272 int clock_time, pio_mode, cycle_time; 277 u8 cycle_count, setup_count, active_count, recovery_count;
273 u8 recovery_count2, cycle_count; 278 u8 pio_mode;
274 int setup_count, active_count, recovery_count; 279 int clock_time = 1000 / system_bus_clock();
275 int bus_speed = system_bus_clock(); 280 ide_pio_data_t pio;
276 ide_pio_data_t d;
277 281
278 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &d); 282 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio);
279 cycle_time = d.cycle_time; 283 cycle_time = pio.cycle_time;
280 284
281 /*
282 * I copied all this complicated stuff from cmd640.c and made a few
283 * minor changes. For now I am just going to pray that it is correct.
284 */
285 setup_time = ide_pio_timings[pio_mode].setup_time; 285 setup_time = ide_pio_timings[pio_mode].setup_time;
286 active_time = ide_pio_timings[pio_mode].active_time; 286 active_time = ide_pio_timings[pio_mode].active_time;
287 recovery_time = cycle_time - (setup_time + active_time);
288 clock_time = 1000 / bus_speed;
289 cycle_count = (cycle_time + clock_time - 1) / clock_time;
290
291 setup_count = (setup_time + clock_time - 1) / clock_time;
292 287
293 active_count = (active_time + clock_time - 1) / clock_time; 288 setup_count = quantize_timing( setup_time, clock_time);
289 cycle_count = quantize_timing( cycle_time, clock_time);
290 active_count = quantize_timing(active_time, clock_time);
294 291
295 recovery_count = (recovery_time + clock_time - 1) / clock_time; 292 recovery_count = cycle_count - active_count;
296 recovery_count2 = cycle_count - (setup_count + active_count); 293 /* program_drive_counts() takes care of zero recovery cycles */
297 if (recovery_count2 > recovery_count)
298 recovery_count = recovery_count2;
299 if (recovery_count > 16) { 294 if (recovery_count > 16) {
300 active_count += recovery_count - 16; 295 active_count += recovery_count - 16;
301 recovery_count = 16; 296 recovery_count = 16;
302 } 297 }
303 if (active_count > 16) 298 if (active_count > 16)
304 active_count = 16; /* maximum allowed by cmd646 */ 299 active_count = 16; /* maximum allowed by cmd64x */
305 300
306 program_drive_counts (drive, setup_count, active_count, recovery_count); 301 program_drive_counts (drive, setup_count, active_count, recovery_count);
307 302
308 cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " 303 cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, "
309 "clocks=%d/%d/%d\n", 304 "clocks=%d/%d/%d\n",
310 drive->name, mode_wanted, pio_mode, cycle_time, 305 drive->name, mode_wanted, pio_mode, cycle_time,
311 d.overridden ? " (overriding vendor mode)" : "", 306 pio.overridden ? " (overriding vendor mode)" : "",
312 setup_count, active_count, recovery_count); 307 setup_count, active_count, recovery_count);
313 308
314 return pio_mode; 309 return pio_mode;
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 53f25500c22b..be4fc96c29e0 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -240,12 +240,31 @@ static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_devi
240 return 0; 240 return 0;
241} 241}
242 242
243/* If libata is configured, jmicron PCI quirk will configure it such
244 * that the SATA ports are in AHCI function while the PATA ports are
245 * in a separate IDE function. In such cases, match device class and
246 * attach only to IDE. If libata isn't configured, keep the old
247 * behavior for backward compatibility.
248 */
249#if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE)
250#define JMB_CLASS PCI_CLASS_STORAGE_IDE << 8
251#define JMB_CLASS_MASK 0xffff00
252#else
253#define JMB_CLASS 0
254#define JMB_CLASS_MASK 0
255#endif
256
243static struct pci_device_id jmicron_pci_tbl[] = { 257static struct pci_device_id jmicron_pci_tbl[] = {
244 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 258 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361,
245 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 259 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 0},
246 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 260 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363,
247 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 261 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 1},
248 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 262 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365,
263 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 2},
264 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366,
265 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 3},
266 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368,
267 PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 4},
249 { 0, }, 268 { 0, },
250}; 269};
251 270
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 6ceb25bc5a7b..ace98929cc3d 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive)
255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); 255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
256 } 256 }
257 257
258 if (drive->media != ide_disk) 258 if (drive->media != ide_disk && drive->media != ide_cdrom)
259 return 0; 259 return 0;
260 260
261 if (id->capability & 4) { 261 if (id->capability & 4) {
@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
545 545
546 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 546 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
547 547
548 hwif->atapi_dma = 1;
548 hwif->ultra_mask = 0x7f; 549 hwif->ultra_mask = 0x7f;
549 hwif->mwdma_mask = 0x07; 550 hwif->mwdma_mask = 0x07;
550 551
diff --git a/drivers/ide/ppc/scc_pata.c b/drivers/ide/pci/scc_pata.c
index f84bf791f72e..f84bf791f72e 100644
--- a/drivers/ide/ppc/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index a52c80fe7d3e..118fb3205ca8 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -505,11 +505,6 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
505 } 505 }
506 } 506 }
507} 507}
508
509#ifndef CONFIG_IDEDMA_PCI_AUTO
510#warning CONFIG_IDEDMA_PCI_AUTO=n support is obsolete, and will be removed soon.
511#endif
512
513#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ 508#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
514 509
515/** 510/**