summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/patches-3.9/425-bcm933xx_hcs.patch
blob: 79533fb64ee51720f901c7f3fde4ece4a8348c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -37,6 +37,7 @@
 #include <pci_rt2x00_fixup.h>
 
 #include <uapi/linux/bcm963xx_tag.h>
+#include <uapi/linux/bcm933xx_hcs.h>
 
 #define PFX	"board_bcm963xx: "
 
@@ -45,6 +46,7 @@
 
 #define CFE_OFFSET_64K			0x10000
 #define CFE_OFFSET_128K			0x20000
+#define HCS_OFFSET_128K			0x20000
 
 static struct board_info board;
 
@@ -782,8 +784,9 @@ void __init board_prom_init(void)
 	unsigned int i;
 	u8 *boot_addr, *cfe;
 	char cfe_version[32];
-	char *board_name;
+	char *board_name = NULL;
 	u32 val;
+	struct bcm_hcs *hcs;
 
 	/* read base address of boot chip select (0)
 	 * 6328/6362 do not have MPI but boot from a fixed address
@@ -812,9 +815,13 @@ void __init board_prom_init(void)
 	if (strcmp(cfe_version, "unknown") != 0) {
 		/* cfe present */
 		boardid_fixup(boot_addr);
+
+		board_name = bcm63xx_nvram_get_name();
+	} else if (BCMCPU_IS_3368()) {
+		hcs = (struct bcm_hcs *)KSEG1ADDR(0x1fc00000 + HCS_OFFSET_128K);
+		board_name = hcs->filename;
 	}
 
-	board_name = bcm63xx_nvram_get_name();
 	/* find board by name */
 	for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
 		if (strncmp(board_name, bcm963xx_boards[i]->name, 16))
--- /dev/null
+++ b/include/uapi/linux/bcm933xx_hcs.h
@@ -0,0 +1,18 @@
+#ifndef __BCM_HCS_H
+#define __BCM_HCS_H
+
+struct bcm_hcs {
+	uint16_t magic;
+	uint16_t control;
+	uint16_t rev_maj;
+	uint16_t rev_min;
+	uint32_t build_date;
+	uint32_t filelen;
+	uint32_t ldaddress;
+	char filename[64];
+	uint16_t hcs;
+	uint16_t her_znaet_chto;
+	uint32_t crc;
+};
+
+#endif /* __BCM_HCS */