brcm47xx: update sprom patches like they are in the mainline kernel
[openwrt.git] / target / linux / brcm47xx / patches-3.2 / 200-MIPS-BCM47XX-provide-sprom-to-bcma-bus.patch
1 --- a/arch/mips/bcm47xx/setup.c
2 +++ b/arch/mips/bcm47xx/setup.c
3 @@ -3,7 +3,7 @@
4 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
5 * Copyright (C) 2006 Michael Buesch <m@bues.ch>
6 * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
7 - * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
8 + * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de>
9 * Copyright (C) 2011-2012 Tathagata Das <tathagata@alumnux.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 @@ -93,7 +93,7 @@ static void bcm47xx_machine_halt(void)
13 }
14
15 #ifdef CONFIG_BCM47XX_SSB
16 -static int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
17 +static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
18 {
19 char prefix[10];
20
21 @@ -110,7 +110,7 @@ static int bcm47xx_get_sprom(struct ssb_
22 }
23
24 static int bcm47xx_get_invariants(struct ssb_bus *bus,
25 - struct ssb_init_invariants *iv)
26 + struct ssb_init_invariants *iv)
27 {
28 char buf[20];
29
30 @@ -165,7 +165,7 @@ static void __init bcm47xx_register_ssb(
31 char buf[100];
32 struct ssb_mipscore *mcore;
33
34 - err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom);
35 + err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom_ssb);
36 if (err)
37 printk(KERN_WARNING "bcm47xx: someone else already registered"
38 " a ssb SPROM callback handler (err %d)\n", err);
39 @@ -199,10 +199,41 @@ static void __init bcm47xx_register_ssb(
40 #endif
41
42 #ifdef CONFIG_BCM47XX_BCMA
43 +static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
44 +{
45 + char prefix[10];
46 + struct bcma_device *core;
47 +
48 + switch (bus->hosttype) {
49 + case BCMA_HOSTTYPE_PCI:
50 + snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
51 + bus->host_pci->bus->number + 1,
52 + PCI_SLOT(bus->host_pci->devfn));
53 + bcm47xx_fill_sprom(out, prefix);
54 + return 0;
55 + case BCMA_HOSTTYPE_SOC:
56 + bcm47xx_fill_sprom_ethernet(out, NULL);
57 + core = bcma_find_core(bus, BCMA_CORE_80211);
58 + if (core) {
59 + snprintf(prefix, sizeof(prefix), "sb/%u/",
60 + core->core_index);
61 + bcm47xx_fill_sprom(out, prefix);
62 + }
63 + return 0;
64 + default:
65 + pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n");
66 + return -EINVAL;
67 + }
68 +}
69 +
70 static void __init bcm47xx_register_bcma(void)
71 {
72 int err;
73
74 + err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma);
75 + if (err)
76 + pr_warn("bcm47xx: someone else already registered a bcma SPROM callback handler (err %d)\n", err);
77 +
78 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
79 if (err)
80 panic("Failed to initialize BCMA bus (err %d)\n", err);
This page took 0.046986 seconds and 5 git commands to generate.