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 diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
31 index 82ff9fd..98c075f 100644
32 --- a/arch/mips/bcm47xx/setup.c
33 +++ b/arch/mips/bcm47xx/setup.c
34 @@ -206,9 +206,6 @@ void __init bcm47xx_bus_setup(void)
35 err = bcma_host_soc_init(&bcm47xx_bus.bcma);
37 panic("Failed to initialize BCMA bus (err %d)", err);
39 - bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo,
44 diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
45 index 92a6c9d..b0d62e7 100644
46 --- a/arch/mips/bcm47xx/sprom.c
47 +++ b/arch/mips/bcm47xx/sprom.c
48 @@ -640,19 +640,6 @@ void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
52 -#ifdef CONFIG_BCM47XX_BCMA
53 -void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
56 - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
58 - if (!boardinfo->vendor)
59 - boardinfo->vendor = SSB_BOARDVENDOR_BCM;
61 - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
65 #if defined(CONFIG_BCM47XX_SSB)
66 static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
68 @@ -707,33 +694,46 @@ static void bcm47xx_sprom_apply_prefix_alias(char *prefix, size_t prefix_size)
70 static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
73 + struct bcma_boardinfo *binfo = &bus->boardinfo;
74 struct bcma_device *core;
77 + bool fallback = false;
79 switch (bus->hosttype) {
80 case BCMA_HOSTTYPE_PCI:
81 memset(out, 0, sizeof(struct ssb_sprom));
82 - snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
83 + snprintf(buf, sizeof(buf), "pci/%u/%u/",
84 bus->host_pci->bus->number + 1,
85 PCI_SLOT(bus->host_pci->devfn));
86 - bcm47xx_sprom_apply_prefix_alias(prefix, sizeof(prefix));
87 - bcm47xx_fill_sprom(out, prefix, false);
89 + bcm47xx_sprom_apply_prefix_alias(buf, sizeof(buf));
92 case BCMA_HOSTTYPE_SOC:
93 memset(out, 0, sizeof(struct ssb_sprom));
94 core = bcma_find_core(bus, BCMA_CORE_80211);
96 - snprintf(prefix, sizeof(prefix), "sb/%u/",
97 + snprintf(buf, sizeof(buf), "sb/%u/",
99 - bcm47xx_fill_sprom(out, prefix, true);
103 - bcm47xx_fill_sprom(out, NULL, false);
109 pr_warn("Unable to fill SPROM for given bustype.\n");
113 + nvram_read_u16(prefix, NULL, "boardvendor", &binfo->vendor, 0, true);
114 + if (!binfo->vendor)
115 + binfo->vendor = SSB_BOARDVENDOR_BCM;
116 + nvram_read_u16(prefix, NULL, "boardtype", &binfo->type, 0, true);
118 + bcm47xx_fill_sprom(out, prefix, fallback);
124 diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
125 index 8ed77f6..1461c10 100644
126 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
127 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
128 @@ -52,10 +52,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
129 void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
132 -#ifdef CONFIG_BCM47XX_BCMA
133 -void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
134 - const char *prefix);
137 void bcm47xx_set_system_type(u16 chip_id);