linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ata: ahci: Lookup PCS register offset based on PCI device ID
@ 2019-08-08 20:24 Stephen Douthit
  2019-08-09  3:46 ` Jens Axboe
  2019-08-10  7:43 ` Christoph Hellwig
  0 siblings, 2 replies; 22+ messages in thread
From: Stephen Douthit @ 2019-08-08 20:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Stephen Douthit, linux-ide, linux-kernel

Intel moved the PCS register from 0x92 to 0x94 on Denverton for some
reason, so now we get to check the device ID before poking it on reset.

Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
---
 drivers/ata/ahci.c | 42 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index f7652baa6337..7090c7754fc2 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -623,6 +623,41 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev,
 	ahci_save_initial_config(&pdev->dev, hpriv);
 }
 
+/*
+ * Intel moved the PCS register on the Denverton AHCI controller, see which
+ * offset this controller is using
+ */
+static int ahci_pcs_offset(struct ata_host *host)
+{
+	struct pci_dev *pdev = to_pci_dev(host->dev);
+
+	switch (pdev->device) {
+	case 0x19b0:
+	case 0x19b1:
+	case 0x19b2:
+	case 0x19b3:
+	case 0x19b4:
+	case 0x19b5:
+	case 0x19b6:
+	case 0x19b7:
+	case 0x19bE:
+	case 0x19bF:
+	case 0x19c0:
+	case 0x19c1:
+	case 0x19c2:
+	case 0x19c3:
+	case 0x19c4:
+	case 0x19c5:
+	case 0x19c6:
+	case 0x19c7:
+	case 0x19cE:
+	case 0x19cF:
+		return 0x94;
+	}
+
+	return 0x92;
+}
+
 static int ahci_pci_reset_controller(struct ata_host *host)
 {
 	struct pci_dev *pdev = to_pci_dev(host->dev);
@@ -634,13 +669,14 @@ static int ahci_pci_reset_controller(struct ata_host *host)
 
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		struct ahci_host_priv *hpriv = host->private_data;
+		int pcs = ahci_pcs_offset(host);
 		u16 tmp16;
 
 		/* configure PCS */
-		pci_read_config_word(pdev, 0x92, &tmp16);
+		pci_read_config_word(pdev, pcs, &tmp16);
 		if ((tmp16 & hpriv->port_map) != hpriv->port_map) {
-			tmp16 |= hpriv->port_map;
-			pci_write_config_word(pdev, 0x92, tmp16);
+			tmp16 |= hpriv->port_map & 0xff;
+			pci_write_config_word(pdev, pcs, tmp16);
 		}
 	}
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-08-20 14:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 20:24 [PATCH] ata: ahci: Lookup PCS register offset based on PCI device ID Stephen Douthit
2019-08-09  3:46 ` Jens Axboe
2019-08-09 14:13   ` Stephen Douthit
2019-08-09 14:16     ` Jens Axboe
2019-08-10  7:43 ` Christoph Hellwig
2019-08-10 20:22   ` Dan Williams
2019-08-12 13:02   ` Stephen Douthit
2019-08-12 14:11     ` Jens Axboe
2019-08-12 16:29     ` Dan Williams
2019-08-12 17:49       ` Stephen Douthit
2019-08-12 18:06         ` Christoph Hellwig
2019-08-12 19:12           ` Stephen Douthit
2019-08-12 19:31           ` Dan Williams
2019-08-13  7:29             ` Christoph Hellwig
2019-08-13 22:07               ` Dan Williams
2019-08-14 14:34                 ` Stephen Douthit
2019-08-14 16:09                   ` Dan Williams
2019-08-14 16:54                     ` Stephen Douthit
2019-08-14 17:17                       ` Dan Williams
2019-08-19 16:30                         ` Stephen Douthit
2019-08-20  2:17                           ` Dan Williams
2019-08-20 13:59                             ` Stephen Douthit

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