[U-Boot] [PATCH 01/27 v2] Blackfin: bfin_mac: force board_get_enetaddr() usage
Mike Frysinger
vapier at gentoo.org
Thu Jan 29 22:05:08 CET 2009
On Thursday 29 January 2009 15:41:31 Wolfgang Denk wrote:
> In message <200901291525.03553.vapier at gentoo.org> you wrote:
> > so how exactly are $ethaddr in the env and bi_enetaddr in the global data
> > supposed to interact ? this is a mess in the current tree and i dont see
> > any notes that indicate how things are supposed to be handled. and i'd
> > like to make these changes once and get it right the first time ;).
>
> Can't you just ask some simple and easy questions for a change? ;-)
>
> > i see it as:
> > - common net code calls board_eth_init()
> > - board_eth_init() sets up ethaddr in env if it isnt set already
> > - board_eth_init() calls the driver init (bfin_EMAC_initialize() in my
> > case) - driver init looks up ethaddr in env and sets bi_enetaddr in
> > global data - all other code uses bi_enetaddr to get the MAC address
>
> This doesn't work, as in the case that you don;t use any network
> commands in U-Boot, board_eth_init() will not run and consequently you
> don't know the MAC address so you cannot pass it to Linux either.
>
> Rather:
>
> - misc_init_r() [or similar] sets up ethaddr in env if it isnt
> set already and sets bi_enetaddr in global data
> - board_eth_init() calls the driver init
> (bfin_EMAC_initialize() in your case)
> - driver init looks up ethaddr in env or bi_enetaddr
well this gets us into the realm of what i was trying to avoid/fix in the
first place: duplication of the env/ethaddr handling/parsing code. i get
tired of auditing every board/driver just to find the same simple bugs were
duplicated and/or not handled properly.
i guess i can mitigate this by making functions in include/asm-blackfin/net.h
and having the boards/drivers call those.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090129/7a2b60ec/attachment.pgp
More information about the U-Boot
mailing list