brcm47xx: fix detection of some Linksys WRT54G* devices
[openwrt.git] / target / linux / brcm47xx / patches-3.10 / 072-MIPS-BCM47XX-only-print-SoC-name-in-system-type-in-c.patch
1 From 17e0ca5d6e08a83eed8dada75af4c0107f162051 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Thu, 19 Sep 2013 23:40:09 +0200
4 Subject: [PATCH 018/110] MIPS: BCM47XX: only print SoC name in system type in
5  cpuinfo
6
7 Recently the output of "system type" in  /proc/cpuinfo was changed to
8 Broadcom BCM4730 (Some sample board), but it is better to just print
9 the SoC name in the "system type" entry. The board name will be added
10 in the machine entry later.
11
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
13 Acked-by: John Crispin <blogic@openwrt.org>
14 Patchwork: http://patchwork.linux-mips.org/patch/5865/
15 ---
16  arch/mips/bcm47xx/prom.c                     |   31 ++++++++------------------
17  arch/mips/bcm47xx/setup.c                    |    2 ++
18  arch/mips/include/asm/mach-bcm47xx/bcm47xx.h |    2 ++
19  3 files changed, 13 insertions(+), 22 deletions(-)
20
21 --- a/arch/mips/bcm47xx/prom.c
22 +++ b/arch/mips/bcm47xx/prom.c
23 @@ -37,32 +37,19 @@
24  
25  static int cfe_cons_handle;
26  
27 -static u16 get_chip_id(void)
28 -{
29 -       switch (bcm47xx_bus_type) {
30 -#ifdef CONFIG_BCM47XX_SSB
31 -       case BCM47XX_BUS_TYPE_SSB:
32 -               return bcm47xx_bus.ssb.chip_id;
33 -#endif
34 -#ifdef CONFIG_BCM47XX_BCMA
35 -       case BCM47XX_BUS_TYPE_BCMA:
36 -               return bcm47xx_bus.bcma.bus.chipinfo.id;
37 -#endif
38 -       }
39 -       return 0;
40 -}
41 +static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
42  
43  const char *get_system_type(void)
44  {
45 -       static char buf[50];
46 -       u16 chip_id = get_chip_id();
47 -
48 -       snprintf(buf, sizeof(buf),
49 -                (chip_id > 0x9999) ? "Broadcom BCM%d (%s)" :
50 -                                     "Broadcom BCM%04X (%s)",
51 -                chip_id, bcm47xx_board_get_name());
52 +       return bcm47xx_system_type;
53 +}
54  
55 -       return buf;
56 +__init void bcm47xx_set_system_type(u16 chip_id)
57 +{
58 +       snprintf(bcm47xx_system_type, sizeof(bcm47xx_system_type),
59 +                (chip_id > 0x9999) ? "Broadcom BCM%d" :
60 +                                     "Broadcom BCM%04X",
61 +                chip_id);
62  }
63  
64  void prom_putchar(char c)
65 --- a/arch/mips/bcm47xx/setup.c
66 +++ b/arch/mips/bcm47xx/setup.c
67 @@ -210,12 +210,14 @@ void __init plat_mem_setup(void)
68  #ifdef CONFIG_BCM47XX_BCMA
69                 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
70                 bcm47xx_register_bcma();
71 +               bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id);
72  #endif
73         } else {
74                 printk(KERN_INFO "bcm47xx: using ssb bus\n");
75  #ifdef CONFIG_BCM47XX_SSB
76                 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
77                 bcm47xx_register_ssb();
78 +               bcm47xx_set_system_type(bcm47xx_bus.ssb.chip_id);
79  #endif
80         }
81  
82 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
83 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
84 @@ -56,4 +56,6 @@ void bcm47xx_fill_bcma_boardinfo(struct
85                                  const char *prefix);
86  #endif
87  
88 +void bcm47xx_set_system_type(u16 chip_id);
89 +
90  #endif /* __ASM_BCM47XX_H */