brcm63xx: add linux 4.4 support
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.4 / 359-MIPS-BCM63XX-allow-different-types-of-sprom.patch
1 From 1cece9f7aca1f0c193edce201f77a87008c5a405 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Tue, 29 Jul 2014 21:58:38 +0200
4 Subject: [PATCH 04/10] MIPS: BCM63XX: allow different types of sprom
5
6 Different chips require different sprom contents, so prepare for
7 supplying the appropriate sprom type.
8
9 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 ---
11 arch/mips/bcm63xx/sprom.c | 13 ++++++++++++-
12 arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 5 +++++
13 2 files changed, 17 insertions(+), 1 deletion(-)
14
15 --- a/arch/mips/bcm63xx/sprom.c
16 +++ b/arch/mips/bcm63xx/sprom.c
17 @@ -22,7 +22,7 @@
18 * bcm4318 WLAN work
19 */
20 #ifdef CONFIG_SSB_PCIHOST
21 -static struct ssb_sprom bcm63xx_sprom = {
22 +static __initconst struct ssb_sprom bcm63xx_default_sprom = {
23 .revision = 0x02,
24 .board_rev = 0x17,
25 .country_code = 0x0,
26 @@ -43,6 +43,8 @@ static struct ssb_sprom bcm63xx_sprom =
27 .boardflags_hi = 0x0000,
28 };
29
30 +static struct ssb_sprom bcm63xx_sprom;
31 +
32 int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
33 {
34 if (bus->bustype == SSB_BUSTYPE_PCI) {
35 @@ -60,6 +62,15 @@ int __init bcm63xx_register_fallback_spr
36 int ret = 0;
37
38 #ifdef CONFIG_SSB_PCIHOST
39 + switch (data->type) {
40 + case SPROM_DEFAULT:
41 + memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom,
42 + sizeof(bcm63xx_sprom));
43 + break;
44 + default:
45 + return -EINVAL;
46 + }
47 +
48 memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
49 memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
50 memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
51 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
52 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
53 @@ -3,8 +3,13 @@
54
55 #include <linux/if_ether.h>
56
57 +enum sprom_type {
58 + SPROM_DEFAULT, /* default fallback sprom */
59 +};
60 +
61 struct fallback_sprom_data {
62 u8 mac_addr[ETH_ALEN];
63 + enum sprom_type type;
64 };
65
66 int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data);