ide: turn set_irq() method into write_devctl() method
authorSergei Shtylyov <sshtylyov@ru.mvista.com>
Tue, 31 Mar 2009 18:15:30 +0000 (20:15 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 31 Mar 2009 18:15:30 +0000 (20:15 +0200)
Turn set_irq() method with its software reset hack into write_devctl() method
(for just writing a value into the device control register) at last...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
19 files changed:
drivers/ide/at91_ide.c
drivers/ide/au1xxx-ide.c
drivers/ide/falconide.c
drivers/ide/ide-eh.c
drivers/ide/ide-h8300.c
drivers/ide/ide-io-std.c
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide-pm.c
drivers/ide/ide-probe.c
drivers/ide/ide-taskfile.c
drivers/ide/ns87415.c
drivers/ide/pmac.c
drivers/ide/q40ide.c
drivers/ide/scc_pata.c
drivers/ide/sgiioc4.c
drivers/ide/tx4938ide.c
drivers/ide/tx4939ide.c
include/linux/ide.h

index 8fc6ae958b0b0e49ae1e7aaa5e1fc7c06203d50c..e6e96743aa7b82961b23a82b5a12de884652e68b 100644 (file)
@@ -295,7 +295,7 @@ static const struct ide_tp_ops at91_ide_tp_ops = {
        .exec_command   = ide_exec_command,
        .read_status    = ide_read_status,
        .read_altstatus = ide_read_altstatus,
-       .set_irq        = ide_set_irq,
+       .write_devctl   = ide_write_devctl,
 
        .tf_load        = at91_ide_tf_load,
        .tf_read        = at91_ide_tf_read,
index 1bfb43d0d3a83f95dac8f91d434101e72a73b791..2ca10d533dad6052424b2bd3a12c105bccad6f5f 100644 (file)
@@ -467,8 +467,7 @@ static const struct ide_tp_ops au1xxx_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
index b368a5effc3a029240a7dde6ff8abd265fc39346..5063be85dc33b71feb25c7983da751b84e1ecc33 100644 (file)
@@ -89,8 +89,7 @@ static const struct ide_tp_ops falconide_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
index 11664976eea30cbde1f846cfcdde5147ed17c309..de4b7f1c9c9f8a81ef32c459fb5a6ac9d1637bc1 100644 (file)
@@ -401,15 +401,14 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi)
         * immediate interrupt due to the edge transition it produces.
         * This single interrupt gives us a "fast poll" for drives that
         * recover from reset very quickly, saving us the first 50ms wait time.
-        *
-        * TODO: add ->softreset method and stop abusing ->set_irq
         */
        /* set SRST and nIEN */
-       tp_ops->set_irq(hwif, 4);
+       tp_ops->write_devctl(hwif, ATA_SRST | ATA_NIEN | ATA_DEVCTL_OBS);
        /* more than enough time */
        udelay(10);
        /* clear SRST, leave nIEN (unless device is on the quirk list) */
-       tp_ops->set_irq(hwif, drive->quirk_list == 2);
+       tp_ops->write_devctl(hwif, (drive->quirk_list == 2 ? 0 : ATA_NIEN) |
+                            ATA_DEVCTL_OBS);
        /* more than enough time */
        udelay(10);
        hwif->poll_timeout = jiffies + WAIT_WORSTCASE;
index 7492f28d1290da74f445db3688480253321b1900..a57ccad61acfb558dcbf7afa808ef62a37828aa4 100644 (file)
@@ -159,8 +159,7 @@ static const struct ide_tp_ops h8300_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = h8300_tf_load,
        .tf_read                = h8300_tf_read,
index 3a867e49a0affd13358da26967c3e036982487fe..bbeedce6b17db45368e866f5352dbbb1c3493af4 100644 (file)
@@ -64,23 +64,14 @@ u8 ide_read_altstatus(ide_hwif_t *hwif)
 }
 EXPORT_SYMBOL_GPL(ide_read_altstatus);
 
-void ide_set_irq(ide_hwif_t *hwif, int on)
+void ide_write_devctl(ide_hwif_t *hwif, u8 ctl)
 {
-       u8 ctl = ATA_DEVCTL_OBS;
-
-       if (on == 4) { /* hack for SRST */
-               ctl |= 4;
-               on &= ~4;
-       }
-
-       ctl |= on ? 0 : 2;
-
        if (hwif->host_flags & IDE_HFLAG_MMIO)
                writeb(ctl, (void __iomem *)hwif->io_ports.ctl_addr);
        else
                outb(ctl, hwif->io_ports.ctl_addr);
 }
-EXPORT_SYMBOL_GPL(ide_set_irq);
+EXPORT_SYMBOL_GPL(ide_write_devctl);
 
 void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
 {
@@ -312,8 +303,7 @@ const struct ide_tp_ops default_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
index 3c52317d85246e510ec813525b25ec2dffc77936..5b57905a7d713e5174980d38ee642bd6758a837c 100644 (file)
@@ -494,7 +494,9 @@ repeat:
                         * quirk_list may not like intr setups/cleanups
                         */
                        if (prev_port && prev_port->cur_dev->quirk_list == 0)
-                               prev_port->tp_ops->set_irq(prev_port, 0);
+                               prev_port->tp_ops->write_devctl(prev_port,
+                                                               ATA_NIEN |
+                                                               ATA_DEVCTL_OBS);
 
                        hwif->host->cur_port = hwif;
                }
index 0caca342802d4d7c167bc858247044806a6a0be3..ae227dd8466f683a093c99a646c0ebd1525c9bff 100644 (file)
@@ -360,7 +360,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
        SELECT_DRIVE(drive);
        SELECT_MASK(drive, 1);
        udelay(1);
-       tp_ops->set_irq(hwif, 0);
+       tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
 
        memset(&cmd, 0, sizeof(cmd));
        cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT;
@@ -372,7 +372,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
        tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES);
 
        if (drive->quirk_list == 2)
-               tp_ops->set_irq(hwif, 1);
+               tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
 
        error = __ide_wait_stat(drive, drive->ready_stat,
                                ATA_BUSY | ATA_DRQ | ATA_ERR,
index ebf2d21ebdcbdd3ccb7fdad35e1ffdafee1ac89f..20553d4c42a2410e4df3873c6efec6c3aa428a28 100644 (file)
@@ -233,7 +233,7 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
                if (rc)
                        printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
                SELECT_DRIVE(drive);
-               hwif->tp_ops->set_irq(hwif, 1);
+               hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
                rc = ide_wait_not_busy(hwif, 100000);
                if (rc)
                        printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
index 7c1f1bf818362da8689dc26efa55dfd00777d14c..d240f76b0da6bcb50670b792255e050ee4b9b307 100644 (file)
@@ -260,7 +260,7 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
         * during the identify phase that the IRQ handler isn't expecting.
         */
        if (io_ports->ctl_addr)
-               tp_ops->set_irq(hwif, 0);
+               tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
 
        /* take a deep breath */
        msleep(50);
@@ -628,7 +628,7 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
                if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 ||
                    (drive->dev_flags & IDE_DFLAG_PRESENT)) {
                        SELECT_DRIVE(drive);
-                       hwif->tp_ops->set_irq(hwif, 1);
+                       hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
                        mdelay(2);
                        rc = ide_wait_not_busy(hwif, 35000);
                        if (rc)
@@ -845,7 +845,7 @@ static int init_irq (ide_hwif_t *hwif)
                irq_handler = ide_intr;
 
        if (io_ports->ctl_addr)
-               hwif->tp_ops->set_irq(hwif, 1);
+               hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
 
        if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
                goto out_up;
index dba68db629bf906bfa1d7006e4556b6bfd1b51ab..47f13cd11031a36dfec07a84e05836437d475319 100644 (file)
@@ -80,7 +80,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
 
        if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
                ide_tf_dump(drive->name, tf);
-               tp_ops->set_irq(hwif, 1);
+               tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
                SELECT_MASK(drive, 0);
                tp_ops->tf_load(drive, cmd);
        }
index 13a9e00efa134c57d4d75f9b6f9fc1900b8ae695..00ab0be7335a616ae57a7131b46aa4c161fe06ef 100644 (file)
@@ -109,8 +109,7 @@ static const struct ide_tp_ops superio_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = superio_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = superio_tf_read,
index 879c3d8d9f36d299c7764c51d9c7eb0535cc2955..7aa45ea37eeb0dde37a1384d4c3573e1c6068b66 100644 (file)
@@ -476,17 +476,8 @@ static void pmac_exec_command(ide_hwif_t *hwif, u8 cmd)
                                     + IDE_TIMING_CONFIG));
 }
 
-static void pmac_set_irq(ide_hwif_t *hwif, int on)
+static void pmac_write_devctl(ide_hwif_t *hwif, u8 ctl)
 {
-       u8 ctl = ATA_DEVCTL_OBS;
-
-       if (on == 4) { /* hack for SRST */
-               ctl |= 4;
-               on &= ~4;
-       }
-
-       ctl |= on ? 0 : 2;
-
        writeb(ctl, (void __iomem *)hwif->io_ports.ctl_addr);
        (void)readl((void __iomem *)(hwif->io_ports.data_addr
                                     + IDE_TIMING_CONFIG));
@@ -954,8 +945,7 @@ static const struct ide_tp_ops pmac_tp_ops = {
        .exec_command           = pmac_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = pmac_set_irq,
+       .write_devctl           = pmac_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
index 2a43a2f496337181e48c86700a403dc4f40ac50e..7fddfd34fcce71c7710cbf8623418f42e7ece529 100644 (file)
@@ -99,8 +99,7 @@ static const struct ide_tp_ops q40ide_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
index 6e47eac1cd7fd6d5c2b394cae6a35e2fd15190bd..6ba4983d831c0b6dd64c241a47305ce1c2c4c6bb 100644 (file)
@@ -148,17 +148,8 @@ static u8 scc_dma_sff_read_status(ide_hwif_t *hwif)
        return (u8)in_be32((void *)(hwif->dma_base + 4));
 }
 
-static void scc_set_irq(ide_hwif_t *hwif, int on)
+static void scc_write_devctl(ide_hwif_t *hwif, u8 ctl)
 {
-       u8 ctl = ATA_DEVCTL_OBS;
-
-       if (on == 4) { /* hack for SRST */
-               ctl |= 4;
-               on &= ~4;
-       }
-
-       ctl |= on ? 0 : 2;
-
        out_be32((void *)hwif->io_ports.ctl_addr, ctl);
        eieio();
        in_be32((void *)(hwif->dma_base + 0x01c));
@@ -843,8 +834,7 @@ static const struct ide_tp_ops scc_tp_ops = {
        .exec_command           = scc_exec_command,
        .read_status            = scc_read_status,
        .read_altstatus         = scc_read_altstatus,
-
-       .set_irq                = scc_set_irq,
+       .write_devctl           = scc_write_devctl,
 
        .tf_load                = scc_tf_load,
        .tf_read                = scc_tf_read,
index 6ef5a567d377b9a0415ad832e7175b680eff8919..58980fcafc3b94a3505cc6c91542c5bfa56768a0 100644 (file)
@@ -503,8 +503,7 @@ static const struct ide_tp_ops sgiioc4_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = sgiioc4_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = ide_tf_load,
        .tf_read                = ide_tf_read,
index 1c4a78ac1a208e98403005dd67987bcf7f29e6bc..ec3aa32fbbe0d4cd00f8a6dde92b141ef077b911 100644 (file)
@@ -204,8 +204,7 @@ static const struct ide_tp_ops tx4938ide_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = tx4938ide_tf_load,
        .tf_read                = tx4938ide_tf_read,
index 77aee5b2ce954050fd64b6d39a3590e2be2336a3..43bc0372413a121e5cf33dc97d4c51c88771709b 100644 (file)
@@ -571,8 +571,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = tx4939ide_tf_load,
        .tf_read                = tx4939ide_tf_read,
@@ -595,8 +594,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
        .exec_command           = ide_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-
-       .set_irq                = ide_set_irq,
+       .write_devctl           = ide_write_devctl,
 
        .tf_load                = tx4939ide_tf_load,
        .tf_read                = ide_tf_read,
index 836c4c6cb7e303abb2f62eabf7ea3914c503ff4b..ccb70abe991bf100285c3512eaafd4a485e81561 100644 (file)
@@ -655,8 +655,7 @@ struct ide_tp_ops {
        void    (*exec_command)(struct hwif_s *, u8);
        u8      (*read_status)(struct hwif_s *);
        u8      (*read_altstatus)(struct hwif_s *);
-
-       void    (*set_irq)(struct hwif_s *, int);
+       void    (*write_devctl)(struct hwif_s *, u8);
 
        void    (*tf_load)(ide_drive_t *, struct ide_cmd *);
        void    (*tf_read)(ide_drive_t *, struct ide_cmd *);
@@ -1165,8 +1164,7 @@ void ide_tf_dump(const char *, struct ide_taskfile *);
 void ide_exec_command(ide_hwif_t *, u8);
 u8 ide_read_status(ide_hwif_t *);
 u8 ide_read_altstatus(ide_hwif_t *);
-
-void ide_set_irq(ide_hwif_t *, int);
+void ide_write_devctl(ide_hwif_t *, u8);
 
 void ide_tf_load(ide_drive_t *, struct ide_cmd *);
 void ide_tf_read(ide_drive_t *, struct ide_cmd *);