]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
libata: Merge branch 'for-3.13-fixes' into for-3.14
authorTejun Heo <tj@kernel.org>
Tue, 3 Dec 2013 12:39:51 +0000 (07:39 -0500)
committerTejun Heo <tj@kernel.org>
Tue, 3 Dec 2013 12:39:51 +0000 (07:39 -0500)
Pulling in for-3.13-fixes for the ahci_imx fix as further changes
depend on it.

Signed-off-by: Tejun Heo <tj@kernel.org>
1  2 
drivers/ata/ahci.c

diff --combined drivers/ata/ahci.c
index c55e0056252755472e6af52a3bcfd0d994de747d,14f1e95063380a5e2a315428fc8a4d5e8bcc39d3..ef8642e12a7627e364b92ff4002a7ed632d209db
@@@ -83,8 -83,6 +83,8 @@@ enum board_ids 
  static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
  static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
                                 unsigned long deadline);
 +static void ahci_mcp89_apple_enable(struct pci_dev *pdev);
 +static bool is_mcp89_apple(struct pci_dev *pdev);
  static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
                                unsigned long deadline);
  #ifdef CONFIG_PM
@@@ -437,6 -435,8 +437,8 @@@ static const struct pci_device_id ahci_
          .driver_data = board_ahci_yes_fbs },                  /* 88se9172 on some Gigabyte */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3),
          .driver_data = board_ahci_yes_fbs },
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
+         .driver_data = board_ahci_yes_fbs },
  
        /* Promise */
        { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci },   /* PDC42819 */
@@@ -661,10 -661,6 +663,10 @@@ static int ahci_pci_device_resume(struc
        if (rc)
                return rc;
  
 +      /* Apple BIOS helpfully mangles the registers on resume */
 +      if (is_mcp89_apple(pdev))
 +              ahci_mcp89_apple_enable(pdev);
 +
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
                rc = ahci_pci_reset_controller(host);
                if (rc)
@@@ -781,48 -777,6 +783,48 @@@ static void ahci_p5wdh_workaround(struc
        }
  }
  
 +/*
 + * Macbook7,1 firmware forcibly disables MCP89 AHCI and changes PCI ID when
 + * booting in BIOS compatibility mode.  We restore the registers but not ID.
 + */
 +static void ahci_mcp89_apple_enable(struct pci_dev *pdev)
 +{
 +      u32 val;
 +
 +      printk(KERN_INFO "ahci: enabling MCP89 AHCI mode\n");
 +
 +      pci_read_config_dword(pdev, 0xf8, &val);
 +      val |= 1 << 0x1b;
 +      /* the following changes the device ID, but appears not to affect function */
 +      /* val = (val & ~0xf0000000) | 0x80000000; */
 +      pci_write_config_dword(pdev, 0xf8, val);
 +
 +      pci_read_config_dword(pdev, 0x54c, &val);
 +      val |= 1 << 0xc;
 +      pci_write_config_dword(pdev, 0x54c, val);
 +
 +      pci_read_config_dword(pdev, 0x4a4, &val);
 +      val &= 0xff;
 +      val |= 0x01060100;
 +      pci_write_config_dword(pdev, 0x4a4, val);
 +
 +      pci_read_config_dword(pdev, 0x54c, &val);
 +      val &= ~(1 << 0xc);
 +      pci_write_config_dword(pdev, 0x54c, val);
 +
 +      pci_read_config_dword(pdev, 0xf8, &val);
 +      val &= ~(1 << 0x1b);
 +      pci_write_config_dword(pdev, 0xf8, val);
 +}
 +
 +static bool is_mcp89_apple(struct pci_dev *pdev)
 +{
 +      return pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
 +              pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
 +              pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
 +              pdev->subsystem_device == 0xcb89;
 +}
 +
  /* only some SB600 ahci controllers can do 64bit DMA */
  static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
  {
@@@ -1255,9 -1209,15 +1257,9 @@@ static int ahci_init_one(struct pci_de
        if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable)
                return -ENODEV;
  
 -      /*
 -       * For some reason, MCP89 on MacBook 7,1 doesn't work with
 -       * ahci, use ata_generic instead.
 -       */
 -      if (pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
 -          pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
 -          pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
 -          pdev->subsystem_device == 0xcb89)
 -              return -ENODEV;
 +      /* Apple BIOS on MCP89 prevents us using AHCI */
 +      if (is_mcp89_apple(pdev))
 +              ahci_mcp89_apple_enable(pdev);
  
        /* Promise's PDC42819 is a SAS/SATA controller that has an AHCI mode.
         * At the moment, we can only use the AHCI mode. Let the users know