[PATCH] ARM: cm-fx6: Set correct MAC address
Sascha Hauer
s.hauer at pengutronix.de
Tue Jul 28 00:08:10 PDT 2015
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 at 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
More information about the barebox
mailing list