Re: [PATCH] ahci: retry enabling AHCI a few times before spitting out WARN_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Volker Armin Hemmann wrote:
git fetch git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream:upstream
From git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
 * [new branch]      upstream   -> upstream
energy libata-dev # git checkout -f upstream
Checking out files: 100% (1243/1243), done.
Switched to branch "upstream"
energy libata-dev # patch -p1 < ../ahci.patch
patching file drivers/ata/ahci.c
Hunk #1 FAILED at 556.
1 out of 1 hunk FAILED -- saving rejects to file drivers/ata/ahci.c.rej

That's really weird.

$ git fetch -f -u git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git  upstream:upstream
remote: Counting objects: 7151, done.
remote: Compressing objects: 100% (1439/1439), done.
Indexing 5254 objects...
remote: Total 5254 (delta 4424), reused 4645 (delta 3815)
100% (5254/5254) done
Resolving 4424 deltas...
100% (4424/4424) done
1186 objects were added to complete this thin pack.
* refs/heads/upstream: forcing update to non-fast forward branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
 old...new: ed75ba5...48feb3c
$ git checkout -f upstream
Checking 1203 files out...
100% (1203/1203) done
Switched to branch "upstream"
$ filterdiff ~/tmp/\[PATCH\]\ ahci\:\ retry\ enabling\ AHCI\ a\ few\ times\ before\ spitting\ out\ WARN_ON\(\).eml | patch -p1
patching file drivers/ata/ahci.c
$ git diff
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 739ba3f..711b5d7 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -556,16 +556,27 @@ static inline void __iomem *ahci_port_base(struct ata_port *ap)

static void ahci_enable_ahci(void __iomem *mmio)
{
+       int i;
       u32 tmp;

       /* turn on AHCI_EN */
       tmp = readl(mmio + HOST_CTL);
-       if (!(tmp & HOST_AHCI_EN)) {
+       if (tmp & HOST_AHCI_EN)
+               return;
+
+       /* Some controllers need AHCI_EN to be written multiple times.
+        * Try a few times before giving up.
+        */
+       for (i = 0; i < 5; i++) {
               tmp |= HOST_AHCI_EN;
               writel(tmp, mmio + HOST_CTL);
               tmp = readl(mmio + HOST_CTL);   /* flush && sanity check */
-               WARN_ON(!(tmp & HOST_AHCI_EN));
+               if (tmp & HOST_AHCI_EN)
+                       return;
+               msleep(10);
       }
+
+       WARN_ON(1);
}

/**


--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux