ipq806x: assert AHB PCIe reset during init
[openwrt/openwrt.git] / target / linux / ipq806x / patches-3.18 / 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 @@ -284,6 +284,7 @@ static int stmmac_pltfr_probe(struct pla
13 struct stmmac_priv *priv = NULL;
14 struct plat_stmmacenet_data *plat_dat = NULL;
15 const char *mac = NULL;
16 + u8 mtd_mac[ETH_ALEN] = { };
17
18 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
19 addr = devm_ioremap_resource(dev, res);
20 @@ -313,6 +314,15 @@ static int stmmac_pltfr_probe(struct pla
21 pr_err("%s: main dt probe failed", __func__);
22 return ret;
23 }
24 +
25 + if (!mac) {
26 + ret = of_get_mac_address_mtd(dev->of_node, &mtd_mac);
27 + if (ret == -EPROBE_DEFER)
28 + return ret;
29 +
30 + if (is_valid_ether_addr(&mtd_mac))
31 + mac = mtd_mac;
32 + }
33 }
34
35 /* Custom setup (if needed) */