[U-Boot] [PATCH] mpc85xx: add function prototypes for sys and ddr clocks to speed.c

Scott Wood scottwood at freescale.com
Fri May 21 20:34:02 CEST 2010


On 05/21/2010 01:18 PM, Timur Tabi wrote:
> Scott Wood wrote:
>> On 05/21/2010 01:07 PM, Timur Tabi wrote:
>>> On most Freescale 85xx boards, the CONFIG_SYS_CLK_FREQ and CONFIG_DDR_CLK_FREQ
>>> macros are defined like this:
>>
>> Like what?
>
> Doh.  Git commit delete those lines because they began with a "#".

Hmm... is there any way to override that and insert such a line into a 
git commit?

> Well, I'm open to suggestions.  Wolfgang asked me to find a solution to this:
>
> #ifndef __ASSEMBLY__
> unsigned long calculate_board_sys_clk(void);
> unsigned long calculate_board_ddr_clk(void);
> #endif
> #define CONFIG_SYS_CLK_FREQ	calculate_board_sys_clk()
> #define CONFIG_DDR_CLK_FREQ	calculate_board_ddr_clk()
>
> He doesn't want the prototypes in the board header file.

I think the board header file (or some header factored out from a set of 
similar boards, which the board header includes) is exactly where it 
belongs, given that it's implemented in a board C file, and the C call 
is not a public API.  Some boards just hard code it as a constant. 
Others might want to call some other function, maybe with arguments (in 
fact, I see a dummy argument of zero passed in many if not all existing 
calls to these functions -- why?).

Duplicating large chunks of code is bad, but extremism in avoiding 
anything that even looks similar to something else, and breaking the 
logical isolation of said things in the process, is bad as well.

-Scott


More information about the U-Boot mailing list