summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-12-05 19:19:50 +0000
committerhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-12-05 19:19:50 +0000
commit2308d83efb10f97b03a12808b56f08ae4d7540a5 (patch)
tree7e40103c70b144be9d1f55eb543c3396b92ae737 /target
parent2c5bea6134b3f2a601323b48c4d6c58ced2cf727 (diff)
brcm47xx: backport patch from kernel 2.6.37
Backport patches from r24162 brcm47xx: reorder patches like they were commitet upstream git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24266 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/010-MIPS-BCM47xx-Do-not-read-config-from-CFE.patch76
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/011-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch (renamed from target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch)97
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Use-sscanf-for-parsing-mac-address.patch76
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/013-MIPS-BCM47xx-Swap-serial-console-if-ttyS1-was-specif.patch45
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch33
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/030-b44-fix-workarround-for-wap54g10.patch50
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/031-sb-fix-nvram_get-on-bcm47xx-platform.patch51
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/210-b44_phy_fix.patch37
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/400-arch-bcm47xx.patch2
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/921-bootargs_fix.patch11
-rw-r--r--target/linux/brcm47xx/patches-2.6.36/950-sbb-sysfs-files.patch31
11 files changed, 375 insertions, 134 deletions
diff --git a/target/linux/brcm47xx/patches-2.6.36/010-MIPS-BCM47xx-Do-not-read-config-from-CFE.patch b/target/linux/brcm47xx/patches-2.6.36/010-MIPS-BCM47xx-Do-not-read-config-from-CFE.patch
new file mode 100644
index 0000000000..b2bdf744ce
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.36/010-MIPS-BCM47xx-Do-not-read-config-from-CFE.patch
@@ -0,0 +1,76 @@
+From 12b15e5d5914d174e3411d0f0b3fd55dc1b5e55a Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 27 Nov 2010 00:34:02 +0100
+Subject: [PATCH 1/6] MIPS: BCM47xx: Do not read config from CFE
+
+The config options read out here are not stored in CFE, but only in
+NVRAM on the devices. Remove reading from CFE and only access the NVRAM.
+Reading out CFE does not harm, but is useless here.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ arch/mips/bcm47xx/setup.c | 28 +++++++++-------------------
+ 1 files changed, 9 insertions(+), 19 deletions(-)
+
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -32,7 +32,6 @@
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+ #include <bcm47xx.h>
+-#include <asm/fw/cfe/cfe_api.h>
+ #include <asm/mach-bcm47xx/nvram.h>
+
+ struct ssb_bus ssb_bcm47xx;
+@@ -82,42 +81,33 @@ static int bcm47xx_get_invariants(struct
+ /* Fill boardinfo structure */
+ memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
+
+- if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
+ iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
+- if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
+ iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
+- if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
+ iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
+
+ /* Fill sprom structure */
+ memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
+ iv->sprom.revision = 3;
+
+- if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
+ str2eaddr(buf, iv->sprom.et0mac);
+
+- if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
+ str2eaddr(buf, iv->sprom.et1mac);
+
+- if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
+ iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0);
+
+- if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
+ iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0);
+
+- if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
+ iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
+
+- if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0 ||
+- nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
+ iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
+
+ return 0;
diff --git a/target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch b/target/linux/brcm47xx/patches-2.6.36/011-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch
index e72b5d7418..74b0da1ca9 100644
--- a/target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch
+++ b/target/linux/brcm47xx/patches-2.6.36/011-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch
@@ -1,30 +1,27 @@
-From e5c5828063a55a752e2392d820383dd7a5da3737 Mon Sep 17 00:00:00 2001
+From 4f95d9875b74bbf804a3a83f2c3c5e2068c3f857 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Sun, 18 Jul 2010 13:34:32 +0200
+Date: Sat, 27 Nov 2010 00:44:58 +0100
Subject: [PATCH 2/6] MIPS: BCM47xx: Fill values for b43 into ssb sprom
-Most of the values are stored in the nvram and not in the CFE. At first
-the nvram should be read and if there is no value it should look into
-the CFE. Now more values are read out because the b43 and b43legacy
-drivers needs them.
+Fill the sprom with all available values from the nvram. Most of these
+new values are needed for the b43 or b43legacy driver.
Some parts of this patch have been in OpenWRT for a long time and were
made by Michael Buesch.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
- arch/mips/bcm47xx/setup.c | 131 +++++++++++++++++++++++++++++++++-----------
- 1 files changed, 98 insertions(+), 33 deletions(-)
+ arch/mips/bcm47xx/setup.c | 114 ++++++++++++++++++++++++++++++++++++---------
+ 1 files changed, 92 insertions(+), 22 deletions(-)
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -74,6 +74,95 @@ static void str2eaddr(char *str, char *d
+@@ -73,42 +73,112 @@ static void str2eaddr(char *str, char *d
}
}
+#define READ_FROM_NVRAM(_outvar, name, buf) \
-+ if (nvram_getenv(name, buf, sizeof(buf)) >= 0 || \
-+ cfe_getenv(name, buf, sizeof(buf)) >= 0) \
++ if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
+ sprom->_outvar = simple_strtoul(buf, NULL, 0);
+
+static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
@@ -36,14 +33,11 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
+ sprom->revision = 1; /* Fallback: Old hardware does not define this. */
+ READ_FROM_NVRAM(revision, "sromrev", buf);
-+ if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
+ str2eaddr(buf, sprom->il0mac);
-+ if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
+ str2eaddr(buf, sprom->et0mac);
-+ if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
+ str2eaddr(buf, sprom->et1mac);
+ READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
+ READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
@@ -95,75 +89,64 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf);
+ READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf);
+
-+ if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("boardflags", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) {
+ boardflags = simple_strtoul(buf, NULL, 0);
-+ if (boardflags) {
-+ sprom->boardflags_lo = (boardflags & 0x0000FFFFU);
-+ sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16;
++ if (boardflags) {
++ sprom->boardflags_lo = (boardflags & 0x0000FFFFU);
++ sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16;
++ }
+ }
-+ if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("boardflags2", buf, sizeof(buf)) >= 0)
++ if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) {
+ boardflags = simple_strtoul(buf, NULL, 0);
-+ if (boardflags) {
-+ sprom->boardflags2_lo = (boardflags & 0x0000FFFFU);
-+ sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16;
++ if (boardflags) {
++ sprom->boardflags2_lo = (boardflags & 0x0000FFFFU);
++ sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16;
++ }
+ }
+}
+
static int bcm47xx_get_invariants(struct ssb_bus *bus,
struct ssb_init_invariants *iv)
{
-@@ -82,43 +171,19 @@ static int bcm47xx_get_invariants(struct
+- char buf[100];
++ char buf[20];
+
/* Fill boardinfo structure */
memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
-- if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
-+ iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
-+ if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("boardtype", buf, sizeof(buf)) >= 0)
- iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
-- if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
+ if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
- iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
-- if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
-+ if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("boardrev", buf, sizeof(buf)) >= 0)
++ iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
++ else
++ iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
+ if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
+ iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
+ if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
- /* Fill sprom structure */
- memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
- iv->sprom.revision = 3;
-
-- if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
+- if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
- str2eaddr(buf, iv->sprom.et0mac);
-
-- if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
+- if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
- str2eaddr(buf, iv->sprom.et1mac);
-
-- if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
+- if (nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
- iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0);
-
-- if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
+- if (nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
- iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0);
-
-- if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
+- if (nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
- iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
--
-- if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0 ||
-- nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
-- iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
+ bcm47xx_fill_sprom(&iv->sprom);
-+
-+ if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("cardbus", buf, sizeof(buf)) >= 0)
+
+- if (nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
+- iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
++ if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
+ iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
return 0;
diff --git a/target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Use-sscanf-for-parsing-mac-address.patch b/target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Use-sscanf-for-parsing-mac-address.patch
new file mode 100644
index 0000000000..d4321c3a80
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.36/012-MIPS-BCM47xx-Use-sscanf-for-parsing-mac-address.patch
@@ -0,0 +1,76 @@
+From f52926174040418e26112cd0ba36afd8bb066928 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 27 Nov 2010 14:02:49 +0100
+Subject: [PATCH 3/6] MIPS: BCM47xx: Use sscanf for parsing mac address
+
+Instead of writing out own function for parsing the mac address we now
+use sscanf.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ arch/mips/bcm47xx/setup.c | 23 +++--------------------
+ arch/mips/include/asm/mach-bcm47xx/nvram.h | 7 +++++++
+ 2 files changed, 10 insertions(+), 20 deletions(-)
+
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -56,23 +56,6 @@ static void bcm47xx_machine_halt(void)
+ cpu_relax();
+ }
+
+-static void str2eaddr(char *str, char *dest)
+-{
+- int i = 0;
+-
+- if (str == NULL) {
+- memset(dest, 0, 6);
+- return;
+- }
+-
+- for (;;) {
+- dest[i++] = (char) simple_strtoul(str, NULL, 16);
+- str += 2;
+- if (!*str++ || i == 6)
+- break;
+- }
+-}
+-
+ #define READ_FROM_NVRAM(_outvar, name, buf) \
+ if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
+ sprom->_outvar = simple_strtoul(buf, NULL, 0);
+@@ -87,11 +70,11 @@ static void bcm47xx_fill_sprom(struct ss
+ sprom->revision = 1; /* Fallback: Old hardware does not define this. */
+ READ_FROM_NVRAM(revision, "sromrev", buf);
+ if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
+- str2eaddr(buf, sprom->il0mac);
++ nvram_parse_macaddr(buf, sprom->il0mac);
+ if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
+- str2eaddr(buf, sprom->et0mac);
++ nvram_parse_macaddr(buf, sprom->et0mac);
+ if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
+- str2eaddr(buf, sprom->et1mac);
++ nvram_parse_macaddr(buf, sprom->et1mac);
+ READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
+ READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
+ READ_FROM_NVRAM(et0mdcport, "et0mdcport", buf);
+--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
++++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
+@@ -12,6 +12,7 @@
+ #define __NVRAM_H
+
+ #include <linux/types.h>
++#include <linux/kernel.h>
+
+ struct nvram_header {
+ u32 magic;
+@@ -36,4 +37,10 @@ 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)
++{
++ sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
++ &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
++}
++
+ #endif
diff --git a/target/linux/brcm47xx/patches-2.6.36/013-MIPS-BCM47xx-Swap-serial-console-if-ttyS1-was-specif.patch b/target/linux/brcm47xx/patches-2.6.36/013-MIPS-BCM47xx-Swap-serial-console-if-ttyS1-was-specif.patch
new file mode 100644
index 0000000000..e6a0d526b3
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.36/013-MIPS-BCM47xx-Swap-serial-console-if-ttyS1-was-specif.patch
@@ -0,0 +1,45 @@
+From 25abc0cde3f4865910b380d68ffda0916b5870e7 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 27 Nov 2010 12:25:21 +0100
+Subject: [PATCH 4/6] MIPS: BCM47xx: Swap serial console if ttyS1 was specified.
+
+Some devices like the Netgear WGT634U are using ttyS1 for default
+console output. We should switch to that console if it was given in
+the kernel_args parameters.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ arch/mips/bcm47xx/setup.c | 16 ++++++++++++++++
+ 1 files changed, 16 insertions(+), 0 deletions(-)
+
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -169,12 +169,28 @@ static int bcm47xx_get_invariants(struct
+ void __init plat_mem_setup(void)
+ {
+ int err;
++ char buf[100];
++ struct ssb_mipscore *mcore;
+
+ err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
+ bcm47xx_get_invariants);
+ if (err)
+ panic("Failed to initialize SSB bus (err %d)\n", err);
+
++ mcore = &ssb_bcm47xx.mipscore;
++ if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
++ if (strstr(buf, "console=ttyS1")) {
++ struct ssb_serial_port port;
++
++ printk(KERN_DEBUG "Swapping serial ports!\n");
++ /* swap serial ports */
++ memcpy(&port, &mcore->serial_ports[0], sizeof(port));
++ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
++ sizeof(port));
++ memcpy(&mcore->serial_ports[1], &port, sizeof(port));
++ }
++ }
++
+ _machine_restart = bcm47xx_machine_restart;
+ _machine_halt = bcm47xx_machine_halt;
+ pm_power_off = bcm47xx_machine_halt;
diff --git a/target/linux/brcm47xx/patches-2.6.36/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch b/target/linux/brcm47xx/patches-2.6.36/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch
index 0d241e656b..de1e8d12de 100644
--- a/target/linux/brcm47xx/patches-2.6.36/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch
+++ b/target/linux/brcm47xx/patches-2.6.36/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch
@@ -24,35 +24,19 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
-@@ -190,12 +192,47 @@ static int bcm47xx_get_invariants(struct
+@@ -168,7 +170,7 @@ static int bcm47xx_get_invariants(struct
void __init plat_mem_setup(void)
{
- int err;
+ int i, err;
-+ char buf[100];
-+ struct ssb_mipscore *mcore;
+ char buf[100];
+ struct ssb_mipscore *mcore;
+
+@@ -191,6 +193,24 @@ void __init plat_mem_setup(void)
+ }
+ }
- err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
- bcm47xx_get_invariants);
- if (err)
- panic("Failed to initialize SSB bus (err %d)\n", err);
-+ mcore = &ssb_bcm47xx.mipscore;
-+
-+ if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0 ||
-+ cfe_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
-+ if (strstr(buf, "console=ttyS1")) {
-+ struct ssb_serial_port port;
-+
-+ printk(KERN_DEBUG "Swapping serial ports!\n");
-+ /* swap serial ports */
-+ memcpy(&port, &mcore->serial_ports[0], sizeof(port));
-+ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
-+ sizeof(port));
-+ memcpy(&mcore->serial_ports[1], &port, sizeof(port));
-+ }
-+ }
-+
+ for (i = 0; i < mcore->nr_serial_ports; i++) {
+ struct ssb_serial_port *port = &(mcore->serial_ports[i]);
+ struct uart_port s;
@@ -70,6 +54,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ early_serial_setup(&s);
+ }
+ printk(KERN_DEBUG "Serial init done.\n");
-
++
_machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt;
+ pm_power_off = bcm47xx_machine_halt;
diff --git a/target/linux/brcm47xx/patches-2.6.36/030-b44-fix-workarround-for-wap54g10.patch b/target/linux/brcm47xx/patches-2.6.36/030-b44-fix-workarround-for-wap54g10.patch
new file mode 100644
index 0000000000..a23e3a71e4
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.36/030-b44-fix-workarround-for-wap54g10.patch
@@ -0,0 +1,50 @@
+From 93f94103b9d239b15bba69f592bb6fb2ec5e363f Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 27 Nov 2010 13:14:14 +0100
+Subject: [PATCH 5/6] b44: fix workarround for wap54g10
+
+The code for the b44_wap54g10_workaround was never included, because
+the config option was wrong. The nvram_get function was never in
+mainline kernel, only in external OpenWrt patches.
+
+The code should be compiled in when CONFIG_BCM47XX is selected and not
+when CONFIG_SSB_DRIVER_MIPS is selected, because nvram_getenv is only
+available on bcm47xx platforms and now in the mainline kernel code.
+Using an include is better than a second function declaration, to fix
+this when the function signature changes.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ drivers/net/b44.c | 11 +++++------
+ 1 files changed, 5 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/b44.c
++++ b/drivers/net/b44.c
+@@ -381,11 +381,11 @@ static void b44_set_flow_ctrl(struct b44
+ __b44_set_flow_ctrl(bp, pause_enab);
+ }
+
+-#ifdef SSB_DRIVER_MIPS
+-extern char *nvram_get(char *name);
++#ifdef CONFIG_BCM47XX
++#include <asm/mach-bcm47xx/nvram.h>
+ static void b44_wap54g10_workaround(struct b44 *bp)
+ {
+- const char *str;
++ char buf[20];
+ u32 val;
+ int err;
+
+@@ -394,10 +394,9 @@ static void b44_wap54g10_workaround(stru
+ * see https://dev.openwrt.org/ticket/146
+ * check and reset bit "isolate"
+ */
+- str = nvram_get("boardnum");
+- if (!str)
++ if (nvram_getenv("boardnum", buf, sizeof(buf)) < 0)
+ return;
+- if (simple_strtoul(str, NULL, 0) == 2) {
++ if (simple_strtoul(buf, NULL, 0) == 2) {
+ err = __b44_readphy(bp, 0, MII_BMCR, &val);
+ if (err)
+ goto error;
diff --git a/target/linux/brcm47xx/patches-2.6.36/031-sb-fix-nvram_get-on-bcm47xx-platform.patch b/target/linux/brcm47xx/patches-2.6.36/031-sb-fix-nvram_get-on-bcm47xx-platform.patch
new file mode 100644
index 0000000000..a6f98ee4cc
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.36/031-sb-fix-nvram_get-on-bcm47xx-platform.patch
@@ -0,0 +1,51 @@
+From 99dfec6e793651963ede3c2721b9ff3c81e3aeac Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 27 Nov 2010 14:04:36 +0100
+Subject: [PATCH 6/6] sb: fix nvram_get on bcm47xx platform
+
+The nvram_get function was never in the mainline kernel, it only
+existed in an external OpenWrt patch. Use nvram_getenv function, which
+is in mainline and use an include instead of an extra function
+declaration.
+et0macaddr contains the mac address in text from like
+00:11:22:33:44:55. We have to parse it before adding it into macaddr.
+
+nvram_parse_macaddr will be merged into asm/mach-bcm47xx/nvram.h though
+the MIPS git tree and will be available soon. It will not build now
+without nvram_parse_macaddr, but it haven't done before.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ include/linux/ssb/ssb_driver_gige.h | 17 +++++++++++------
+ 1 files changed, 11 insertions(+), 6 deletions(-)
+
+--- a/include/linux/ssb/ssb_driver_gige.h
++++ b/include/linux/ssb/ssb_driver_gige.h
+@@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_p
+ return 0;
+ }
+
+-extern char * nvram_get(const char *name);
++#ifdef CONFIG_BCM47XX
++#include <asm/mach-bcm47xx/nvram.h>
+ /* Get the device MAC address */
+ static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
+ {
+-#ifdef CONFIG_BCM47XX
+- char *res = nvram_get("et0macaddr");
+- if (res)
+- memcpy(macaddr, res, 6);
+-#endif
++ char buf[20];
++ if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
++ return;
++ nvram_parse_macaddr(buf, macaddr);
+ }
++#else
++static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
++{
++}
++#endif
+
+ extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
+ struct pci_dev *pdev);
diff --git a/target/linux/brcm47xx/patches-2.6.36/210-b44_phy_fix.patch b/target/linux/brcm47xx/patches-2.6.36/210-b44_phy_fix.patch
index 6dda4b413e..ef023c5063 100644
--- a/target/linux/brcm47xx/patches-2.6.36/210-b44_phy_fix.patch
+++ b/target/linux/brcm47xx/patches-2.6.36/210-b44_phy_fix.patch
@@ -1,35 +1,6 @@
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
-@@ -381,11 +381,12 @@ static void b44_set_flow_ctrl(struct b44
- __b44_set_flow_ctrl(bp, pause_enab);
- }
-
--#ifdef SSB_DRIVER_MIPS
--extern char *nvram_get(char *name);
-+#ifdef CONFIG_BCM47XX
-+
-+#include <asm/mach-bcm47xx/nvram.h>
- static void b44_wap54g10_workaround(struct b44 *bp)
- {
-- const char *str;
-+ char buf[20];
- u32 val;
- int err;
-
-@@ -394,10 +395,9 @@ static void b44_wap54g10_workaround(stru
- * see https://dev.openwrt.org/ticket/146
- * check and reset bit "isolate"
- */
-- str = nvram_get("boardnum");
-- if (!str)
-+ if (nvram_getenv("boardnum", buf, sizeof(buf)) > 0)
- return;
-- if (simple_strtoul(str, NULL, 0) == 2) {
-+ if (simple_strtoul(buf, NULL, 0) == 2) {
- err = __b44_readphy(bp, 0, MII_BMCR, &val);
- if (err)
- goto error;
-@@ -412,10 +412,43 @@ static void b44_wap54g10_workaround(stru
+@@ -411,10 +411,41 @@ static void b44_wap54g10_workaround(stru
error:
pr_warning("PHY: cannot reset MII transceiver isolate bit\n");
}
@@ -60,9 +31,7 @@
+ }
+ return;
+}
-+
#else
-+
static inline void b44_wap54g10_workaround(struct b44 *bp)
{
}
@@ -73,7 +42,7 @@
#endif
static int b44_setup_phy(struct b44 *bp)
-@@ -424,6 +457,7 @@ static int b44_setup_phy(struct b44 *bp)
+@@ -423,6 +454,7 @@ static int b44_setup_phy(struct b44 *bp)
int err;
b44_wap54g10_workaround(bp);
@@ -81,7 +50,7 @@
if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
return 0;
-@@ -2089,6 +2123,8 @@ static int __devinit b44_get_invariants(
+@@ -2088,6 +2120,8 @@ static int __devinit b44_get_invariants(
* valid PHY address. */
bp->phy_addr &= 0x1F;
diff --git a/target/linux/brcm47xx/patches-2.6.36/400-arch-bcm47xx.patch b/target/linux/brcm47xx/patches-2.6.36/400-arch-bcm47xx.patch
index afaea44c70..981bf29f50 100644
--- a/target/linux/brcm47xx/patches-2.6.36/400-arch-bcm47xx.patch
+++ b/target/linux/brcm47xx/patches-2.6.36/400-arch-bcm47xx.patch
@@ -33,7 +33,7 @@
+EXPORT_SYMBOL(nvram_get);
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -238,3 +238,20 @@ void __init plat_mem_setup(void)
+@@ -215,3 +215,20 @@ void __init plat_mem_setup(void)
_machine_halt = bcm47xx_machine_halt;
pm_power_off = bcm47xx_machine_halt;
}
diff --git a/target/linux/brcm47xx/patches-2.6.36/921-bootargs_fix.patch b/target/linux/brcm47xx/patches-2.6.36/921-bootargs_fix.patch
deleted file mode 100644
index 5661e7f3b3..0000000000
--- a/target/linux/brcm47xx/patches-2.6.36/921-bootargs_fix.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/arch/mips/bcm47xx/setup.c
-+++ b/arch/mips/bcm47xx/setup.c
-@@ -84,7 +84,7 @@ static void str2eaddr(char *str, char *d
- static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
- {
- char buf[100];
-- u32 boardflags;
-+ u32 uninitialized_var(boardflags);
-
- memset(sprom, 0, sizeof(struct ssb_sprom));
-
diff --git a/target/linux/brcm47xx/patches-2.6.36/950-sbb-sysfs-files.patch b/target/linux/brcm47xx/patches-2.6.36/950-sbb-sysfs-files.patch
index 20c773952a..97e470b9fa 100644
--- a/target/linux/brcm47xx/patches-2.6.36/950-sbb-sysfs-files.patch
+++ b/target/linux/brcm47xx/patches-2.6.36/950-sbb-sysfs-files.patch
@@ -1,14 +1,30 @@
+From 3cfa0a9d4b4cc30ec735c5c9535ff493bae24d08 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 27 Nov 2010 18:14:23 +0100
+Subject: [PATCH] ssb: Add sysfs attributes to ssb devices
+
+Make it possible to read out the attributes, till now only show on
+dmesg, through sysfs.
+
+This patch was some time in OpenWrt.
+
+Signed-off-by: Bernhard Loos <bernhardloos@googlemail.com>
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ drivers/ssb/main.c | 30 ++++++++++++++++++++++++++++++
+ 1 files changed, 30 insertions(+), 0 deletions(-)
+
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
-@@ -384,6 +384,34 @@ static int ssb_device_uevent(struct devi
+@@ -384,6 +384,35 @@ static int ssb_device_uevent(struct devi
ssb_dev->id.revision);
}
-+#define ssb_config_attr(attrib, field, format_string) \
-+static ssize_t \
++#define ssb_config_attr(attrib, field, format_string) \
++static ssize_t \
+attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
-+{ \
-+ return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
++{ \
++ return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
+}
+
+ssb_config_attr(core_num, core_index, "%u\n")
@@ -19,7 +35,8 @@
+static ssize_t
+name_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
-+ return sprintf(buf, "%s\n", ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
++ return sprintf(buf, "%s\n",
++ ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
+}
+
+static struct device_attribute ssb_device_attrs[] = {
@@ -35,7 +52,7 @@
static struct bus_type ssb_bustype = {
.name = "ssb",
.match = ssb_bus_match,
-@@ -393,6 +421,7 @@ static struct bus_type ssb_bustype = {
+@@ -393,6 +422,7 @@ static struct bus_type ssb_bustype = {
.suspend = ssb_device_suspend,
.resume = ssb_device_resume,
.uevent = ssb_device_uevent,