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