1 From 12e1ab54dcd414c3579cfd26be9d9c9e1cab92ad Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Tue, 12 May 2015 13:05:18 +0200
4 Subject: [PATCH] MIPS: BCM47xx: Read board info for all bcma buses
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Extra bcma buses may be totally different models, see following dump:
11 pci/1/1/boardtype=0x0545
12 pci/2/1/boardtype=0x62b
13 We need to detect them properly to allow drivers apply some board
16 [ralf@linux-mips.org: folded in Rafal's fix.]
18 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
19 Cc: linux-mips@linux-mips.org
20 Cc: Hauke Mehrtens <hauke@hauke-m.de>
21 Patchwork: https://patchwork.linux-mips.org/patch/10028/
22 Patchwork: https://patchwork.linux-mips.org/patch/10048/
23 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
25 arch/mips/bcm47xx/setup.c | 3 --
26 arch/mips/bcm47xx/sprom.c | 44 ++++++++++++++--------------
27 arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 4 ---
28 3 files changed, 22 insertions(+), 29 deletions(-)
30 --- a/arch/mips/bcm47xx/setup.c
31 +++ b/arch/mips/bcm47xx/setup.c
32 @@ -206,9 +206,6 @@ void __init bcm47xx_bus_setup(void)
33 err = bcma_host_soc_init(&bcm47xx_bus.bcma);
35 panic("Failed to initialize BCMA bus (err %d)", err);
37 - bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo,
42 --- a/arch/mips/bcm47xx/sprom.c
43 +++ b/arch/mips/bcm47xx/sprom.c
44 @@ -640,19 +640,6 @@ void bcm47xx_fill_ssb_boardinfo(struct s
48 -#ifdef CONFIG_BCM47XX_BCMA
49 -void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
52 - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
54 - if (!boardinfo->vendor)
55 - boardinfo->vendor = SSB_BOARDVENDOR_BCM;
57 - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
61 #if defined(CONFIG_BCM47XX_SSB)
62 static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
64 @@ -707,33 +694,46 @@ static void bcm47xx_sprom_apply_prefix_a
66 static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
69 + struct bcma_boardinfo *binfo = &bus->boardinfo;
70 struct bcma_device *core;
73 + bool fallback = false;
75 switch (bus->hosttype) {
76 case BCMA_HOSTTYPE_PCI:
77 memset(out, 0, sizeof(struct ssb_sprom));
78 - snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
79 + snprintf(buf, sizeof(buf), "pci/%u/%u/",
80 bus->host_pci->bus->number + 1,
81 PCI_SLOT(bus->host_pci->devfn));
82 - bcm47xx_sprom_apply_prefix_alias(prefix, sizeof(prefix));
83 - bcm47xx_fill_sprom(out, prefix, false);
85 + bcm47xx_sprom_apply_prefix_alias(buf, sizeof(buf));
88 case BCMA_HOSTTYPE_SOC:
89 memset(out, 0, sizeof(struct ssb_sprom));
90 core = bcma_find_core(bus, BCMA_CORE_80211);
92 - snprintf(prefix, sizeof(prefix), "sb/%u/",
93 + snprintf(buf, sizeof(buf), "sb/%u/",
95 - bcm47xx_fill_sprom(out, prefix, true);
99 - bcm47xx_fill_sprom(out, NULL, false);
105 pr_warn("Unable to fill SPROM for given bustype.\n");
109 + nvram_read_u16(prefix, NULL, "boardvendor", &binfo->vendor, 0, true);
110 + if (!binfo->vendor)
111 + binfo->vendor = SSB_BOARDVENDOR_BCM;
112 + nvram_read_u16(prefix, NULL, "boardtype", &binfo->type, 0, true);
114 + bcm47xx_fill_sprom(out, prefix, fallback);
120 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
121 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
122 @@ -52,10 +52,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom
123 void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
126 -#ifdef CONFIG_BCM47XX_BCMA
127 -void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
128 - const char *prefix);
131 void bcm47xx_set_system_type(u16 chip_id);