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

Simon Glass
2011-05-17T03:47:42Z

On Sun, May 15, 2011 at 10:51 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <BANLkTi=ZL-WHPE9mXDgBZzXoEaZ10pBhsg@mail.gmail.com> you wrote:
>>
>> Being a boot loader, charged with basic hardware initialisation, I believe
>> bitfield access primitives should be well-supported by U-Boot.
>
> I agree, and they are.

Hi Wolfgang,

Well there is something there, but we can always do better.

>
>> Would you consider an RFC patch to add pan-U-Boot bitfield operations?
>> Failing that, how about just for ARM?
>
> I fail to understand what you mean. ?We already have such
> implementations in place. ?I just oobject against adding new,
> non-standard ones when the existing ones perform the same purpose.

There are a few very primitive macros in setbits and clrbits. I would
very much like to see at least:

- 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 example
- 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.

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

Regards,
Simon

>
> 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
> I think it's a new feature. Don't tell anyone it was an accident. :-)
> ?-- Larry Wall on s/foo/bar/eieio in <10911@jpl-devvax.JPL.NASA.GOV>
>