[U-Boot] [PATCH v2 13/22] omap4: add clock support

Aneesh V
2011-06-21T06:25:22Z

Dear Wolfgang,

On Tuesday 21 June 2011 11:19 AM, Aneesh V wrote:
> Dear Wolfgang,
>
> On Sunday 15 May 2011 08:51 PM, Aneesh V wrote:
> [snip ..]
>> +static const u32 clk_modules_hw_auto_essential[] = {
>> + CM_WKUP_GPIO1_CLKCTRL,
>> + CM_L4PER_GPIO2_CLKCTRL,
>> + CM_L4PER_GPIO3_CLKCTRL,
>> + CM_L4PER_GPIO4_CLKCTRL,
>> + CM_L4PER_GPIO5_CLKCTRL,
>> + CM_L4PER_GPIO6_CLKCTRL,
>> + CM_MEMIF_EMIF_1_CLKCTRL,
>> + CM_MEMIF_EMIF_2_CLKCTRL,
>> + CM_L3INIT_HSUSBOTG_CLKCTRL,
>> + CM_L3INIT_USBPHY_CLKCTRL,
>> + CM_L4CFG_L4_CFG_CLKCTRL,
>> + 0
>> +};
>
> In this series you asked me to convert the base + offset mode of
> register address definition to struct based register address
> definition. While doing this I am facing a problem. Please note the
> above array that contain register addresses. This is a group of
> registers that control our clock modules. All these registers have
> similar bit fields and they can be programmed in same manner. So, I
> keep them in an array and pass the array to a function that iterates
> through array and does similar processing on all the registers(see
> below).
>
> I am finding it difficult to implement this using the struct based
> approach. I tried the sample code below:
>
> struct my_regs_struct {
> const unsigned int reg1;
> const unsigned int reg2;
> const unsigned int reg3;
> };
>
> static struct my_regs_struct *const my_regs = (struct my_regs_struct
> *)0x1000;
>
> static unsigned int *const reg_arr[] = {
> &my_regs->reg1,
> &my_regs->reg3
> };

Apologies for the hasty mail. Looks like I can solve it by doing
something like:

static unsigned int *const reg_arr[] = {
&(((struct my_regs_struct *)0x1000)->reg1),
&(((struct my_regs_struct *)0x1000)->reg3),
};

Analyzing this further right now. Hopefully, the issue can be solved
cleanly.

best regards,
Aneesh