From: Zhangbin Tong Date: Tue, 2 May 2017 10:46:32 +0000 (+0800) Subject: net: stmmac: dwmac-rk: read mac address from devinfo first X-Git-Tag: release-20171130_firefly~4^2~554 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cdcf4ffeabb8a372ed40e9303d9f6b0229706f0f;p=firefly-linux-kernel-4.4.55.git net: stmmac: dwmac-rk: read mac address from devinfo first Change-Id: I2888dcfc57c2e5a266fdf1058f9ab70e04034f22 Signed-off-by: Zhangbin Tong --- diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 19e8c569d2c0..70538ae2be2f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1030,12 +1030,20 @@ static void rk_fix_speed(void *priv, unsigned int speed) dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface); } -void rk_get_eth_addr_vendor(void *priv, unsigned char *addr) +void __weak rk_devinfo_get_eth_mac(u8 *mac) +{ +} + +void rk_get_eth_addr(void *priv, unsigned char *addr) { int ret; struct rk_priv_data *bsp_priv = priv; struct device *dev = &bsp_priv->pdev->dev; + rk_devinfo_get_eth_mac(addr); + if (is_valid_ether_addr(addr)) + goto out; + ret = rk_vendor_read(LAN_MAC_ID, addr, 6); if (ret != 6 || is_zero_ether_addr(addr)) { dev_err(dev, "%s: rk_vendor_read eth mac address failed (%d)", @@ -1048,11 +1056,12 @@ void rk_get_eth_addr_vendor(void *priv, unsigned char *addr) if (ret != 0) dev_err(dev, "%s: rk_vendor_write eth mac address failed (%d)", __func__, ret); - } else { - dev_err(dev, "%s: rk_vendor_read eth mac address: %02x:%02x:%02x:%02x:%02x:%02x", - __func__, addr[0], addr[1], addr[2], - addr[3], addr[4], addr[5]); } + +out: + dev_err(dev, "%s: mac address: %02x:%02x:%02x:%02x:%02x:%02x", + __func__, addr[0], addr[1], addr[2], + addr[3], addr[4], addr[5]); } static int rk_gmac_probe(struct platform_device *pdev) @@ -1080,7 +1089,7 @@ static int rk_gmac_probe(struct platform_device *pdev) plat_dat->init = rk_gmac_init; plat_dat->exit = rk_gmac_exit; plat_dat->fix_mac_speed = rk_fix_speed; - plat_dat->get_eth_addr = rk_get_eth_addr_vendor; + plat_dat->get_eth_addr = rk_get_eth_addr; plat_dat->bsp_priv = rk_gmac_setup(pdev, data); if (IS_ERR(plat_dat->bsp_priv))