]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
blackfin: replace bfin_gen_rand_mac() with eth_random_addr()
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Fri, 18 Apr 2014 10:09:49 +0000 (19:09 +0900)
committerTom Rini <trini@ti.com>
Mon, 12 May 2014 19:19:46 +0000 (15:19 -0400)
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>
31 files changed:
arch/blackfin/include/asm/net.h [deleted file]
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

diff --git a/arch/blackfin/include/asm/net.h b/arch/blackfin/include/asm/net.h
deleted file mode 100644 (file)
index 97cb466..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * net.h - misc Blackfin network helpers
- *
- * Copyright (c) 2008-2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __ASM_BFIN_RAND_MAC__
-#define __ASM_BFIN_RAND_MAC__
-
-/* If the board does not have a real MAC assigned to it, then generate a
- * locally administrated pseudo-random one based on CYCLES and compile date.
- */
-static inline void bfin_gen_rand_mac(uchar *mac_addr)
-{
-       /* make something up */
-       const char s[] = __DATE__;
-       size_t i;
-       u32 cycles;
-       for (i = 0; i < 6; ++i) {
-               asm("%0 = CYCLES;" : "=r" (cycles));
-               mac_addr[i] = cycles ^ s[i];
-       }
-       mac_addr[0] = (mac_addr[0] | 0x02) & ~0x01; /* make it local unicast */
-}
-
-#endif
index de5b9ff0e7594dadcbfa933243cb1aec7f57a4fa..6be9b180159e53a815087c937acfa00f393b6f8e 100644 (file)
@@ -12,7 +12,6 @@
 #include <asm/blackfin.h>
 #include <asm/portmux.h>
 #include <asm/gpio.h>
-#include <asm/net.h>
 #include <net.h>
 #include <netdev.h>
 #include <miiphy.h>
@@ -33,7 +32,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
        puts("Warning: Generating 'random' MAC address\n");
-       bfin_gen_rand_mac(mac_addr);
+       eth_random_addr(mac_addr);
        eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
index 09a2353e7d93f26f730e5691507941ca62c22f93..3a94a572eb24f6f2909808e44ab03b93a7b8136e 100644 (file)
@@ -13,7 +13,6 @@
 #include <netdev.h>
 #include <spi.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/portmux.h>
 #include <asm/mach-common/bits/otp.h>
 #include <asm/sdh.h>
@@ -48,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index 4695b1161a0d2624c9e660be5ff017731590f853..368d6be25fb7193dbbbc6e33fd9c66c23b883947 100644 (file)
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -45,7 +44,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index 211cf24ac303fc889b760ca02a91a897cc2304ae..88e18690e031aec12ef451a0f352972113844e12 100644 (file)
@@ -13,7 +13,6 @@
 #include <netdev.h>
 #include <asm/blackfin.h>
 #include <asm/gpio.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -47,7 +46,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index 920429c12e69fb88aba5ba5bfe1d87f635646c45..ca61ef97b860768065ac6ecf8a50621ea148b8bf 100644 (file)
@@ -12,7 +12,6 @@
 #include <netdev.h>
 #include <net.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -27,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
        puts("Warning: Generating 'random' MAC address\n");
-       bfin_gen_rand_mac(mac_addr);
+       eth_random_addr(mac_addr);
        eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
index c5125288cbddcac21ff45820df4daaa67eb6241c..df0011026a63a52926cf826a5dff33a4602adc82 100644 (file)
@@ -12,7 +12,6 @@
 #include <netdev.h>
 #include <net.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -27,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
        puts("Warning: Generating 'random' MAC address\n");
-       bfin_gen_rand_mac(mac_addr);
+       eth_random_addr(mac_addr);
        eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
index 04d38910b3f14cb8b75b6b1d90259b5fd3174989..725296a41636c6524570f4b378fa3bbd7d96b2d4 100644 (file)
@@ -12,7 +12,6 @@
 #include <netdev.h>
 #include <net.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -27,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
        puts("Warning: Generating 'random' MAC address\n");
-       bfin_gen_rand_mac(mac_addr);
+       eth_random_addr(mac_addr);
        eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
index 5fdf8379c08f02818e5356608fd145d5c4f36340..32045a9e47cb44651062a9041a6038d4a5c4aaca 100644 (file)
@@ -13,7 +13,6 @@
 #include <config.h>
 #include <command.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <net.h>
 #include <asm/mach-common/bits/bootrom.h>
 #include <netdev.h>
@@ -48,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index a5f70a4f8392f9a5ff9ee83df497619bc825645a..1533eb9c7a878378b7b4576726d1f178ce13b385 100644 (file)
@@ -11,7 +11,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 #include "../cm-bf537e/gpio_cfi_flash.h"
 
@@ -46,7 +45,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index 8daf3ad06e875fe64ecab3fa50fb01dfff7d6de0..e79f90f95bceeee4177f4f57436405da50a79653 100644 (file)
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include "gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,7 +31,7 @@ static void board_init_enetaddr(char *var)
                return;
 
        printf("Warning: %s: generating 'random' MAC address\n", var);
-       bfin_gen_rand_mac(enetaddr);
+       eth_random_addr(enetaddr);
        eth_setenv_enetaddr(var, enetaddr);
 }
 
index 5941b5fcbe00a85a7b9df65ef0c10eab1f057d15..632cbda5c06f3c6706591dd5dc991df3cc1433ca 100644 (file)
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include "../cm-bf537e/gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,7 +31,7 @@ static void board_init_enetaddr(char *var)
                return;
 
        printf("Warning: %s: generating 'random' MAC address\n", var);
-       bfin_gen_rand_mac(enetaddr);
+       eth_random_addr(enetaddr);
        eth_setenv_enetaddr(var, enetaddr);
 }
 
index 4b3873bd4f36445e398d3ffc1213f39328375462..df721c9944aa8d8a871685c490c1c9b0634df3fb 100644 (file)
@@ -14,7 +14,6 @@
 #include <common.h>
 #include <config.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/gpio.h>
@@ -55,7 +54,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index c8ae5128b0e269df1f5ee8d5cdbb77b45f770988..ae526334267bdaff8b3b97413640ca31dee70944 100644 (file)
@@ -13,7 +13,6 @@
 #include <common.h>
 #include <net.h>
 #include <netdev.h>
-#include <asm/net.h>
 
 int checkboard(void)
 {
@@ -33,7 +32,7 @@ int misc_init_r(void)
        uchar enetaddr[6];
        if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(enetaddr);
+               eth_random_addr(enetaddr);
                eth_setenv_enetaddr("ethaddr", enetaddr);
        }
 
index 5964059dd1d44cb121e3692a5d02e3058afec10a..5d25fcd0a913629c48eb0723fbb7f31f98b26b32 100644 (file)
@@ -11,7 +11,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include <asm/mach-common/bits/otp.h>
 #include <asm/sdh.h>
 
@@ -47,7 +46,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
        if (!valid_mac) {
                puts("Warning: Generating 'random' MAC address\n");
-               bfin_gen_rand_mac(mac_addr);
+               eth_random_addr(mac_addr);
        }
 
        eth_setenv_enetaddr("ethaddr", mac_addr);
index 38aaae6870bdacf779a3b7ad9787544f21d1d10d..a4f0f7121b19d58dc758475b738c241795e44e45 100644 (file)
@@ -12,7 +12,6 @@
 #include <net.h>
 #include <netdev.h>
 #include <asm/blackfin.h>
-#include <asm/net.h>
 #include "../cm-bf537e/gpio_cfi_flash.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,7 +31,7 @@ static void board_init_enetaddr(char *var)
                return;
 
        printf("Warning: %s: generating 'random' MAC address\n", var);
-       bfin_gen_rand_mac(enetaddr);
+       eth_random_addr(enetaddr);
        eth_setenv_enetaddr(var, enetaddr);
 }
 
index 06f095cc41b5e51e8563c62d118569f92a065da1..c1eda96385188614b429707e8cd82564f5f87bba 100644 (file)
@@ -75,6 +75,7 @@
 #define CONFIG_ROOTPATH                "/romfs/brettl2"
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
+#define CONFIG_LIB_RAND
 #endif
 
 
index 9eb85ebf3df04a5eda7c4f4d65b4eff8279f7170..9e374c4024498a034e2e88b52b9bcf1c28e3f8e8 100644 (file)
@@ -89,7 +89,7 @@
 #define CONFIG_PHY_ADDR                3
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 3065d22f0bdb2fca6cc62d8db2d59dd63f598708..972eca9c1742a79bf5eeff82507db1e70b815e51 100644 (file)
@@ -87,7 +87,7 @@
 #define CONFIG_HOSTNAME                bf526-ezbrd
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 748ddb3b1570ac83032294615cb6acb602df9d1f..92c183e27c25cf47382f427c8ee7c235dd261255 100644 (file)
@@ -85,7 +85,7 @@
 #define CONFIG_HOSTNAME                bf527-ezkit
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 156eeabb06d5f7488b350f0b30ba3704f77ea020..3bc364ccfdfb32c056b133e73fb1458a1a6b92ed 100644 (file)
@@ -89,6 +89,7 @@
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:42 */
 
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 3aa3d50a89b450702fa359c0d777503851e09ed0..ba74a695f88b03d8ab6c06481e8702e452de97b7 100644 (file)
@@ -67,7 +67,7 @@
 #define CONFIG_HOSTNAME                bf537-pnav
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:24:21:18 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index e12d761a24516653e6aec7f65f033f8191e7efd3..0b723cf934e00b42d5b2dab7a21c32f81810f6dc 100644 (file)
@@ -88,7 +88,7 @@
 #define CONFIG_ROOTPATH                "/romfs"
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:42 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index e1705cadaee4f88b3292a2a297d931c97af33b2a..a302f839a1ec239b9d96e83d4a5b26374a717f91 100644 (file)
@@ -67,7 +67,7 @@
 #define CONFIG_HOSTNAME                bf537-stamp
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 384d8715adc7602f91531733498812235b3f5429..8d3ae49913ed365824d669b8ccbaad3a0f5fa42e 100644 (file)
@@ -85,7 +85,7 @@
 #define CONFIG_HOSTNAME                cm-bf527
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 67cf801a3fe43c382a9ce536d321831d60bf9bf1..47967d7120306e9ba34682d0fe70d6aa21366f8a 100644 (file)
@@ -73,7 +73,7 @@
 #define CONFIG_HOSTNAME                cm-bf537e
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 34ce75baebdf48a44d3de108f1cc22453d349ed2..88c99821b1e4d3cf662e402d655bea8df1d5e8b2 100644 (file)
@@ -71,7 +71,7 @@
 #define CONFIG_HOSTNAME                cm-bf537u
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 4f2c742a5d1a5c779a2904523c7e85bb0bce1870..3f1f9f384627362ae5d9b624dacb3a9a6fdd4576 100644 (file)
@@ -55,6 +55,8 @@
 
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
+
+#define CONFIG_LIB_RAND
 #endif
 
 /*
index 0efa2b7b9f262f69d83e2268842f26d04819f497..3767502faa59dfa4c18d234a10d38e0d2f24cad5 100644 (file)
@@ -77,6 +77,7 @@
 #define DM9000_IO              CONFIG_DM9000_BASE
 #define DM9000_DATA            (CONFIG_DM9000_BASE + 2)
 
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 1ff34d517d82ff11c5678a8ae0294c8a10595540..a77ba697d0fbe83b0dfd636dd325508afc54e5f6 100644 (file)
@@ -68,7 +68,7 @@
 #define CONFIG_HOSTNAME                tcm-bf518
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings
index 370d97ffe03f4fd4ec6fd6ef676d2eb016db2f48..c4c1c579bc102b0815aa5fe99c7500aa7f26e5ef 100644 (file)
@@ -73,7 +73,7 @@
 #define CONFIG_HOSTNAME                tcm-bf537
 /* Uncomment next line to use fixed MAC address */
 /* #define CONFIG_ETHADDR      02:80:ad:20:31:e8 */
-
+#define CONFIG_LIB_RAND
 
 /*
  * Flash Settings