]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ahci: support the STA2X11 I/O Hub
authorAlessandro Rubini <rubini@gnudd.com>
Fri, 6 Jan 2012 12:33:39 +0000 (13:33 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 9 Jan 2012 00:24:06 +0000 (19:24 -0500)
The AHCI controller found in the STA2X11 chip uses BAR number 0
instead of 5. Also, the chip's fixup code sets a special DMA mask
for all of its PCI functions, and the mask must be preserved here.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/ahci.c

index cf26222a93c5ddc7a88092ab9c7fcdf262a45ae1..d07bf0366d99ee06cc3d4b3df62d617e5ef7cc15 100644 (file)
@@ -52,7 +52,8 @@
 #define DRV_VERSION    "3.0"
 
 enum {
-       AHCI_PCI_BAR            = 5,
+       AHCI_PCI_BAR_STA2X11    = 0,
+       AHCI_PCI_BAR_STANDARD   = 5,
 };
 
 enum board_ids {
@@ -375,6 +376,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
        { PCI_VDEVICE(SI, 0x1185), board_ahci },                /* SiS 968 */
        { PCI_VDEVICE(SI, 0x0186), board_ahci },                /* SiS 968 */
 
+       /* ST Microelectronics */
+       { PCI_VDEVICE(STMICRO, 0xCC06), board_ahci },           /* ST ConneXt */
+
        /* Marvell */
        { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv },        /* 6145 */
        { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv },        /* 6121 */
@@ -622,6 +626,13 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
 {
        int rc;
 
+       /*
+        * If the device fixup already set the dma_mask to some non-standard
+        * value, don't extend it here. This happens on STA2X11, for example.
+        */
+       if (pdev->dma_mask && pdev->dma_mask < DMA_BIT_MASK(32))
+               return 0;
+
        if (using_dac &&
            !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
                rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
@@ -1026,6 +1037,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        struct ahci_host_priv *hpriv;
        struct ata_host *host;
        int n_ports, i, rc;
+       int ahci_pci_bar = AHCI_PCI_BAR_STANDARD;
 
        VPRINTK("ENTER\n");
 
@@ -1057,6 +1069,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                dev_info(&pdev->dev,
                         "PDC42819 can only drive SATA devices with this driver\n");
 
+       /* The Connext uses non-standard BAR */
+       if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06)
+               ahci_pci_bar = AHCI_PCI_BAR_STA2X11;
+
        /* acquire resources */
        rc = pcim_enable_device(pdev);
        if (rc)
@@ -1065,7 +1081,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        /* AHCI controllers often implement SFF compatible interface.
         * Grab all PCI BARs just in case.
         */
-       rc = pcim_iomap_regions_request_all(pdev, 1 << AHCI_PCI_BAR, DRV_NAME);
+       rc = pcim_iomap_regions_request_all(pdev, 1 << ahci_pci_bar, DRV_NAME);
        if (rc == -EBUSY)
                pcim_pin_device(pdev);
        if (rc)
@@ -1108,7 +1124,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
                pci_intx(pdev, 1);
 
-       hpriv->mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR];
+       hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar];
 
        /* save initial config */
        ahci_pci_save_initial_config(pdev, hpriv);
@@ -1172,8 +1188,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap = host->ports[i];
 
-               ata_port_pbar_desc(ap, AHCI_PCI_BAR, -1, "abar");
-               ata_port_pbar_desc(ap, AHCI_PCI_BAR,
+               ata_port_pbar_desc(ap, ahci_pci_bar, -1, "abar");
+               ata_port_pbar_desc(ap, ahci_pci_bar,
                                   0x100 + ap->port_no * 0x80, "port");
 
                /* set enclosure management message type */