summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2015-05-04 14:55:15 -0500
committerJoe Hershberger <joe.hershberger@ni.com>2015-05-20 11:07:27 -0500
commit76ec988b062ed880ab23d0e0d4e9e6c137b55cc3 (patch)
tree9f97bb7d62c2c8114f688c512e6169f105db1fba /board
parent92ac520821405e196c920d60921bdfa5ab6b878c (diff)
net: Remove all calls to net_random_ethaddr()
Remove the calls to net_random_ethaddr() that some boards and some drivers are calling. This is now implemented inside of net/eth.c Enable the feature for all boards that previously enabled it. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-By: Michael Walle <michael@walle.cc> (for the lsxl board part) Series-changes: 2 -Fixed bfin build errors
Diffstat (limited to 'board')
-rw-r--r--board/bct-brettl2/bct-brettl2.c13
-rw-r--r--board/bf518f-ezbrd/bf518f-ezbrd.c28
-rw-r--r--board/bf526-ezbrd/bf526-ezbrd.c28
-rw-r--r--board/bf527-ezkit/bf527-ezkit.c11
-rw-r--r--board/bf537-minotaur/bf537-minotaur.c18
-rw-r--r--board/bf537-pnav/bf537-pnav.c18
-rw-r--r--board/bf537-srv1/bf537-srv1.c18
-rw-r--r--board/bf537-stamp/bf537-stamp.c28
-rw-r--r--board/buffalo/lsxl/lsxl.c10
-rw-r--r--board/cm-bf527/cm-bf527.c11
-rw-r--r--board/cm-bf537e/cm-bf537e.c15
-rw-r--r--board/cm-bf537u/cm-bf537u.c15
-rw-r--r--board/dnp5370/dnp5370.c28
-rw-r--r--board/ip04/ip04.c12
-rw-r--r--board/tcm-bf518/tcm-bf518.c40
-rw-r--r--board/tcm-bf537/tcm-bf537.c15
16 files changed, 30 insertions, 278 deletions
diff --git a/board/bct-brettl2/bct-brettl2.c b/board/bct-brettl2/bct-brettl2.c
index 1f0dfb4d403..bf7cd62954b 100644
--- a/board/bct-brettl2/bct-brettl2.c
+++ b/board/bct-brettl2/bct-brettl2.c
@@ -29,13 +29,6 @@ int checkboard(void)
}
#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
-{
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
- eth_setenv_enetaddr("ethaddr", mac_addr);
-}
-
int board_eth_init(bd_t *bis)
{
int retry = 3;
@@ -107,12 +100,6 @@ static void turn_leds_off(void)
/* miscellaneous platform dependent initialisations */
int misc_init_r(void)
{
-#ifdef CONFIG_BFIN_MAC
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
- board_init_enetaddr(enetaddr);
-#endif
-
gpio_cfi_flash_init();
init_tlv320aic31();
init_mute_pin();
diff --git a/board/bf518f-ezbrd/bf518f-ezbrd.c b/board/bf518f-ezbrd/bf518f-ezbrd.c
index 8ecfbb28c9a..bf4a7db03d6 100644
--- a/board/bf518f-ezbrd/bf518f-ezbrd.c
+++ b/board/bf518f-ezbrd/bf518f-ezbrd.c
@@ -29,28 +29,14 @@ int checkboard(void)
#if defined(CONFIG_BFIN_MAC)
static void board_init_enetaddr(uchar *mac_addr)
{
-#ifdef CONFIG_SYS_NO_FLASH
-# define USE_MAC_IN_FLASH 0
-#else
-# define USE_MAC_IN_FLASH 1
-#endif
- bool valid_mac = false;
-
- if (USE_MAC_IN_FLASH) {
- /* we cram the MAC in the last flash sector */
- uchar *board_mac_addr = (uchar *)0x203F0096;
- if (is_valid_ethaddr(board_mac_addr)) {
- memcpy(mac_addr, board_mac_addr, 6);
- valid_mac = true;
- }
- }
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
+#ifndef CONFIG_SYS_NO_FLASH
+ /* we cram the MAC in the last flash sector */
+ uchar *board_mac_addr = (uchar *)0x203F0096;
+ if (is_valid_ethaddr(board_mac_addr)) {
+ memcpy(mac_addr, board_mac_addr, 6);
+ eth_setenv_enetaddr("ethaddr", mac_addr);
}
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
+#endif
}
/* Only the first run of boards had a KSZ switch */
diff --git a/board/bf526-ezbrd/bf526-ezbrd.c b/board/bf526-ezbrd/bf526-ezbrd.c
index 0a88491e902..db1ee283f25 100644
--- a/board/bf526-ezbrd/bf526-ezbrd.c
+++ b/board/bf526-ezbrd/bf526-ezbrd.c
@@ -26,28 +26,14 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
-#ifdef CONFIG_SYS_NO_FLASH
-# define USE_MAC_IN_FLASH 0
-#else
-# define USE_MAC_IN_FLASH 1
-#endif
- bool valid_mac = false;
-
- if (USE_MAC_IN_FLASH) {
- /* we cram the MAC in the last flash sector */
- uchar *board_mac_addr = (uchar *)0x203F0096;
- if (is_valid_ethaddr(board_mac_addr)) {
- memcpy(mac_addr, board_mac_addr, 6);
- valid_mac = true;
- }
- }
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
+#ifndef CONFIG_SYS_NO_FLASH
+ /* we cram the MAC in the last flash sector */
+ uchar *board_mac_addr = (uchar *)0x203F0096;
+ if (is_valid_ethaddr(board_mac_addr)) {
+ memcpy(mac_addr, board_mac_addr, 6);
+ eth_setenv_enetaddr("ethaddr", mac_addr);
}
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
+#endif
}
int board_eth_init(bd_t *bis)
diff --git a/board/bf527-ezkit/bf527-ezkit.c b/board/bf527-ezkit/bf527-ezkit.c
index 257775f3c87..b551d4ed7e3 100644
--- a/board/bf527-ezkit/bf527-ezkit.c
+++ b/board/bf527-ezkit/bf527-ezkit.c
@@ -27,8 +27,6 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
- bool valid_mac = false;
-
/* the MAC is stored in OTP memory page 0xDF */
uint32_t ret;
uint64_t otp_mac;
@@ -41,15 +39,8 @@ static void board_init_enetaddr(uchar *mac_addr)
mac_addr[ret] = otp_mac_p[5 - ret];
if (is_valid_ethaddr(mac_addr))
- valid_mac = true;
- }
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
+ eth_setenv_enetaddr("ethaddr", mac_addr);
}
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
}
int board_eth_init(bd_t *bis)
diff --git a/board/bf537-minotaur/bf537-minotaur.c b/board/bf537-minotaur/bf537-minotaur.c
index 71b4293ad62..9312216dc74 100644
--- a/board/bf537-minotaur/bf537-minotaur.c
+++ b/board/bf537-minotaur/bf537-minotaur.c
@@ -23,26 +23,8 @@ int checkboard(void)
}
#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
-{
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
- eth_setenv_enetaddr("ethaddr", mac_addr);
-}
-
int board_eth_init(bd_t *bis)
{
return bfin_EMAC_initialize(bis);
}
#endif
-
-int misc_init_r(void)
-{
-#ifdef CONFIG_BFIN_MAC
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
- board_init_enetaddr(enetaddr);
-#endif
-
- return 0;
-}
diff --git a/board/bf537-pnav/bf537-pnav.c b/board/bf537-pnav/bf537-pnav.c
index 93522df56c3..6739fe1ed61 100644
--- a/board/bf537-pnav/bf537-pnav.c
+++ b/board/bf537-pnav/bf537-pnav.c
@@ -23,26 +23,8 @@ int checkboard(void)
}
#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
-{
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
- eth_setenv_enetaddr("ethaddr", mac_addr);
-}
-
int board_eth_init(bd_t *bis)
{
return bfin_EMAC_initialize(bis);
}
#endif
-
-int misc_init_r(void)
-{
-#ifdef CONFIG_BFIN_MAC
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
- board_init_enetaddr(enetaddr);
-#endif
-
- return 0;
-}
diff --git a/board/bf537-srv1/bf537-srv1.c b/board/bf537-srv1/bf537-srv1.c
index 6581028294f..b0ffe1aeea1 100644
--- a/board/bf537-srv1/bf537-srv1.c
+++ b/board/bf537-srv1/bf537-srv1.c
@@ -23,26 +23,8 @@ int checkboard(void)
}
#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
-{
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
- eth_setenv_enetaddr("ethaddr", mac_addr);
-}
-
int board_eth_init(bd_t *bis)
{
return bfin_EMAC_initialize(bis);
}
#endif
-
-int misc_init_r(void)
-{
-#ifdef CONFIG_BFIN_MAC
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
- board_init_enetaddr(enetaddr);
-#endif
-
- return 0;
-}
diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c
index 66e54925dae..85d41d0aaae 100644
--- a/board/bf537-stamp/bf537-stamp.c
+++ b/board/bf537-stamp/bf537-stamp.c
@@ -29,28 +29,14 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
-#ifdef CONFIG_SYS_NO_FLASH
-# define USE_MAC_IN_FLASH 0
-#else
-# define USE_MAC_IN_FLASH 1
-#endif
- bool valid_mac = false;
-
- if (USE_MAC_IN_FLASH) {
- /* we cram the MAC in the last flash sector */
- uchar *board_mac_addr = (uchar *)0x203F0000;
- if (is_valid_ethaddr(board_mac_addr)) {
- memcpy(mac_addr, board_mac_addr, 6);
- valid_mac = true;
- }
- }
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
+#ifndef CONFIG_SYS_NO_FLASH
+ /* we cram the MAC in the last flash sector */
+ uchar *board_mac_addr = (uchar *)0x203F0000;
+ if (is_valid_ethaddr(board_mac_addr)) {
+ memcpy(mac_addr, board_mac_addr, 6);
+ eth_setenv_enetaddr("ethaddr", mac_addr);
}
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
+#endif
}
int board_eth_init(bd_t *bis)
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 487875c23a1..45dd7888051 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -230,16 +230,6 @@ static void rescue_mode(void)
uchar enetaddr[6];
printf("Entering rescue mode..\n");
-#ifdef CONFIG_RANDOM_MACADDR
- if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
- net_random_ethaddr(enetaddr);
- if (eth_setenv_enetaddr("ethaddr", enetaddr)) {
- printf("Failed to set ethernet address\n");
- set_led(LED_ALARM_BLINKING);
- return;
- }
- }
-#endif
setenv("bootsource", "rescue");
}
diff --git a/board/cm-bf527/cm-bf527.c b/board/cm-bf527/cm-bf527.c
index 2871fa2d6a7..3186c6717ef 100644
--- a/board/cm-bf527/cm-bf527.c
+++ b/board/cm-bf527/cm-bf527.c
@@ -26,8 +26,6 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
- bool valid_mac = false;
-
/* the MAC is stored in OTP memory page 0xDF */
uint32_t ret;
uint64_t otp_mac;
@@ -40,15 +38,8 @@ static void board_init_enetaddr(uchar *mac_addr)
mac_addr[ret] = otp_mac_p[5 - ret];
if (is_valid_ethaddr(mac_addr))
- valid_mac = true;
- }
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
+ eth_setenv_enetaddr("ethaddr", mac_addr);
}
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
}
int board_eth_init(bd_t *bis)
diff --git a/board/cm-bf537e/cm-bf537e.c b/board/cm-bf537e/cm-bf537e.c
index 902611ec016..57c72a2c067 100644
--- a/board/cm-bf537e/cm-bf537e.c
+++ b/board/cm-bf537e/cm-bf537e.c
@@ -23,18 +23,6 @@ int checkboard(void)
return 0;
}
-static void board_init_enetaddr(char *var)
-{
- uchar enetaddr[6];
-
- if (eth_getenv_enetaddr(var, enetaddr))
- return;
-
- printf("Warning: %s: generating 'random' MAC address\n", var);
- net_random_ethaddr(enetaddr);
- eth_setenv_enetaddr(var, enetaddr);
-}
-
#ifndef CONFIG_BFIN_MAC
# define bfin_EMAC_initialize(x) 1
#endif
@@ -50,9 +38,6 @@ int board_eth_init(bd_t *bis)
int misc_init_r(void)
{
- board_init_enetaddr("ethaddr");
- board_init_enetaddr("eth1addr");
-
gpio_cfi_flash_init();
return 0;
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 69bffd76de8..f365cdbeb77 100644
--- a/board/cm-bf537u/cm-bf537u.c
+++ b/board/cm-bf537u/cm-bf537u.c
@@ -23,18 +23,6 @@ int checkboard(void)
return 0;
}
-static void board_init_enetaddr(char *var)
-{
- uchar enetaddr[6];
-
- if (eth_getenv_enetaddr(var, enetaddr))
- return;
-
- printf("Warning: %s: generating 'random' MAC address\n", var);
- net_random_ethaddr(enetaddr);
- eth_setenv_enetaddr(var, enetaddr);
-}
-
#ifndef CONFIG_BFIN_MAC
# define bfin_EMAC_initialize(x) 1
#endif
@@ -50,9 +38,6 @@ int board_eth_init(bd_t *bis)
int misc_init_r(void)
{
- board_init_enetaddr("ethaddr");
- board_init_enetaddr("eth1addr");
-
gpio_cfi_flash_init();
return 0;
diff --git a/board/dnp5370/dnp5370.c b/board/dnp5370/dnp5370.c
index 655fcace2b8..ae9ba84dc24 100644
--- a/board/dnp5370/dnp5370.c
+++ b/board/dnp5370/dnp5370.c
@@ -36,28 +36,14 @@ int checkboard(void)
#ifdef CONFIG_BFIN_MAC
static void board_init_enetaddr(uchar *mac_addr)
{
-#ifdef CONFIG_SYS_NO_FLASH
-# define USE_MAC_IN_FLASH 0
-#else
-# define USE_MAC_IN_FLASH 1
-#endif
- bool valid_mac = false;
-
- if (USE_MAC_IN_FLASH) {
- /* we cram the MAC in the last flash sector */
- uchar *board_mac_addr = (uchar *)0x202F0000;
- if (is_valid_ethaddr(board_mac_addr)) {
- memcpy(mac_addr, board_mac_addr, 6);
- valid_mac = true;
- }
- }
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
+#ifndef CONFIG_SYS_NO_FLASH
+ /* we cram the MAC in the last flash sector */
+ uchar *board_mac_addr = (uchar *)0x202F0000;
+ if (is_valid_ethaddr(board_mac_addr)) {
+ memcpy(mac_addr, board_mac_addr, 6);
+ eth_setenv_enetaddr("ethaddr", mac_addr);
}
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
+#endif
}
int board_eth_init(bd_t *bis)
diff --git a/board/ip04/ip04.c b/board/ip04/ip04.c
index d20500f4df5..70765bce50d 100644
--- a/board/ip04/ip04.c
+++ b/board/ip04/ip04.c
@@ -26,16 +26,4 @@ int board_eth_init(bd_t *bis)
{
return dm9000_initialize(bis);
}
-
-int misc_init_r(void)
-{
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(enetaddr);
- eth_setenv_enetaddr("ethaddr", enetaddr);
- }
-
- return 0;
-}
#endif
diff --git a/board/tcm-bf518/tcm-bf518.c b/board/tcm-bf518/tcm-bf518.c
index 3fa7d972eaf..4348678aebc 100644
--- a/board/tcm-bf518/tcm-bf518.c
+++ b/board/tcm-bf518/tcm-bf518.c
@@ -23,52 +23,12 @@ int checkboard(void)
}
#if defined(CONFIG_BFIN_MAC)
-static void board_init_enetaddr(uchar *mac_addr)
-{
- bool valid_mac = false;
-
-#if 0
- /* the MAC is stored in OTP memory page 0xDF */
- uint32_t ret;
- uint64_t otp_mac;
-
- ret = bfrom_OtpRead(0xDF, OTP_LOWER_HALF, &otp_mac);
- if (!(ret & OTP_MASTER_ERROR)) {
- uchar *otp_mac_p = (uchar *)&otp_mac;
-
- for (ret = 0; ret < 6; ++ret)
- mac_addr[ret] = otp_mac_p[5 - ret];
-
- if (is_valid_ethaddr(mac_addr))
- valid_mac = true;
- }
-#endif
-
- if (!valid_mac) {
- puts("Warning: Generating 'random' MAC address\n");
- net_random_ethaddr(mac_addr);
- }
-
- eth_setenv_enetaddr("ethaddr", mac_addr);
-}
-
int board_eth_init(bd_t *bis)
{
return bfin_EMAC_initialize(bis);
}
#endif
-int misc_init_r(void)
-{
-#ifdef CONFIG_BFIN_MAC
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
- board_init_enetaddr(enetaddr);
-#endif
-
- return 0;
-}
-
#ifdef CONFIG_BFIN_SDH
int board_mmc_init(bd_t *bis)
{
diff --git a/board/tcm-bf537/tcm-bf537.c b/board/tcm-bf537/tcm-bf537.c
index 2531a443364..2cf70cab151 100644
--- a/board/tcm-bf537/tcm-bf537.c
+++ b/board/tcm-bf537/tcm-bf537.c
@@ -23,18 +23,6 @@ int checkboard(void)
return 0;
}
-static void board_init_enetaddr(char *var)
-{
- uchar enetaddr[6];
-
- if (eth_getenv_enetaddr(var, enetaddr))
- return;
-
- printf("Warning: %s: generating 'random' MAC address\n", var);
- net_random_ethaddr(enetaddr);
- eth_setenv_enetaddr(var, enetaddr);
-}
-
#ifndef CONFIG_BFIN_MAC
# define bfin_EMAC_initialize(x) 1
#endif
@@ -50,9 +38,6 @@ int board_eth_init(bd_t *bis)
int misc_init_r(void)
{
- board_init_enetaddr("ethaddr");
- board_init_enetaddr("eth1addr");
-
gpio_cfi_flash_init();
return 0;