aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-io.c14
-rw-r--r--drivers/ide/ide-iops.c37
-rw-r--r--drivers/ide/ide-probe.c9
-rw-r--r--drivers/ide/ide-taskfile.c2
-rw-r--r--drivers/ide/pci/scc_pata.c19
-rw-r--r--drivers/ide/ppc/pmac.c17
-rw-r--r--include/linux/ide.h10
7 files changed, 78 insertions, 30 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index fdc221ce9920..bbd7bd4c48ee 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -746,16 +746,17 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
746 * the bus may be broken enough to walk on our toes at this 746 * the bus may be broken enough to walk on our toes at this
747 * point. 747 * point.
748 */ 748 */
749 ide_hwif_t *hwif = drive->hwif;
749 int rc; 750 int rc;
750#ifdef DEBUG_PM 751#ifdef DEBUG_PM
751 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); 752 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name);
752#endif 753#endif
753 rc = ide_wait_not_busy(HWIF(drive), 35000); 754 rc = ide_wait_not_busy(hwif, 35000);
754 if (rc) 755 if (rc)
755 printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); 756 printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
756 SELECT_DRIVE(drive); 757 SELECT_DRIVE(drive);
757 ide_set_irq(drive, 1); 758 hwif->set_irq(hwif, 1);
758 rc = ide_wait_not_busy(HWIF(drive), 100000); 759 rc = ide_wait_not_busy(hwif, 100000);
759 if (rc) 760 if (rc)
760 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); 761 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
761 } 762 }
@@ -1041,7 +1042,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1041 * quirk_list may not like intr setups/cleanups 1042 * quirk_list may not like intr setups/cleanups
1042 */ 1043 */
1043 if (drive->quirk_list != 1) 1044 if (drive->quirk_list != 1)
1044 ide_set_irq(drive, 0); 1045 hwif->set_irq(hwif, 0);
1045 } 1046 }
1046 hwgroup->hwif = hwif; 1047 hwgroup->hwif = hwif;
1047 hwgroup->drive = drive; 1048 hwgroup->drive = drive;
@@ -1519,6 +1520,7 @@ EXPORT_SYMBOL(ide_do_drive_cmd);
1519 1520
1520void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) 1521void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)
1521{ 1522{
1523 ide_hwif_t *hwif = drive->hwif;
1522 ide_task_t task; 1524 ide_task_t task;
1523 1525
1524 memset(&task, 0, sizeof(task)); 1526 memset(&task, 0, sizeof(task));
@@ -1529,9 +1531,9 @@ void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)
1529 task.tf.lbah = (bcount >> 8) & 0xff; 1531 task.tf.lbah = (bcount >> 8) & 0xff;
1530 1532
1531 ide_tf_dump(drive->name, &task.tf); 1533 ide_tf_dump(drive->name, &task.tf);
1532 ide_set_irq(drive, 1); 1534 hwif->set_irq(hwif, 1);
1533 SELECT_MASK(drive, 0); 1535 SELECT_MASK(drive, 0);
1534 drive->hwif->tf_load(drive, &task); 1536 hwif->tf_load(drive, &task);
1535} 1537}
1536 1538
1537EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); 1539EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index e106954e13f9..41ec53f329fa 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -135,6 +135,23 @@ static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
135 return inb(hwif->dma_base + ATA_DMA_STATUS); 135 return inb(hwif->dma_base + ATA_DMA_STATUS);
136} 136}
137 137
138static void ide_set_irq(ide_hwif_t *hwif, int on)
139{
140 u8 ctl = ATA_DEVCTL_OBS;
141
142 if (on == 4) { /* hack for SRST */
143 ctl |= 4;
144 on &= ~4;
145 }
146
147 ctl |= on ? 0 : 2;
148
149 if (hwif->host_flags & IDE_HFLAG_MMIO)
150 writeb(ctl, (void __iomem *)hwif->io_ports.ctl_addr);
151 else
152 outb(ctl, hwif->io_ports.ctl_addr);
153}
154
138static void ide_tf_load(ide_drive_t *drive, ide_task_t *task) 155static void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
139{ 156{
140 ide_hwif_t *hwif = drive->hwif; 157 ide_hwif_t *hwif = drive->hwif;
@@ -360,6 +377,8 @@ void default_hwif_transport(ide_hwif_t *hwif)
360 hwif->read_altstatus = ide_read_altstatus; 377 hwif->read_altstatus = ide_read_altstatus;
361 hwif->read_sff_dma_status = ide_read_sff_dma_status; 378 hwif->read_sff_dma_status = ide_read_sff_dma_status;
362 379
380 hwif->set_irq = ide_set_irq;
381
363 hwif->tf_load = ide_tf_load; 382 hwif->tf_load = ide_tf_load;
364 hwif->tf_read = ide_tf_read; 383 hwif->tf_read = ide_tf_read;
365 384
@@ -722,7 +741,7 @@ int ide_driveid_update(ide_drive_t *drive)
722 */ 741 */
723 742
724 SELECT_MASK(drive, 1); 743 SELECT_MASK(drive, 1);
725 ide_set_irq(drive, 0); 744 hwif->set_irq(hwif, 0);
726 msleep(50); 745 msleep(50);
727 hwif->exec_command(hwif, WIN_IDENTIFY); 746 hwif->exec_command(hwif, WIN_IDENTIFY);
728 timeout = jiffies + WAIT_WORSTCASE; 747 timeout = jiffies + WAIT_WORSTCASE;
@@ -808,12 +827,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
808 SELECT_DRIVE(drive); 827 SELECT_DRIVE(drive);
809 SELECT_MASK(drive, 0); 828 SELECT_MASK(drive, 0);
810 udelay(1); 829 udelay(1);
811 ide_set_irq(drive, 0); 830 hwif->set_irq(hwif, 0);
812 hwif->OUTB(speed, io_ports->nsect_addr); 831 hwif->OUTB(speed, io_ports->nsect_addr);
813 hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr); 832 hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr);
814 hwif->exec_command(hwif, WIN_SETFEATURES); 833 hwif->exec_command(hwif, WIN_SETFEATURES);
815 if (drive->quirk_list == 2) 834 if (drive->quirk_list == 2)
816 ide_set_irq(drive, 1); 835 hwif->set_irq(hwif, 1);
817 836
818 error = __ide_wait_stat(drive, drive->ready_stat, 837 error = __ide_wait_stat(drive, drive->ready_stat,
819 BUSY_STAT|DRQ_STAT|ERR_STAT, 838 BUSY_STAT|DRQ_STAT|ERR_STAT,
@@ -1129,7 +1148,6 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1129 ide_hwgroup_t *hwgroup; 1148 ide_hwgroup_t *hwgroup;
1130 struct ide_io_ports *io_ports; 1149 struct ide_io_ports *io_ports;
1131 const struct ide_port_ops *port_ops; 1150 const struct ide_port_ops *port_ops;
1132 u8 ctl;
1133 1151
1134 spin_lock_irqsave(&ide_lock, flags); 1152 spin_lock_irqsave(&ide_lock, flags);
1135 hwif = HWIF(drive); 1153 hwif = HWIF(drive);
@@ -1174,16 +1192,15 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1174 * immediate interrupt due to the edge transition it produces. 1192 * immediate interrupt due to the edge transition it produces.
1175 * This single interrupt gives us a "fast poll" for drives that 1193 * This single interrupt gives us a "fast poll" for drives that
1176 * recover from reset very quickly, saving us the first 50ms wait time. 1194 * recover from reset very quickly, saving us the first 50ms wait time.
1195 *
1196 * TODO: add ->softreset method and stop abusing ->set_irq
1177 */ 1197 */
1178 /* set SRST and nIEN */ 1198 /* set SRST and nIEN */
1179 hwif->OUTBSYNC(hwif, ATA_DEVCTL_OBS | 6, io_ports->ctl_addr); 1199 hwif->set_irq(hwif, 4);
1180 /* more than enough time */ 1200 /* more than enough time */
1181 udelay(10); 1201 udelay(10);
1182 if (drive->quirk_list == 2) 1202 /* clear SRST, leave nIEN (unless device is on the quirk list) */
1183 ctl = ATA_DEVCTL_OBS; /* clear SRST and nIEN */ 1203 hwif->set_irq(hwif, drive->quirk_list == 2);
1184 else
1185 ctl = ATA_DEVCTL_OBS | 2; /* clear SRST, leave nIEN */
1186 hwif->OUTBSYNC(hwif, ctl, io_ports->ctl_addr);
1187 /* more than enough time */ 1204 /* more than enough time */
1188 udelay(10); 1205 udelay(10);
1189 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 1206 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index fe14d576ef01..475bd7263184 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -361,7 +361,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
361 autoprobe = 1; 361 autoprobe = 1;
362 cookie = probe_irq_on(); 362 cookie = probe_irq_on();
363 } 363 }
364 ide_set_irq(drive, autoprobe); 364 hwif->set_irq(hwif, autoprobe);
365 } 365 }
366 366
367 retval = actual_try_to_identify(drive, cmd); 367 retval = actual_try_to_identify(drive, cmd);
@@ -369,7 +369,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
369 if (autoprobe) { 369 if (autoprobe) {
370 int irq; 370 int irq;
371 371
372 ide_set_irq(drive, 0); 372 hwif->set_irq(hwif, 0);
373 /* clear drive IRQ */ 373 /* clear drive IRQ */
374 (void)hwif->read_status(hwif); 374 (void)hwif->read_status(hwif);
375 udelay(5); 375 udelay(5);
@@ -709,7 +709,7 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
709 /* Ignore disks that we will not probe for later. */ 709 /* Ignore disks that we will not probe for later. */
710 if (!drive->noprobe || drive->present) { 710 if (!drive->noprobe || drive->present) {
711 SELECT_DRIVE(drive); 711 SELECT_DRIVE(drive);
712 ide_set_irq(drive, 1); 712 hwif->set_irq(hwif, 1);
713 mdelay(2); 713 mdelay(2);
714 rc = ide_wait_not_busy(hwif, 35000); 714 rc = ide_wait_not_busy(hwif, 35000);
715 if (rc) 715 if (rc)
@@ -1066,8 +1066,7 @@ static int init_irq (ide_hwif_t *hwif)
1066 sa = IRQF_SHARED; 1066 sa = IRQF_SHARED;
1067 1067
1068 if (io_ports->ctl_addr) 1068 if (io_ports->ctl_addr)
1069 /* clear nIEN */ 1069 hwif->set_irq(hwif, 1);
1070 hwif->OUTBSYNC(hwif, ATA_DEVCTL_OBS, io_ports->ctl_addr);
1071 1070
1072 if (request_irq(hwif->irq,&ide_intr,sa,hwif->name,hwgroup)) 1071 if (request_irq(hwif->irq,&ide_intr,sa,hwif->name,hwgroup))
1073 goto out_unlink; 1072 goto out_unlink;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index fc2b3957afac..ea345369553e 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -80,7 +80,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
80 80
81 if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { 81 if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
82 ide_tf_dump(drive->name, tf); 82 ide_tf_dump(drive->name, tf);
83 ide_set_irq(drive, 1); 83 hwif->set_irq(hwif, 1);
84 SELECT_MASK(drive, 0); 84 SELECT_MASK(drive, 0);
85 hwif->tf_load(drive, task); 85 hwif->tf_load(drive, task);
86 } 86 }
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index a89dc4780786..727eda6db76c 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -149,6 +149,23 @@ static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
149 return (u8)in_be32((void *)(hwif->dma_base + 4)); 149 return (u8)in_be32((void *)(hwif->dma_base + 4));
150} 150}
151 151
152static void scc_set_irq(ide_hwif_t *hwif, int on)
153{
154 u8 ctl = ATA_DEVCTL_OBS;
155
156 if (on == 4) { /* hack for SRST */
157 ctl |= 4;
158 on &= ~4;
159 }
160
161 ctl |= on ? 0 : 2;
162
163 out_be32((void *)hwif->io_ports.ctl_addr, ctl);
164 eieio();
165 in_be32((void *)(hwif->dma_base + 0x01c));
166 eieio();
167}
168
152static void scc_ide_insw(unsigned long port, void *addr, u32 count) 169static void scc_ide_insw(unsigned long port, void *addr, u32 count)
153{ 170{
154 u16 *ptr = (u16 *)addr; 171 u16 *ptr = (u16 *)addr;
@@ -802,6 +819,8 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
802 hwif->read_altstatus = scc_read_altstatus; 819 hwif->read_altstatus = scc_read_altstatus;
803 hwif->read_sff_dma_status = scc_read_sff_dma_status; 820 hwif->read_sff_dma_status = scc_read_sff_dma_status;
804 821
822 hwif->set_irq = scc_set_irq;
823
805 hwif->tf_load = scc_tf_load; 824 hwif->tf_load = scc_tf_load;
806 hwif->tf_read = scc_tf_read; 825 hwif->tf_read = scc_tf_read;
807 826
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 7c3a84f8fbed..a0d66480a797 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -502,6 +502,22 @@ static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd)
502 + IDE_TIMING_CONFIG)); 502 + IDE_TIMING_CONFIG));
503} 503}
504 504
505static void pmac_set_irq(ide_hwif_t *hwif, int on)
506{
507 u8 ctl = ATA_DEVCTL_OBS;
508
509 if (on == 4) { /* hack for SRST */
510 ctl |= 4;
511 on &= ~4;
512 }
513
514 ctl |= on ? 0 : 2;
515
516 writeb(ctl, (void __iomem *)hwif->io_ports.ctl_addr);
517 (void)readl((void __iomem *)(hwif->io_ports.data_addr
518 + IDE_TIMING_CONFIG));
519}
520
505/* 521/*
506 * Old tuning functions (called on hdparm -p), sets up drive PIO timings 522 * Old tuning functions (called on hdparm -p), sets up drive PIO timings
507 */ 523 */
@@ -1100,6 +1116,7 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1100 return -ENOENT; 1116 return -ENOENT;
1101 1117
1102 hwif->exec_command = pmac_exec_command; 1118 hwif->exec_command = pmac_exec_command;
1119 hwif->set_irq = pmac_set_irq;
1103 1120
1104 /* Setup MMIO ops */ 1121 /* Setup MMIO ops */
1105 default_hwif_mmiops(hwif); 1122 default_hwif_mmiops(hwif);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e5fa5e868d67..ae93f89e4448 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -494,6 +494,8 @@ typedef struct hwif_s {
494 u8 (*read_altstatus)(struct hwif_s *); 494 u8 (*read_altstatus)(struct hwif_s *);
495 u8 (*read_sff_dma_status)(struct hwif_s *); 495 u8 (*read_sff_dma_status)(struct hwif_s *);
496 496
497 void (*set_irq)(struct hwif_s *, int);
498
497 void (*tf_load)(ide_drive_t *, struct ide_task_s *); 499 void (*tf_load)(ide_drive_t *, struct ide_task_s *);
498 void (*tf_read)(ide_drive_t *, struct ide_task_s *); 500 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
499 501
@@ -1356,14 +1358,6 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1356 return &hwif->drives[(drive->dn ^ 1) & 1]; 1358 return &hwif->drives[(drive->dn ^ 1) & 1];
1357} 1359}
1358 1360
1359static inline void ide_set_irq(ide_drive_t *drive, int on)
1360{
1361 ide_hwif_t *hwif = drive->hwif;
1362
1363 hwif->OUTBSYNC(hwif, ATA_DEVCTL_OBS | (on ? 0 : 2),
1364 hwif->io_ports.ctl_addr);
1365}
1366
1367static inline u8 ide_read_error(ide_drive_t *drive) 1361static inline u8 ide_read_error(ide_drive_t *drive)
1368{ 1362{
1369 ide_hwif_t *hwif = drive->hwif; 1363 ide_hwif_t *hwif = drive->hwif;