From: Mike Frysinger Date: Mon, 18 Jan 2010 02:08:38 -0500 Subject: [U-Boot] [PATCH v5 08/12] SPEAr : Support for HW mac id read/write from i2c mem In-Reply-To: <4B53FC8F.2000909@gmail.com> References: <1263563153-408-1-git-send-email-vipin.kumar@st.com> <1263563153-408-9-git-send-email-vipin.kumar@st.com> <4B53FC8F.2000909@gmail.com> Message-ID: <201001180208.39950.vapier@gentoo.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 Monday 18 January 2010 01:15:43 Ben Warren wrote: > Vipin KUMAR wrote: > > This patch adds the support to read and write mac id from i2c > > memory. > > For reading: > > if (env contains ethaddr) > > pick env ethaddr > > else > > pick ethaddr from i2c memory > > For writing: > > chip_config ethaddr XX:XX:XX:XX:XX:XX writes the mac id > > in i2c memory > > > > --- a/board/spear/common/spr_misc.c > > +++ b/board/spear/common/spr_misc.c > > @@ -67,6 +67,12 @@ int dram_init(void) > > > > int misc_init_r(void) > > { > > +#if defined(CONFIG_CMD_NET) > > + uchar mac_id[6]; > > + > > + if (!eth_getenv_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id)) > > + eth_setenv_enetaddr("ethaddr", mac_id); > > It's really not a good idea to programatically set an environment > variable like this. Also, there's already a well-defined and documented > protocol for how MAC addresses should be read and the precedence > between EEPROM storage and environment storage. Please find a way to > fit into that model. Since you don't have network support yet, I have > no idea which network controller you're using, and recommend waiting > until this is really needed. he's doing it the way doc/README.enetaddr suggests ... -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/20100118/e56d51d9/attachment.pgp