X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Fgeneric%2Fpatches-4.4%2F681-NET-add-of_get_mac_address_mtd.patch;h=5b1a9ceaebda59979d5d852f773fe26926993a04;hb=5b692a3989088ee13e25f7dca4ac512e61257570;hp=0026f12c9e5231a25e20beb0f03ccad2a7a9f371;hpb=cb065c4bd7a009b1f0072138aa9249dc63edb5c7;p=openwrt.git diff --git a/target/linux/generic/patches-4.4/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/patches-4.4/681-NET-add-of_get_mac_address_mtd.patch index 0026f12c9e..5b1a9ceaeb 100644 --- a/target/linux/generic/patches-4.4/681-NET-add-of_get_mac_address_mtd.patch +++ b/target/linux/generic/patches-4.4/681-NET-add-of_get_mac_address_mtd.patch @@ -24,7 +24,16 @@ Signed-off-by: Felix Fietkau /** * of_get_phy_mode - Get phy mode for given device_node -@@ -47,6 +48,66 @@ static const void *of_get_mac_addr(struc +@@ -38,7 +39,7 @@ int of_get_phy_mode(struct device_node * + } + EXPORT_SYMBOL_GPL(of_get_phy_mode); + +-static const void *of_get_mac_addr(struct device_node *np, const char *name) ++static void *of_get_mac_addr(struct device_node *np, const char *name) + { + struct property *pp = of_find_property(np, name, NULL); + +@@ -47,6 +48,73 @@ static const void *of_get_mac_addr(struc return NULL; } @@ -41,6 +50,7 @@ Signed-off-by: Felix Fietkau + phandle phandle; + u32 mac_inc = 0; + u8 mac[ETH_ALEN]; ++ void *addr; + + list = of_get_property(np, "mtd-mac-address", &size); + if (!list || (size != (2 * sizeof(*list)))) @@ -70,6 +80,12 @@ Signed-off-by: Felix Fietkau + if (!is_valid_ether_addr(mac)) + return NULL; + ++ addr = of_get_mac_addr(np, "mac-address"); ++ if (addr) { ++ memcpy(addr, mac, ETH_ALEN); ++ return addr; ++ } ++ + prop = kzalloc(sizeof(*prop), GFP_KERNEL); + if (!prop) + return NULL; @@ -91,7 +107,7 @@ Signed-off-by: Felix Fietkau /** * Search the device tree for the best MAC address to use. 'mac-address' is * checked first, because that is supposed to contain to "most recent" MAC -@@ -64,6 +125,9 @@ static const void *of_get_mac_addr(struc +@@ -64,11 +132,18 @@ static const void *of_get_mac_addr(struc * addresses. Some older U-Boots only initialized 'local-mac-address'. In * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists * but is all zeros. @@ -101,15 +117,12 @@ Signed-off-by: Felix Fietkau */ const void *of_get_mac_address(struct device_node *np) { -@@ -77,6 +141,10 @@ const void *of_get_mac_address(struct de - if (addr) - return addr; + const void *addr; -- return of_get_mac_addr(np, "address"); -+ addr = of_get_mac_addr(np, "address"); ++ addr = of_get_mac_address_mtd(np); + if (addr) + return addr; + -+ return of_get_mac_address_mtd(np); - } - EXPORT_SYMBOL(of_get_mac_address); + addr = of_get_mac_addr(np, "mac-address"); + if (addr) + return addr;