brcm47xx: backport BCM47XX Linksys WRT54G series patches
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.10 / 071-MIPS-BCM47XX-print-board-name-in-proc-cpuinfo.patch
1 commit 7ad3b82f9d80ef8919dcfdfe7561e1a83e09c6bd
2 Author: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Wed Sep 18 13:29:58 2013 +0200
4
5 MIPS: BCM47XX: Print board name in /proc/cpuinfo
6
7 Do not print the constant system type "Broadcom BCM47XX" but print the
8 name of the actual SoC in use and the detected board.
9
10 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 Cc: linux-mips@linux-mips.org
12 Patchwork: https://patchwork.linux-mips.org/patch/5839/
13 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
14
15 --- a/arch/mips/bcm47xx/prom.c
16 +++ b/arch/mips/bcm47xx/prom.c
17 @@ -32,12 +32,37 @@
18 #include <asm/bootinfo.h>
19 #include <asm/fw/cfe/cfe_api.h>
20 #include <asm/fw/cfe/cfe_error.h>
21 +#include <bcm47xx.h>
22 +#include <bcm47xx_board.h>
23
24 static int cfe_cons_handle;
25
26 +static u16 get_chip_id(void)
27 +{
28 + switch (bcm47xx_bus_type) {
29 +#ifdef CONFIG_BCM47XX_SSB
30 + case BCM47XX_BUS_TYPE_SSB:
31 + return bcm47xx_bus.ssb.chip_id;
32 +#endif
33 +#ifdef CONFIG_BCM47XX_BCMA
34 + case BCM47XX_BUS_TYPE_BCMA:
35 + return bcm47xx_bus.bcma.bus.chipinfo.id;
36 +#endif
37 + }
38 + return 0;
39 +}
40 +
41 const char *get_system_type(void)
42 {
43 - return "Broadcom BCM47XX";
44 + static char buf[50];
45 + u16 chip_id = get_chip_id();
46 +
47 + snprintf(buf, sizeof(buf),
48 + (chip_id > 0x9999) ? "Broadcom BCM%d (%s)" :
49 + "Broadcom BCM%04X (%s)",
50 + chip_id, bcm47xx_board_get_name());
51 +
52 + return buf;
53 }
54
55 void prom_putchar(char c)