diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ab7ea55..c1925b2 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -439,6 +439,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { /* SiS */ { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ + { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 966 */ { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */ @@ -716,7 +717,10 @@ static void ahci_init_controller(void __iomem *mmio, struct pci_dev *pdev, u32 tmp; if (port_flags & AHCI_FLAG_MV_PATA) { - port_mmio = ahci_port_base(mmio, 4); + if (pdev->device == 0x6121) + port_mmio = ahci_port_base(mmio, 2); + else + port_mmio = ahci_port_base(mmio, 4); writel(0, port_mmio + PORT_IRQ_MASK); @@ -1570,16 +1574,30 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) * presence register, as bit 4 (counting from 0) */ if (probe_ent->port_flags & AHCI_FLAG_MV_PATA) { - dev_printk(KERN_ERR, &pdev->dev, - "MV_AHCI HACK: port_map %x -> %x, cap_n %u -> %u\n", - hpriv->port_map, - hpriv->port_map & 0xf, - cap_n_ports, - (cap_n_ports > 4) ? 4 : cap_n_ports); - - hpriv->port_map &= 0xf; - if (cap_n_ports > 4) - cap_n_ports = 4; + if (pdev->device == 0x6121) { + dev_printk(KERN_ERR, &pdev->dev, + "MV_AHCI HACK: port_map %x -> %x, cap_n %u -> %u\n", + hpriv->port_map, + hpriv->port_map & 0x3, + cap_n_ports, + (cap_n_ports > 2) ? 2 : cap_n_ports); + + hpriv->port_map &= 0x3; + if (cap_n_ports > 2) + cap_n_ports = 2; + } + else { + dev_printk(KERN_ERR, &pdev->dev, + "MV_AHCI HACK: port_map %x -> %x, cap_n %u -> %u\n", + hpriv->port_map, + hpriv->port_map & 0xf, + cap_n_ports, + (cap_n_ports > 4) ? 4 : cap_n_ports); + + hpriv->port_map &= 0xf; + if (cap_n_ports > 4) + cap_n_ports = 4; + } } VPRINTK("cap 0x%x port_map 0x%x n_ports %d\n", @@ -1757,7 +1775,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out; } - if (pci_enable_msi(pdev) == 0) + if ((pdev->vendor != PCI_VENDOR_ID_MARVELL) && (pci_enable_msi(pdev) == 0)) have_msi = 1; else { pci_intx(pdev, 1);