[PATCH 2/2] fec: add support for IIM stored mac address
Baruch Siach
baruch at tkos.co.il
Tue Aug 10 02:25:05 EDT 2010
This patch adds support for i.MX25 only, because that's what I have. Extending
this to other i.MX chip should be trivial, given the right IIM_MAC_ADDR define.
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
arch/arm/mach-imx/include/mach/imx25-regs.h | 1 +
drivers/net/fec_imx.c | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h
index 7c2b5f9..f3da7b5 100644
--- a/arch/arm/mach-imx/include/mach/imx25-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx25-regs.h
@@ -142,6 +142,7 @@
/* IIM fuse definitions */
#define IIM_UID 0x820
+#define IIM_MAC_ADDR 0x868
#endif /* __ASM_ARCH_MX25_REGS_H */
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 40a7543..af93eec 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -235,6 +235,16 @@ static void fec_rbd_clean(int last, struct buffer_descriptor *pRbd)
static int fec_get_hwaddr(struct eth_device *dev, unsigned char *mac)
{
+ int i;
+
+ if (cpu_is_mx25()) {
+ /* get MAC address from the IMM fusebox */
+ for (i = 0; i < 6; i++)
+ mac[i] = readb(IMX_IIM_BASE + IIM_MAC_ADDR + i*4);
+
+ return 0;
+ }
+
/* no eeprom */
return -1;
}
--
1.7.1
More information about the barebox
mailing list