public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 5/7] ARM: OMAP5-uevm: Add USB MAC ethernet address
Date: Thu, 1 Aug 2013 14:06:00 -0500	[thread overview]
Message-ID: <1375383962-10160-6-git-send-email-dmurphy@ti.com> (raw)
In-Reply-To: <1375383962-10160-1-git-send-email-dmurphy@ti.com>

Set the usbethaddr based on the OMAP DIE_ID registers
which should be unique for each processor.

Then set this as the usb ethernet MAC address.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v3 - new patch
v4 - Updated per the comments - http://patchwork.ozlabs.org/patch/259754/

 board/ti/omap5_uevm/evm.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index 6219770..19d6e71 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -18,6 +18,10 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/ehci.h>
 #include <asm/ehci-omap.h>
+
+#define DIE_ID_REG_BASE     (OMAP54XX_L4_CORE_BASE + 0x2000)
+#define DIE_ID_REG_OFFSET	0x200
+
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -122,9 +126,28 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
 	int ret;
 	int auxclk;
+	int reg;
+	uint8_t device_mac[6];
 
 	enable_host_clocks();
 
+	if (!getenv("usbethaddr")) {
+		reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET;
+
+		/*
+		 * create a fake MAC address from the processor ID code.
+		 * first byte is 0x02 to signify locally administered.
+		 */
+		device_mac[0] = 0x02;
+		device_mac[1] = readl(reg + 0x10) & 0xff;
+		device_mac[2] = readl(reg + 0xC) & 0xff;
+		device_mac[3] = readl(reg + 0x8) & 0xff;
+		device_mac[4] = readl(reg) & 0xff;
+		device_mac[5] = (readl(reg) >> 8) & 0xff;
+
+		eth_setenv_enetaddr("usbethaddr", device_mac);
+	}
+
 	auxclk = readl((*prcm)->scrm_auxclk1);
 	/* Request auxilary clock */
 	auxclk |= AUXCLK_ENABLE_MASK;
-- 
1.7.9.5

  parent reply	other threads:[~2013-08-01 19:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 19:05 [U-Boot] OMAP5 uEVM USB eHCI patch set v4 Dan Murphy
2013-08-01 19:05 ` [U-Boot] [PATCH v4 1/7] omap5: uevm: Change the board name to correct name Dan Murphy
2013-08-01 19:05 ` [U-Boot] [PATCH v4 2/7] ARM: OMAP5: USB: Add OMAP5 common USB EHCI information Dan Murphy
2013-08-01 19:05 ` [U-Boot] [PATCH v4 3/7] ARM: OMAP: USB: Fix linker error when ULPI is not defined Dan Murphy
2013-08-01 19:05 ` [U-Boot] [PATCH v4 4/7] ARM: OMAP5-uevm: Add USB ehci support for the uEVM Dan Murphy
2013-08-01 19:06 ` Dan Murphy [this message]
2013-08-01 19:06 ` [U-Boot] [PATCH v4 6/7] USB: usb-hub: Add a weak function for resetting devices Dan Murphy
2013-08-01 19:06 ` [U-Boot] [PATCH v4 7/7] ARM: OMAP5-uevm: Add usb device reset API Dan Murphy
2013-08-01 19:35 ` [U-Boot] OMAP5 uEVM USB eHCI patch set v4 Marek Vasut

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=1375383962-10160-6-git-send-email-dmurphy@ti.com \
    --to=dmurphy@ti.com \
    --cc=u-boot@lists.denx.de \
    /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