From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sascha Hauer Date: Tue, 21 Apr 2009 13:38:23 +0200 Subject: [U-Boot] [PATCH 1/3] smc911x: write back the manually set MAC address In-Reply-To: <1239189819-26805-1-git-send-email-daniel@caiaq.de> References: <1239189819-26805-1-git-send-email-daniel@caiaq.de> Message-ID: <20090421113823.GW21747@pengutronix.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Apr 08, 2009 at 01:23:37PM +0200, Daniel Mack wrote: > If the MAX address is given by the environment, write it back to the > hardware. > > Signed-off-by: Daniel Mack > Cc: Sascha Hauer Acked-by: Sascha Hauer Anyway, you shouldn't rely on this. I'm the original author of this driver, but I do not use U-Boot-v1 anymore, so I can't tell if this breaks something or not. Sascha > --- > drivers/net/smc911x.c | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c > index 30f2dc2..8c9a2a8 100644 > --- a/drivers/net/smc911x.c > +++ b/drivers/net/smc911x.c > @@ -41,8 +41,13 @@ static int smx911x_handle_mac_address(bd_t *bd) > unsigned long addrh, addrl; > uchar m[6]; > > - /* if the environment has a valid mac address then use it */ > - if (!eth_getenv_enetaddr("ethaddr", m)) { > + if (eth_getenv_enetaddr("ethaddr", m)) { > + /* if the environment has a valid mac address then use it */ > + addrl = m[0] | (m[1] << 8) | (m[2] << 16) | (m[3] << 24); > + addrh = m[4] | (m[5] << 8); > + smc911x_set_mac_csr(ADDRL, addrl); > + smc911x_set_mac_csr(ADDRH, addrh); > + } else { > /* if not, try to get one from the eeprom */ > addrh = smc911x_get_mac_csr(ADDRH); > addrl = smc911x_get_mac_csr(ADDRL); > -- > 1.6.2.1 > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |