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

Wolfgang Denk wd at denx.de
Tue May 17 07:27:16 CEST 2011


Dear Simon Glass,

In message <BANLkTine7BFSYOusgxwg0rg3owNbPN_dOQ at mail.gmail.com> you wrote:
>
> There are a few very primitive macros in setbits and clrbits. I would
> very much like to see at least:

Maybe we can agree to use these existing macros then instead of
inventing new ones with the same functionality.

> - define a field once in a header in an easy format along with any
> enums which define allowable values if applicable
> - pack and unpack a value into a field: so set a bitfield to 13, for exampl=
> e
> - obtain a mask for a field (i.e. with all bits set)
> - equivalent of writel and readl for a bitfield (writel in fact being
> read/modify/write so perhaps a different name)
> 
> Some of these exist, some don't.

Do you know of examples of such more complex definitions in the Linux
kernel code?

> Any thoughts? I we get something in there I suspect ARM people will
> use it at least, and that will reduce the number of ways this gets

I doubt that.  You can see that even the existing macros are unknown
to many, and they also do not bother to check around or asdk.  It's
always so much easier to invent your own new shiny macro that fits
your current purpose perfectly.

> done. At present the local bitfield macros are not accessible to even
> other SOCs, let along other architectures. As this thread shows (and
> some of the code I have been reviewing recently) there is a demand for
> something more functional.

How is this problem being addressed in Linux?  At the very minimum we
should chose a compatible implementation.

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
Forty two.


More information about the U-Boot mailing list