[U-Boot] [PATCH v3 02/10] armv7: add miscellaneous utility macros

Wolfgang Denk
2011-06-16T11:46:48Z

Dear Graeme Russ,

In message <4DF9E409.1060600@gmail.com> you wrote:
>
> is equivalent except that, as already pointed out, clrsetbits and friends:
>
> a) Are not portable because only ARM and PPC define them which makes
> them, by definition, non-standard

They should be added to _any_ arch/<arch>/include/asm/io.h that
doesn't use them yet.

> b) Each invocation results in a read barrier plus a write barrier

...which is intentionally (actually mandatory) when accessing I/O memory,
and negligable overhead on plain memory.

> c) If the hardware register is sensitive to partial updates (i.e. requires
> all bit-fields to be updated in on operation) this requires a read into
> a local variable, calls to clrsetbits against that variable and finally
> a write-back - Lots of memory barriers

Wrong. The macro does this automatically. There is only a single read
and a single write per call.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Ernest asks Frank how long he has been working for the company.
"Ever since they threatened to fire me."