Root/target/linux/brcm63xx/patches-3.3/304-boardid_fixup.patch

1--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3@@ -28,12 +28,16 @@
4 #include <bcm63xx_dev_pcmcia.h>
5 #include <bcm63xx_dev_spi.h>
6 #include <board_bcm963xx.h>
7+#include <linux/bcm963xx_tag.h>
8 
9 #define PFX "board_bcm963xx: "
10 
11 #define BCM963XX_KEYS_POLL_INTERVAL 20
12 #define BCM963XX_KEYS_DEBOUNCE_INTERVAL (BCM963XX_KEYS_POLL_INTERVAL * 3)
13 
14+#define CFE_OFFSET_64K 0x10000
15+#define CFE_OFFSET_128K 0x20000
16+
17 static struct bcm963xx_nvram nvram;
18 static unsigned int mac_addr_used;
19 static struct board_info board;
20@@ -724,6 +728,29 @@ static int board_get_mac_address(u8 *mac
21     return 0;
22 }
23 
24+static void __init boardid_fixup(u8 *boot_addr)
25+{
26+ struct bcm_tag *tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_64K);
27+
28+ /* check if bcm_tag is at 64k offset */
29+ if (strncmp(nvram.name, tag->board_id, BOARDID_LEN) != 0) {
30+ /* else try 128k */
31+ tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_128K);
32+ if (strncmp(nvram.name, tag->board_id, BOARDID_LEN) != 0) {
33+ /* No tag found */
34+ printk(KERN_DEBUG "No bcm_tag found!\n");
35+ return;
36+ }
37+ }
38+ /* check if we should override the boardid */
39+ if (tag->information1[0] != '+')
40+ return;
41+
42+ strncpy(nvram.name, &tag->information1[1], BOARDID_LEN);
43+
44+ printk(KERN_INFO "Overriding boardid with '%s'\n", nvram.name);
45+}
46+
47 /*
48  * early init callback, read nvram data from flash and checksum it
49  */
50@@ -771,6 +798,11 @@ void __init board_prom_init(void)
51         return;
52     }
53 
54+ if (strcmp(cfe_version, "unknown") != 0) {
55+ /* cfe present */
56+ boardid_fixup(boot_addr);
57+ }
58+
59     /* find board by name */
60     for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
61         if (strncmp(nvram.name, bcm963xx_boards[i]->name,
62

Archive Download this file



interactive