aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.1/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch
blob: 0c4a9be47d6fb35c7eecd9d5840408bbb0ea785e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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);