[PATCH uboot v2016.05-aspeed-openbmc 1/9] net: aspeednic: Create aspeed_write_hwaddr from set_mac_address
Cédric Le Goater
clg at kaod.org
Thu Jun 30 02:09:43 AEST 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>
Signed-off-by: Joel Stanley <joel at jms.id.au>
Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
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 cea3394728cc..7ce7056d88a2 100644
--- a/drivers/net/aspeednic.c
+++ b/drivers/net/aspeednic.c
@@ -399,7 +399,7 @@ static int aspeednic_init(struct eth_device* dev, bd_t* bis);
static int aspeednic_send(struct eth_device* dev, 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)
@@ -547,6 +547,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) {
@@ -1140,7 +1141,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++) {
@@ -1350,7 +1351,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)) {
net_random_ethaddr(dev->enetaddr);
@@ -1362,6 +1363,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.1.4
More information about the openbmc
mailing list