From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] drivers/mci: add PXA host controller
Date: Wed, 07 Dec 2011 17:01:58 +0100 [thread overview]
Message-ID: <87y5uocqvd.fsf@free.fr> (raw)
In-Reply-To: <20111207084944.GL27267@pengutronix.de> (Sascha Hauer's message of "Wed, 7 Dec 2011 09:49:44 +0100")
Sascha Hauer <s.hauer@pengutronix.de> writes:
>> + if (mmc_readl(MMC_STAT) & STAT_CLK_EN) {
>> + writel(STOP_CLOCK, host->base + MMC_STRPCL);
>> +
>> + do {
>> + v = mmc_readl(MMC_STAT);
>> + if (!(v & STAT_CLK_EN))
>> + break;
>> + udelay(1);
>> + } while (timeout--);
>
> please use this for timeout loops:
>
> uint64_t start = get_time_ns(void);
>
> while (!is_timeout(start, 10 * MSECOND)
> poll_something();
Ok, should I do this also to the other 2 timeout loops (pxamci_read_data and
pxamci_write_data), or can I use the same pattern which would give :
static void pxamci_stop_clock(struct pxamci_host *host)
{
static const int timeout = 100000;
int i;
stat = mmc_readl(MMC_STAT);
if (stat & STAT_CLK_EN)
writel(STOP_CLOCK, host->base + MMC_STRPCL);
for (i = 0; i < timeout && stat & STAT_CLK_EN; i++)
stat = mmc_readl(MMC_STAT);
if (stat & STAT_CLK_EN)
mci_err("unable to stop clock\n");
}
I have no strong opinion here, I'll follow your preference, just tell me.
> Otherwise the driver looks good to me.
Great.
Cheers.
--
Robert
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-12-07 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 20:11 [PATCH 1/3] arm/mach-pxa: add MMC clock Robert Jarzmik
2011-12-06 20:11 ` [PATCH 2/3] arm/mach-pxa: add mci_pxa2xx file Robert Jarzmik
2011-12-06 20:11 ` [PATCH 3/3] drivers/mci: add PXA host controller Robert Jarzmik
2011-12-07 8:49 ` Sascha Hauer
2011-12-07 16:01 ` Robert Jarzmik [this message]
2011-12-07 16:41 ` Sascha Hauer
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=87y5uocqvd.fsf@free.fr \
--to=robert.jarzmik@free.fr \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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