Commit c42f56d96d1ec642496ee0fdf741dc13fbbec2e2
Committed by
Tom Rini
1 parent
da384a9d76
Exists in
v2017.01-smarct4x
and in
41 other branches
blackfin: replace bfin_gen_rand_mac() with eth_random_addr()
bfin_gen_rand_mac() uses __DATE__ as the seed for random ethernet address. This makes the build non-deterministic. In the first place, it should not be implemented as a Bfin-specific function. Use eth_random_addr() instead. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Sonic Zhang <sonic.zhang@analog.com>
Showing 31 changed files with 31 additions and 69 deletions Side-by-side Diff
- arch/blackfin/include/asm/net.h
- board/bct-brettl2/bct-brettl2.c
- board/bf518f-ezbrd/bf518f-ezbrd.c
- board/bf526-ezbrd/bf526-ezbrd.c
- board/bf527-ezkit/bf527-ezkit.c
- board/bf537-minotaur/bf537-minotaur.c
- board/bf537-pnav/bf537-pnav.c
- board/bf537-srv1/bf537-srv1.c
- board/bf537-stamp/bf537-stamp.c
- board/cm-bf527/cm-bf527.c
- board/cm-bf537e/cm-bf537e.c
- board/cm-bf537u/cm-bf537u.c
- board/dnp5370/dnp5370.c
- board/ip04/ip04.c
- board/tcm-bf518/tcm-bf518.c
- board/tcm-bf537/tcm-bf537.c
- include/configs/bct-brettl2.h
- include/configs/bf518f-ezbrd.h
- include/configs/bf526-ezbrd.h
- include/configs/bf527-ezkit.h
- include/configs/bf537-minotaur.h
- include/configs/bf537-pnav.h
- include/configs/bf537-srv1.h
- include/configs/bf537-stamp.h
- include/configs/cm-bf527.h
- include/configs/cm-bf537e.h
- include/configs/cm-bf537u.h
- include/configs/dnp5370.h
- include/configs/ip04.h
- include/configs/tcm-bf518.h
- include/configs/tcm-bf537.h
arch/blackfin/include/asm/net.h
1 | -/* | |
2 | - * net.h - misc Blackfin network helpers | |
3 | - * | |
4 | - * Copyright (c) 2008-2009 Analog Devices Inc. | |
5 | - * | |
6 | - * Licensed under the GPL-2 or later. | |
7 | - */ | |
8 | - | |
9 | -#ifndef __ASM_BFIN_RAND_MAC__ | |
10 | -#define __ASM_BFIN_RAND_MAC__ | |
11 | - | |
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. | |
14 | - */ | |
15 | -static inline void bfin_gen_rand_mac(uchar *mac_addr) | |
16 | -{ | |
17 | - /* make something up */ | |
18 | - const char s[] = __DATE__; | |
19 | - size_t i; | |
20 | - u32 cycles; | |
21 | - for (i = 0; i < 6; ++i) { | |
22 | - asm("%0 = CYCLES;" : "=r" (cycles)); | |
23 | - mac_addr[i] = cycles ^ s[i]; | |
24 | - } | |
25 | - mac_addr[0] = (mac_addr[0] | 0x02) & ~0x01; /* make it local unicast */ | |
26 | -} | |
27 | - | |
28 | -#endif |
board/bct-brettl2/bct-brettl2.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <asm/blackfin.h> |
13 | 13 | #include <asm/portmux.h> |
14 | 14 | #include <asm/gpio.h> |
15 | -#include <asm/net.h> | |
16 | 15 | #include <net.h> |
17 | 16 | #include <netdev.h> |
18 | 17 | #include <miiphy.h> |
... | ... | @@ -33,7 +32,7 @@ |
33 | 32 | static void board_init_enetaddr(uchar *mac_addr) |
34 | 33 | { |
35 | 34 | puts("Warning: Generating 'random' MAC address\n"); |
36 | - bfin_gen_rand_mac(mac_addr); | |
35 | + eth_random_addr(mac_addr); | |
37 | 36 | eth_setenv_enetaddr("ethaddr", mac_addr); |
38 | 37 | } |
39 | 38 |
board/bf518f-ezbrd/bf518f-ezbrd.c
... | ... | @@ -13,7 +13,6 @@ |
13 | 13 | #include <netdev.h> |
14 | 14 | #include <spi.h> |
15 | 15 | #include <asm/blackfin.h> |
16 | -#include <asm/net.h> | |
17 | 16 | #include <asm/portmux.h> |
18 | 17 | #include <asm/mach-common/bits/otp.h> |
19 | 18 | #include <asm/sdh.h> |
... | ... | @@ -48,7 +47,7 @@ |
48 | 47 | |
49 | 48 | if (!valid_mac) { |
50 | 49 | puts("Warning: Generating 'random' MAC address\n"); |
51 | - bfin_gen_rand_mac(mac_addr); | |
50 | + eth_random_addr(mac_addr); | |
52 | 51 | } |
53 | 52 | |
54 | 53 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/bf526-ezbrd/bf526-ezbrd.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <net.h> |
13 | 13 | #include <netdev.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | #include <asm/mach-common/bits/otp.h> |
17 | 16 | |
18 | 17 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -45,7 +44,7 @@ |
45 | 44 | |
46 | 45 | if (!valid_mac) { |
47 | 46 | puts("Warning: Generating 'random' MAC address\n"); |
48 | - bfin_gen_rand_mac(mac_addr); | |
47 | + eth_random_addr(mac_addr); | |
49 | 48 | } |
50 | 49 | |
51 | 50 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/bf527-ezkit/bf527-ezkit.c
... | ... | @@ -13,7 +13,6 @@ |
13 | 13 | #include <netdev.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | 15 | #include <asm/gpio.h> |
16 | -#include <asm/net.h> | |
17 | 16 | #include <asm/mach-common/bits/otp.h> |
18 | 17 | |
19 | 18 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -47,7 +46,7 @@ |
47 | 46 | |
48 | 47 | if (!valid_mac) { |
49 | 48 | puts("Warning: Generating 'random' MAC address\n"); |
50 | - bfin_gen_rand_mac(mac_addr); | |
49 | + eth_random_addr(mac_addr); | |
51 | 50 | } |
52 | 51 | |
53 | 52 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/bf537-minotaur/bf537-minotaur.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <netdev.h> |
13 | 13 | #include <net.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | |
17 | 16 | DECLARE_GLOBAL_DATA_PTR; |
18 | 17 | |
... | ... | @@ -27,7 +26,7 @@ |
27 | 26 | static void board_init_enetaddr(uchar *mac_addr) |
28 | 27 | { |
29 | 28 | puts("Warning: Generating 'random' MAC address\n"); |
30 | - bfin_gen_rand_mac(mac_addr); | |
29 | + eth_random_addr(mac_addr); | |
31 | 30 | eth_setenv_enetaddr("ethaddr", mac_addr); |
32 | 31 | } |
33 | 32 |
board/bf537-pnav/bf537-pnav.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <netdev.h> |
13 | 13 | #include <net.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | |
17 | 16 | DECLARE_GLOBAL_DATA_PTR; |
18 | 17 | |
... | ... | @@ -27,7 +26,7 @@ |
27 | 26 | static void board_init_enetaddr(uchar *mac_addr) |
28 | 27 | { |
29 | 28 | puts("Warning: Generating 'random' MAC address\n"); |
30 | - bfin_gen_rand_mac(mac_addr); | |
29 | + eth_random_addr(mac_addr); | |
31 | 30 | eth_setenv_enetaddr("ethaddr", mac_addr); |
32 | 31 | } |
33 | 32 |
board/bf537-srv1/bf537-srv1.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <netdev.h> |
13 | 13 | #include <net.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | |
17 | 16 | DECLARE_GLOBAL_DATA_PTR; |
18 | 17 | |
... | ... | @@ -27,7 +26,7 @@ |
27 | 26 | static void board_init_enetaddr(uchar *mac_addr) |
28 | 27 | { |
29 | 28 | puts("Warning: Generating 'random' MAC address\n"); |
30 | - bfin_gen_rand_mac(mac_addr); | |
29 | + eth_random_addr(mac_addr); | |
31 | 30 | eth_setenv_enetaddr("ethaddr", mac_addr); |
32 | 31 | } |
33 | 32 |
board/bf537-stamp/bf537-stamp.c
... | ... | @@ -13,7 +13,6 @@ |
13 | 13 | #include <config.h> |
14 | 14 | #include <command.h> |
15 | 15 | #include <asm/blackfin.h> |
16 | -#include <asm/net.h> | |
17 | 16 | #include <net.h> |
18 | 17 | #include <asm/mach-common/bits/bootrom.h> |
19 | 18 | #include <netdev.h> |
... | ... | @@ -48,7 +47,7 @@ |
48 | 47 | |
49 | 48 | if (!valid_mac) { |
50 | 49 | puts("Warning: Generating 'random' MAC address\n"); |
51 | - bfin_gen_rand_mac(mac_addr); | |
50 | + eth_random_addr(mac_addr); | |
52 | 51 | } |
53 | 52 | |
54 | 53 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/cm-bf527/cm-bf527.c
... | ... | @@ -11,7 +11,6 @@ |
11 | 11 | #include <net.h> |
12 | 12 | #include <netdev.h> |
13 | 13 | #include <asm/blackfin.h> |
14 | -#include <asm/net.h> | |
15 | 14 | #include <asm/mach-common/bits/otp.h> |
16 | 15 | #include "../cm-bf537e/gpio_cfi_flash.h" |
17 | 16 | |
... | ... | @@ -46,7 +45,7 @@ |
46 | 45 | |
47 | 46 | if (!valid_mac) { |
48 | 47 | puts("Warning: Generating 'random' MAC address\n"); |
49 | - bfin_gen_rand_mac(mac_addr); | |
48 | + eth_random_addr(mac_addr); | |
50 | 49 | } |
51 | 50 | |
52 | 51 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/cm-bf537e/cm-bf537e.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <net.h> |
13 | 13 | #include <netdev.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | #include "gpio_cfi_flash.h" |
17 | 16 | |
18 | 17 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -32,7 +31,7 @@ |
32 | 31 | return; |
33 | 32 | |
34 | 33 | printf("Warning: %s: generating 'random' MAC address\n", var); |
35 | - bfin_gen_rand_mac(enetaddr); | |
34 | + eth_random_addr(enetaddr); | |
36 | 35 | eth_setenv_enetaddr(var, enetaddr); |
37 | 36 | } |
38 | 37 |
board/cm-bf537u/cm-bf537u.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <net.h> |
13 | 13 | #include <netdev.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | #include "../cm-bf537e/gpio_cfi_flash.h" |
17 | 16 | |
18 | 17 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -32,7 +31,7 @@ |
32 | 31 | return; |
33 | 32 | |
34 | 33 | printf("Warning: %s: generating 'random' MAC address\n", var); |
35 | - bfin_gen_rand_mac(enetaddr); | |
34 | + eth_random_addr(enetaddr); | |
36 | 35 | eth_setenv_enetaddr(var, enetaddr); |
37 | 36 | } |
38 | 37 |
board/dnp5370/dnp5370.c
... | ... | @@ -14,7 +14,6 @@ |
14 | 14 | #include <common.h> |
15 | 15 | #include <config.h> |
16 | 16 | #include <asm/blackfin.h> |
17 | -#include <asm/net.h> | |
18 | 17 | #include <net.h> |
19 | 18 | #include <netdev.h> |
20 | 19 | #include <asm/gpio.h> |
... | ... | @@ -55,7 +54,7 @@ |
55 | 54 | |
56 | 55 | if (!valid_mac) { |
57 | 56 | puts("Warning: Generating 'random' MAC address\n"); |
58 | - bfin_gen_rand_mac(mac_addr); | |
57 | + eth_random_addr(mac_addr); | |
59 | 58 | } |
60 | 59 | |
61 | 60 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/ip04/ip04.c
... | ... | @@ -13,7 +13,6 @@ |
13 | 13 | #include <common.h> |
14 | 14 | #include <net.h> |
15 | 15 | #include <netdev.h> |
16 | -#include <asm/net.h> | |
17 | 16 | |
18 | 17 | int checkboard(void) |
19 | 18 | { |
... | ... | @@ -33,7 +32,7 @@ |
33 | 32 | uchar enetaddr[6]; |
34 | 33 | if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { |
35 | 34 | puts("Warning: Generating 'random' MAC address\n"); |
36 | - bfin_gen_rand_mac(enetaddr); | |
35 | + eth_random_addr(enetaddr); | |
37 | 36 | eth_setenv_enetaddr("ethaddr", enetaddr); |
38 | 37 | } |
39 | 38 |
board/tcm-bf518/tcm-bf518.c
... | ... | @@ -11,7 +11,6 @@ |
11 | 11 | #include <net.h> |
12 | 12 | #include <netdev.h> |
13 | 13 | #include <asm/blackfin.h> |
14 | -#include <asm/net.h> | |
15 | 14 | #include <asm/mach-common/bits/otp.h> |
16 | 15 | #include <asm/sdh.h> |
17 | 16 | |
... | ... | @@ -47,7 +46,7 @@ |
47 | 46 | |
48 | 47 | if (!valid_mac) { |
49 | 48 | puts("Warning: Generating 'random' MAC address\n"); |
50 | - bfin_gen_rand_mac(mac_addr); | |
49 | + eth_random_addr(mac_addr); | |
51 | 50 | } |
52 | 51 | |
53 | 52 | eth_setenv_enetaddr("ethaddr", mac_addr); |
board/tcm-bf537/tcm-bf537.c
... | ... | @@ -12,7 +12,6 @@ |
12 | 12 | #include <net.h> |
13 | 13 | #include <netdev.h> |
14 | 14 | #include <asm/blackfin.h> |
15 | -#include <asm/net.h> | |
16 | 15 | #include "../cm-bf537e/gpio_cfi_flash.h" |
17 | 16 | |
18 | 17 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -32,7 +31,7 @@ |
32 | 31 | return; |
33 | 32 | |
34 | 33 | printf("Warning: %s: generating 'random' MAC address\n", var); |
35 | - bfin_gen_rand_mac(enetaddr); | |
34 | + eth_random_addr(enetaddr); | |
36 | 35 | eth_setenv_enetaddr(var, enetaddr); |
37 | 36 | } |
38 | 37 |
include/configs/bct-brettl2.h
include/configs/bf518f-ezbrd.h
include/configs/bf526-ezbrd.h
include/configs/bf527-ezkit.h
include/configs/bf537-minotaur.h
include/configs/bf537-pnav.h
include/configs/bf537-srv1.h
include/configs/bf537-stamp.h
include/configs/cm-bf527.h
include/configs/cm-bf537e.h
include/configs/cm-bf537u.h
include/configs/dnp5370.h
include/configs/ip04.h
include/configs/tcm-bf518.h
include/configs/tcm-bf537.h