1 From 03feb9db77fba3eef3d83e17a87a56979659b248 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Tue, 29 Jul 2014 22:48:26 +0200
4 Subject: [PATCH 07/10] MIPS: BCM63XX: also register a fallback sprom for bcma
6 Similar to SSB, register a fallback sprom handler for BCMA.
8 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 arch/mips/bcm63xx/boards/Kconfig | 1 +
11 arch/mips/bcm63xx/sprom.c | 40 +++++++++++++++++++++++++++++++++++-----
12 2 files changed, 36 insertions(+), 5 deletions(-)
14 --- a/arch/mips/bcm63xx/boards/Kconfig
15 +++ b/arch/mips/bcm63xx/boards/Kconfig
16 @@ -5,6 +5,7 @@ menu "Board support"
18 bool "Generic Broadcom 963xx boards"
24 --- a/arch/mips/bcm63xx/sprom.c
25 +++ b/arch/mips/bcm63xx/sprom.c
27 #include <linux/string.h>
28 #include <linux/platform_device.h>
29 #include <linux/ssb/ssb.h>
30 +#include <linux/bcma/bcma.h>
31 #include <bcm63xx_fallback_sprom.h>
32 #include <board_bcm963xx.h>
35 * Register a sane SPROMv2 to make the on-board
38 -#ifdef CONFIG_SSB_PCIHOST
39 +#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI)
40 static __initconst struct ssb_sprom bcm63xx_default_sprom = {
43 @@ -43,7 +44,7 @@ static __initconst struct ssb_sprom bcm6
44 .boardflags_hi = 0x0000,
48 +#if defined (CONFIG_SSB_PCIHOST)
49 static __initconst u16 bcm4306_sprom[] = {
50 0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002,
51 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff,
52 @@ -158,10 +159,12 @@ static __initconst u16 bcm43222_sprom[]
53 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
54 0xffff, 0xffff, 0xffff, 0x0008,
56 +#endif /* CONFIG_SSB_PCIHOST */
58 static struct ssb_sprom bcm63xx_sprom;
60 -int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
61 +#if defined(CONFIG_SSB_PCIHOST)
62 +int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
64 if (bus->bustype == SSB_BUSTYPE_PCI) {
65 memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
66 @@ -171,6 +174,20 @@ int bcm63xx_get_fallback_sprom(struct ss
72 +#if defined(CONFIG_BCMA_HOST_PCI)
73 +int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out)
75 + if (bus->hosttype == BCMA_HOSTTYPE_PCI) {
76 + memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
79 + printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
85 /* FIXME: use lib_sprom after submission upstream */
87 @@ -654,10 +671,11 @@ int __init bcm63xx_register_fallback_spr
91 -#ifdef CONFIG_SSB_PCIHOST
92 +#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI)
96 +#if defined(CONFIG_SSB_PCIHOST)
98 memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom));
99 size = ARRAY_SIZE(bcm4306_sprom);
100 @@ -678,6 +696,7 @@ int __init bcm63xx_register_fallback_spr
101 memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom));
102 size = ARRAY_SIZE(bcm43222_sprom);
106 memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
107 sizeof(bcm63xx_sprom));
108 @@ -692,8 +711,19 @@ int __init bcm63xx_register_fallback_spr
109 memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
110 memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
111 memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
112 +#endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */
114 +#if defined(CONFIG_SSB_PCIHOST)
115 + ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_ssb_sprom);
121 - ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom);
122 +#if defined(CONFIG_BCMA_HOST_PCI)
123 + ret = bcma_arch_register_fallback_sprom(bcm63xx_get_fallback_bcma_sprom);