From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 12 Jun 2009 23:30:55 +0200 Subject: [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk (csb337) In-Reply-To: <200906091114.24166.david-b@pacbell.net> References: <200906091114.24166.david-b@pacbell.net> Message-ID: <20090612213055.GB1802@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11:14 Tue 09 Jun , David Brownell wrote: > CSB337 boards originally shipped with MicroMonitor, not U-Boot; > and with a version using a different convention for recording > Ethernet addresses than anyone else. To avoid breaking Linux > when it uses U-Boot, have it use the same convention on that > hardware. > > Signed-off-by: David Brownell > --- > cpu/arm920t/at91rm9200/ether.c | 22 ++++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > I'm not really a fan of this but ok if I see the csn337 board patch Ben what do you think? > --- a/cpu/arm920t/at91rm9200/ether.c > +++ b/cpu/arm920t/at91rm9200/ether.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > /* ----- Ethernet Buffer definitions ----- */ > > @@ -184,7 +185,7 @@ int eth_init (bd_t * bd) > > p_mac->EMAC_CFG |= AT91C_EMAC_CSR; /* Clear statistics */ > > - /* Init Ehternet buffers */ > + /* Init Ethernet buffers */ > for (i = 0; i < RBF_FRAMEMAX; i++) { > rbfdt[i].addr = (unsigned long)rbf_framebuf[i]; > rbfdt[i].size = 0; > @@ -193,9 +194,22 @@ int eth_init (bd_t * bd) > rbfp = &rbfdt[0]; > > eth_getenv_enetaddr("ethaddr", enetaddr); > - p_mac->EMAC_SA2L = (enetaddr[3] << 24) | (enetaddr[2] << 16) > - | (enetaddr[1] << 8) | (enetaddr[0]); > - p_mac->EMAC_SA2H = (enetaddr[5] << 8) | (enetaddr[4]); > + > + /* The CSB337 originally used a version of the MicroMonitor bootloader > + * which saved Ethernet addresses in the "wrong" order. Operating > + * systems (like Linux) know this, and apply a workaround. Replicate > + * that MicroMonitor behavior so we avoid needing to make such OS code > + * care about which bootloader was used. > + */ > + if (machine_is_csb337()) { please use ifdef to avoid other people size impact due this > + p_mac->EMAC_SA2H = (enetaddr[0] << 8) | (enetaddr[1]); > + p_mac->EMAC_SA2L = (enetaddr[2] << 24) | (enetaddr[3] << 16) > + | (enetaddr[4] << 8) | (enetaddr[5]); > + } else { > + p_mac->EMAC_SA2L = (enetaddr[3] << 24) | (enetaddr[2] << 16) > + | (enetaddr[1] << 8) | (enetaddr[0]); > + p_mac->EMAC_SA2H = (enetaddr[5] << 8) | (enetaddr[4]); > + } > Best Regards, J.