diff options
author | Jonas Gorski <jogo@openwrt.org> | 2015-09-04 14:45:40 +0000 |
---|---|---|
committer | Jonas Gorski <jogo@openwrt.org> | 2015-09-04 14:45:40 +0000 |
commit | 95097939323c17d60496d9d3e5acf079c62f90aa (patch) | |
tree | 4248a46f1b6d07557eb7b1f51ef5cd40aa0f8789 | |
parent | 4025298f8e4e5d1606c0b609ff4e44c24c3c36e5 (diff) | |
download | master-187ad058-95097939323c17d60496d9d3e5acf079c62f90aa.tar.gz master-187ad058-95097939323c17d60496d9d3e5acf079c62f90aa.tar.bz2 master-187ad058-95097939323c17d60496d9d3e5acf079c62f90aa.zip |
ipq806x: add support for retrieving macs from mtd
Add support for mtd-mac-address for stmac.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46793 3c298f89-4303-0410-b956-a3cf2f4a3e73
2 files changed, 70 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-3.18/709-stmac-platform-add-support-for-retreiving-mac-from-m.patch b/target/linux/ipq806x/patches-3.18/709-stmac-platform-add-support-for-retreiving-mac-from-m.patch new file mode 100644 index 0000000000..68222ceea7 --- /dev/null +++ b/target/linux/ipq806x/patches-3.18/709-stmac-platform-add-support-for-retreiving-mac-from-m.patch @@ -0,0 +1,35 @@ +From 5bf2dabde1fa3af0c9082b42b6847ef3fd198b13 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jogo@openwrt.org> +Date: Sun, 9 Aug 2015 12:53:55 +0200 +Subject: [PATCH] stmac: platform: add support for retreiving mac from mtd + +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +@@ -284,6 +284,7 @@ static int stmmac_pltfr_probe(struct pla + struct stmmac_priv *priv = NULL; + struct plat_stmmacenet_data *plat_dat = NULL; + const char *mac = NULL; ++ u8 mtd_mac[ETH_ALEN] = { }; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + addr = devm_ioremap_resource(dev, res); +@@ -313,6 +314,15 @@ static int stmmac_pltfr_probe(struct pla + pr_err("%s: main dt probe failed", __func__); + return ret; + } ++ ++ if (!mac) { ++ ret = of_get_mac_address_mtd(dev->of_node, &mtd_mac); ++ if (ret == -EPROBE_DEFER) ++ return ret; ++ ++ if (is_valid_ether_addr(&mtd_mac)) ++ mac = mtd_mac; ++ } + } + + /* Custom setup (if needed) */ diff --git a/target/linux/ipq806x/patches-4.1/709-stmac-platform-add-support-for-retreiving-mac-from-m.patch b/target/linux/ipq806x/patches-4.1/709-stmac-platform-add-support-for-retreiving-mac-from-m.patch new file mode 100644 index 0000000000..84c15c7566 --- /dev/null +++ b/target/linux/ipq806x/patches-4.1/709-stmac-platform-add-support-for-retreiving-mac-from-m.patch @@ -0,0 +1,35 @@ +From 5bf2dabde1fa3af0c9082b42b6847ef3fd198b13 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jogo@openwrt.org> +Date: Sun, 9 Aug 2015 12:53:55 +0200 +Subject: [PATCH] stmac: platform: add support for retreiving mac from mtd + +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +@@ -302,6 +302,7 @@ static int stmmac_pltfr_probe(struct pla + struct stmmac_priv *priv = NULL; + struct plat_stmmacenet_data *plat_dat = NULL; + const char *mac = NULL; ++ u8 mtd_mac[ETH_ALEN] = { }; + int irq, wol_irq, lpi_irq; + + /* Get IRQ information early to have an ability to ask for deferred +@@ -362,6 +363,15 @@ static int stmmac_pltfr_probe(struct pla + pr_err("%s: main dt probe failed", __func__); + return ret; + } ++ ++ if (!mac) { ++ ret = of_get_mac_address_mtd(dev->of_node, &mtd_mac); ++ if (ret == -EPROBE_DEFER) ++ return ret; ++ ++ if (is_valid_ether_addr(&mtd_mac)) ++ mac = mtd_mac; ++ } + } + + /* Custom setup (if needed) */ |