[PATCH 2/3] arm: mxs: tx28: get MAC from OCOTP

Wolfram Sang w.sang at pengutronix.de
Thu Apr 5 05:05:40 EDT 2012


Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
---
 arch/arm/boards/karo-tx28/tx28-stk5.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index b36d822..04fdbc3 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -21,11 +21,13 @@
 #include <fec.h>
 #include <sizes.h>
 #include <io.h>
+#include <net.h>
 #include <asm/sections.h>
 #include <mach/imx-regs.h>
 #include <mach/clock.h>
 #include <mach/mci.h>
 #include <mach/fb.h>
+#include <mach/ocotp.h>
 
 static struct mxs_mci_platform_data mci_pdata = {
 	.caps = MMC_MODE_4BIT,
@@ -345,6 +347,22 @@ static int register_persistent_environment(void)
 					DEVFS_PARTITION_FIXED, "env0");
 }
 
+void tx28_get_ethaddr(void)
+{
+	u32 buf[2];	/* to make use of cpu_to_be32 */
+	u32 ethaddr[2];
+	int ret;
+
+	ret = mxs_ocotp_read(buf, 8, 0);
+	if (ret != 8)
+		return;
+
+	ethaddr[0] = cpu_to_be32(buf[0]);
+	ethaddr[1] = cpu_to_be32(buf[1]);
+
+	eth_register_ethaddr(0, (char *)ethaddr);
+}
+
 void base_board_init(void)
 {
 	int i, ret;
@@ -369,6 +387,11 @@ void base_board_init(void)
 	add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
 			   IORESOURCE_MEM, &tx28_fb_pdata);
 
+	add_generic_device("ocotp", 0, NULL, IMX_OCOTP_BASE, 0,
+			   IORESOURCE_MEM, NULL);
+
+	tx28_get_ethaddr();
+
 	imx_enable_enetclk();
 	add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0,
 			   IORESOURCE_MEM, &fec_info);
-- 
1.7.9.5




More information about the barebox mailing list