linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting
@ 2019-08-09 14:48 Stephen Douthit
  2019-08-09 14:48 ` [PATCH v2 1/2] ata: ahci: Lookup PCS register offset based on PCI device ID Stephen Douthit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Douthit @ 2019-08-09 14:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Stephen Douthit, linux-ide, linux-kernel

v2: Fix case of hex values

Stephen Douthit (2):
  ata: ahci: Lookup PCS register offset based on PCI device ID
  ata: ahci: Cleanup hex values to use lowercase everywhere

 drivers/ata/ahci.c | 62 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 49 insertions(+), 13 deletions(-)

-- 
2.21.0


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

* [PATCH v2 1/2] ata: ahci: Lookup PCS register offset based on PCI device ID
  2019-08-09 14:48 [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Stephen Douthit
@ 2019-08-09 14:48 ` Stephen Douthit
  2019-08-09 14:48 ` [PATCH v2 2/2] ata: ahci: Cleanup hex values to use lowercase everywhere Stephen Douthit
  2019-08-09 16:00 ` [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Douthit @ 2019-08-09 14:48 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..7e4abeb10606 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] 4+ messages in thread

* [PATCH v2 2/2] ata: ahci: Cleanup hex values to use lowercase everywhere
  2019-08-09 14:48 [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Stephen Douthit
  2019-08-09 14:48 ` [PATCH v2 1/2] ata: ahci: Lookup PCS register offset based on PCI device ID Stephen Douthit
@ 2019-08-09 14:48 ` Stephen Douthit
  2019-08-09 16:00 ` [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Douthit @ 2019-08-09 14:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Stephen Douthit, linux-ide, linux-kernel

Result of sed -i 's/\(0x[0-9a-fA-F]\{1,\}\)/\L\1/' drivers/ata/ahci.c

No functional change intended.

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

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7e4abeb10606..ce7373f0a861 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -272,8 +272,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, 0x19b5), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19b6), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19b7), board_ahci }, /* DNV AHCI */
-	{ PCI_VDEVICE(INTEL, 0x19bE), board_ahci }, /* DNV AHCI */
-	{ PCI_VDEVICE(INTEL, 0x19bF), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19be), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19bf), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19c0), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19c1), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19c2), board_ahci }, /* DNV AHCI */
@@ -282,8 +282,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, 0x19c5), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19c6), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x19c7), board_ahci }, /* DNV AHCI */
-	{ PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */
-	{ PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19ce), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19cf), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */
 	{ PCI_VDEVICE(INTEL, 0x1c03), board_ahci_mobile }, /* CPT M AHCI */
 	{ PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */
@@ -506,7 +506,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 	{ PCI_VDEVICE(SI, 0x0186), board_ahci },		/* SiS 968 */
 
 	/* ST Microelectronics */
-	{ PCI_VDEVICE(STMICRO, 0xCC06), board_ahci },		/* ST ConneXt */
+	{ PCI_VDEVICE(STMICRO, 0xcc06), board_ahci },		/* ST ConneXt */
 
 	/* Marvell */
 	{ PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv },	/* 6145 */
@@ -1192,7 +1192,7 @@ static bool ahci_broken_system_poweroff(struct pci_dev *pdev)
 				DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6310"),
 			},
 			/* PCI slot number of the controller */
-			.driver_data = (void *)0x1FUL,
+			.driver_data = (void *)0x1fUL,
 		},
 		{
 			.ident = "HP Compaq 6720s",
@@ -1201,7 +1201,7 @@ static bool ahci_broken_system_poweroff(struct pci_dev *pdev)
 				DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6720s"),
 			},
 			/* PCI slot number of the controller */
-			.driver_data = (void *)0x1FUL,
+			.driver_data = (void *)0x1fUL,
 		},
 
 		{ }	/* terminate list */
@@ -1490,9 +1490,9 @@ static void acer_sa5_271_workaround(struct ahci_host_priv *hpriv,
 
 	if (dmi_check_system(sysids)) {
 		dev_info(&pdev->dev, "enabling Acer Switch Alpha 12 workaround\n");
-		if ((hpriv->saved_cap & 0xC734FF00) == 0xC734FF00) {
+		if ((hpriv->saved_cap & 0xc734ff00) == 0xC734FF00) {
 			hpriv->port_map = 0x7;
-			hpriv->cap = 0xC734FF02;
+			hpriv->cap = 0xc734ff02;
 		}
 	}
 }
@@ -1691,7 +1691,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 			 "PDC42819 can only drive SATA devices with this driver\n");
 
 	/* Some devices use non-standard BARs */
-	if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06)
+	if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xcc06)
 		ahci_pci_bar = AHCI_PCI_BAR_STA2X11;
 	else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
 		ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
-- 
2.21.0


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

* Re: [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting
  2019-08-09 14:48 [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Stephen Douthit
  2019-08-09 14:48 ` [PATCH v2 1/2] ata: ahci: Lookup PCS register offset based on PCI device ID Stephen Douthit
  2019-08-09 14:48 ` [PATCH v2 2/2] ata: ahci: Cleanup hex values to use lowercase everywhere Stephen Douthit
@ 2019-08-09 16:00 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-08-09 16:00 UTC (permalink / raw)
  To: Stephen Douthit; +Cc: linux-ide, linux-kernel

On 8/9/19 7:48 AM, Stephen Douthit wrote:
> v2: Fix case of hex values
> 
> Stephen Douthit (2):
>    ata: ahci: Lookup PCS register offset based on PCI device ID
>    ata: ahci: Cleanup hex values to use lowercase everywhere
> 
>   drivers/ata/ahci.c | 62 ++++++++++++++++++++++++++++++++++++----------
>   1 file changed, 49 insertions(+), 13 deletions(-)

Thanks, applied.

-- 
Jens Axboe


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 14:48 [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Stephen Douthit
2019-08-09 14:48 ` [PATCH v2 1/2] ata: ahci: Lookup PCS register offset based on PCI device ID Stephen Douthit
2019-08-09 14:48 ` [PATCH v2 2/2] ata: ahci: Cleanup hex values to use lowercase everywhere Stephen Douthit
2019-08-09 16:00 ` [PATCH v2 0/2] Lookup PCS offset, and cleanup hex formatting Jens Axboe

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