summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-09-26 06:02:41 +0200
committerJeff Garzik <jeff@garzik.org>2007-10-12 20:55:42 +0200
commit3cc3eb1148e4b2dfabf7a1dcf36fd8be1331ca95 (patch)
tree5f987f613eb8dae6c170f97fe9acb47379902a32
parentlibata: Fix build failure on ppc64 drivers/ata/pata_scc.c (diff)
downloadlinux-3cc3eb1148e4b2dfabf7a1dcf36fd8be1331ca95.tar.xz
linux-3cc3eb1148e4b2dfabf7a1dcf36fd8be1331ca95.zip
[libata] AHCI: enable AHCI mode, before using AHCI reset
AHCI spec says host-reset bit may only be set when the ahci-enable bit is also set. Noticed by Peer Chen <peerchen@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/ahci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 9f3c591c7214..b615390b6b8a 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -827,8 +827,14 @@ static int ahci_reset_controller(struct ata_host *host)
void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
u32 tmp;
- /* global controller reset */
+ /* we must be in AHCI mode, before using anything
+ * AHCI-specific, such as HOST_RESET.
+ */
tmp = readl(mmio + HOST_CTL);
+ if (!(tmp & HOST_AHCI_EN))
+ writel(tmp | HOST_AHCI_EN, mmio + HOST_CTL);
+
+ /* global controller reset */
if ((tmp & HOST_RESET) == 0) {
writel(tmp | HOST_RESET, mmio + HOST_CTL);
readl(mmio + HOST_CTL); /* flush */