[U-Boot,04/10] ARM: AM335x: add support for reading cpsw 2nd mac address from efuse

Submitted by Tom Rini on Feb. 18, 2014, 12:31 p.m.

Details

Message ID 1392726721-12169-4-git-send-email-trini@ti.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Tom Rini Feb. 18, 2014, 12:31 p.m.
From: Mugunthan V N <mugunthanvnm@ti.com>

Adding support for reading cpsw 2nd mac address from efuse and pass it
to kernel via dtb which will be used in dual emac mode of cpsw.
Also adding mii command support to am335x common config.

Acked-by: Tom Rini <trini@ti.com>
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 board/ti/am335x/board.c            |   15 +++++++++++++++
 include/configs/ti_am335x_common.h |    1 +
 2 files changed, 16 insertions(+)

Comments

Tom Rini March 4, 2014, 7:13 p.m.
On Tue, Feb 18, 2014 at 07:31:55AM -0500, Tom Rini wrote:

> From: Mugunthan V N <mugunthanvnm@ti.com>
> 
> Adding support for reading cpsw 2nd mac address from efuse and pass it
> to kernel via dtb which will be used in dual emac mode of cpsw.
> Also adding mii command support to am335x common config.
> 
> Acked-by: Tom Rini <trini@ti.com>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied to u-boot-ti/master, thanks!

Patch hide | download patch | download mbox

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 862f966..7609a18 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -602,6 +602,21 @@  int board_eth_init(bd_t *bis)
 	}
 
 #ifdef CONFIG_DRIVER_TI_CPSW
+
+	mac_lo = readl(&cdev->macid1l);
+	mac_hi = readl(&cdev->macid1h);
+	mac_addr[0] = mac_hi & 0xFF;
+	mac_addr[1] = (mac_hi & 0xFF00) >> 8;
+	mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
+	mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
+	mac_addr[4] = mac_lo & 0xFF;
+	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
+
+	if (!getenv("eth1addr")) {
+		if (is_valid_ether_addr(mac_addr))
+			eth_setenv_enetaddr("eth1addr", mac_addr);
+	}
+
 	if (read_eeprom(&header) < 0)
 		puts("Could not get board ID.\n");
 
diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h
index 91f97dd..b59c7fe 100644
--- a/include/configs/ti_am335x_common.h
+++ b/include/configs/ti_am335x_common.h
@@ -31,6 +31,7 @@ 
 /* Network defines. */
 #define CONFIG_CMD_NET			/* 'bootp' and 'tftp' */
 #define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
 #define CONFIG_BOOTP_DNS		/* Configurable parts of CMD_DHCP */
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME