84c15c75668539367b57121ed31c4b605ba5966a
[openwrt/staging/yousong.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 @@ -302,6 +302,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 int irq, wol_irq, lpi_irq;
18
19 /* Get IRQ information early to have an ability to ask for deferred
20 @@ -362,6 +363,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) */