linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Volker Armin Hemmann <volker.armin.hemmann@tu-clausthal.de>
Cc: Jeff Garzik <jeff@garzik.org>,
	IDE/ATA development list <linux-ide@vger.kernel.org>,
	Peer Chen <pchen@nvidia.com>
Subject: Re: [PATCH] ahci: retry enabling AHCI a few times before spitting out WARN_ON()
Date: Fri, 25 Apr 2008 09:44:58 +0900	[thread overview]
Message-ID: <4811298A.4070903@gmail.com> (raw)
In-Reply-To: <200804250217.34418.volker.armin.hemmann@tu-clausthal.de>

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

  reply	other threads:[~2008-04-25  0:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23 11:52 [PATCH] ahci: retry enabling AHCI a few times before spitting out WARN_ON() Tejun Heo
2008-04-24  0:24 ` Volker Armin Hemmann
2008-04-24  1:34   ` Tejun Heo
2008-04-24  1:51     ` Volker Armin Hemmann
2008-04-24  2:57       ` Tejun Heo
2008-04-24  3:28         ` Volker Armin Hemmann
2008-04-24  3:36           ` Tejun Heo
2008-04-24  3:57             ` Volker Armin Hemmann
2008-04-24  4:01               ` Tejun Heo
2008-04-24  4:15                 ` Volker Armin Hemmann
2008-04-24  4:20                   ` Tejun Heo
2008-04-24  4:32                     ` Volker Armin Hemmann
2008-04-25  0:17                     ` Volker Armin Hemmann
2008-04-25  0:44                       ` Tejun Heo [this message]
2008-04-25  1:17                         ` Volker Armin Hemmann
2008-04-25  1:59                           ` Tejun Heo
2008-04-25  2:40                             ` Volker Armin Hemmann
2008-04-25  4:47 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4811298A.4070903@gmail.com \
    --to=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=pchen@nvidia.com \
    --cc=volker.armin.hemmann@tu-clausthal.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).