kernel/4.3: update to version 4.3.3
[openwrt.git] / target / linux / imx6 / patches-4.3 / 208-sky2-allow-mac-to-come-from-dt.patch
1 --- a/drivers/net/ethernet/marvell/sky2.c
2 +++ b/drivers/net/ethernet/marvell/sky2.c
3 @@ -4812,7 +4812,24 @@ static struct net_device *sky2_init_netd
4          * 1) from device tree data
5          * 2) from internal registers set by bootloader
6          */
7 -       iap = of_get_mac_address(hw->pdev->dev.of_node);
8 +
9 +       iap = NULL;
10 +       if (IS_ENABLED(CONFIG_OF)) {
11 +               struct device_node *np;
12 +               np = of_find_node_by_path("/aliases");
13 +               if (np) {
14 +                       const char *path = of_get_property(np, "sky2", NULL);
15 +                       if (path)
16 +                               np = of_find_node_by_path(path);
17 +                       if (np)
18 +                               path = of_get_mac_address(np);
19 +                       if (path)
20 +                               iap = (unsigned char *) path;
21 +               }
22 +       }
23 +
24 +       if (!iap)
25 +               iap = of_get_mac_address(hw->pdev->dev.of_node);
26         if (iap)
27                 memcpy(dev->dev_addr, iap, ETH_ALEN);
28         else