]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/ide/ide-probe.c
ide: try to use PIO Mode 0 during probe if possible
[mirror_ubuntu-artful-kernel.git] / drivers / ide / ide-probe.c
index d8c1c3e735bb12ea218527c849d5e6b3d4712cae..b609a581df44995ebfe3927a77e1d72d10feff13 100644 (file)
@@ -283,13 +283,11 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
         * identify command to be sure of reply
         */
        if (cmd == ATA_CMD_ID_ATAPI) {
-               struct ide_cmd cmd;
+               struct ide_taskfile tf;
 
-               memset(&cmd, 0, sizeof(cmd));
+               memset(&tf, 0, sizeof(tf));
                /* disable DMA & overlap */
-               cmd.tf_flags = IDE_TFLAG_OUT_FEATURE;
-
-               tp_ops->tf_load(drive, &cmd);
+               tp_ops->tf_load(drive, &tf, IDE_VALID_FEATURE);
        }
 
        /* ask drive for ID */
@@ -337,14 +335,11 @@ int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus)
 
 static u8 ide_read_device(ide_drive_t *drive)
 {
-       struct ide_cmd cmd;
-
-       memset(&cmd, 0, sizeof(cmd));
-       cmd.tf_flags = IDE_TFLAG_IN_DEVICE;
+       struct ide_taskfile tf;
 
-       drive->hwif->tp_ops->tf_read(drive, &cmd);
+       drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_DEVICE);
 
-       return cmd.tf.device;
+       return tf.device;
 }
 
 /**
@@ -1037,6 +1032,15 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
                if (port_ops && port_ops->init_dev)
                        port_ops->init_dev(drive);
        }
+
+       ide_port_for_each_dev(i, drive, hwif) {
+               /*
+                * default to PIO Mode 0 before we figure out
+                * the most suited mode for the attached device
+                */
+               if (port_ops && port_ops->set_pio_mode)
+                       port_ops->set_pio_mode(drive, 0);
+       }
 }
 
 static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
@@ -1314,6 +1318,7 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws)
                host->get_lock     = d->get_lock;
                host->release_lock = d->release_lock;
                host->host_flags = d->host_flags;
+               host->irq_flags = d->irq_flags;
        }
 
        return host;