kernel: fix bluetooth and zsmalloc for 3.14
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.13 / 304-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 <board_bcm963xx.h>
5
6 #include <uapi/linux/bcm933xx_hcs.h>
7 +#include <uapi/linux/bcm963xx_tag.h>
8
9 #define PFX "board_bcm963xx: "
10
11 @@ -43,6 +44,9 @@
12 #define BCM963XX_KEYS_POLL_INTERVAL 20
13 #define BCM963XX_KEYS_DEBOUNCE_INTERVAL (BCM963XX_KEYS_POLL_INTERVAL * 3)
14
15 +#define CFE_OFFSET_64K 0x10000
16 +#define CFE_OFFSET_128K 0x20000
17 +
18 static struct board_info board;
19
20 /*
21 @@ -782,6 +786,30 @@ const char *board_get_name(void)
22 return board.name;
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 + char *board_name = (char *)bcm63xx_nvram_get_name();
29 +
30 + /* check if bcm_tag is at 64k offset */
31 + if (strncmp(board_name, tag->board_id, BOARDID_LEN) != 0) {
32 + /* else try 128k */
33 + tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_128K);
34 + if (strncmp(board_name, tag->board_id, BOARDID_LEN) != 0) {
35 + /* No tag found */
36 + printk(KERN_DEBUG "No bcm_tag found!\n");
37 + return;
38 + }
39 + }
40 + /* check if we should override the boardid */
41 + if (tag->information1[0] != '+')
42 + return;
43 +
44 + strncpy(board_name, &tag->information1[1], BOARDID_LEN);
45 +
46 + printk(KERN_INFO "Overriding boardid with '%s'\n", board_name);
47 +}
48 +
49 /*
50 * early init callback, read nvram data from flash and checksum it
51 */
52 @@ -820,6 +848,10 @@ void __init board_prom_init(void)
53 hcs = (struct bcm_hcs *)boot_addr;
54 board_name = hcs->filename;
55 } else {
56 + if (strcmp(cfe_version, "unknown") != 0) {
57 + /* cfe present */
58 + boardid_fixup(boot_addr);
59 + }
60 board_name = bcm63xx_nvram_get_name();
61 }
62 /* find board by name */