[U-Boot] [PATCH 1/5] Tegra2: Add bitfield access macros

Simon Glass sjg at chromium.org
Wed Jun 8 21:48:32 CEST 2011


On Wed, Jun 8, 2011 at 12:21 PM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Simon Glass,
>
> In message <BANLkTincWYC+E+_yo+3ZKhUL6ZH_x_neLv1LaUnMxJyp7JN8tg at mail.gmail.com> you wrote:
>>
>> I don't agree. Going back to the original patch, the macro allow us to
>> write this code to read/write bias time for example (showing header
>> and C file):
>
> We don't make any progress if you now go back to the starting point.
> Please feel free to do so, but I don't follow.

Hi Wolfgang,

I think I responded to your point about not being able to search in
the source code. I can't really respond to your point about it being
obscure as I think that is a matter of opinion. But please let me know
if I missed something else from your response.

I also presented two options based around clrsetbits_le32. Does
something like the below meet with your approval?

(in a header somewhere:)
#define UTMIP_BIAS_PDTRK_COUNT_SHIFT 4
#define UTMIP_BIAS_PDTRK_COUNT_MASK (0xf << UTMIP_BIAS_PDTRK_COUNT_SHIFT)
#define UTMIP_BIAS_PDTRK_COUNT_VAL(v) \
     ((v << UTMIP_BIAS_PDTRK_COUNT_SHIFT) & UTMIP_BIAS_PDTRK_COUNT_MASK)
#define UTMIP_BIAS_PDTRK_COUNT_EXTRACT(v) \
     ((v & UTMIP_BIAS_PDTRK_COUNT_MASK) >> UTMIP_BIAS_PDTRK_COUNT_SHIFT)

(in the C file:)
clrsetbits_le32(&usbctlr->utmip_bias_cfg1, UTMIP_BIAS_PDTRK_COUNT_MASK,
       UTMIP_BIAS_PDTRK_COUNT_VAL(params->bias_time));
return UTMIP_BIAS_PDTRK_COUNT_EXTRACT(readl(&usbctlr->utmip_bias_cfg1))

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
> "All my life I wanted to be someone; I guess I should have been  more
> specific."                                              - Jane Wagner
>


More information about the U-Boot mailing list