brcm63xx: add kernel 4.1 support
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.1 / 801-ssb_export_fallback_sprom.patch
1 --- a/arch/mips/bcm63xx/sprom.c
2 +++ b/arch/mips/bcm63xx/sprom.c
3 @@ -8,6 +8,7 @@
4 */
5
6 #include <linux/init.h>
7 +#include <linux/export.h>
8 #include <linux/kernel.h>
9 #include <linux/string.h>
10 #include <linux/platform_device.h>
11 @@ -387,7 +388,19 @@ struct fallback_sprom_match {
12 struct ssb_sprom sprom;
13 };
14
15 -static struct fallback_sprom_match fallback_sprom;
16 +struct fallback_sprom_match fallback_sprom;
17 +
18 +int bcm63xx_get_fallback_sprom(uint pci_bus, uint pci_slot, struct ssb_sprom *out)
19 +{
20 + if (pci_bus != fallback_sprom.pci_bus ||
21 + pci_slot != fallback_sprom.pci_dev)
22 + pr_warn("fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n",
23 + fallback_sprom.pci_bus, fallback_sprom.pci_dev,
24 + pci_bus, pci_slot);
25 + memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom));
26 + return 0;
27 +}
28 +EXPORT_SYMBOL(bcm63xx_get_fallback_sprom);
29
30 #if defined(CONFIG_SSB_PCIHOST)
31 int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out)