summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorFugang Duan <b38611@freescale.com>2016-04-06 14:11:01 +0800
committerFrank Li <Frank.Li@nxp.com>2016-04-29 10:05:37 -0500
commitefb83ff690d80d1e4888e5b6d4891e54ee188e5f (patch)
treed00b08361077f237481defe2305121fcaa81e868 /arch/arm
parenta90438ea7226cf80f0bf8c02cbec0cc28b64f340 (diff)
MLK-12620 ARM: imx: correct i.MX7D fuse MAC1_ADDR offset address
i.MX7d MAC1_ADDR fuse offset address is 0x640, i.MX6q/dl/sx/ul MAC1_ADDR fuse offset address is 0x620. Correct it for i.MX7d, otherwise read un-correct MAC address. Signed-off-by: Fugang Duan <fugang.duan@nxp.com> (cherry picked from commit:74ee5313534dd9453601f4428c4916d46405669f)
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/common.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/arm/mach-imx/common.c b/arch/arm/mach-imx/common.c
index b240b449d889..c375cc4f18e2 100644
--- a/arch/arm/mach-imx/common.c
+++ b/arch/arm/mach-imx/common.c
@@ -14,6 +14,8 @@
#include <linux/of_net.h>
#include <linux/slab.h>
+#include "hardware.h"
+
unsigned long iram_tlb_base_addr;
unsigned long iram_tlb_phys_addr;
@@ -37,7 +39,8 @@ void restore_ttbr1(unsigned long ttbr1)
);
}
-#define OCOTP_MACn(n) (0x00000620 + (n) * 0x10)
+#define OCOTP_MAC_OFF (cpu_is_imx7d() ? 0x640 : 0x620)
+#define OCOTP_MACn(n) (OCOTP_MAC_OFF + (n) * 0x10)
void __init imx6_enet_mac_init(const char *enet_compat, const char *ocotp_compat)
{
struct device_node *ocotp_np, *enet_np, *from = NULL;
@@ -47,7 +50,7 @@ void __init imx6_enet_mac_init(const char *enet_compat, const char *ocotp_compat
u32 macaddr_high = 0;
u32 macaddr1_high = 0;
u8 *macaddr;
- int i;
+ int i, id;
for (i = 0; i < 2; i++) {
enet_np = of_find_compatible_node(from, NULL, enet_compat);
@@ -59,6 +62,10 @@ void __init imx6_enet_mac_init(const char *enet_compat, const char *ocotp_compat
if (of_get_mac_address(enet_np))
goto put_enet_node;
+ id = of_alias_get_id(enet_np, "ethernet");
+ if (id < 0)
+ id = i;
+
ocotp_np = of_find_compatible_node(NULL, NULL, ocotp_compat);
if (!ocotp_np) {
pr_warn("failed to find ocotp node\n");
@@ -72,7 +79,7 @@ void __init imx6_enet_mac_init(const char *enet_compat, const char *ocotp_compat
}
macaddr_low = readl_relaxed(base + OCOTP_MACn(1));
- if (i)
+ if (id)
macaddr1_high = readl_relaxed(base + OCOTP_MACn(2));
else
macaddr_high = readl_relaxed(base + OCOTP_MACn(0));
@@ -90,7 +97,7 @@ void __init imx6_enet_mac_init(const char *enet_compat, const char *ocotp_compat
}
macaddr = newmac->value;
- if (i) {
+ if (id) {
macaddr[5] = (macaddr_low >> 16) & 0xff;
macaddr[4] = (macaddr_low >> 24) & 0xff;
macaddr[3] = macaddr1_high & 0xff;