diff options
15 files changed, 87 insertions, 240 deletions
diff --git a/target/linux/brcm47xx/patches-3.2/190-ssb-sprom-fix-some-sizes-signedness.patch b/target/linux/brcm47xx/patches-3.2/190-ssb-sprom-fix-some-sizes-signedness.patch index ac73f3d4b..de251f451 100644 --- a/target/linux/brcm47xx/patches-3.2/190-ssb-sprom-fix-some-sizes-signedness.patch +++ b/target/linux/brcm47xx/patches-3.2/190-ssb-sprom-fix-some-sizes-signedness.patch @@ -1,26 +1,3 @@ -From 0af3fa9e4c9ea0ca0662f09183d71ea9a7eb572f Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 14:33:08 +0100 -Subject: [PATCH 190/202] ssb: sprom fix some sizes / signedness - -Some parts of the sprom struct are bigger than needed. -The leddc and maxpwr values are just 8 bit long and not 16. -rxpo2g and rxpo5g are signed -antenna_gain is unsigned - -I got these information for the open source part of the Braodcom SDK -covering sprom version 1 to 9. rxpo2g contained a negative number on my -bcm5354 based device, this cased an error and Broadcom SDK says this is -signed. - -I was unable to find any reverences to antenna_gain.ghz5 in the -Broadcom SDK. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - include/linux/ssb/ssb.h | 20 ++++++++++---------- - 1 files changed, 10 insertions(+), 10 deletions(-) - --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -33,8 +33,8 @@ struct ssb_sprom { @@ -60,16 +37,3 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> u8 rssisav2g; /* 2GHz RSSI params */ u8 rssismc2g; u8 rssismf2g; -@@ -95,10 +95,10 @@ struct ssb_sprom { - * loss in the connectors is bigger than the gain. */ - struct { - struct { -- s8 a0, a1, a2, a3; -+ u8 a0, a1, a2, a3; - } ghz24; /* 2.4GHz band */ - struct { -- s8 a0, a1, a2, a3; -+ u8 a0, a1, a2, a3; - } ghz5; /* 5GHz band */ - } antenna_gain; - diff --git a/target/linux/brcm47xx/patches-3.2/191-ssb-fix-per-path-sprom-vars.patch b/target/linux/brcm47xx/patches-3.2/191-ssb-fix-per-path-sprom-vars.patch deleted file mode 100644 index d5fea1aae..000000000 --- a/target/linux/brcm47xx/patches-3.2/191-ssb-fix-per-path-sprom-vars.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f453c08359a875df66cbbda48087e3592c29da58 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 16:23:58 +0100 -Subject: [PATCH 191/202] ssb: fix per path sprom vars - -On sprom version 4 and 5 there are 4 values for pa_2g, pa_5gl, pa_5g -and pa_5gh, for sprom version 8 and 9 there are only 3. Make the per -path sprom store also work for older sprom versions. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - include/linux/ssb/ssb.h | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - ---- a/include/linux/ssb/ssb.h -+++ b/include/linux/ssb/ssb.h -@@ -19,7 +19,7 @@ struct ssb_driver; - struct ssb_sprom_core_pwr_info { - u8 itssi_2g, itssi_5g; - u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh; -- u16 pa_2g[3], pa_5gl[3], pa_5g[3], pa_5gh[3]; -+ u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4]; - }; - - struct ssb_sprom { diff --git a/target/linux/brcm47xx/patches-3.2/192-ssb-add-ccode.patch b/target/linux/brcm47xx/patches-3.2/192-ssb-add-ccode.patch deleted file mode 100644 index 1b6d5c44e..000000000 --- a/target/linux/brcm47xx/patches-3.2/192-ssb-add-ccode.patch +++ /dev/null @@ -1,22 +0,0 @@ -From b0a2a5c4a88f5d83046b408714ec9b86772fa75d Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 17:16:28 +0100 -Subject: [PATCH 192/202] ssb: add ccode - -This member contains the country code encoded with two chars - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - include/linux/ssb/ssb.h | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - ---- a/include/linux/ssb/ssb.h -+++ b/include/linux/ssb/ssb.h -@@ -35,6 +35,7 @@ struct ssb_sprom { - u8 country_code; /* Country Code */ - u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */ - u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ -+ char ccode[2]; - u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ - u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ - u16 pa0b0; diff --git a/target/linux/brcm47xx/patches-3.2/192-ssb-fix-per-path-sprom-vars.patch b/target/linux/brcm47xx/patches-3.2/192-ssb-fix-per-path-sprom-vars.patch new file mode 100644 index 000000000..56357e7eb --- /dev/null +++ b/target/linux/brcm47xx/patches-3.2/192-ssb-fix-per-path-sprom-vars.patch @@ -0,0 +1,11 @@ +--- a/include/linux/ssb/ssb.h ++++ b/include/linux/ssb/ssb.h +@@ -19,7 +19,7 @@ struct ssb_driver; + struct ssb_sprom_core_pwr_info { + u8 itssi_2g, itssi_5g; + u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh; +- u16 pa_2g[3], pa_5gl[3], pa_5g[3], pa_5gh[3]; ++ u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4]; + }; + + struct ssb_sprom { diff --git a/target/linux/brcm47xx/patches-3.2/193-ssb-add-alpha2.patch b/target/linux/brcm47xx/patches-3.2/193-ssb-add-alpha2.patch new file mode 100644 index 000000000..ab01516d3 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.2/193-ssb-add-alpha2.patch @@ -0,0 +1,10 @@ +--- a/include/linux/ssb/ssb.h ++++ b/include/linux/ssb/ssb.h +@@ -33,6 +33,7 @@ struct ssb_sprom { + u8 et1mdcport; /* MDIO for enet1 */ + u16 board_rev; /* Board revision number from SPROM. */ + u8 country_code; /* Country Code */ ++ char alpha2[2]; /* Country Code as two chars like EU or US */ + u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */ + u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ + u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ diff --git a/target/linux/brcm47xx/patches-3.2/193-ssb-add-some-missing-sprom-attributes.patch b/target/linux/brcm47xx/patches-3.2/194-ssb-add-some-missing-sprom-attributes.patch index e0bcddbf3..21893efb8 100644 --- a/target/linux/brcm47xx/patches-3.2/193-ssb-add-some-missing-sprom-attributes.patch +++ b/target/linux/brcm47xx/patches-3.2/194-ssb-add-some-missing-sprom-attributes.patch @@ -1,16 +1,3 @@ -From 91e6ca304fb163e2f9b15188686fc4637f2cd32a Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Fri, 17 Feb 2012 23:26:39 +0100 -Subject: [PATCH 193/202] ssb: add some missing sprom attributes - -This patch extends the sprom struct to contain all sprom attributes -found in sprom version 1 to 9. This was done accordingly to the open -source part of the Braodcom SDK. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - include/linux/ssb/ssb.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++- - 1 files changed, 75 insertions(+), 1 deletions(-) --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -18,11 +5,11 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> u8 et0mdcport; /* MDIO for enet0 */ u8 et1mdcport; /* MDIO for enet1 */ u16 board_rev; /* Board revision number from SPROM. */ -+ u16 board_num; -+ u16 board_type; ++ u16 board_num; /* Board number from SPROM. */ ++ u16 board_type; /* Board type from SPROM. */ u8 country_code; /* Country Code */ + char alpha2[2]; /* Country Code as two chars like EU or US */ u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */ - u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ @@ -112,7 +114,79 @@ struct ssb_sprom { } ghz5; } fem; diff --git a/target/linux/brcm47xx/patches-3.2/194-bcma-export-bcma_find_core.patch b/target/linux/brcm47xx/patches-3.2/195-bcma-export-bcma_find_core.patch index 1722ae120..79e32a241 100644 --- a/target/linux/brcm47xx/patches-3.2/194-bcma-export-bcma_find_core.patch +++ b/target/linux/brcm47xx/patches-3.2/195-bcma-export-bcma_find_core.patch @@ -1,16 +1,3 @@ -From a07c69ed06031373726e9e5e513d0d942997c265 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 14:22:32 +0100 -Subject: [PATCH 194/202] bcma: export bcma_find_core - -This function is needed by the bcm47xx arch code to get the number of -the ieee80211 core. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - drivers/bcma/main.c | 3 ++- - include/linux/bcma/bcma.h | 1 + - 2 files changed, 3 insertions(+), 1 deletions(-) --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c diff --git a/target/linux/brcm47xx/patches-3.2/196-MIPS-BCM47XX-return-number-of-written-bytes-in-nvram.patch b/target/linux/brcm47xx/patches-3.2/196-MIPS-BCM47XX-return-number-of-written-bytes-in-nvram.patch deleted file mode 100644 index ce226f36e..000000000 --- a/target/linux/brcm47xx/patches-3.2/196-MIPS-BCM47XX-return-number-of-written-bytes-in-nvram.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 3ac18c5072e097ffa719994ef3b5c64e744a5405 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 14:46:45 +0100 -Subject: [PATCH 196/202] MIPS: BCM47XX: return number of written bytes in - nvram_getenv - - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - arch/mips/bcm47xx/nvram.c | 3 +-- - 1 files changed, 1 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm47xx/nvram.c -+++ b/arch/mips/bcm47xx/nvram.c -@@ -243,8 +243,7 @@ int nvram_getenv(char *name, char *val, - value = eq + 1; - if ((eq - var) == strlen(name) && - strncmp(var, name, (eq - var)) == 0) { -- snprintf(val, val_len, "%s", value); -- return 0; -+ return snprintf(val, val_len, "%s", value); - } - } - return NVRAM_ERR_ENVNOTFOUND; diff --git a/target/linux/brcm47xx/patches-3.2/195-bcma-add-support-for-sprom-not-found-on-the-device.patch b/target/linux/brcm47xx/patches-3.2/196-bcma-add-support-for-sprom-not-found-on-the-device.patch index 6991576d2..296e10ae1 100644 --- a/target/linux/brcm47xx/patches-3.2/195-bcma-add-support-for-sprom-not-found-on-the-device.patch +++ b/target/linux/brcm47xx/patches-3.2/196-bcma-add-support-for-sprom-not-found-on-the-device.patch @@ -1,46 +1,35 @@ -From 332b8f6ca7da3197c631928b6bd1e7fdca87e109 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 01:16:35 +0100 -Subject: [PATCH 195/202] bcma: add support for sprom not found on the device. - -On SoCs the sprom is stored in the nvram in a special partition on the -flash chip. The nvram contains the sprom for the main bus, but -sometimes also for a pci devices using bcma. This patch makes it -possible for the arch code to register a function to fetch the needed -sprom from the nvram and provide it to the bcma code. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - drivers/bcma/sprom.c | 80 ++++++++++++++++++++++++++++++++++++++++---- - include/linux/bcma/bcma.h | 6 +++ - 2 files changed, 78 insertions(+), 8 deletions(-) --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c -@@ -16,6 +16,49 @@ +@@ -2,6 +2,8 @@ + * Broadcom specific AMBA + * SPROM reading + * ++ * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de> ++ * + * Licensed under the GNU/GPL. See COPYING for details. + */ + +@@ -16,6 +18,45 @@ #define SPOFF(offset) ((offset) / sizeof(u16)) +static int(*get_fallback_sprom)(struct bcma_bus *dev, struct ssb_sprom *out); + +/** -+ * ssb_arch_register_fallback_sprom - Registers a method providing a ++ * bcma_arch_register_fallback_sprom - Registers a method providing a + * fallback SPROM if no SPROM is found. + * + * @sprom_callback: The callback function. + * + * With this function the architecture implementation may register a + * callback handler which fills the SPROM data structure. The fallback is -+ * only used for PCI based SSB devices, where no valid SPROM can be found -+ * in the shadow registers. ++ * used for PCI based BCMA devices, where no valid SPROM can be found ++ * in the shadow registers and to provide the SPROM for SoCs where BCMA is ++ * to controll the system bus. + * + * This function is useful for weird architectures that have a half-assed -+ * SSB device hardwired to their PCI bus. -+ * -+ * Note that it does only work with PCI attached SSB devices. PCMCIA -+ * devices currently don't use this fallback. -+ * Architectures must provide the SPROM for native SSB devices anyway, so -+ * the fallback also isn't used for native devices. ++ * BCMA device hardwired to their PCI bus. + * + * This function is available for architecture code, only. So it is not + * exported. @@ -67,7 +56,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> /************************************************** * R/W ops. **************************************************/ -@@ -205,23 +248,44 @@ static void bcma_sprom_extract_r8(struct +@@ -205,23 +246,43 @@ static void bcma_sprom_extract_r8(struct SSB_SROM8_FEM_ANTSWLUT) >> SSB_SROM8_FEM_ANTSWLUT_SHIFT; } @@ -80,8 +69,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + + if (bus->drv_cc.core->id.rev >= 32) { + sromctrl = bcma_read32(bus->drv_cc.core, BCMA_CC_SROM_CONTROL); -+ if (!(sromctrl & BCMA_CC_SROM_CONTROL_PRESENT)) -+ return false; ++ return sromctrl & BCMA_CC_SROM_CONTROL_PRESENT; + } + return true; +} @@ -107,7 +95,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + /* + * Maybe there is no SPROM on the device? + * Now we ask the arch code if there is some sprom -+ * available for this device in some other storage ++ * available for this device in some other storage. + */ + err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); + if (err) { diff --git a/target/linux/brcm47xx/patches-3.2/197-MIPS-BCM47XX-fix-signature-of-nvram_parse_macaddr.patch b/target/linux/brcm47xx/patches-3.2/197-MIPS-BCM47XX-fix-signature-of-nvram_parse_macaddr.patch deleted file mode 100644 index ade9bcb75..000000000 --- a/target/linux/brcm47xx/patches-3.2/197-MIPS-BCM47XX-fix-signature-of-nvram_parse_macaddr.patch +++ /dev/null @@ -1,23 +0,0 @@ -From c330338212785092aab7a266f24b52c132775463 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 15:00:36 +0100 -Subject: [PATCH 197/202] MIPS: BCM47XX: fix signature of nvram_parse_macaddr - -Explicitly enforce an char array of 6 bytes for the mac address. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - arch/mips/include/asm/mach-bcm47xx/nvram.h | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm47xx/nvram.h -+++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h -@@ -37,7 +37,7 @@ struct nvram_header { - - extern int nvram_getenv(char *name, char *val, size_t val_len); - --static inline void nvram_parse_macaddr(char *buf, u8 *macaddr) -+static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6]) - { - if (strchr(buf, ':')) - sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], diff --git a/target/linux/brcm47xx/patches-3.2/197-MIPS-BCM47XX-return-number-of-written-bytes-in-nvram.patch b/target/linux/brcm47xx/patches-3.2/197-MIPS-BCM47XX-return-number-of-written-bytes-in-nvram.patch new file mode 100644 index 000000000..7d8180b1e --- /dev/null +++ b/target/linux/brcm47xx/patches-3.2/197-MIPS-BCM47XX-return-number-of-written-bytes-in-nvram.patch @@ -0,0 +1,13 @@ + +--- a/arch/mips/bcm47xx/nvram.c ++++ b/arch/mips/bcm47xx/nvram.c +@@ -243,8 +243,7 @@ int nvram_getenv(char *name, char *val, + value = eq + 1; + if ((eq - var) == strlen(name) && + strncmp(var, name, (eq - var)) == 0) { +- snprintf(val, val_len, "%s", value); +- return 0; ++ return snprintf(val, val_len, "%s", value); + } + } + return NVRAM_ERR_ENVNOTFOUND; diff --git a/target/linux/brcm47xx/patches-3.2/198-MIPS-BCM47XX-fix-signature-of-nvram_parse_macaddr.patch b/target/linux/brcm47xx/patches-3.2/198-MIPS-BCM47XX-fix-signature-of-nvram_parse_macaddr.patch new file mode 100644 index 000000000..ce2350441 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.2/198-MIPS-BCM47XX-fix-signature-of-nvram_parse_macaddr.patch @@ -0,0 +1,12 @@ + +--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h ++++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h +@@ -37,7 +37,7 @@ struct nvram_header { + + extern int nvram_getenv(char *name, char *val, size_t val_len); + +-static inline void nvram_parse_macaddr(char *buf, u8 *macaddr) ++static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6]) + { + if (strchr(buf, ':')) + sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], diff --git a/target/linux/brcm47xx/patches-3.2/198-MIPS-BCM47XX-move-and-extend-sprom-parsing.patch b/target/linux/brcm47xx/patches-3.2/199-MIPS-BCM47XX-move-and-extend-sprom-parsing.patch index b817d8adf..9a62987ae 100644 --- a/target/linux/brcm47xx/patches-3.2/198-MIPS-BCM47XX-move-and-extend-sprom-parsing.patch +++ b/target/linux/brcm47xx/patches-3.2/199-MIPS-BCM47XX-move-and-extend-sprom-parsing.patch @@ -1,22 +1,3 @@ -From bf975de39d2c6be28421c1de2068fd8bd018b96d Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sat, 18 Feb 2012 14:50:24 +0100 -Subject: [PATCH 198/202] MIPS: BCM47XX: move and extend sprom parsing - -Move the sprom parsing from nvram into sprom.c. There are all values -needed for sprom version 1 to 9 read from nvram and there are more -sanity checks added. This is based on the sprom parsing in the open -source part of the Broadcom SDK. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - arch/mips/bcm47xx/Makefile | 2 +- - arch/mips/bcm47xx/setup.c | 151 +------- - arch/mips/bcm47xx/sprom.c | 618 ++++++++++++++++++++++++++ - arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 3 + - 4 files changed, 623 insertions(+), 151 deletions(-) - create mode 100644 arch/mips/bcm47xx/sprom.c - --- a/arch/mips/bcm47xx/Makefile +++ b/arch/mips/bcm47xx/Makefile @@ -3,5 +3,5 @@ @@ -188,7 +169,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- /dev/null +++ b/arch/mips/bcm47xx/sprom.c -@@ -0,0 +1,618 @@ +@@ -0,0 +1,620 @@ +/* + * Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org> + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> @@ -331,7 +312,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + nvram_parse_macaddr(buf, *val); +} + -+static void nvram_read_ccode(const char *prefix, const char *name, ++static void nvram_read_alpha2(const char *prefix, const char *name, + char (*val)[2]) +{ + char buf[10]; @@ -346,7 +327,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + if (buf[0] == '0') + return; + if (strlen(buf) > 2) { -+ pr_warn("ccode is too long %s", buf); ++ pr_warn("alpha2 is too long %s", buf); + return; + } + memcpy(val, buf, sizeof(val)); @@ -363,9 +344,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + nvram_read_u8(prefix, NULL, "ledbh3", &sprom->gpio3, 0xff); + nvram_read_u8(prefix, NULL, "aa2g", &sprom->ant_available_bg, 0); + nvram_read_u8(prefix, NULL, "aa5g", &sprom->ant_available_a, 0); -+ nvram_read_u8(prefix, NULL, "ag0", &sprom->antenna_gain.ghz24.a0, 0); -+ nvram_read_u8(prefix, NULL, "ag1", &sprom->antenna_gain.ghz24.a1, 0); -+ nvram_read_ccode(prefix, "ccode", &sprom->ccode); ++ nvram_read_s8(prefix, NULL, "ag0", &sprom->antenna_gain.ghz24.a0, 0); ++ nvram_read_s8(prefix, NULL, "ag1", &sprom->antenna_gain.ghz24.a1, 0); ++ nvram_read_alpha2(prefix, "ccode", &sprom->alpha2); +} + +static void bcm47xx_fill_sprom_r12389(struct ssb_sprom *sprom, @@ -447,8 +428,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + &sprom->boardflags2_hi); + nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0); + nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0); -+ nvram_read_u8(prefix, NULL, "ag2", &sprom->antenna_gain.ghz24.a2, 0); -+ nvram_read_u8(prefix, NULL, "ag3", &sprom->antenna_gain.ghz24.a3, 0); ++ nvram_read_s8(prefix, NULL, "ag2", &sprom->antenna_gain.ghz24.a2, 0); ++ nvram_read_s8(prefix, NULL, "ag3", &sprom->antenna_gain.ghz24.a3, 0); + nvram_read_u8(prefix, NULL, "txchain", &sprom->txchain, 0xf); + nvram_read_u8(prefix, NULL, "rxchain", &sprom->rxchain, 0xf); + nvram_read_u8(prefix, NULL, "antswitch", &sprom->antswitch, 0xff); @@ -804,6 +785,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + pr_warn("Unsupported SPROM revision %d detected. Will extract" + " v1\n", sprom->revision); + sprom->revision = 1; ++ bcm47xx_fill_sprom_r1234589(sprom, prefix); ++ bcm47xx_fill_sprom_r12389(sprom, prefix); + bcm47xx_fill_sprom_r1(sprom, prefix); + } +} diff --git a/target/linux/brcm47xx/patches-3.2/199-MIPS-BCM47XX-provide-sprom-to-bcma-bus.patch b/target/linux/brcm47xx/patches-3.2/200-MIPS-BCM47XX-provide-sprom-to-bcma-bus.patch index c96813c85..b0cf17d11 100644 --- a/target/linux/brcm47xx/patches-3.2/199-MIPS-BCM47XX-provide-sprom-to-bcma-bus.patch +++ b/target/linux/brcm47xx/patches-3.2/200-MIPS-BCM47XX-provide-sprom-to-bcma-bus.patch @@ -1,17 +1,3 @@ -From 112b2e12edda60f495b57e8a1d85eb95e2662845 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Thu, 16 Feb 2012 23:44:26 +0100 -Subject: [PATCH 199/202] MIPS: BCM47XX: provide sprom to bcma bus - -On SoCs the sprom is often stored in nvram in the flashchip. This patch -registers a sprom fallback callback handler in bcma and provides the -sprom needed for this device. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - arch/mips/bcm47xx/setup.c | 39 +++++++++++++++++++++++++++++++++++---- - 1 files changed, 35 insertions(+), 4 deletions(-) - --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -3,7 +3,7 @@ @@ -59,13 +45,14 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + char prefix[10]; + struct bcma_device *core; + -+ if (bus->hosttype == BCMA_HOSTTYPE_PCI) { ++ switch (bus->hosttype) { ++ case BCMA_HOSTTYPE_PCI: + snprintf(prefix, sizeof(prefix), "pci/%u/%u/", + bus->host_pci->bus->number + 1, + PCI_SLOT(bus->host_pci->devfn)); + bcm47xx_fill_sprom(out, prefix); + return 0; -+ } else if (bus->hosttype == BCMA_HOSTTYPE_SOC) { ++ case BCMA_HOSTTYPE_SOC: + bcm47xx_fill_sprom_ethernet(out, NULL); + core = bcma_find_core(bus, BCMA_CORE_80211); + if (core) { @@ -74,8 +61,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + bcm47xx_fill_sprom(out, prefix); + } + return 0; -+ } else { -+ printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n"); ++ default: ++ pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); + return -EINVAL; + } +} @@ -86,8 +73,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma); + if (err) -+ printk(KERN_WARNING "bcm47xx: someone else already registered" -+ " a bcma SPROM callback handler (err %d)\n", err); ++ pr_warn("bcm47xx: someone else already registered a bcma SPROM callback handler (err %d)\n", err); + err = bcma_host_soc_register(&bcm47xx_bus.bcma); if (err) diff --git a/target/linux/brcm47xx/patches-3.2/231-bcma_reorder_sprom_fill.patch b/target/linux/brcm47xx/patches-3.2/231-bcma_reorder_sprom_fill.patch index ae7b7d4dc..075f7bee5 100644 --- a/target/linux/brcm47xx/patches-3.2/231-bcma_reorder_sprom_fill.patch +++ b/target/linux/brcm47xx/patches-3.2/231-bcma_reorder_sprom_fill.patch @@ -16,17 +16,17 @@ bcm47xx_fill_sprom(&iv->sprom, NULL); if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) -@@ -205,12 +207,14 @@ static int bcm47xx_get_sprom_bcma(struct - struct bcma_device *core; +@@ -206,12 +208,14 @@ static int bcm47xx_get_sprom_bcma(struct - if (bus->hosttype == BCMA_HOSTTYPE_PCI) { + switch (bus->hosttype) { + case BCMA_HOSTTYPE_PCI: + memset(out, 0, sizeof(struct ssb_sprom)); snprintf(prefix, sizeof(prefix), "pci/%u/%u/", bus->host_pci->bus->number + 1, PCI_SLOT(bus->host_pci->devfn)); bcm47xx_fill_sprom(out, prefix); return 0; - } else if (bus->hosttype == BCMA_HOSTTYPE_SOC) { + case BCMA_HOSTTYPE_SOC: + memset(out, 0, sizeof(struct ssb_sprom)); bcm47xx_fill_sprom_ethernet(out, NULL); core = bcma_find_core(bus, BCMA_CORE_80211); |