Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[firefly-linux-kernel-4.4.55.git] / drivers / scsi / sata_nv.c
index 03d9bc6e69dfafddda8dc2f39b10953ad00fc6af..1a56d6c79dddfc8fac2e52d4320110977e1ce599 100644 (file)
@@ -29,6 +29,8 @@
  *  NV-specific details such as register offsets, SATA phy location,
  *  hotplug info, etc.
  *
+ *  0.09
+ *     - Fixed bug introduced by 0.08's MCP51 and MCP55 support.
  *
  *  0.08
  *     - Added support for MCP51 and MCP55.
@@ -132,9 +134,7 @@ enum nv_host_type
        GENERIC,
        NFORCE2,
        NFORCE3,
-       CK804,
-       MCP51,
-       MCP55
+       CK804
 };
 
 static struct pci_device_id nv_pci_tbl[] = {
@@ -153,11 +153,13 @@ static struct pci_device_id nv_pci_tbl[] = {
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2,
                PCI_ANY_ID, PCI_ANY_ID, 0, 0, CK804 },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA,
-               PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 },
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2,
-               PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 },
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA,
-               PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP55 },
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC },
+       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0, GENERIC },
        { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
                PCI_ANY_ID, PCI_ANY_ID,
                PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC },
@@ -236,7 +238,7 @@ static Scsi_Host_Template nv_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations nv_ops = {
+static const struct ata_port_operations nv_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
@@ -329,7 +331,7 @@ static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg)
                return 0xffffffffU;
 
        if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
-               return readl((void*)ap->ioaddr.scr_addr + (sc_reg * 4));
+               return readl((void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4));
        else
                return inl(ap->ioaddr.scr_addr + (sc_reg * 4));
 }
@@ -343,7 +345,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
                return;
 
        if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
-               writel(val, (void*)ap->ioaddr.scr_addr + (sc_reg * 4));
+               writel(val, (void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4));
        else
                outl(val, ap->ioaddr.scr_addr + (sc_reg * 4));
 }
@@ -351,6 +353,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
 static void nv_host_stop (struct ata_host_set *host_set)
 {
        struct nv_host *host = host_set->private_data;
+       struct pci_dev *pdev = to_pci_dev(host_set->dev);
 
        // Disable hotplug event interrupts.
        if (host->host_desc->disable_hotplug)
@@ -358,7 +361,8 @@ static void nv_host_stop (struct ata_host_set *host_set)
 
        kfree(host);
 
-       ata_host_stop(host_set);
+       if (host_set->mmio_base)
+               pci_iounmap(pdev, host_set->mmio_base);
 }
 
 static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -401,7 +405,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        rc = -ENOMEM;
 
        ppi = &nv_port_info;
-       probe_ent = ata_pci_init_native_mode(pdev, &ppi);
+       probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
        if (!probe_ent)
                goto err_out_regions;
 
@@ -420,8 +424,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) {
                unsigned long base;
 
-               probe_ent->mmio_base = ioremap(pci_resource_start(pdev, 5),
-                               pci_resource_len(pdev, 5));
+               probe_ent->mmio_base = pci_iomap(pdev, 5, 0);
                if (probe_ent->mmio_base == NULL) {
                        rc = -EIO;
                        goto err_out_free_host;
@@ -457,7 +460,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
 err_out_iounmap:
        if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
-               iounmap(probe_ent->mmio_base);
+               pci_iounmap(pdev, probe_ent->mmio_base);
 err_out_free_host:
        kfree(host);
 err_out_free_ent: