[PATCH 4/4] at91sam9x5ek: use w1 serial number to generate local mac address

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Oct 31 14:22:04 EDT 2012


The OUI will be 'tml' => 76:6D:6C

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 arch/arm/boards/at91sam9x5ek/init.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c
index b3d7ab2..78f7349 100644
--- a/arch/arm/boards/at91sam9x5ek/init.c
+++ b/arch/arm/boards/at91sam9x5ek/init.c
@@ -40,6 +40,7 @@
 #include <gpio_keys.h>
 #include <readkey.h>
 #include <linux/w1-gpio.h>
+#include <w1_mac_address.h>
 
 #include "hw_version.h"
 
@@ -105,6 +106,14 @@ static struct at91_ether_platform_data macb_pdata = {
 	.phy_addr = 0,
 };
 
+static void ek_add_device_eth(void)
+{
+	if (w1_local_mac_address_register(0, "tml", "w1-2d-0"))
+		w1_local_mac_address_register(0, "tml", "w1-23-0");
+
+	at91_add_device_eth(0, &macb_pdata);
+}
+
 /*
  * USB Host port
  */
@@ -160,7 +169,7 @@ static int at91sam9x5ek_devices_init(void)
 {
 	ek_add_device_w1();
 	ek_add_device_nand();
-	at91_add_device_eth(0, &macb_pdata);
+	ek_add_device_eth();
 	at91_add_device_usbh_ohci(&ek_usbh_data);
 	ek_add_led();
 
-- 
1.7.10.4




More information about the barebox mailing list