[U-Boot] [PATCH V4 1/6] io: add and* and or* operation api to set and clear bit

Scott Wood scottwood at freescale.com
Tue Mar 29 18:03:23 CEST 2011


On Tue, 29 Mar 2011 10:47:04 +0800
Lei Wen <adrian.wenl at gmail.com> wrote:

> Hi Scott,
> 
> On Tue, Mar 29, 2011 at 12:05 AM, Scott Wood <scottwood at freescale.com> wrote:
> > What does this do that setbits*/clrbits* don't?
> 
> Those and*/or* include the dmb() operation included in the read*/write*, which
> is not included in the __raw_read*/__raw_write* that setbits*/clrbits* refer to.
> I think it's better to keep another instance to set the bit, since
> there is read* and __raw_read*
> exist and have difference.

But why are setbits/clrbits using raw accesses?  That's not how they're
defined on powerpc, which is where these accessors originated.  I suspect
they were defined that way out of laziness from before ARM made a
distinction between raw and non-raw accessors, and it is now a bug in
setbits/clrbits (and out_be*, in_le*, etc) which should be fixed rather
than introducing an alternative.

And then if you want a raw version of these functions, introduce
raw_setbits_le32, raw_in_le16, etc.

-Scott



More information about the U-Boot mailing list