Backport patches from r24162 brcm47xx: reorder patches like they were commitet upstream SVN-Revision: 24266master
parent
7b1ae48645
commit
852f7b37ed
@ -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;
|
@ -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
|
@ -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;
|
@ -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;
|
@ -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);
|
@ -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));
|
||||
|
Loading…
Reference in new issue