@@ -851,6 +851,8 @@ static int emac_probe(struct platform_device *pdev)
goto out_release_sram;
}
+ of_get_ethdev_label(np, ndev);
+
/* Read MAC-address from DT */
ret = of_get_ethdev_address(np, ndev);
if (ret) {
@@ -1523,6 +1523,8 @@ static int altera_tse_probe(struct platform_device *pdev)
*/
priv->rx_dma_buf_sz = ALTERA_RXDMABUFFER_SIZE;
+ of_get_ethdev_label(pdev->dev.of_node, ndev);
+
/* get default MAC address from device tree */
ret = of_get_ethdev_address(pdev->dev.of_node, ndev);
if (ret)
@@ -940,6 +940,8 @@ int arc_emac_probe(struct net_device *ndev, int interface)
goto out_clken;
}
+ of_get_ethdev_label(dev->of_node, ndev);
+
/* Get MAC address from device tree */
err = of_get_ethdev_address(dev->of_node, ndev);
if (err)
@@ -1966,6 +1966,8 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->stop_desc->ctrl = 0;
ag->stop_desc->next = (u32)ag->stop_desc_dma;
+ of_get_ethdev_label(np, ndev);
+
err = of_get_ethdev_address(np, ndev);
if (err) {
netif_err(ag, probe, ndev, "invalid MAC address, using random address\n");
@@ -715,6 +715,7 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
return err;
SET_NETDEV_DEV(netdev, &pdev->dev);
+ of_get_ethdev_label(dev->of_node, netdev);
err = of_get_ethdev_address(dev->of_node, netdev);
if (err)
eth_hw_addr_random(netdev);
@@ -2555,6 +2555,9 @@ static int bcm_sysport_probe(struct platform_device *pdev)
}
/* Initialize netdevice members */
+
+ of_get_ethdev_label(dn, dev);
+
ret = of_get_ethdev_address(dn, dev);
if (ret) {
dev_warn(&pdev->dev, "using random Ethernet MAC\n");
@@ -140,6 +140,8 @@ static int bgmac_probe(struct bcma_device *core)
bcma_set_drvdata(core, bgmac);
+ of_get_ethdev_label(bgmac->dev->of_node, bgmac->net_dev);
+
err = of_get_ethdev_address(bgmac->dev->of_node, bgmac->net_dev);
if (err == -EPROBE_DEFER)
return err;
@@ -191,6 +191,8 @@ static int bgmac_probe(struct platform_device *pdev)
bgmac->dev = &pdev->dev;
bgmac->dma_dev = &pdev->dev;
+ of_get_ethdev_label(np, bgmac->net_dev);
+
ret = of_get_ethdev_address(np, bgmac->net_dev);
if (ret == -EPROBE_DEFER)
return ret;
@@ -4784,6 +4784,8 @@ static int macb_probe(struct platform_device *pdev)
if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR)
bp->rx_intr_mask |= MACB_BIT(RXUBR);
+ of_get_ethdev_label(np, bp->dev);
+
err = of_get_ethdev_address(np, bp->dev);
if (err == -EPROBE_DEFER)
goto err_out_free_netdev;
@@ -1501,6 +1501,8 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
netdev->min_mtu = 64 - OCTEON_MGMT_RX_HEADROOM;
netdev->max_mtu = 16383 - OCTEON_MGMT_RX_HEADROOM - VLAN_HLEN;
+ of_get_ethdev_label(pdev->dev.of_node, netdev);
+
result = of_get_ethdev_address(pdev->dev.of_node, netdev);
if (result)
eth_hw_addr_random(netdev);
@@ -1147,6 +1147,7 @@ static int ethoc_probe(struct platform_device *pdev)
eth_hw_addr_set(netdev, pdata->hwaddr);
priv->phy_id = pdata->phy_id;
} else {
+ of_get_ethdev_label(pdev->dev.of_node, netdev);
of_get_ethdev_address(pdev->dev.of_node, netdev);
priv->phy_id = -1;
}
@@ -600,6 +600,8 @@ static s32 nps_enet_probe(struct platform_device *pdev)
}
dev_dbg(dev, "Registers base address is 0x%p\n", priv->regs_base);
+ of_get_ethdev_label(dev->of_node, ndev);
+
/* set kernel MAC address to dev */
err = of_get_ethdev_address(dev->of_node, ndev);
if (err)
@@ -885,6 +885,8 @@ static int mpc52xx_fec_probe(struct platform_device *op)
/* TX */
priv->t_irq = bcom_get_task_irq(priv->tx_dmatsk);
+ of_get_ethdev_label(np, ndev);
+
/*
* MAC address init:
*
@@ -1005,6 +1005,8 @@ static int fs_enet_probe(struct platform_device *ofdev)
spin_lock_init(&fep->lock);
spin_lock_init(&fep->tx_lock);
+ of_get_ethdev_label(ofdev->dev.of_node, ndev);
+
of_get_ethdev_address(ofdev->dev.of_node, ndev);
ret = fep->ops->allocate_bd(ndev);
@@ -753,6 +753,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
if (stash_len || stash_idx)
priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
+ of_get_ethdev_label(np, dev);
+
err = of_get_ethdev_address(np, dev);
if (err) {
eth_hw_addr_random(dev);
@@ -3731,6 +3731,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
goto err_free_netdev;
}
+ of_get_ethdev_label(np, dev);
of_get_ethdev_address(np, dev);
ugeth->ug_info = ug_info;
@@ -841,6 +841,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
(unsigned long)phy->phy_id,
phy_modes(phy->interface));
+ of_get_ethdev_label(node, ndev);
+
ret = of_get_ethdev_address(node, ndev);
if (ret) {
eth_hw_addr_random(ndev);
@@ -1219,6 +1219,8 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
goto out_phy_node;
}
+ of_get_ethdev_label(node, ndev);
+
ret = of_get_ethdev_address(node, ndev);
if (ret) {
eth_hw_addr_random(ndev);
@@ -2974,6 +2974,8 @@ static int emac_init_config(struct emac_instance *dev)
#endif
}
+ of_get_ethdev_label(np, dev->ndev);
+
/* Read MAC-address */
err = of_get_ethdev_address(np, dev->ndev);
if (err) {
@@ -1296,6 +1296,8 @@ static int korina_probe(struct platform_device *pdev)
SET_NETDEV_DEV(dev, &pdev->dev);
lp = netdev_priv(dev);
+ of_get_ethdev_label(pdev->dev.of_node, dev);
+
if (mac_addr)
eth_hw_addr_set(dev, mac_addr);
else if (of_get_ethdev_address(pdev->dev.of_node, dev) < 0)
@@ -526,6 +526,8 @@ static int xrx200_probe(struct platform_device *pdev)
return PTR_ERR(priv->clk);
}
+ of_get_ethdev_label(np, net_dev);
+
err = of_get_ethdev_address(np, net_dev);
if (err)
eth_hw_addr_random(net_dev);
@@ -264,6 +264,8 @@ static int liteeth_probe(struct platform_device *pdev)
priv->tx_base = buf_base + priv->num_rx_slots * priv->slot_size;
priv->tx_slot = 0;
+ of_get_ethdev_label(pdev->dev.of_node, netdev);
+
err = of_get_ethdev_address(pdev->dev.of_node, netdev);
if (err)
eth_hw_addr_random(netdev);
@@ -5251,6 +5251,8 @@ static int mvneta_probe(struct platform_device *pdev)
goto err_free_ports;
}
+ of_get_ethdev_label(dn, dev);
+
err = of_get_ethdev_address(dn, dev);
if (!err) {
mac_from = "device tree";
@@ -1433,6 +1433,8 @@ static int pxa168_eth_probe(struct platform_device *pdev)
INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
+ of_get_ethdev_label(pdev->dev.of_node, dev);
+
err = of_get_ethdev_address(pdev->dev.of_node, dev);
if (err) {
u8 addr[ETH_ALEN];
@@ -4716,6 +4716,8 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
else
dev->max_mtu = ETH_JUMBO_MTU;
+ of_get_ethdev_label(hw->pdev->dev.of_node, dev);
+
/* try to get mac address in the following order:
* 1) from device tree data
* 2) from internal registers set by bootloader
@@ -2588,6 +2588,8 @@ static int __init mtk_init(struct net_device *dev)
struct mtk_eth *eth = mac->hw;
int ret;
+ of_get_ethdev_label(mac->of_node, dev);
+
ret = of_get_ethdev_address(mac->of_node, dev);
if (ret) {
/* If the mac address is invalid, use random mac address */
@@ -197,6 +197,8 @@ static void ks8851_init_mac(struct ks8851_net *ks, struct device_node *np)
struct net_device *dev = ks->netdev;
int ret;
+ of_get_ethdev_label(np, dev);
+
ret = of_get_ethdev_address(np, dev);
if (!ret) {
ks8851_write_mac_addr(dev);
@@ -1346,6 +1346,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
pldat->phy_node = of_parse_phandle(np, "phy-handle", 0);
+ of_get_ethdev_label(np, ndev);
+
/* Get MAC address from current HW setting (POR state is all zeros) */
__lpc_get_mac(pldat, addr);
eth_hw_addr_set(ndev, addr);
@@ -968,6 +968,8 @@ qca_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, qcaspi_devs);
+ of_get_ethdev_label(spi->dev.of_node, qca->net_dev);
+
ret = of_get_ethdev_address(spi->dev.of_node, qca->net_dev);
if (ret) {
eth_hw_addr_random(qca->net_dev);
@@ -346,6 +346,7 @@ static int qca_uart_probe(struct serdev_device *serdev)
INIT_WORK(&qca->tx_work, qcauart_transmit);
of_property_read_u32(serdev->dev.of_node, "current-speed", &speed);
+ of_get_ethdev_label(serdev->dev.of_node, qca->net_dev);
ret = of_get_ethdev_address(serdev->dev.of_node, qca->net_dev);
if (ret) {
@@ -2741,6 +2741,8 @@ static int ravb_probe(struct platform_device *pdev)
/* Debug message level */
priv->msg_enable = RAVB_DEF_MSG_ENABLE;
+ of_get_ethdev_label(np, ndev);
+
/* Read and set MAC address */
ravb_read_mac_address(np, ndev);
if (!is_valid_ether_addr(ndev->dev_addr)) {
@@ -117,6 +117,8 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
goto err_drv_remove;
}
+ of_get_ethdev_label(node, priv->dev);
+
/* Get MAC address if available (DT) */
of_get_ethdev_address(node, priv->dev);
@@ -1599,6 +1599,8 @@ static int ave_probe(struct platform_device *pdev)
ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
+ of_get_ethdev_label(np, ndev);
+
ret = of_get_ethdev_address(np, ndev);
if (ret) {
/* if the mac address is invalid, use random mac address */
@@ -2002,6 +2002,8 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
netcp->tx_resume_threshold = netcp->tx_pause_threshold;
netcp->node_interface = node_interface;
+ of_get_ethdev_label(node_interface, ndev);
+
ret = of_property_read_u32(node_interface, "efuse-mac", &efuse_mac);
if (efuse_mac) {
if (of_address_to_resource(node, NETCP_EFUSE_REG_INDEX, &res)) {
@@ -1158,6 +1158,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong");
lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
+ of_get_ethdev_label(ofdev->dev.of_node, ndev);
+
rc = of_get_ethdev_address(ofdev->dev.of_node, ndev);
if (rc) {
dev_warn(dev, "No MAC address found, using random\n");
@@ -409,6 +409,8 @@ int cvm_oct_common_init(struct net_device *dev)
struct octeon_ethernet *priv = netdev_priv(dev);
int ret;
+ of_get_ethdev_label(priv->of_node, dev);
+
ret = of_get_ethdev_address(priv->of_node, dev);
if (ret)
eth_hw_addr_random(dev);
Make consistency between DT based netdev and DSA interfaces in eth net drivers by setting initial netdev name based on DT label. Exactly same behavior is already implemented and used in DSA drivers. This change just makes initial consistency between netdev eth devices and DSA devices. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/net/ethernet/allwinner/sun4i-emac.c | 2 ++ drivers/net/ethernet/altera/altera_tse_main.c | 2 ++ drivers/net/ethernet/arc/emac_main.c | 2 ++ drivers/net/ethernet/atheros/ag71xx.c | 2 ++ drivers/net/ethernet/broadcom/bcm4908_enet.c | 1 + drivers/net/ethernet/broadcom/bcmsysport.c | 3 +++ drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 ++ drivers/net/ethernet/broadcom/bgmac-platform.c | 2 ++ drivers/net/ethernet/cadence/macb_main.c | 2 ++ drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 2 ++ drivers/net/ethernet/ethoc.c | 1 + drivers/net/ethernet/ezchip/nps_enet.c | 2 ++ drivers/net/ethernet/freescale/fec_mpc52xx.c | 2 ++ drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 ++ drivers/net/ethernet/freescale/gianfar.c | 2 ++ drivers/net/ethernet/freescale/ucc_geth.c | 1 + drivers/net/ethernet/hisilicon/hisi_femac.c | 2 ++ drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 ++ drivers/net/ethernet/ibm/emac/core.c | 2 ++ drivers/net/ethernet/korina.c | 2 ++ drivers/net/ethernet/lantiq_xrx200.c | 2 ++ drivers/net/ethernet/litex/litex_liteeth.c | 2 ++ drivers/net/ethernet/marvell/mvneta.c | 2 ++ drivers/net/ethernet/marvell/pxa168_eth.c | 2 ++ drivers/net/ethernet/marvell/sky2.c | 2 ++ drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++ drivers/net/ethernet/micrel/ks8851_common.c | 2 ++ drivers/net/ethernet/nxp/lpc_eth.c | 2 ++ drivers/net/ethernet/qualcomm/qca_spi.c | 2 ++ drivers/net/ethernet/qualcomm/qca_uart.c | 1 + drivers/net/ethernet/renesas/ravb_main.c | 2 ++ drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 2 ++ drivers/net/ethernet/socionext/sni_ave.c | 2 ++ drivers/net/ethernet/ti/netcp_core.c | 2 ++ drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 ++ drivers/staging/octeon/ethernet.c | 2 ++ 36 files changed, 69 insertions(+)