[PATCH u-boot v2 1/5] net: aspeednic: Create aspeed_write_hwaddr from set_mac_address

OpenBMC Patches openbmc-patches at stwcx.xyz
Wed Mar 16 10:00:57 AEDT 2016


From: "Milton D. Miller II" <miltonm at us.ibm.com>

Tell the ethernet framework how to set the MAC address on the
aspeed nic so it can be set at the expected points in the code.

Rename set_mac_address to aspeed_write_hwaddr.  Drop the unused
argument, change the prototype to int, and return 0.

Assign the device write_hwaddr method to this new function.

Signed-off-by: Milton Miller <miltonm at us.ibm.com>
---
 drivers/net/aspeednic.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/aspeednic.c b/drivers/net/aspeednic.c
index d70c7ab..b8ce24c 100644
--- a/drivers/net/aspeednic.c
+++ b/drivers/net/aspeednic.c
@@ -411,7 +411,7 @@ static int   aspeednic_init(struct eth_device* dev, bd_t* bis);
 static int   aspeednic_send(struct eth_device* dev, volatile void *packet, int length);
 static int   aspeednic_recv(struct eth_device* dev);
 static void  aspeednic_halt(struct eth_device* dev);
-static void  set_mac_address (struct eth_device* dev, bd_t* bis);
+static int   aspeednic_write_hwaddr(struct eth_device* dev);
 static void  phy_write_register (struct eth_device* dev, u8 PHY_Register, u8 PHY_Address, u16 PHY_Data);
 static u16   phy_read_register (struct eth_device* dev, u8 PHY_Register, u8 PHY_Address);
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
@@ -564,6 +564,7 @@ int aspeednic_initialize(bd_t *bis)
   dev->halt   = aspeednic_halt;
   dev->send   = aspeednic_send;
   dev->recv   = aspeednic_recv;
+  dev->write_hwaddr = aspeednic_write_hwaddr;
 
   /* Ensure we're not sleeping. */
   if (CONFIG_ASPEED_MAC_PHY_SETTING >= 1) {
@@ -1157,7 +1158,7 @@ static int aspeednic_init(struct eth_device* dev, bd_t* bis)
 
   aspeednic_probe_phy(dev);
 
-  set_mac_address (dev, bis);
+  aspeednic_write_hwaddr(dev);
   set_mac_control_register (dev);
 
   for (i = 0; i < NUM_RX_DESC; i++) {
@@ -1362,7 +1363,7 @@ static void aspeednic_halt(struct eth_device* dev)
   STOP_MAC(dev);
 }
 
-static void set_mac_address (struct eth_device* dev, bd_t* bis)
+static int aspeednic_write_hwaddr(struct eth_device* dev)
 {
   if (!eth_getenv_enetaddr_by_index("eth", 0, dev->enetaddr)) {
     eth_random_enetaddr(dev->enetaddr);
@@ -1374,6 +1375,8 @@ static void set_mac_address (struct eth_device* dev, bd_t* bis)
   if (CONFIG_ASPEED_MAC_PHY_SETTING >= 1) {
     memcpy(NCSI_Request.SA, dev->enetaddr, 6);
   }
+
+  return 0;
 }
 
 static u16 phy_read_register (struct eth_device* dev, u8 PHY_Register, u8 PHY_Address)
-- 
2.7.1




More information about the openbmc mailing list