[U-Boot-Users] [RFC][PATCH 1/1] Add board_eth_init() function

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Mar 25 16:31:44 CET 2008


On Tue, 2008-03-25 at 10:57 -0400, Ben Warren wrote:
> Joakim Tjernlund wrote:
> > On Tue, 2008-03-25 at 10:22 -0400, Ben Warren wrote:
> >   
> >> Stefan Roese wrote:
> >>     
> >>> On Saturday 22 March 2008, Ben Warren wrote:
> >>>
> >>> <snip>
> >>>
> >>>   
> >>>       
> >>>>>  All I'm asking for is to make sure that this can be configured  in  a
> >>>>>  board  specific  way.  If  there  is a zensible default setting which
> >>>>>  covers most cases without need for board-specific stuff  that's  just
> >>>>>  all the better.
> >>>>>       
> >>>>>           
> >>>> How about something like this:
> >>>>
> >>>> #ifdef CONFIG_ETH_INIT_DEFAULT
> >>>>         CFG_ETH_INIT_DEFAULT(bis);
> >>>> #else
> >>>>         board_eth_init(bis);
> >>>> #endif
> >>>>     
> >>>>         
> >>> Using Markus's idea, why not use a cpu (platform) specific *and* a board 
> >>> specific init function, both with an empty weak alias in the common eth.c 
> >>> code:
> >>>
> >>> 	cpu_eth_init(bis);
> >>> 	board_eth_init(bis);
> >>>   
> >>>       
> >> I thought about this some more, and the problem is that cpu_eth_init() and board_eth_init()
> >> are mutually exclusive, with board_eth_init() having a higher priority.
> >> I think the following will work, but would appreciate some feedback.
> >>
> >> -----
> >>
> >> int board_eth_init(bd_t *bis) __attribute(weak);
> >> int cpu_eth_init(bd_t *bis) __attribute(weak);
> >>
> >> .
> >> .
> >> .
> >>
> >> if (board_eth_init)
> >> 	board_eth_init(bis);
> >> else if (cpu_eth_init)
> >> 	cpu_eth_init(bis);
> >>
> >> -----
> >>
> >> This gets rid of the pointless aliases and gives precedence to the board-specific initialization.
> >>
> >>
> >> regards,
> >> Ben
> >>     
> >
> > I think you must enable full relocation, CONFIG_RELOC_FIXUP_WORKS, to
> > make the "if (board_eth_init)" work. This is just a guess though.
> >
> >   Jocke
> >
> >   
> Nothing a little testing can't figure out.
> 
> thanks,
> Ben

You could do too:
if (!board_eth_init(bis))
    cpu_eth_init(bis);

 Jocke




More information about the U-Boot mailing list