Commit 0eceb82f authored by Danny Kukawka's avatar Danny Kukawka Committed by Bob Liu

arch/blackfin: don't generate random mac in bfin_get_ether_addr()

Changed bfin_get_ether_addr() to return a state and to
set no random mac address if the board don't provide one.

Let the caller of bfin_get_ether_addr() set a random mac
address if the return value is not 0.

v2: don't set random mac in bfin_get_ether_addr()
Signed-off-by: default avatarDanny Kukawka <danny.kukawka@bisect.de>
Acked-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
parent dd47ba13
...@@ -821,7 +821,7 @@ void native_machine_restart(char *cmd) ...@@ -821,7 +821,7 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
/* the MAC is stored in OTP memory page 0xDF */ /* the MAC is stored in OTP memory page 0xDF */
u32 ret; u32 ret;
...@@ -834,5 +834,6 @@ void bfin_get_ether_addr(char *addr) ...@@ -834,5 +834,6 @@ void bfin_get_ether_addr(char *addr)
for (ret = 0; ret < 6; ++ret) for (ret = 0; ret < 6; ++ret)
addr[ret] = otp_mac_p[5 - ret]; addr[ret] = otp_mac_p[5 - ret];
} }
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -730,9 +730,8 @@ void native_machine_restart(char *cmd) ...@@ -730,9 +730,8 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
random_ether_addr(addr); return 1;
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -846,7 +846,7 @@ void native_machine_restart(char *cmd) ...@@ -846,7 +846,7 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
/* the MAC is stored in OTP memory page 0xDF */ /* the MAC is stored in OTP memory page 0xDF */
u32 ret; u32 ret;
...@@ -859,5 +859,6 @@ void bfin_get_ether_addr(char *addr) ...@@ -859,5 +859,6 @@ void bfin_get_ether_addr(char *addr)
for (ret = 0; ret < 6; ++ret) for (ret = 0; ret < 6; ++ret)
addr[ret] = otp_mac_p[5 - ret]; addr[ret] = otp_mac_p[5 - ret];
} }
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -983,9 +983,8 @@ void native_machine_restart(char *cmd) ...@@ -983,9 +983,8 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
random_ether_addr(addr); return 1;
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -870,7 +870,7 @@ void native_machine_restart(char *cmd) ...@@ -870,7 +870,7 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
/* the MAC is stored in OTP memory page 0xDF */ /* the MAC is stored in OTP memory page 0xDF */
u32 ret; u32 ret;
...@@ -883,5 +883,6 @@ void bfin_get_ether_addr(char *addr) ...@@ -883,5 +883,6 @@ void bfin_get_ether_addr(char *addr)
for (ret = 0; ret < 6; ++ret) for (ret = 0; ret < 6; ++ret)
addr[ret] = otp_mac_p[5 - ret]; addr[ret] = otp_mac_p[5 - ret];
} }
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -1311,7 +1311,7 @@ void native_machine_restart(char *cmd) ...@@ -1311,7 +1311,7 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
/* the MAC is stored in OTP memory page 0xDF */ /* the MAC is stored in OTP memory page 0xDF */
u32 ret; u32 ret;
...@@ -1324,5 +1324,6 @@ void bfin_get_ether_addr(char *addr) ...@@ -1324,5 +1324,6 @@ void bfin_get_ether_addr(char *addr)
for (ret = 0; ret < 6; ++ret) for (ret = 0; ret < 6; ++ret)
addr[ret] = otp_mac_p[5 - ret]; addr[ret] = otp_mac_p[5 - ret];
} }
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -931,7 +931,7 @@ void native_machine_restart(char *cmd) ...@@ -931,7 +931,7 @@ void native_machine_restart(char *cmd)
bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS); bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
/* the MAC is stored in OTP memory page 0xDF */ /* the MAC is stored in OTP memory page 0xDF */
u32 ret; u32 ret;
...@@ -945,5 +945,6 @@ void bfin_get_ether_addr(char *addr) ...@@ -945,5 +945,6 @@ void bfin_get_ether_addr(char *addr)
for (ret = 0; ret < 6; ++ret) for (ret = 0; ret < 6; ++ret)
addr[ret] = otp_mac_p[5 - ret]; addr[ret] = otp_mac_p[5 - ret];
} }
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -813,9 +813,8 @@ void __init native_machine_early_platform_add_devices(void) ...@@ -813,9 +813,8 @@ void __init native_machine_early_platform_add_devices(void)
ARRAY_SIZE(cm_bf537e_early_devices)); ARRAY_SIZE(cm_bf537e_early_devices));
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
random_ether_addr(addr); return 1;
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -790,9 +790,8 @@ void __init native_machine_early_platform_add_devices(void) ...@@ -790,9 +790,8 @@ void __init native_machine_early_platform_add_devices(void)
ARRAY_SIZE(cm_bf537u_early_devices)); ARRAY_SIZE(cm_bf537u_early_devices));
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
random_ether_addr(addr); return 1;
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -399,9 +399,10 @@ arch_initcall(dnp5370_init); ...@@ -399,9 +399,10 @@ arch_initcall(dnp5370_init);
/* /*
* Currently the MAC address is saved in Flash by U-Boot * Currently the MAC address is saved in Flash by U-Boot
*/ */
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
*(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
*(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -535,9 +535,8 @@ void __init native_machine_early_platform_add_devices(void) ...@@ -535,9 +535,8 @@ void __init native_machine_early_platform_add_devices(void)
ARRAY_SIZE(stamp_early_devices)); ARRAY_SIZE(stamp_early_devices));
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
random_ether_addr(addr); return 1;
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -3013,9 +3013,10 @@ void native_machine_restart(char *cmd) ...@@ -3013,9 +3013,10 @@ void native_machine_restart(char *cmd)
* Currently the MAC address is saved in Flash by U-Boot * Currently the MAC address is saved in Flash by U-Boot
*/ */
#define FLASH_MAC 0x203f0000 #define FLASH_MAC 0x203f0000
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
*(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
*(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
return 0;
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
...@@ -780,9 +780,8 @@ void __init native_machine_early_platform_add_devices(void) ...@@ -780,9 +780,8 @@ void __init native_machine_early_platform_add_devices(void)
ARRAY_SIZE(cm_bf537_early_devices)); ARRAY_SIZE(cm_bf537_early_devices));
} }
void bfin_get_ether_addr(char *addr) int bfin_get_ether_addr(char *addr)
{ {
random_ether_addr(addr); return 1;
printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
} }
EXPORT_SYMBOL(bfin_get_ether_addr); EXPORT_SYMBOL(bfin_get_ether_addr);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment