mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: cm-fx6: Set correct MAC address
@ 2015-07-28  7:08 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2015-07-28  7:08 UTC (permalink / raw)
  To: Barebox List

The cm-fx6 board has an EEPROM which contains the boards MAC address
and other informations. This adds support for reading the MAC address.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/cm-fx6/board.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boards/cm-fx6/board.c b/arch/arm/boards/cm-fx6/board.c
index a681dea..edef18f 100644
--- a/arch/arm/boards/cm-fx6/board.c
+++ b/arch/arm/boards/cm-fx6/board.c
@@ -22,6 +22,7 @@
 #include <mach/generic.h>
 #include <linux/sizes.h>
 #include <mach/imx6.h>
+#include <net.h>
 
 static int phy_fixup(struct phy_device *phydev)
 {
@@ -58,6 +59,29 @@ static int phy_fixup(struct phy_device *phydev)
 
 #define PHY_ID_AR8031	0x004dd074
 
+static int cm_fx6_eeprom_init(void)
+{
+	struct cdev *cdev;
+	u8 mac[6];
+	int ret;
+
+	if (!of_machine_is_compatible("compulab,cm-fx6"))
+		return 0;
+
+	cdev = cdev_by_name("eeprom0");
+	if (!cdev)
+		return -ENODEV;
+
+	ret = cdev_read(cdev, mac, 6, 4, 0);
+	if (ret < 0)
+		return ret;
+
+	eth_register_ethaddr(0, mac);
+
+	return 0;
+}
+late_initcall(cm_fx6_eeprom_init);
+
 static int cm_fx6_devices_init(void)
 {
 	if (!of_machine_is_compatible("compulab,cm-fx6"))
-- 
2.1.4


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-28  7:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  7:08 [PATCH] ARM: cm-fx6: Set correct MAC address Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox