Skip to content
Snippets Groups Projects
Commit e0b04a15 authored by Ramon Fried's avatar Ramon Fried Committed by Tom Rini
Browse files

snapdragon: added MAC generation functions


Add support for generation of unique MAC address
that is derived from board serial.
Algorithm for generation of MAC taken from LK.

Signed-off-by: default avatarRamon Fried <ramon.fried@gmail.com>
parent 86e5e429
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,6 @@
#define MISC_H
u32 msm_board_serial(void);
void msm_generate_mac_addr(u8 *mac);
#endif
......@@ -35,3 +35,19 @@ u32 msm_board_serial(void)
return UNSTUFF_BITS(mmc_dev->cid, 16, 32);
}
void msm_generate_mac_addr(u8 *mac)
{
int i;
char sn[9];
snprintf(sn, 8, "%08x", msm_board_serial());
/* fill in the mac with serialno, use locally adminstrated pool */
mac[0] = 0x02;
mac[1] = 00;
for (i = 3; i >= 0; i--) {
mac[i + 2] = simple_strtoul(&sn[2 * i], NULL, 16);
sn[2 * i] = 0;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment