[U-Boot] [PATCH v3 3/3] mpc5121: pdm360ng: add coprocessor POST

Anatolij Gustschin
2010-04-15T10:24:16Z

Hello Wolfgang,

On Wed, 14 Apr 2010 17:40:16 +0200
Wolfgang Denk <wd@denx.de> wrote:

> ...
> > --- a/post/tests.c
> > +++ b/post/tests.c
> > @@ -53,6 +53,7 @@ extern int gdc_post_test (int flags);
> > extern int fpga_post_test (int flags);
> > extern int lwmon5_watchdog_post_test(int flags);
> > extern int sysmon1_post_test(int flags);
> > +extern int pdm360ng_coprocessor_post_test(int flags);
> >
> > extern int sysmon_init_f (void);
> >
> > @@ -286,6 +287,18 @@ struct post_test post_list[] =
> > #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
> > CONFIG_POST_BSPEC5,
> > #endif
> > +#if CONFIG_POST & CONFIG_SYS_POST_COPROC
> > + {
> > + "Coprocessors communication test",
> > + "coproc_com",
> > + "This test checks communication with coprocessors.",
> > + POST_RAM | POST_ALWAYS | POST_CRITICAL,
> > + &pdm360ng_coprocessor_post_test,
> > + NULL,
> > + NULL,
> > + CONFIG_SYS_POST_COPROC
> > + }
> > +#endif
> > };
>
> I don't want to see board specific code (pdm360ng_*) in such a global
> file. Please use a more generic approach.

What would be a preferred way to realize this? Defining a weak
function in post/post.c or post/tests.c which could be over-ridden
by board specific one? Like:

int __post_coprocessor_post_test(int flags)
{
return 0;
}
int coprocessor_post_test(int flags)
__attribute__((weak, alias("__post_coprocessor_post_test")));

Then I have to put board specific post code in board/pdm360ng/post.c
to the pdm360ng.c file back. Otherwise the board's
coprocessor_post_test() function is not linked if there is no other
code in this post.c file which is strongly-linked.

Anatolij