OpenWrt – Rev 1

Subversion Repositories:
Rev:
From 1cece9f7aca1f0c193edce201f77a87008c5a405 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Tue, 29 Jul 2014 21:58:38 +0200
Subject: [PATCH 04/10] MIPS: BCM63XX: allow different types of sprom

Different chips require different sprom contents, so prepare for
supplying the appropriate sprom type.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/bcm63xx/sprom.c                                   | 13 ++++++++++++-
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h |  5 +++++
 2 files changed, 17 insertions(+), 1 deletion(-)

--- a/arch/mips/bcm63xx/sprom.c
+++ b/arch/mips/bcm63xx/sprom.c
@@ -22,7 +22,7 @@
  * bcm4318 WLAN work
  */
 #ifdef CONFIG_SSB_PCIHOST
-static struct ssb_sprom bcm63xx_sprom = {
+static __initconst struct ssb_sprom bcm63xx_default_sprom = {
        .revision               = 0x02,
        .board_rev              = 0x17,
        .country_code           = 0x0,
@@ -43,6 +43,8 @@ static struct ssb_sprom bcm63xx_sprom =
        .boardflags_hi          = 0x0000,
 };
 
+static struct ssb_sprom bcm63xx_sprom;
+
 int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
 {
        if (bus->bustype == SSB_BUSTYPE_PCI) {
@@ -60,6 +62,15 @@ int __init bcm63xx_register_fallback_spr
        int ret = 0;
 
 #ifdef CONFIG_SSB_PCIHOST
+       switch (data->type) {
+       case SPROM_DEFAULT:
+               memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
+                      sizeof(bcm63xx_sprom));
+               break;
+       default:
+               return -EINVAL;
+       }
+
        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);
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
@@ -3,8 +3,13 @@
 
 #include <linux/if_ether.h>
 
+enum sprom_type {
+       SPROM_DEFAULT, /* default fallback sprom */
+};
+
 struct fallback_sprom_data {
        u8 mac_addr[ETH_ALEN];
+       enum sprom_type type;
 };
 
 int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data);