Commit 877d4e3c authored by Linus Walleij's avatar Linus Walleij Committed by David S. Miller

ixp4xx_eth: Set MAC address from device tree

If there is a MAC address specified in the device tree, then
use it. This is already perfectly legal to specify in accordance
with the generic ethernet-controller.yaml schema.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3ba206c
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_net.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/ptp_classify.h> #include <linux/ptp_classify.h>
...@@ -156,7 +157,7 @@ struct eth_plat_info { ...@@ -156,7 +157,7 @@ struct eth_plat_info {
u8 phy; /* MII PHY ID, 0 - 31 */ u8 phy; /* MII PHY ID, 0 - 31 */
u8 rxq; /* configurable, currently 0 - 31 only */ u8 rxq; /* configurable, currently 0 - 31 only */
u8 txreadyq; u8 txreadyq;
u8 hwaddr[6]; u8 hwaddr[ETH_ALEN];
u8 npe; /* NPE instance used by this interface */ u8 npe; /* NPE instance used by this interface */
bool has_mdio; /* If this instance has an MDIO bus */ bool has_mdio; /* If this instance has an MDIO bus */
}; };
...@@ -1387,6 +1388,7 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) ...@@ -1387,6 +1388,7 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev)
struct of_phandle_args npe_spec; struct of_phandle_args npe_spec;
struct device_node *mdio_np; struct device_node *mdio_np;
struct eth_plat_info *plat; struct eth_plat_info *plat;
u8 mac[ETH_ALEN];
int ret; int ret;
plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
...@@ -1428,6 +1430,12 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) ...@@ -1428,6 +1430,12 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev)
} }
plat->txreadyq = queue_spec.args[0]; plat->txreadyq = queue_spec.args[0];
ret = of_get_mac_address(np, mac);
if (!ret) {
dev_info(dev, "Setting macaddr from DT %pM\n", mac);
memcpy(plat->hwaddr, mac, ETH_ALEN);
}
return plat; return plat;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment