aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2018-08-20 11:10:27 +0200
committerFelix Fietkau <nbd@nbd.name>2018-08-25 19:18:08 +0200
commita1f4ebcc874f8414ef551d653363eb0ef95d553c (patch)
tree8932cd5fc84753e30b86c1379332c70c7a59576c /target/linux/generic
parente882e63f1e1169030389b304489ab8a7d785df33 (diff)
downloadupstream-a1f4ebcc874f8414ef551d653363eb0ef95d553c.tar.gz
upstream-a1f4ebcc874f8414ef551d653363eb0ef95d553c.tar.bz2
upstream-a1f4ebcc874f8414ef551d653363eb0ef95d553c.zip
kernel: make mtd mac address increment more flexible
Allow selecting the byte on which the increment should be added. Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch12
1 files changed, 9 insertions, 3 deletions
diff --git a/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch
index b29b5f11b0..2b89a05238 100644
--- a/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch
+++ b/target/linux/generic/pending-4.14/681-NET-add-of_get_mac_address_mtd.patch
@@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
{
struct property *pp = of_find_property(np, name, NULL);
-@@ -47,6 +48,73 @@ static const void *of_get_mac_addr(struc
+@@ -47,6 +48,79 @@ static const void *of_get_mac_addr(struc
return NULL;
}
@@ -50,6 +50,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ u32 mac_inc = 0;
+ u8 mac[ETH_ALEN];
+ void *addr;
++ u32 inc_idx;
+
+ list = of_get_property(np, "mtd-mac-address", &size);
+ if (!list || (size != (2 * sizeof(*list))))
@@ -73,8 +74,13 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac);
+ put_mtd_device(mtd);
+
++ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx))
++ inc_idx = 5;
++ if (inc_idx > 5)
++ return NULL;
++
+ if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc))
-+ mac[5] += mac_inc;
++ mac[inc_idx] += mac_inc;
+
+ if (!is_valid_ether_addr(mac))
+ return NULL;
@@ -106,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/**
* 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,11 +132,18 @@ static const void *of_get_mac_addr(struc
+@@ -64,11 +138,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.