709-stmac-platform-add-support-for-retreiving-mac-from-m.patch 948 B

12345678910111213141516171819202122232425262728293031
  1. From 5bf2dabde1fa3af0c9082b42b6847ef3fd198b13 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sun, 9 Aug 2015 12:53:55 +0200
  4. Subject: [PATCH] stmac: platform: add support for retreiving mac from mtd
  5. ---
  6. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++++
  7. 1 file changed, 10 insertions(+)
  8. --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
  9. +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
  10. @@ -116,6 +116,19 @@ stmmac_probe_config_dt(struct platform_d
  11. return ERR_PTR(-ENOMEM);
  12. *mac = of_get_mac_address(np);
  13. + if (!*mac) {
  14. + u8 mtd_mac[ETH_ALEN];
  15. + int ret;
  16. +
  17. + ret = of_get_mac_address_mtd(np, mtd_mac);
  18. + if (ret == -EPROBE_DEFER)
  19. + return ERR_PTR(ret);
  20. +
  21. + if (is_valid_ether_addr(mtd_mac))
  22. + *mac = devm_kmemdup(&pdev->dev, mtd_mac, ETH_ALEN,
  23. + GFP_KERNEL);
  24. + }
  25. +
  26. plat->interface = of_get_phy_mode(np);
  27. /* Get max speed of operation from device tree */