linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ahci: preserve PORTS_IMPL over host resets
@ 2006-09-30 12:21 Tejun Heo
  2006-09-30 12:22 ` [PATCH 2/2] [PATCH] ahci: honor PORTS_IMPL on ICH8s Tejun Heo
  2006-10-05 11:27 ` [PATCH 1/2] ahci: preserve PORTS_IMPL over host resets Jeff Garzik
  0 siblings, 2 replies; 7+ messages in thread
From: Tejun Heo @ 2006-09-30 12:21 UTC (permalink / raw)
  To: Jeff Garzik, linux-ide, robbat2

Instead of writing 0xf blindly, preserve the content of write-once
PORTS_IMPL register over host resets.

This patch is taken from Jeff Garzik's AHCI init update patch.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
---
 drivers/ata/ahci.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 54e1f38..d268ced 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -563,11 +563,12 @@ static int ahci_deinit_port(void __iomem
 
 static int ahci_reset_controller(void __iomem *mmio, struct pci_dev *pdev)
 {
-	u32 cap_save, tmp;
+	u32 cap_save, impl_save, tmp;
 
 	cap_save = readl(mmio + HOST_CAP);
 	cap_save &= ( (1<<28) | (1<<17) );
 	cap_save |= (1 << 27);
+	impl_save = readl(mmio + HOST_PORTS_IMPL);
 
 	/* global controller reset */
 	tmp = readl(mmio + HOST_CTL);
@@ -588,10 +589,16 @@ static int ahci_reset_controller(void __
 		return -EIO;
 	}
 
+	/* turn on AHCI mode */
 	writel(HOST_AHCI_EN, mmio + HOST_CTL);
 	(void) readl(mmio + HOST_CTL);	/* flush */
+
+	/* These write-once registers are normally cleared on reset.
+	 * Restore BIOS values... which we HOPE were present before
+	 * reset.
+	 */
 	writel(cap_save, mmio + HOST_CAP);
-	writel(0xf, mmio + HOST_PORTS_IMPL);
+	writel(impl_save, mmio + HOST_PORTS_IMPL);
 	(void) readl(mmio + HOST_PORTS_IMPL);	/* flush */
 
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
-- 
1.4.2.1



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

end of thread, other threads:[~2006-10-05 15:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-30 12:21 [PATCH 1/2] ahci: preserve PORTS_IMPL over host resets Tejun Heo
2006-09-30 12:22 ` [PATCH 2/2] [PATCH] ahci: honor PORTS_IMPL on ICH8s Tejun Heo
2006-09-30 16:13   ` Robin H. Johnson
2006-10-05 11:25   ` Jeff Garzik
2006-10-05 15:12     ` Tejun Heo
2006-10-05 11:27 ` [PATCH 1/2] ahci: preserve PORTS_IMPL over host resets Jeff Garzik
2006-10-05 15:02   ` Tejun Heo

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