ramips: specify eeprom file name on RT288X
[openwrt.git] / target / linux / brcm63xx / patches-3.0 / 250-boardid_fixup.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -32,9 +32,13 @@
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 +#define CFE_OFFSET_64K 0x10000
12 +#define CFE_OFFSET_128K 0x20000
13 +
14 static struct bcm963xx_nvram nvram;
15 static unsigned int mac_addr_used;
16 static struct board_info board;
17 @@ -734,6 +738,29 @@ static int board_get_mac_address(u8 *mac
18 return 0;
19 }
20
21 +static void __init boardid_fixup(u8 *boot_addr)
22 +{
23 + struct bcm_tag *tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_64K);
24 +
25 + /* check if bcm_tag is at 64k offset */
26 + if (strncmp(nvram.name, tag->boardid, BOARDID_LEN) != 0) {
27 + /* else try 128k */
28 + tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_128K);
29 + if (strncmp(nvram.name, tag->boardid, BOARDID_LEN) != 0) {
30 + /* No tag found */
31 + printk(KERN_DEBUG "No bcm_tag found!\n");
32 + return;
33 + }
34 + }
35 + /* check if we should override the boardid */
36 + if (tag->information1[0] != '+')
37 + return;
38 +
39 + strncpy(nvram.name, &tag->information1[1], BOARDID_LEN);
40 +
41 + printk(KERN_INFO "Overriding boardid with '%s'\n", nvram.name);
42 +}
43 +
44 /*
45 * early init callback, read nvram data from flash and checksum it
46 */
47 @@ -782,6 +809,11 @@ void __init board_prom_init(void)
48 return;
49 }
50
51 + if (strcmp(cfe_version, "unknown") != 0) {
52 + /* cfe present */
53 + boardid_fixup(boot_addr);
54 + }
55 +
56 /* find board by name */
57 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
58 if (strncmp(nvram.name, bcm963xx_boards[i]->name,
This page took 0.044952 seconds and 5 git commands to generate.