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

Helmut Raiger helmut.raiger at hale.at
Thu Sep 29 16:01:50 CEST 2011


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.



More information about the U-Boot mailing list