]> err.no Git - linux-2.6/commitdiff
[libata] AHCI: enable AHCI mode, before using AHCI reset
authorJeff Garzik <jeff@garzik.org>
Wed, 26 Sep 2007 04:02:41 +0000 (00:02 -0400)
committerJeff Garzik <jeff@garzik.org>
Fri, 12 Oct 2007 18:55:42 +0000 (14:55 -0400)
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>
drivers/ata/ahci.c

index 9f3c591c7214090f2cc4b5f17b921dd7de48f6c4..b615390b6b8a0fc7c52d4bc09060562f3f490a5c 100644 (file)
@@ -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 */