700-net-ethernet-mediatek-support-net-labels.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. From bd0f89de5476ca25e73fae829ba3e1dafae1d90d Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= <[email protected]>
  3. Date: Fri, 21 Jun 2019 10:04:05 +0200
  4. Subject: [PATCH] net: ethernet: mediatek: support net-labels
  5. With this patch, device name can be set within dts file in the same way as dsa
  6. port can.
  7. Add: label = "wan"; to GMAC node.
  8. Signed-off-by: René van Dorst <[email protected]>
  9. ---
  10. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
  11. 1 file changed, 4 insertions(+)
  12. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  13. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  14. @@ -4558,6 +4558,7 @@ static const struct net_device_ops mtk_n
  15. static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
  16. {
  17. + const char *name = of_get_property(np, "label", NULL);
  18. const __be32 *_id = of_get_property(np, "reg", NULL);
  19. phy_interface_t phy_mode;
  20. struct phylink *phylink;
  21. @@ -4729,6 +4730,9 @@ static int mtk_add_mac(struct mtk_eth *e
  22. register_netdevice_notifier(&mac->device_notifier);
  23. }
  24. + if (name)
  25. + strlcpy(eth->netdev[id]->name, name, IFNAMSIZ);
  26. +
  27. return 0;
  28. free_netdev: