Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[pandora-kernel.git] / drivers / ata / libata-core.c
index 6a2083a..e900c5e 100644 (file)
@@ -93,6 +93,10 @@ static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ;
 module_param(ata_probe_timeout, int, 0444);
 MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)");
 
+int noacpi;
+module_param(noacpi, int, 0444);
+MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set");
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
@@ -1410,7 +1414,16 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
        }
 
        tf.protocol = ATA_PROT_PIO;
-       tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */
+
+       /* Some devices choke if TF registers contain garbage.  Make
+        * sure those are properly initialized.
+        */
+       tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+
+       /* Device presence detection is unreliable on some
+        * controllers.  Always poll IDENTIFY if available.
+        */
+       tf.flags |= ATA_TFLAG_POLLING;
 
        err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
                                     id, sizeof(id[0]) * ATA_ID_WORDS);
@@ -1555,6 +1568,16 @@ int ata_dev_configure(struct ata_device *dev)
                ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER, host %u, dev %u\n",
                               __FUNCTION__, ap->id, dev->devno);
 
+       /* set _SDD */
+       rc = ata_acpi_push_id(ap, dev->devno);
+       if (rc) {
+               ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n",
+                       rc);
+       }
+
+       /* retrieve and execute the ATA task file of _GTF */
+       ata_acpi_exec_tfs(ap);
+
        /* print device capabilities */
        if (ata_msg_probe(ap))
                ata_dev_printk(dev, KERN_DEBUG,
@@ -1597,10 +1620,10 @@ int ata_dev_configure(struct ata_device *dev)
                dev->n_sectors = ata_id_n_sectors(id);
 
                /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
-               ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV_OFS,
+               ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
                                sizeof(fwrevbuf));
 
-               ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD_OFS,
+               ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
                                sizeof(modelbuf));
 
                if (dev->id[59] & 0x100)
@@ -2333,6 +2356,10 @@ static int ata_dev_set_mode(struct ata_device *dev)
                dev->flags |= ATA_DFLAG_PIO;
 
        err_mask = ata_dev_set_xfermode(dev);
+       /* Old CFA may refuse this command, which is just fine */
+       if (dev->xfer_shift == ATA_SHIFT_PIO && ata_id_is_cfa(dev->id))
+               err_mask &= ~AC_ERR_DEV;
+
        if (err_mask) {
                ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
                               "(err_mask=0x%x)\n", err_mask);