[PATCH 3/3] drivers/mci: add PXA host controller
Robert Jarzmik
robert.jarzmik at free.fr
Wed Dec 7 11:01:58 EST 2011
Sascha Hauer <s.hauer at 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
More information about the barebox
mailing list