[U-Boot] [PATCH][Net] Convert SMC91111 Ethernet driver toCONFIG_NET_MULTI API

Mike Frysinger vapier at gentoo.org
Tue Jul 28 01:43:37 CEST 2009


On Monday 27 July 2009 18:16:27 Robin Getz wrote:
> On Mon 27 Jul 2009 17:43, Ben Warren pondered:
> > All in-tree boards that use this controller have CONFIG_NET_MULTI
> > added
>
> First - thanks.
>
> Second - It's a style thing, but...
>
> > ---
> >  board/bf533-ezkit/bf533-ezkit.c               |   12 +
> >  include/netdev.h                              |    1 +
> >  71 files changed, 888 insertions(+), 490 deletions(-)
>
> [snip]
>
> > diff --git a/board/bf533-ezkit/bf533-ezkit.c
> > b/board/bf533-ezkit/bf533-ezkit.c
> > index d5f0b7c..ff0e15e 100644
> > --- a/board/bf533-ezkit/bf533-ezkit.c
> > +++ b/board/bf533-ezkit/bf533-ezkit.c
> > @@ -26,6 +26,7 @@
> >   */
> >
> >  #include <common.h>
> > +#include <netdev.h>
> >  #include "psd4256.h"
> >  #include "flash-defines.h"
> >
> > @@ -57,3 +58,14 @@ int misc_init_r(void)
> >
> >  	return 0;
> >  }
> > +
> > +#ifdef CONFIG_CMD_NET
> > +int board_eth_init(bd_t *bis)
> > +{
> > +	int rc = 0;
> > +#ifdef CONFIG_SMC91111
> > +	rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
> > +#endif
> > +	return rc;
> > +}
> > +#endif
>
> [snip]
>
> > diff --git a/include/netdev.h b/include/netdev.h
> > index 3e66586..4636b57 100644
> > --- a/include/netdev.h
> > +++ b/include/netdev.h
> > @@ -73,6 +73,7 @@ int rtl8169_initialize(bd_t *bis);
> >  int scc_initialize(bd_t *bis);
> >  int skge_initialize(bd_t *bis);
> >  int smc911x_initialize(u8 dev_num, int base_addr);
> > +int smc91111_initialize(u8 dev_num, int base_addr);
> >  int tsi108_eth_initialize(bd_t *bis);
> >  int uec_initialize(int index);
> >  int uec_standard_init(bd_t *bis);
>
> would be alot less ifdefs if you put it in the header file...
>
> #ifdef CONFIG_SMC91111
> int smc91111_initialize(u8 dev_num, int base_addr);
> #else
> #define smc91111_initialize(dev_num, base_addr) 0
> #endif
>
> that would remove all the "ifdef CONFIG_SMC91111" in all the board files...
>
> also would not be required to set the initial value anymore either...

for at least the Blackfin boards, i would keep the style that was used with 
the bf548-ezkit:
#ifdef CONFIG_SMC91111
int board_eth_init(bd_t *bis)
{
	return smc91111_initialize(0, CONFIG_SMC91111_BASE);
}
#endif

for most of the boards, they wont really have anything else, but if they do, i 
can extend them then.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090727/0879e434/attachment.pgp 


More information about the U-Boot mailing list