Re: Add suport for Marvell 88SE6121 in ahci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jose Alberto Reguero wrote:
This work for kernel 2.6.20-rc6

First apply this patch:

http://marc.theaimsgroup.com/?l=linux-ide&m=116986924301674&w=2

Then apply the patch attached.

Comments:

The Marvell 88SE6121 has three ports (0,1,2). The PATA port is port 2. (PATA port for 6141 is port 4). In M2V Motherboard(Marvell 88SE6121) there is only two SATA ports, one of them is external SATA. This two ports work well with this patch.

With this part:

<       if (pci_enable_msi(pdev) == 0)
---
if ((pdev->vendor != PCI_VENDOR_ID_MARVELL) && (pci_enable_msi(pdev)
== 0))

you don't need to disable MSI in kernel.
MMCONFIG is disabled at startup in M2V.

dmesg:
........
PCI: Not using MMCONFIG.

Very useful data points, thanks!

For the future, please make sure to create patches using "diff -u", otherwise the patches are very difficult to read and apply.

I've attached your patch as a "diff -u" patch so that others can check it out.

	Jeff



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);

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux