[U-Boot] [PATCH v2 1/9] sunxi: initial sun7i clocks and timer support.

Ian Campbell ijc at hellion.org.uk
Thu Mar 27 22:29:56 CET 2014


On Mon, 2014-03-24 at 21:52 +0100, Marek Vasut wrote:

> > +static struct sunxi_timer *timer_base =
> > +     &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->timer[TIMER_NUM];
> > +
> > +/* macro to read the 32 bit timer: since it decrements, we invert read
> > value */ +#define READ_TIMER() (~readl(&timer_base->val))
> 
> This macro has to go, just use ~readl() in place. But still, why do you use that 
> negation in "~readl()" anyway ?

The comment right above it explains why: the timer counts backwards and
inverting it accounts for that.

This is subtle enough that I don't think using ~readl() in place in the
3 callers would be an improvement.

Ian.




More information about the U-Boot mailing list