1 From 112b2e12edda60f495b57e8a1d85eb95e2662845 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Thu, 16 Feb 2012 23:44:26 +0100
4 Subject: [PATCH 199/202] MIPS: BCM47XX: provide sprom to bcma bus
6 On SoCs the sprom is often stored in nvram in the flashchip. This patch
7 registers a sprom fallback callback handler in bcma and provides the
8 sprom needed for this device.
10 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12 arch/mips/bcm47xx/setup.c | 39 +++++++++++++++++++++++++++++++++++----
13 1 files changed, 35 insertions(+), 4 deletions(-)
15 --- a/arch/mips/bcm47xx/setup.c
16 +++ b/arch/mips/bcm47xx/setup.c
18 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
19 * Copyright (C) 2006 Michael Buesch <m@bues.ch>
20 * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
21 - * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
22 + * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de>
24 * This program is free software; you can redistribute it and/or modify it
25 * under the terms of the GNU General Public License as published by the
26 @@ -91,7 +91,7 @@ static void bcm47xx_machine_halt(void)
29 #ifdef CONFIG_BCM47XX_SSB
30 -static int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
31 +static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
35 @@ -108,7 +108,7 @@ static int bcm47xx_get_sprom(struct ssb_
38 static int bcm47xx_get_invariants(struct ssb_bus *bus,
39 - struct ssb_init_invariants *iv)
40 + struct ssb_init_invariants *iv)
44 @@ -163,7 +163,7 @@ static void __init bcm47xx_register_ssb(
46 struct ssb_mipscore *mcore;
48 - err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom);
49 + err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom_ssb);
51 printk(KERN_WARNING "bcm47xx: someone else already registered"
52 " a ssb SPROM callback handler (err %d)\n", err);
53 @@ -197,10 +197,41 @@ static void __init bcm47xx_register_ssb(
56 #ifdef CONFIG_BCM47XX_BCMA
57 +static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
60 + struct bcma_device *core;
62 + if (bus->hosttype == BCMA_HOSTTYPE_PCI) {
63 + snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
64 + bus->host_pci->bus->number + 1,
65 + PCI_SLOT(bus->host_pci->devfn));
66 + bcm47xx_fill_sprom(out, prefix);
68 + } else if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
69 + bcm47xx_fill_sprom_ethernet(out, NULL);
70 + core = bcma_find_core(bus, BCMA_CORE_80211);
72 + snprintf(prefix, sizeof(prefix), "sb/%u/",
74 + bcm47xx_fill_sprom(out, prefix);
78 + printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n");
83 static void __init bcm47xx_register_bcma(void)
87 + err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma);
89 + printk(KERN_WARNING "bcm47xx: someone else already registered"
90 + " a bcma SPROM callback handler (err %d)\n", err);
92 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
94 panic("Failed to initialize BCMA bus (err %d)\n", err);