129 lines
3.9 KiB
Diff
129 lines
3.9 KiB
Diff
|
From 03feb9db77fba3eef3d83e17a87a56979659b248 Mon Sep 17 00:00:00 2001
|
||
|
From: Jonas Gorski <jogo@openwrt.org>
|
||
|
Date: Tue, 29 Jul 2014 22:48:26 +0200
|
||
|
Subject: [PATCH 07/10] MIPS: BCM63XX: also register a fallback sprom for bcma
|
||
|
|
||
|
Similar to SSB, register a fallback sprom handler for BCMA.
|
||
|
|
||
|
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||
|
---
|
||
|
arch/mips/bcm63xx/boards/Kconfig | 1 +
|
||
|
arch/mips/bcm63xx/sprom.c | 40 +++++++++++++++++++++++++++++++++++-----
|
||
|
2 files changed, 36 insertions(+), 5 deletions(-)
|
||
|
|
||
|
--- a/arch/mips/bcm63xx/boards/Kconfig
|
||
|
+++ b/arch/mips/bcm63xx/boards/Kconfig
|
||
|
@@ -5,6 +5,7 @@ menu "Board support"
|
||
|
config BOARD_BCM963XX
|
||
|
bool "Generic Broadcom 963xx boards"
|
||
|
select SSB
|
||
|
+ select BCMA
|
||
|
default y
|
||
|
|
||
|
endmenu
|
||
|
--- a/arch/mips/bcm63xx/sprom.c
|
||
|
+++ b/arch/mips/bcm63xx/sprom.c
|
||
|
@@ -12,6 +12,7 @@
|
||
|
#include <linux/string.h>
|
||
|
#include <linux/platform_device.h>
|
||
|
#include <linux/ssb/ssb.h>
|
||
|
+#include <linux/bcma/bcma.h>
|
||
|
#include <bcm63xx_fallback_sprom.h>
|
||
|
#include <board_bcm963xx.h>
|
||
|
|
||
|
@@ -21,7 +22,7 @@
|
||
|
* Register a sane SPROMv2 to make the on-board
|
||
|
* bcm4318 WLAN work
|
||
|
*/
|
||
|
-#ifdef CONFIG_SSB_PCIHOST
|
||
|
+#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI)
|
||
|
static __initconst struct ssb_sprom bcm63xx_default_sprom = {
|
||
|
.revision = 0x02,
|
||
|
.board_rev = 0x17,
|
||
|
@@ -43,7 +44,7 @@ static __initconst struct ssb_sprom bcm6
|
||
|
.boardflags_hi = 0x0000,
|
||
|
};
|
||
|
|
||
|
-
|
||
|
+#if defined (CONFIG_SSB_PCIHOST)
|
||
|
static __initconst u16 bcm4306_sprom[] = {
|
||
|
0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002,
|
||
|
0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff,
|
||
|
@@ -158,10 +159,12 @@ static __initconst u16 bcm43222_sprom[]
|
||
|
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
|
||
|
0xffff, 0xffff, 0xffff, 0x0008,
|
||
|
};
|
||
|
+#endif /* CONFIG_SSB_PCIHOST */
|
||
|
|
||
|
static struct ssb_sprom bcm63xx_sprom;
|
||
|
|
||
|
-int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
|
||
|
+#if defined(CONFIG_SSB_PCIHOST)
|
||
|
+int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
|
||
|
{
|
||
|
if (bus->bustype == SSB_BUSTYPE_PCI) {
|
||
|
memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
|
||
|
@@ -171,6 +174,20 @@ int bcm63xx_get_fallback_sprom(struct ss
|
||
|
return -EINVAL;
|
||
|
}
|
||
|
}
|
||
|
+#endif
|
||
|
+
|
||
|
+#if defined(CONFIG_BCMA_HOST_PCI)
|
||
|
+int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out)
|
||
|
+{
|
||
|
+ if (bus->hosttype == BCMA_HOSTTYPE_PCI) {
|
||
|
+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
|
||
|
+ return 0;
|
||
|
+ } else {
|
||
|
+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
|
||
|
+ return -EINVAL;
|
||
|
+ }
|
||
|
+}
|
||
|
+#endif
|
||
|
|
||
|
/* FIXME: use lib_sprom after submission upstream */
|
||
|
|
||
|
@@ -718,10 +735,11 @@ int __init bcm63xx_register_fallback_spr
|
||
|
{
|
||
|
int ret = 0;
|
||
|
|
||
|
-#ifdef CONFIG_SSB_PCIHOST
|
||
|
+#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI)
|
||
|
u16 size = 0;
|
||
|
|
||
|
switch (data->type) {
|
||
|
+#if defined(CONFIG_SSB_PCIHOST)
|
||
|
case SPROM_BCM4306:
|
||
|
memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom));
|
||
|
size = ARRAY_SIZE(bcm4306_sprom);
|
||
|
@@ -742,6 +760,7 @@ int __init bcm63xx_register_fallback_spr
|
||
|
memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom));
|
||
|
size = ARRAY_SIZE(bcm43222_sprom);
|
||
|
break;
|
||
|
+#endif
|
||
|
case SPROM_DEFAULT:
|
||
|
memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
|
||
|
sizeof(bcm63xx_sprom));
|
||
|
@@ -756,8 +775,19 @@ int __init bcm63xx_register_fallback_spr
|
||
|
memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
|
||
|
memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
|
||
|
memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
|
||
|
+#endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */
|
||
|
+
|
||
|
+#if defined(CONFIG_SSB_PCIHOST)
|
||
|
+ ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_ssb_sprom);
|
||
|
+ if (ret)
|
||
|
+ return ret;
|
||
|
+
|
||
|
+#endif
|
||
|
|
||
|
- ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom);
|
||
|
+#if defined(CONFIG_BCMA_HOST_PCI)
|
||
|
+ ret = bcma_arch_register_fallback_sprom(bcm63xx_get_fallback_bcma_sprom);
|
||
|
+ if (ret)
|
||
|
+ return ret;
|
||
|
#endif
|
||
|
return ret;
|
||
|
}
|