]>
git.ipfire.org Git - people/ms/u-boot.git/blob - include/asm-blackfin/net.h
97cb46691e4636ad8ec4d9de27424272ee01aeb4
2 * net.h - misc Blackfin network helpers
4 * Copyright (c) 2008-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #ifndef __ASM_BFIN_RAND_MAC__
10 #define __ASM_BFIN_RAND_MAC__
12 /* If the board does not have a real MAC assigned to it, then generate a
13 * locally administrated pseudo-random one based on CYCLES and compile date.
15 static inline void bfin_gen_rand_mac(uchar
*mac_addr
)
17 /* make something up */
18 const char s
[] = __DATE__
;
21 for (i
= 0; i
< 6; ++i
) {
22 asm("%0 = CYCLES;" : "=r" (cycles
));
23 mac_addr
[i
] = cycles
^ s
[i
];
25 mac_addr
[0] = (mac_addr
[0] | 0x02) & ~0x01; /* make it local unicast */