MIPS: BCM63XX: provide a MAC address for BCM3368 chips
authorFlorian Fainelli <florian@openwrt.org>
Tue, 18 Jun 2013 16:55:42 +0000 (16:55 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 1 Jul 2013 13:10:54 +0000 (15:10 +0200)
The BCM3368 SoC uses a NVRAM format which is not compatible with the one
used by CFE, provide a default MAC address which is suitable for use and
which is the default one also being used by the bootloader on these
chips.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: cernekee@gmail.com
Cc: jogo@openwrt.org
Patchwork: https://patchwork.linux-mips.org/patch/5498/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/bcm63xx/nvram.c

index a4b8864f93072d8e305d6a7bcca4953b2cbcc4a5..e652e578a679aa3d1c5c41e336121bedb298ad72 100644 (file)
@@ -42,6 +42,7 @@ void __init bcm63xx_nvram_init(void *addr)
 {
        unsigned int check_len;
        u32 crc, expected_crc;
+       u8 hcs_mac_addr[ETH_ALEN] = { 0x00, 0x10, 0x18, 0xff, 0xff, 0xff };
 
        /* extract nvram data */
        memcpy(&nvram, addr, sizeof(nvram));
@@ -62,6 +63,15 @@ void __init bcm63xx_nvram_init(void *addr)
        if (crc != expected_crc)
                pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
                        expected_crc, crc);
+
+       /* Cable modems have a different NVRAM which is embedded in the eCos
+        * firmware and not easily extractible, give at least a MAC address
+        * pool.
+        */
+       if (BCMCPU_IS_3368()) {
+               memcpy(nvram.mac_addr_base, hcs_mac_addr, ETH_ALEN);
+               nvram.mac_addr_count = 2;
+       }
 }
 
 u8 *bcm63xx_nvram_get_name(void)