diff options
author | Marek Vasut <marek.vasut+renesas@gmail.com> | 2018-01-21 14:55:44 +0100 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-01-27 20:38:53 +0100 |
commit | 68ac92e9378c3453c86de35df0b6700181f4393b (patch) | |
tree | 345790df2e9e648092f156e44664d1bd60770c91 /drivers | |
parent | 52c15e220bc28eda298d899f552bc023131de7f3 (diff) |
net: sh_eth: Separate out MAC address programming
Pull out the code for writing MAC address into the NIC into a
separate function, so it can be reused by both DM and non-DM
code. This is done in preparation for DM support, which handles
MAC address programming separately.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sh_eth.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 99eab4c688..2449e86b7d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -391,6 +391,18 @@ err_tx_init: return ret; } +static void sh_eth_write_hwaddr(struct sh_eth_info *port_info, + unsigned char *mac) +{ + u32 val; + + val = (mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3]; + sh_eth_write(port_info, val, MAHR); + + val = (mac[4] << 8) | mac[5]; + sh_eth_write(port_info, val, MALR); +} + static int sh_eth_phy_config(struct sh_eth_dev *eth) { int port = eth->port, ret = 0; @@ -433,12 +445,7 @@ static int sh_eth_config(struct sh_eth_dev *eth) sh_eth_write(port_info, 0, ECSIPR); /* Set Mac address */ - val = dev->enetaddr[0] << 24 | dev->enetaddr[1] << 16 | - dev->enetaddr[2] << 8 | dev->enetaddr[3]; - sh_eth_write(port_info, val, MAHR); - - val = dev->enetaddr[4] << 8 | dev->enetaddr[5]; - sh_eth_write(port_info, val, MALR); + sh_eth_write_hwaddr(port_info, dev->enetaddr); sh_eth_write(port_info, RFLR_RFL_MIN, RFLR); #if defined(SH_ETH_TYPE_GETHER) |