linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Jose Alberto Reguero <jareguero@telefonica.net>
Cc: linux-ide@vger.kernel.org, Jay Cliburn <jacliburn@bellsouth.net>
Subject: Re: Add suport for Marvell 88SE6121 in ahci
Date: Wed, 31 Jan 2007 10:03:18 -0500	[thread overview]
Message-ID: <45C0AFB6.5010907@garzik.org> (raw)
In-Reply-To: <200701311504.40277.jareguero@telefonica.net>

[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]

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




[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2281 bytes --]

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

  reply	other threads:[~2007-01-31 15:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 14:04 Add suport for Marvell 88SE6121 in ahci Jose Alberto Reguero
2007-01-31 15:03 ` Jeff Garzik [this message]
2007-01-31 16:43   ` Jose Alberto Reguero
2007-03-16 14:21   ` Jose Alberto Reguero
2007-03-18  5:28     ` Tejun Heo
2007-03-18 12:35       ` Jose Alberto Reguero
2007-03-18 13:48         ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C0AFB6.5010907@garzik.org \
    --to=jeff@garzik.org \
    --cc=jacliburn@bellsouth.net \
    --cc=jareguero@telefonica.net \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).