|
25 | 25 | #include <linux/module.h>
|
26 | 26 | #include <linux/netdevice.h>
|
27 | 27 | #include <linux/of_mdio.h>
|
| 28 | +#include <linux/of_net.h> |
28 | 29 | #include <linux/of_platform.h>
|
29 | 30 | #include <linux/of_irq.h>
|
30 | 31 | #include <linux/of_address.h>
|
@@ -292,7 +293,8 @@ static int axienet_dma_bd_init(struct net_device *ndev)
|
292 | 293 | * This function is called to initialize the MAC address of the Axi Ethernet
|
293 | 294 | * core. It writes to the UAW0 and UAW1 registers of the core.
|
294 | 295 | */
|
295 |
| -static void axienet_set_mac_address(struct net_device *ndev, void *address) |
| 296 | +static void axienet_set_mac_address(struct net_device *ndev, |
| 297 | + const void *address) |
296 | 298 | {
|
297 | 299 | struct axienet_local *lp = netdev_priv(ndev);
|
298 | 300 |
|
@@ -1456,7 +1458,7 @@ static int axienet_probe(struct platform_device *pdev)
|
1456 | 1458 | struct device_node *np;
|
1457 | 1459 | struct axienet_local *lp;
|
1458 | 1460 | struct net_device *ndev;
|
1459 |
| - u8 mac_addr[6]; |
| 1461 | + const void *mac_addr; |
1460 | 1462 | struct resource *ethres, dmares;
|
1461 | 1463 | u32 value;
|
1462 | 1464 |
|
@@ -1567,13 +1569,12 @@ static int axienet_probe(struct platform_device *pdev)
|
1567 | 1569 | }
|
1568 | 1570 |
|
1569 | 1571 | /* Retrieve the MAC address */
|
1570 |
| - ret = of_property_read_u8_array(pdev->dev.of_node, |
1571 |
| - "local-mac-address", mac_addr, 6); |
1572 |
| - if (ret) { |
| 1572 | + mac_addr = of_get_mac_address(pdev->dev.of_node); |
| 1573 | + if (!mac_addr) { |
1573 | 1574 | dev_err(&pdev->dev, "could not find MAC address\n");
|
1574 | 1575 | goto free_netdev;
|
1575 | 1576 | }
|
1576 |
| - axienet_set_mac_address(ndev, (void *)mac_addr); |
| 1577 | + axienet_set_mac_address(ndev, mac_addr); |
1577 | 1578 |
|
1578 | 1579 | lp->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD;
|
1579 | 1580 | lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD;
|
|
0 commit comments