Skip to contentSkip to conversation

omap3: am3517evm : Read MAC address from E-Fuses

PATCH New Sriramakrishnan A G 1 participant 1 message Mar 22, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap3: am3517evm : Read MAC address from E-Fuses

MAC address is programmed in the e-fuses accessible through Control module space. Board init code reads the programmed value from e-fuse and passes this information to the driver.

---
 arch/arm/mach-omap2/board-am3517evm.c |   12 +++++++++++-
 arch/arm/mach-omap2/control.h         |    2 ++
 2 files changed, 13 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +11 -1
index 77541cf..177c65d 100644
@@ -128,7 +128,17 @@ static void am3517_disable_ethernet_int(void)
 
 static void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
 {
-	unsigned int regval;
+	u32 regval, mac_lo, mac_hi;
+
+	mac_lo = omap_ctrl_readl(AM35XX_CONTROL_FUSE_EMAC_LSB);
+	mac_hi = omap_ctrl_readl(AM35XX_CONTROL_FUSE_EMAC_MSB);
+
+	pdata->mac_addr[0] = (u_int8_t)((mac_hi & 0xFF0000) >> 16);
+	pdata->mac_addr[1] = (u_int8_t)((mac_hi & 0xFF00) >> 8);
+	pdata->mac_addr[2] = (u_int8_t)((mac_hi & 0xFF) >> 0);
+	pdata->mac_addr[3] = (u_int8_t)((mac_lo & 0xFF0000) >> 16);
+	pdata->mac_addr[4] = (u_int8_t)((mac_lo & 0xFF00) >> 8);
+	pdata->mac_addr[5] = (u_int8_t)((mac_lo & 0xFF) >> 0);
 
 	pdata->ctrl_reg_offset		= AM35XX_EMAC_CNTRL_OFFSET;
 	pdata->ctrl_mod_reg_offset	= AM35XX_EMAC_CNTRL_MOD_OFFSET;
arch/arm/mach-omap2/control.h +2 -0
index c2804c1..8b6cc4f 100644
@@ -198,6 +198,8 @@
 
 /* AM35XX only CONTROL_GENERAL register offsets */
 #define AM35XX_CONTROL_MSUSPENDMUX_6    (OMAP2_CONTROL_GENERAL + 0x0038)
+#define AM35XX_CONTROL_FUSE_EMAC_LSB	(OMAP2_CONTROL_GENERAL + 0x0110)
+#define AM35XX_CONTROL_FUSE_EMAC_MSB	(OMAP2_CONTROL_GENERAL + 0x0114)
 #define AM35XX_CONTROL_DEVCONF2         (OMAP2_CONTROL_GENERAL + 0x0310)
 #define AM35XX_CONTROL_DEVCONF3         (OMAP2_CONTROL_GENERAL + 0x0314)
 #define AM35XX_CONTROL_CBA_PRIORITY     (OMAP2_CONTROL_GENERAL + 0x0320)
Signature · 1 line
1.6.2.4