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

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Oct 29 09:47:00 EDT 2012


The OUI will be 'ron' => 72:6F:6E

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

diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 907c6bb..f3764bb 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -36,6 +36,7 @@
 #include <mach/at91sam9_smc.h>
 #include <mach/sam9_smc.h>
 #include <linux/w1-gpio.h>
+#include <w1_mac_address.h>
 
 struct w1_gpio_platform_data w1_pdata = {
 	.pin = AT91_PIN_PA31,
@@ -128,6 +129,13 @@ static void pm9g45_phy_init(void)
 	at91_set_gpio_value(AT91_PIN_PD2, 1);
 }
 
+static void pm9g45_add_device_eth(void)
+{
+	w1_mac_address_register(0, true, "ron", "w1-1-0");
+	pm9g45_phy_init();
+	at91_add_device_eth(0, &macb_pdata);
+}
+
 static int pm9g45_mem_init(void)
 {
 	at91_add_device_sdram(128 * 1024 * 1024);
@@ -143,8 +151,7 @@ static int pm9g45_devices_init(void)
 
 	pm_add_device_nand();
 	pm9g45_add_device_mci();
-	pm9g45_phy_init();
-	at91_add_device_eth(0, &macb_pdata);
+	pm9g45_add_device_eth();
 	pm9g45_add_device_usbh();
 
 	devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
-- 
1.7.10.4




More information about the barebox mailing list