From: Jeff Garzik <jeff@garzik.org>
To: Tejun Heo <htejun@gmail.com>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>,
Peer Chen <pchen@nvidia.com>,
"Hemmann, Volker Armin" <volker.armin.hemmann@tu-clausthal.de>
Subject: Re: [PATCH] ahci: retry enabling AHCI a few times before spitting out WARN_ON()
Date: Fri, 25 Apr 2008 00:47:53 -0400 [thread overview]
Message-ID: <48116279.6080302@garzik.org> (raw)
In-Reply-To: <480F231A.7020401@gmail.com>
Tejun Heo wrote:
> Some chips need AHCI_EN set more than once to actually set it. Try a
> few times before giving up and spitting out WARN_ON().
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> Cc: Peer Chen <pchen@nvidia.com>
> Cc: Volker Armin Hemmann <volker.armin.hemmann@tu-clausthal.de>
> ---
> drivers/ata/ahci.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> 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);
> }
applied
prev parent reply other threads:[~2008-04-25 4:47 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
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 [this message]
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=48116279.6080302@garzik.org \
--to=jeff@garzik.org \
--cc=htejun@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.