[PATCH 3/3] drivers/mci: add PXA host controller

Sascha Hauer s.hauer at pengutronix.de
Wed Dec 7 11:41:55 EST 2011


On Wed, Dec 07, 2011 at 05:01:58PM +0100, Robert Jarzmik wrote:
> 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 :

Please always use is_timeout(). Just polling 100000 times gives no well
defined timeout.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list