]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
MIPS: BCM47xx: Read board info for all bcma buses
authorRafał Miłecki <zajec5@gmail.com>
Tue, 12 May 2015 11:05:18 +0000 (13:05 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Sun, 21 Jun 2015 19:52:25 +0000 (21:52 +0200)
Extra bcma buses may be totally different models, see following dump:
boardtype=0x0646
pci/1/1/boardtype=0x0545
pci/2/1/boardtype=0x62b
We need to detect them properly to allow drivers apply some board
specific hacks.

[ralf@linux-mips.org: folded in Rafal's fix.]

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: https://patchwork.linux-mips.org/patch/10028/
Patchwork: https://patchwork.linux-mips.org/patch/10048/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/bcm47xx/setup.c
arch/mips/bcm47xx/sprom.c
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h

index 82ff9fd2ab6ef6c68d4caed686300299fc9bd59e..98c075f81795611d5d81b91dbd2372a2e7e1b2f4 100644 (file)
@@ -206,9 +206,6 @@ void __init bcm47xx_bus_setup(void)
                err = bcma_host_soc_init(&bcm47xx_bus.bcma);
                if (err)
                        panic("Failed to initialize BCMA bus (err %d)", err);
-
-               bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo,
-                                           NULL);
        }
 #endif
 
index 92a6c9dc21bda559e4d597e645e2c616acc2b963..b0d62e7e7af777c8d4ea4e72aa2c12fc0397fd9a 100644 (file)
@@ -640,19 +640,6 @@ void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
 }
 #endif
 
-#ifdef CONFIG_BCM47XX_BCMA
-void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
-                                const char *prefix)
-{
-       nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0,
-                      true);
-       if (!boardinfo->vendor)
-               boardinfo->vendor = SSB_BOARDVENDOR_BCM;
-
-       nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0, true);
-}
-#endif
-
 #if defined(CONFIG_BCM47XX_SSB)
 static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
 {
@@ -707,33 +694,46 @@ static void bcm47xx_sprom_apply_prefix_alias(char *prefix, size_t prefix_size)
 
 static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
 {
-       char prefix[10];
+       struct bcma_boardinfo *binfo = &bus->boardinfo;
        struct bcma_device *core;
+       char buf[10];
+       char *prefix;
+       bool fallback = false;
 
        switch (bus->hosttype) {
        case BCMA_HOSTTYPE_PCI:
                memset(out, 0, sizeof(struct ssb_sprom));
-               snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
+               snprintf(buf, sizeof(buf), "pci/%u/%u/",
                         bus->host_pci->bus->number + 1,
                         PCI_SLOT(bus->host_pci->devfn));
-               bcm47xx_sprom_apply_prefix_alias(prefix, sizeof(prefix));
-               bcm47xx_fill_sprom(out, prefix, false);
-               return 0;
+               bcm47xx_sprom_apply_prefix_alias(buf, sizeof(buf));
+               prefix = buf;
+               break;
        case BCMA_HOSTTYPE_SOC:
                memset(out, 0, sizeof(struct ssb_sprom));
                core = bcma_find_core(bus, BCMA_CORE_80211);
                if (core) {
-                       snprintf(prefix, sizeof(prefix), "sb/%u/",
+                       snprintf(buf, sizeof(buf), "sb/%u/",
                                 core->core_index);
-                       bcm47xx_fill_sprom(out, prefix, true);
+                       prefix = buf;
+                       fallback = true;
                } else {
-                       bcm47xx_fill_sprom(out, NULL, false);
+                       prefix = NULL;
                }
-               return 0;
+               break;
        default:
                pr_warn("Unable to fill SPROM for given bustype.\n");
                return -EINVAL;
        }
+
+       nvram_read_u16(prefix, NULL, "boardvendor", &binfo->vendor, 0, true);
+       if (!binfo->vendor)
+               binfo->vendor = SSB_BOARDVENDOR_BCM;
+       nvram_read_u16(prefix, NULL, "boardtype", &binfo->type, 0, true);
+
+       bcm47xx_fill_sprom(out, prefix, fallback);
+
+       return 0;
 }
 #endif
 
index 8ed77f6189405651f49b87a9a90fceda08f20ced..1461c10c1c4c4e9a9c5c3e0ec1384b433e4f312c 100644 (file)
@@ -52,10 +52,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
 void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
                                const char *prefix);
 #endif
-#ifdef CONFIG_BCM47XX_BCMA
-void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
-                                const char *prefix);
-#endif
 
 void bcm47xx_set_system_type(u16 chip_id);