From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: cm-fx6: Set correct MAC address
Date: Tue, 28 Jul 2015 09:08:10 +0200 [thread overview]
Message-ID: <1438067290-18479-1-git-send-email-s.hauer@pengutronix.de> (raw)
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
reply other threads:[~2015-07-28 7:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1438067290-18479-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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