|
29 | 29 | #include <linux/net_tstamp.h> |
30 | 30 | #include <linux/of.h> |
31 | 31 | #include <linux/of_mdio.h> |
| 32 | +#include <linux/of_net.h> |
32 | 33 | #include <linux/phy.h> |
33 | 34 | #include <linux/platform_device.h> |
34 | 35 | #include <linux/ptp_classify.h> |
@@ -156,7 +157,7 @@ struct eth_plat_info { |
156 | 157 | u8 phy; /* MII PHY ID, 0 - 31 */ |
157 | 158 | u8 rxq; /* configurable, currently 0 - 31 only */ |
158 | 159 | u8 txreadyq; |
159 | | - u8 hwaddr[6]; |
| 160 | + u8 hwaddr[ETH_ALEN]; |
160 | 161 | u8 npe; /* NPE instance used by this interface */ |
161 | 162 | bool has_mdio; /* If this instance has an MDIO bus */ |
162 | 163 | }; |
@@ -1387,6 +1388,7 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) |
1387 | 1388 | struct of_phandle_args npe_spec; |
1388 | 1389 | struct device_node *mdio_np; |
1389 | 1390 | struct eth_plat_info *plat; |
| 1391 | + u8 mac[ETH_ALEN]; |
1390 | 1392 | int ret; |
1391 | 1393 |
|
1392 | 1394 | 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 | 1430 | } |
1429 | 1431 | plat->txreadyq = queue_spec.args[0]; |
1430 | 1432 |
|
| 1433 | + ret = of_get_mac_address(np, mac); |
| 1434 | + if (!ret) { |
| 1435 | + dev_info(dev, "Setting macaddr from DT %pM\n", mac); |
| 1436 | + memcpy(plat->hwaddr, mac, ETH_ALEN); |
| 1437 | + } |
| 1438 | + |
1431 | 1439 | return plat; |
1432 | 1440 | } |
1433 | 1441 |
|
|
0 commit comments