diff options
author | John Rigby <john.rigby@linaro.org> | 2011-10-23 22:55:22 -0600 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2012-01-19 12:54:20 -0700 |
commit | 83ab671bd84e219f07c0693d9684b39a02266aec (patch) | |
tree | a874abd9effee08951c258421103b61218174e08 /arch | |
parent | 599e6e501db6e963aafa71654f807411445ac3f4 (diff) |
OMAP3: Beagle: set mac addr from dieid
TODO: share dieid<-->mac addr code between
OMAP3 and OMAP4
Signed-off-by: John Rigby <john.rigby@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/cpu/armv7/omap3/sys_info.c | 35 | ||||
-rw-r--r-- | arch/arm/include/asm/arch-omap3/sys_proto.h | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/omap3/sys_info.c b/arch/arm/cpu/armv7/omap3/sys_info.c index 22887aec0..c778823e3 100644 --- a/arch/arm/cpu/armv7/omap3/sys_info.c +++ b/arch/arm/cpu/armv7/omap3/sys_info.c @@ -78,6 +78,8 @@ void dieid_num_r(void) printf("Die ID #%s\n", uid_s); } + + /****************************************** * get_cpu_type(void) - extract cpu info ******************************************/ @@ -365,3 +367,36 @@ int print_cpuinfo (void) return 0; } #endif /* CONFIG_DISPLAY_CPUINFO */ + +void omap3_die_id_to_ethernet_mac(u8 *mac, int subtype) +{ + struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE; + u32 idcode; + u32 id[4]; + + idcode = readl(&id_base->idcode); + id[0] = readl(&id_base->die_id_0); + id[1] = readl(&id_base->die_id_1); + id[2] = readl(&id_base->die_id_2); + id[3] = readl(&id_base->die_id_3); + + mac[0] = id[2]; + mac[1] = id[2] >> 8; + mac[2] = id[1]; + mac[3] = id[1] >> 8; + mac[4] = id[1] >> 16; + mac[5] = id[1] >> 24; + /* XOR other chip-specific data with ID */ + idcode ^= id[3]; + + mac[0] ^= idcode; + mac[1] ^= idcode >> 8; + mac[2] ^= idcode >> 16; + mac[3] ^= idcode >> 24; + + /* allow four MACs from this same basic data */ + mac[1] = (mac[1] & ~0xc0) | ((subtype & 3) << 6); + + /* mark it as not multicast and outside official 80211 MAC namespace */ + mac[0] = (mac[0] & ~1) | 2; +} diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h index e5031d502..a9412d229 100644 --- a/arch/arm/include/asm/arch-omap3/sys_proto.h +++ b/arch/arm/include/asm/arch-omap3/sys_proto.h @@ -73,4 +73,5 @@ void power_init_r(void); void dieid_num_r(void); void do_omap3_emu_romcode_call(u32 service_id, u32 parameters); void omap3_gp_romcode_call(u32 service_id, u32 parameter); +void omap3_die_id_to_ethernet_mac(u8 *, int); #endif |