diff options
author | Fugang Duan <b38611@freescale.com> | 2016-04-06 14:11:01 +0800 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2016-06-24 14:46:30 +0200 |
commit | d1878f948d1d54b6ed1f3053c9fa5b1933e75e76 (patch) | |
tree | 9e11c511606a5e1b182aa06ac3ee04fe9a083d4b | |
parent | 01f5bdba88beea4806fb6db77c02c32e694392f3 (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)
-rw-r--r-- | arch/arm/mach-imx/common.c | 15 |
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; |