d385c9a36cc40538b9c054faa93ff8de74eec335
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.1 / 709-stmac-platform-add-support-for-retreiving-mac-from-m.patch
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 ---
7 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++++
8 1 file changed, 10 insertions(+)
9
10 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
11 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
12 @@ -116,6 +116,19 @@ stmmac_probe_config_dt(struct platform_d
13 return ERR_PTR(-ENOMEM);
14
15 *mac = of_get_mac_address(np);
16 + if (!*mac) {
17 + u8 mtd_mac[ETH_ALEN];
18 + int ret;
19 +
20 + ret = of_get_mac_address_mtd(np, mtd_mac);
21 + if (ret == -EPROBE_DEFER)
22 + return ERR_PTR(ret);
23 +
24 + if (is_valid_ether_addr(mtd_mac))
25 + *mac = devm_kmemdup(&pdev->dev, mtd_mac, ETH_ALEN,
26 + GFP_KERNEL);
27 + }
28 +
29 plat->interface = of_get_phy_mode(np);
30
31 /* Get max speed of operation from device tree */