All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Wolski <awolski@poczta.fm>
To: u-boot@lists.denx.de
Subject: [U-Boot] macb: get mac address from environment
Date: Sun, 12 Jul 2009 01:05:40 +0200	[thread overview]
Message-ID: <h3b5s0$21q$1@ger.gmane.org> (raw)

This fix macb driver broken by commit 
56b555a644f3cbb1b3929cb52b61d3ce483885f5

Signed-off-by: Andrzej Wolski <awolski@poczta.fm>
---
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 6de0a04..0d2ef5e 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -408,8 +408,7 @@ static int macb_init(struct eth_device *netdev, bd_t 
*bd)
  {
  	struct macb_device *macb = to_macb(netdev);
  	unsigned long paddr;
-	u32 hwaddr_bottom;
-	u16 hwaddr_top;
+	uchar enetaddr[6];
  	int i;

  	/*
@@ -439,10 +438,10 @@ static int macb_init(struct eth_device *netdev, 
bd_t *bd)
  	macb_writel(macb, TBQP, macb->tx_ring_dma);

  	/* set hardware address */
-	hwaddr_bottom = cpu_to_le32(*((u32 *)netdev->enetaddr));
-	macb_writel(macb, SA1B, hwaddr_bottom);
-	hwaddr_top = cpu_to_le16(*((u16 *)(netdev->enetaddr + 4)));
-	macb_writel(macb, SA1T, hwaddr_top);
+	eth_getenv_enetaddr("ethaddr", enetaddr);
+	macb_writel(macb, SA1B, (enetaddr[3] << 24) | (enetaddr[2] << 16)
+				 | (enetaddr[1] <<  8) | (enetaddr[0]));
+	macb_writel(macb, SA1T, (enetaddr[5] <<  8) | (enetaddr[4]));

  	/* choose RMII or MII mode. This depends on the board */
  #ifdef CONFIG_RMII

-- 

             reply	other threads:[~2009-07-11 23:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 23:05 Andrzej Wolski [this message]
2009-07-12  1:09 ` [U-Boot] macb: get mac address from environment Mike Frysinger
2009-07-12  2:27   ` Andrzej Wolski
2009-07-12  3:23     ` Mike Frysinger
2009-07-12 12:05       ` Andrzej Wolski

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='h3b5s0$21q$1@ger.gmane.org' \
    --to=awolski@poczta.fm \
    --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.