brcm47xx: update board detection patches
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.10 / 261-MIPS-BCM47XX-print-board-name-in-proc-cpuinfo.patch
1 --- a/arch/mips/bcm47xx/prom.c
2 +++ b/arch/mips/bcm47xx/prom.c
3 @@ -32,10 +32,35 @@
4 #include <asm/bootinfo.h>
5 #include <asm/fw/cfe/cfe_api.h>
6 #include <asm/fw/cfe/cfe_error.h>
7 +#include <bcm47xx.h>
8 +#include <bcm47xx_board.h>
9 +
10 +static u16 get_chip_id(void)
11 +{
12 + switch (bcm47xx_bus_type) {
13 +#ifdef CONFIG_BCM47XX_SSB
14 + case BCM47XX_BUS_TYPE_SSB:
15 + return bcm47xx_bus.ssb.chip_id;
16 +#endif
17 +#ifdef CONFIG_BCM47XX_BCMA
18 + case BCM47XX_BUS_TYPE_BCMA:
19 + return bcm47xx_bus.bcma.bus.chipinfo.id;
20 +#endif
21 + }
22 + return 0;
23 +}
24
25 const char *get_system_type(void)
26 {
27 - return "Broadcom BCM47XX";
28 + static char buf[50];
29 + u16 chip_id = get_chip_id();
30 +
31 + snprintf(buf, sizeof(buf),
32 + (chip_id > 0x9999) ? "Broadcom BCM%d (%s)" :
33 + "Broadcom BCM%04X (%s)",
34 + chip_id, bcm47xx_board_get_name());
35 +
36 + return buf;
37 }
38
39 static __init int prom_init_cfe(void)