[U-Boot] [Resend PATCH V2 (forgot generic.c)] mx31: provide readable WEIM CS accessor

Helmut Raiger
2011-09-29T14:01:50Z

On 09/29/2011 03:21 PM, Stefano Babic wrote:
>
>>
>> static u32 mx31_decode_pll(u32 reg, u32 infreq)
>> {
>> @@ -126,6 +128,13 @@ void mx31_set_pad(enum iomux_pins pin, u32 config)
>>
>> }
>>
>> +void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs)
>> +{
>> + writel(weimcs->upper, WEIM_CSCR_U(cs));
>> + writel(weimcs->lower, WEIM_CSCR_L(cs));
>> + writel(weimcs->additional, WEIM_CSCR_A(cs));
>> +}
> Even if more hidden, the access is always made with base + offset,
> instead of defining a structure.
>

Do you really thing this is more readable:

------------ in imx_regs.h -----------

struct mx31_weim_cscr {
u32 upper;
u32 lower;
u32 additional;
u32 reserved;
};

struct mx31_weim {
struct mx31_weim_cscr cscr[6];
};

-------------- in generic.c --------------

void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs)
{
struct mx31_weim *weim = (struct mx31_weim *) WEIM_BASE;
struct mx31_weim_cscr *cscr = &weim->cscr[cs];

writel(weimcs->upper, &cscr->upper);
writel(weimcs->lower, &cscr->lower);
writel(weimcs->additional, &cscr->additional);
}

It seems pretty clumsy to me, but for sure a matter of taste.
Helmut

--
Scanned by MailScanner.