summaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-07-31 21:42:59 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2014-07-31 21:42:59 +0000
commitf7b3b7db7d3439519f711cc90899289b2195627d (patch)
treec4aca5c2dfe732dd951787c7a392e5b75acb70d8 /target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch
parent3a82681e4fc73a385b7f41fa0587cca5942ed30d (diff)
downloadmaster-31e0f0ae-f7b3b7db7d3439519f711cc90899289b2195627d.tar.gz
master-31e0f0ae-f7b3b7db7d3439519f711cc90899289b2195627d.tar.bz2
master-31e0f0ae-f7b3b7db7d3439519f711cc90899289b2195627d.zip
brcm47xx: 3.14: update MIPS patches with versions sent upstream
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 41911
Diffstat (limited to 'target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch68
1 files changed, 0 insertions, 68 deletions
diff --git a/target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch b/target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch
deleted file mode 100644
index 9ba9bb231f..0000000000
--- a/target/linux/brcm47xx/patches-3.14/180-generate-mac-address.patch
+++ /dev/null
@@ -1,68 +0,0 @@
---- a/arch/mips/bcm47xx/sprom.c
-+++ b/arch/mips/bcm47xx/sprom.c
-@@ -28,6 +28,7 @@
-
- #include <bcm47xx.h>
- #include <bcm47xx_nvram.h>
-+#include <linux/if_ether.h>
-
- static void create_key(const char *prefix, const char *postfix,
- const char *name, char *buf, int len)
-@@ -631,6 +632,33 @@ static void bcm47xx_fill_sprom_path_r45(
- }
- }
-
-+static bool bcm47xx_is_valid_mac(u8 *mac)
-+{
-+ return mac && !(mac[0] == 0x00 && mac[1] == 0x90 && mac[2] == 0x4c);
-+}
-+
-+static int bcm47xx_increase_mac_addr(u8 *mac, u8 num)
-+{
-+ u8 *oui = mac + ETH_ALEN/2 - 1;
-+ u8 *p = mac + ETH_ALEN - 1;
-+
-+ do {
-+ (*p) += num;
-+ if (*p > num)
-+ break;
-+ p--;
-+ num = 1;
-+ } while (p != oui);
-+
-+ if (p == oui) {
-+ pr_err("unable to fetch mac address\n");
-+ return -ENOENT;
-+ }
-+ return 0;
-+}
-+
-+static int mac_addr_used = 2;
-+
- static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
- const char *prefix, bool fallback)
- {
-@@ -648,6 +676,23 @@ static void bcm47xx_fill_sprom_ethernet(
-
- nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback);
- nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback);
-+
-+ /* The address prefix 00:90:4C is used by Broadcom in their initial
-+ configuration. When a mac address with the prefix 00:90:4C is used
-+ all devices from the same series are sharing the same mac address.
-+ To prevent mac address collisions we replace them with a mac address
-+ based on the base address. */
-+ if (!bcm47xx_is_valid_mac(sprom->il0mac)) {
-+ u8 mac[6];
-+ nvram_read_macaddr(NULL, "et0macaddr", mac, false);
-+ if (bcm47xx_is_valid_mac(mac)) {
-+ int err = bcm47xx_increase_mac_addr(mac, mac_addr_used);
-+ if (!err) {
-+ memcpy(sprom->il0mac, mac, ETH_ALEN);
-+ mac_addr_used++;
-+ }
-+ }
-+ }
- }
-
- static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix,