[U-Boot] [PATCH v4 07/27] Introduce generic global_data
Simon Glass
sjg at chromium.org
Thu Mar 15 03:50:47 CET 2012
Hi Graeme,
On Wed, Mar 14, 2012 at 7:35 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Hi Simon,
>
> On Thu, Mar 15, 2012 at 1:16 PM, Simon Glass <sjg at chromium.org> wrote:
>> We want to unify the global_data structure. Most fields are common across
>> architectures, but there are a fair number of SOC-specific additions. It
>> isn't clear how best to deal with these, but for now we just use #ifdef.
>>
>> Checkpatch warnings here might be unavoidable:
>>
>> warning: include/asm-generic/global_data.h,43: do not add new typedefs
>> warning: include/asm-generic/global_data.h,117: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
>> warning: include/asm-generic/global_data.h,121: storage class should be at the beginning of the declaration
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>
>> +#ifdef CONFIG_AT91FAMILY
>> + /* "static data" needed by at91's clock.c */
>> + unsigned long cpu_clk_rate_hz;
>> + unsigned long main_clk_rate_hz;
>> + unsigned long mck_rate_hz;
>> + unsigned long plla_rate_hz;
>> + unsigned long pllb_rate_hz;
>> + unsigned long at91_pllb_usb_init;
>> +#endif
>> +#ifdef CONFIG_ARM
>> + /* "static data" needed by most of timer.c on ARM platforms */
>> + unsigned long timer_rate_hz;
>> + unsigned long tbl;
>> + unsigned long tbu;
>> + unsigned long long timer_reset_value;
>> + unsigned long lastinc;
>> +#endif
>
> IMHO, global data should contain only globally common members and an arch-
> specific struct and ditch (most of) the #ifdefs
My thinking here was to try to bring everything into a single file. It
then should be clearer when things are common between different
architectures. Patches to the generic file can be made without also
having to patch the non-generic files, etc.
A fair number of the #ifdefs are not needed, or are there because some
archs don't implement all the features of U-Boot.
You have an example right there: cpu_clk_rate_hz is similar to cpu_clk
and core_clk.
That said it is a bit of a daunting task to amalgamate them.
Also there is the purely practical consideration that if we continue
to have an asm/global_data.h then we end up with two global datas. One
is for CONFIG_SYS_GENERIC_BOARD and contains just the non-common
fields. The other is for non-CONFIG_SYS_GENERIC_BOARD and contains all
fields. Ick.
So what do you think?
Regards,
Simon
>
> Regards,
>
> Graeme
More information about the U-Boot
mailing list