mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] arm: mxs: tx28: get MAC from OCOTP
Date: Thu,  5 Apr 2012 11:05:40 +0200	[thread overview]
Message-ID: <1333616741-14273-3-git-send-email-w.sang@pengutronix.de> (raw)
In-Reply-To: <1333616741-14273-1-git-send-email-w.sang@pengutronix.de>

Signed-off-by: Wolfram Sang <w.sang@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-04-05  9:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05  9:05 [PATCH 0/3] arm: mxs: ocotp read support Wolfram Sang
2012-04-05  9:05 ` [PATCH 1/3] arm: mxs: add ocotp driver Wolfram Sang
2012-04-05  9:05 ` Wolfram Sang [this message]
2012-04-05  9:05 ` [PATCH 3/3] net: eth: don't say that MAC comes from EEPROM Wolfram Sang
2012-04-05 16:26 ` [PATCH 0/3] arm: mxs: ocotp read support Sascha Hauer

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=1333616741-14273-3-git-send-email-w.sang@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox