Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
[pandora-kernel.git] / drivers / ata / ahci.c
index 71afe03..fb7b90b 100644 (file)
@@ -79,8 +79,6 @@ enum board_ids {
 };
 
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
-                         unsigned long deadline);
 static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
                                 unsigned long deadline);
 static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
@@ -104,12 +102,6 @@ static struct ata_port_operations ahci_p5wdh_ops = {
        .hardreset              = ahci_p5wdh_hardreset,
 };
 
-static struct ata_port_operations ahci_sb600_ops = {
-       .inherits               = &ahci_ops,
-       .softreset              = ahci_sb600_softreset,
-       .pmp_softreset          = ahci_sb600_softreset,
-};
-
 #define AHCI_HFLAGS(flags)     .private_data   = (void *)(flags)
 
 static const struct ata_port_info ahci_port_info[] = {
@@ -188,7 +180,7 @@ static const struct ata_port_info ahci_port_info[] = {
                .flags          = AHCI_FLAG_COMMON,
                .pio_mask       = ATA_PIO4,
                .udma_mask      = ATA_UDMA6,
-               .port_ops       = &ahci_sb600_ops,
+               .port_ops       = &ahci_pmp_retry_srst_ops,
        },
        [board_ahci_sb700] =    /* for SB700 and SB800 */
        {
@@ -196,7 +188,7 @@ static const struct ata_port_info ahci_port_info[] = {
                .flags          = AHCI_FLAG_COMMON,
                .pio_mask       = ATA_PIO4,
                .udma_mask      = ATA_UDMA6,
-               .port_ops       = &ahci_sb600_ops,
+               .port_ops       = &ahci_pmp_retry_srst_ops,
        },
        [board_ahci_vt8251] =
        {
@@ -267,6 +259,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
        { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */
        { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */
        { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */
+       { PCI_VDEVICE(INTEL, 0x1e0e), board_ahci }, /* Panther Point RAID */
 
        /* JMicron 360/1/3/5/6, match class to avoid IDE function */
        { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -502,55 +495,6 @@ static void ahci_pci_init_controller(struct ata_host *host)
        ahci_init_controller(host);
 }
 
-static int ahci_sb600_check_ready(struct ata_link *link)
-{
-       void __iomem *port_mmio = ahci_port_base(link->ap);
-       u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
-       u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
-
-       /*
-        * There is no need to check TFDATA if BAD PMP is found due to HW bug,
-        * which can save timeout delay.
-        */
-       if (irq_status & PORT_IRQ_BAD_PMP)
-               return -EIO;
-
-       return ata_check_ready(status);
-}
-
-static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
-                               unsigned long deadline)
-{
-       struct ata_port *ap = link->ap;
-       void __iomem *port_mmio = ahci_port_base(ap);
-       int pmp = sata_srst_pmp(link);
-       int rc;
-       u32 irq_sts;
-
-       DPRINTK("ENTER\n");
-
-       rc = ahci_do_softreset(link, class, pmp, deadline,
-                              ahci_sb600_check_ready);
-
-       /*
-        * Soft reset fails on some ATI chips with IPMS set when PMP
-        * is enabled but SATA HDD/ODD is connected to SATA port,
-        * do soft reset again to port 0.
-        */
-       if (rc == -EIO) {
-               irq_sts = readl(port_mmio + PORT_IRQ_STAT);
-               if (irq_sts & PORT_IRQ_BAD_PMP) {
-                       ata_link_printk(link, KERN_WARNING,
-                                       "applying SB600 PMP SRST workaround "
-                                       "and retrying\n");
-                       rc = ahci_do_softreset(link, class, 0, deadline,
-                                              ahci_check_ready);
-               }
-       }
-
-       return rc;
-}
-
 static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
                                 unsigned long deadline)
 {
@@ -629,8 +573,8 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 
        if (mesg.event & PM_EVENT_SUSPEND &&
            hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "BIOS update required for suspend/resume\n");
+               dev_err(&pdev->dev,
+                       "BIOS update required for suspend/resume\n");
                return -EIO;
        }
 
@@ -681,22 +625,21 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
                if (rc) {
                        rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                        if (rc) {
-                               dev_printk(KERN_ERR, &pdev->dev,
-                                          "64-bit DMA enable failed\n");
+                               dev_err(&pdev->dev,
+                                       "64-bit DMA enable failed\n");
                                return rc;
                        }
                }
        } else {
                rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "32-bit DMA enable failed\n");
+                       dev_err(&pdev->dev, "32-bit DMA enable failed\n");
                        return rc;
                }
                rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "32-bit consistent DMA enable failed\n");
+                       dev_err(&pdev->dev,
+                               "32-bit consistent DMA enable failed\n");
                        return rc;
                }
        }
@@ -759,8 +702,8 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
            dmi_check_system(sysids)) {
                struct ata_port *ap = host->ports[1];
 
-               dev_printk(KERN_INFO, &pdev->dev, "enabling ASUS P5W DH "
-                          "Deluxe on-board SIMG4726 workaround\n");
+               dev_info(&pdev->dev,
+                        "enabling ASUS P5W DH Deluxe on-board SIMG4726 workaround\n");
 
                ap->ops = &ahci_p5wdh_ops;
                ap->link.flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA;
@@ -811,6 +754,18 @@ static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
                                DMI_MATCH(DMI_BOARD_NAME, "MS-7376"),
                        },
                },
+               /*
+                * All BIOS versions for the Asus M3A support 64bit DMA.
+                * (all release versions from 0301 to 1206 were tested)
+                */
+               {
+                       .ident = "ASUS M3A",
+                       .matches = {
+                               DMI_MATCH(DMI_BOARD_VENDOR,
+                                         "ASUSTeK Computer INC."),
+                               DMI_MATCH(DMI_BOARD_NAME, "M3A"),
+                       },
+               },
                { }
        };
        const struct dmi_system_id *match;
@@ -831,14 +786,14 @@ static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
        if (strcmp(buf, match->driver_data) >= 0)
                goto enable_64bit;
        else {
-               dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, "
-                          "forcing 32bit DMA, update BIOS\n", match->ident);
+               dev_warn(&pdev->dev,
+                        "%s: BIOS too old, forcing 32bit DMA, update BIOS\n",
+                        match->ident);
                return false;
        }
 
 enable_64bit:
-       dev_printk(KERN_WARNING, &pdev->dev, "%s: enabling 64bit DMA\n",
-                  match->ident);
+       dev_warn(&pdev->dev, "%s: enabling 64bit DMA\n", match->ident);
        return true;
 }
 
@@ -1041,9 +996,8 @@ static void ahci_gtf_filter_workaround(struct ata_host *host)
                return;
 
        filter = (unsigned long)dmi->driver_data;
-       dev_printk(KERN_INFO, host->dev,
-                  "applying extra ACPI _GTF filter 0x%x for %s\n",
-                  filter, dmi->ident);
+       dev_info(host->dev, "applying extra ACPI _GTF filter 0x%x for %s\n",
+                filter, dmi->ident);
 
        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap = host->ports[i];
@@ -1062,7 +1016,6 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
 
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       static int printed_version;
        unsigned int board_id = ent->driver_data;
        struct ata_port_info pi = ahci_port_info[board_id];
        const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1075,8 +1028,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        /* The AHCI driver can only drive the SATA ports, the PATA driver
           can drive them all so if both drivers are selected make sure
@@ -1099,8 +1051,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
         * that for SAS drives they're out of luck.
         */
        if (pdev->vendor == PCI_VENDOR_ID_PROMISE)
-               dev_printk(KERN_INFO, &pdev->dev, "PDC42819 "
-                          "can only drive SATA devices with this driver\n");
+               dev_info(&pdev->dev,
+                        "PDC42819 can only drive SATA devices with this driver\n");
 
        /* acquire resources */
        rc = pcim_enable_device(pdev);
@@ -1126,8 +1078,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                 */
                pci_read_config_byte(pdev, ICH_MAP, &map);
                if (map & 0x3) {
-                       dev_printk(KERN_INFO, &pdev->dev, "controller is in "
-                                  "combined mode, can't enable AHCI mode\n");
+                       dev_info(&pdev->dev,
+                                "controller is in combined mode, can't enable AHCI mode\n");
                        return -ENODEV;
                }
        }
@@ -1184,8 +1136,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        if (ahci_broken_suspend(pdev)) {
                hpriv->flags |= AHCI_HFLAG_NO_SUSPEND;
-               dev_printk(KERN_WARNING, &pdev->dev,
-                          "BIOS update required for suspend/resume\n");
+               dev_warn(&pdev->dev,
+                        "BIOS update required for suspend/resume\n");
        }
 
        if (ahci_broken_online(pdev)) {