All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Gorsulowski <Daniel.Gorsulowski@esd.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] Linux Kernel without Ethernet (missed MAC)
Date: Tue, 19 Jan 2010 15:50:01 +0100	[thread overview]
Message-ID: <4B55C699.5040401@esd.eu> (raw)
In-Reply-To: <804f0d21001190144o7c57c836s981dab507a1d5754@mail.gmail.com>

Hi Arno,

Arno Steffen wrote:
> Changing my OMAP EVM board to newest uboot 2009-11 I do have a problem
> with ethernet.
> Although the kernel could be loaded via tftp perfectly, the upcoming
> kernel complains about invalid MAC.
> 
> Kernel command line: mem=128M console=ttyS0,115200n8
> root=/dev/mtdblock8 rw rootfstype=jffs2 ip=dhcp
> ...
On ARM, I solved that problem as follows:

1. Add "ethaddr=$(ethaddr)" to your kernel command line. e.g.:
   mem=128M console=ttyS0,115200n8 ethaddr=$(ethaddr)

2. Apply this patch on linux kernel (approved on v2.6.31):

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 92fe36d..cddf67a 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -81,9 +82,14 @@ static void __init macb_get_hwaddr(struct macb *bp)
 	u32 bottom;
 	u16 top;
 	u8 addr[6];
+	char *ptr = NULL;
+	char *ptr_end;
+	char ethaddr[17];
+	int i;

 	bottom = macb_readl(bp, SA1B);
 	top = macb_readl(bp, SA1T);
+	ptr = strstr(boot_command_line, "ethaddr=");

 	addr[0] = bottom & 0xff;
 	addr[1] = (bottom >> 8) & 0xff;
@@ -94,6 +100,16 @@ static void __init macb_get_hwaddr(struct macb *bp)

 	if (is_valid_ether_addr(addr)) {
 		memcpy(bp->dev->dev_addr, addr, sizeof(addr));
+	} else if (ptr) {
+		memcpy(ethaddr, ptr + 8, 17 * sizeof(char));
+		printk(KERN_NOTICE "ethaddr parsed from commandline: %s\n", ethaddr);
+		ptr_end = ethaddr;
+		for (i = 0; i <= 5; i++) {
+			addr[i] = simple_strtol(ptr_end, &ptr_end, 16) |
+					simple_strtol(ptr_end, &ptr_end, 16) << 4;
+			ptr_end++; /* skip ":" in  ethaddr */
+		}
+		memcpy(bp->dev->dev_addr, addr, sizeof(addr));
 	} else {
 		dev_info(&bp->pdev->dev, "invalid hw address, using random\n");
 		random_ether_addr(bp->dev->dev_addr);

  parent reply	other threads:[~2010-01-19 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19  9:44 [U-Boot] Linux Kernel without Ethernet (missed MAC) Arno Steffen
2010-01-19 13:34 ` Prafulla Wadaskar
2010-01-19 13:54   ` Arno Steffen
2010-01-19 14:15     ` Wolfgang Denk
2010-01-19 14:59       ` Arno Steffen
2010-01-19 16:04         ` Nishanth Menon
2010-01-19 18:47         ` Wolfgang Denk
2010-01-20 10:06         ` Detlev Zundel
2010-01-20 14:11           ` Arno Steffen
2010-01-19 14:50 ` Daniel Gorsulowski [this message]
2010-01-19 16:33   ` Arno Steffen
2010-01-19 18:45   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B55C699.5040401@esd.eu \
    --to=daniel.gorsulowski@esd.eu \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.