[U-Boot] macb: get mac address from environment

Andrzej Wolski awolski at poczta.fm
Sun Jul 12 01:05:40 CEST 2009


This fix macb driver broken by commit 
56b555a644f3cbb1b3929cb52b61d3ce483885f5

Signed-off-by: Andrzej Wolski <awolski at 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

-- 



More information about the U-Boot mailing list