From mboxrd@z Thu Jan 1 00:00:00 1970 From: George G. Davis Date: Fri, 30 Apr 2004 15:59:56 -0400 Subject: [U-Boot-Users] [PATCH] lan91c96 driver MAC address detection In-Reply-To: <40913509.1090309@mpc-data.co.uk> References: <40913509.1090309@mpc-data.co.uk> Message-ID: <20040430195956.GY12746@mvista.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Apr 29, 2004 at 06:02:01PM +0100, Dave Peverley wrote: > Hi all, > > This is a small patch for the lan91c96 ethernet driver that adds the > capability to automatically detect the MAC address stored in EPROM in the > absence of a valid MAC address in the environment. It is modelled on the > system used by the smc91111 driver as suggested by Marius Groeger > (thanks!) > > The patch itself was created against the CVS repository tag > "U-Boot-1_1_0" using the command : > diff -purN u-boot u-boot-omap730p2 > u-boot-1.1.0-omap730p2.patch > > All comments and feedback welcome. Cool! Thanks for that! I have a minor suggestion though. Can we squelch the warning for the "setenv ethaddr" case? Like so: --- drivers/lan91c96.c.orig 2004-04-29 13:15:14.000000000 -0400 +++ drivers/lan91c96.c 2004-04-30 15:47:45.000000000 -0400 @@ -886,9 +886,7 @@ uchar v_rom_mac[6]; env_size = getenv_r ("ethaddr", s_env_mac, sizeof (s_env_mac)); - if (env_size != sizeof(es)) { /* Ignore if env is bad or not set */ - printf ("\n*** Warning: ethaddr is not set properly, ignoring!!\n"); - } else { + if (env_size == sizeof(es)) { env_present = 1; s = s_env_mac; @@ -897,7 +895,8 @@ if (s) s = (*e) ? e + 1 : e; } - } + } else if (env_size >= 0) /* Ignore if env is bad */ + printf ("\n*** Warning: ethaddr is not set properly, ignoring!!\n"); rom_valid = get_rom_mac (v_rom_mac); /* get ROM mac value if any */ I've tested your patch with the above change and it works for me: OMAP1510 Innovator # bootp Using MAC Address 08:00:28:32:0F:FF BOOTP broadcast 1 DHCP client bound to address 192.168.1.91 OMAP1510 Innovator # setenv ethaddr 00:11:22:33:44 OMAP1510 Innovator # bootp *** Warning: ethaddr is not set properly, ignoring!! Using MAC Address 08:00:28:32:0F:FF BOOTP broadcast 1 DHCP client bound to address 192.168.1.91 OMAP1510 Innovator # setenv ethaddr OMAP1510 Innovator # bootp Using MAC Address 08:00:28:32:0F:FF BOOTP broadcast 1 DHCP client bound to address 192.168.1.91 Thanks again! -- Regards, George > > Best Wishes, > > Dave Peverley