brcm47xx: fix for boardflags by xMff

and checkpatch.pl fixes


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22318 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Hauke Mehrtens 2010-07-20 19:41:17 +00:00
parent 81db1e7929
commit 9b5ae82f49
12 changed files with 60 additions and 48 deletions

View File

@ -1,4 +1,4 @@
From cf731bb198bdaa4ce741536252ea99518887b721 Mon Sep 17 00:00:00 2001
From bf93090747e3d23e5354bd8da52f85d96c0f6606 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 12:49:41 +0200
Subject: [PATCH 1/5] MIPS: BCM47xx: Really fix 128MB RAM problem
@ -33,7 +33,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* want to reuse the memory used by CFE (around 4MB). That means cfe_*
* functions stop to work at some point during the boot, we should only
* call them at the beginning of the boot.
+ *
+ *
+ * BCM47XX uses 128MB for addressing the ram, if the system contains
+ * less that that amount of ram it remaps the ram more often into the
+ * available space.
@ -45,7 +45,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
+ if (((unsigned long)(prom_init) + mem) > max) {
+ mem = (128 << 20);
+ printk("assume 128MB RAM\n");
+ printk(KERN_DEBUG "assume 128MB RAM\n");
+ break;
+ }
if (*(unsigned long *)((unsigned long)(prom_init) + mem) ==

View File

@ -1,4 +1,4 @@
From 493d4a90850509e5f09b4799d4fc234b734a9d30 Mon Sep 17 00:00:00 2001
From f382c623892dad1c6a9ebc0e12d01fd45ee50db8 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 13:34:32 +0200
Subject: [PATCH 2/5] MIPS: BCM47xx: Fill more values into ssb sprom
@ -10,19 +10,19 @@ drivers needs them.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
arch/mips/bcm47xx/setup.c | 125 +++++++++++++++++++++++++++++++++------------
1 files changed, 92 insertions(+), 33 deletions(-)
arch/mips/bcm47xx/setup.c | 130 +++++++++++++++++++++++++++++++++-----------
1 files changed, 97 insertions(+), 33 deletions(-)
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -74,6 +74,89 @@ static void str2eaddr(char *str, char *d
@@ -74,6 +74,94 @@ static void str2eaddr(char *str, char *d
}
}
+static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
+{
+ char buf[100];
+ u64 boardflags;
+ u32 boardflags;
+
+ memset(sprom, 0, sizeof(struct ssb_sprom));
+
@ -93,19 +93,24 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
+ if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0 ||
+ cfe_getenv("boardflags", buf, sizeof(buf)) >= 0)
+ boardflags = simple_strtoll(buf, NULL, 0);
+ boardflags = simple_strtoul(buf, NULL, 0);
+ if (boardflags) {
+ sprom->boardflags_lo = (boardflags & 0x000000000000FFFFLLU);
+ sprom->boardflags_hi = (boardflags & 0x00000000FFFF0000LLU) >> 16;
+ sprom->boardflags2_lo = (boardflags & 0x0000FFFF00000000LLU) >> 32;
+ sprom->boardflags2_hi = (boardflags & 0xFFFF000000000000LLU) >> 48;
+ 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)
+ boardflags = simple_strtoul(buf, NULL, 0);
+ 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 +165,19 @@ static int bcm47xx_get_invariants(struct
@@ -82,43 +170,19 @@ static int bcm47xx_get_invariants(struct
/* Fill boardinfo structure */
memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));

View File

@ -1,4 +1,4 @@
From 13f9cbc3c26be8071d33206dd931431e84e83068 Mon Sep 17 00:00:00 2001
From e6feb5dc2c1bb28582fa3e1445f9d90114e39724 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 13:58:09 +0200
Subject: [PATCH 3/5] MIPS: BCM47xx: Activate SSB_B43_PCI_BRIDGE by default

View File

@ -1,4 +1,4 @@
From 09ebc2952d9d3df6b9c548d9943dc8bcffb87540 Mon Sep 17 00:00:00 2001
From 3902bba103634d3256dac557020d7974f0d08aff Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 14:59:24 +0200
Subject: [PATCH 4/5] MIPS: BCM47xx: Setup and register serial early
@ -9,8 +9,8 @@ Set it up and register it for early serial support.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
arch/mips/Kconfig | 1 -
arch/mips/bcm47xx/setup.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
arch/mips/bcm47xx/setup.c | 37 ++++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@ -33,7 +33,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
@@ -184,12 +186,44 @@ static int bcm47xx_get_invariants(struct
@@ -189,12 +191,45 @@ static int bcm47xx_get_invariants(struct
void __init plat_mem_setup(void)
{
@ -52,10 +52,11 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ if (!strncmp(buf, "console=ttyS1", 13)) {
+ struct ssb_serial_port port;
+
+ printk("Swapping serial ports!\n");
+ 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[0], &mcore->serial_ports[1],
+ sizeof(port));
+ memcpy(&mcore->serial_ports[1], &port, sizeof(port));
+ }
+
@ -75,7 +76,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
+ early_serial_setup(&s);
+ }
+ printk("Serial init done.\n");
+ printk(KERN_DEBUG "Serial init done.\n");
_machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt;

View File

@ -1,4 +1,4 @@
From 4863132bcb6c87152ea474297329048cc8516ad2 Mon Sep 17 00:00:00 2001
From 83b4ed2d1789609565822335ea27026d46fbb477 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 15:11:26 +0200
Subject: [PATCH 5/5] MIPS: BCM47xx: Remove CFE console

View File

@ -33,7 +33,7 @@
+EXPORT_SYMBOL(nvram_get);
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -229,3 +229,20 @@ void __init plat_mem_setup(void)
@@ -235,3 +235,20 @@ void __init plat_mem_setup(void)
_machine_halt = bcm47xx_machine_halt;
pm_power_off = bcm47xx_machine_halt;
}

View File

@ -1,4 +1,4 @@
From cf731bb198bdaa4ce741536252ea99518887b721 Mon Sep 17 00:00:00 2001
From bf93090747e3d23e5354bd8da52f85d96c0f6606 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 12:49:41 +0200
Subject: [PATCH 1/5] MIPS: BCM47xx: Really fix 128MB RAM problem
@ -33,7 +33,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* want to reuse the memory used by CFE (around 4MB). That means cfe_*
* functions stop to work at some point during the boot, we should only
* call them at the beginning of the boot.
+ *
+ *
+ * BCM47XX uses 128MB for addressing the ram, if the system contains
+ * less that that amount of ram it remaps the ram more often into the
+ * available space.
@ -45,7 +45,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
+ if (((unsigned long)(prom_init) + mem) > max) {
+ mem = (128 << 20);
+ printk("assume 128MB RAM\n");
+ printk(KERN_DEBUG "assume 128MB RAM\n");
+ break;
+ }
if (*(unsigned long *)((unsigned long)(prom_init) + mem) ==

View File

@ -1,4 +1,4 @@
From 493d4a90850509e5f09b4799d4fc234b734a9d30 Mon Sep 17 00:00:00 2001
From f382c623892dad1c6a9ebc0e12d01fd45ee50db8 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 13:34:32 +0200
Subject: [PATCH 2/5] MIPS: BCM47xx: Fill more values into ssb sprom
@ -10,19 +10,19 @@ drivers needs them.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
arch/mips/bcm47xx/setup.c | 125 +++++++++++++++++++++++++++++++++------------
1 files changed, 92 insertions(+), 33 deletions(-)
arch/mips/bcm47xx/setup.c | 130 +++++++++++++++++++++++++++++++++-----------
1 files changed, 97 insertions(+), 33 deletions(-)
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -74,6 +74,89 @@ static void str2eaddr(char *str, char *d
@@ -74,6 +74,94 @@ static void str2eaddr(char *str, char *d
}
}
+static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
+{
+ char buf[100];
+ u64 boardflags;
+ u32 boardflags;
+
+ memset(sprom, 0, sizeof(struct ssb_sprom));
+
@ -93,19 +93,24 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
+ if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0 ||
+ cfe_getenv("boardflags", buf, sizeof(buf)) >= 0)
+ boardflags = simple_strtoll(buf, NULL, 0);
+ boardflags = simple_strtoul(buf, NULL, 0);
+ if (boardflags) {
+ sprom->boardflags_lo = (boardflags & 0x000000000000FFFFLLU);
+ sprom->boardflags_hi = (boardflags & 0x00000000FFFF0000LLU) >> 16;
+ sprom->boardflags2_lo = (boardflags & 0x0000FFFF00000000LLU) >> 32;
+ sprom->boardflags2_hi = (boardflags & 0xFFFF000000000000LLU) >> 48;
+ 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)
+ boardflags = simple_strtoul(buf, NULL, 0);
+ 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 +165,19 @@ static int bcm47xx_get_invariants(struct
@@ -82,43 +170,19 @@ static int bcm47xx_get_invariants(struct
/* Fill boardinfo structure */
memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));

View File

@ -1,4 +1,4 @@
From 13f9cbc3c26be8071d33206dd931431e84e83068 Mon Sep 17 00:00:00 2001
From e6feb5dc2c1bb28582fa3e1445f9d90114e39724 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 13:58:09 +0200
Subject: [PATCH 3/5] MIPS: BCM47xx: Activate SSB_B43_PCI_BRIDGE by default

View File

@ -1,4 +1,4 @@
From 09ebc2952d9d3df6b9c548d9943dc8bcffb87540 Mon Sep 17 00:00:00 2001
From 3902bba103634d3256dac557020d7974f0d08aff Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 14:59:24 +0200
Subject: [PATCH 4/5] MIPS: BCM47xx: Setup and register serial early
@ -9,8 +9,8 @@ Set it up and register it for early serial support.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
arch/mips/Kconfig | 1 -
arch/mips/bcm47xx/setup.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
arch/mips/bcm47xx/setup.c | 37 ++++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@ -33,7 +33,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
@@ -184,12 +186,44 @@ static int bcm47xx_get_invariants(struct
@@ -189,12 +191,45 @@ static int bcm47xx_get_invariants(struct
void __init plat_mem_setup(void)
{
@ -52,10 +52,11 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ if (!strncmp(buf, "console=ttyS1", 13)) {
+ struct ssb_serial_port port;
+
+ printk("Swapping serial ports!\n");
+ 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[0], &mcore->serial_ports[1],
+ sizeof(port));
+ memcpy(&mcore->serial_ports[1], &port, sizeof(port));
+ }
+
@ -75,7 +76,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
+ early_serial_setup(&s);
+ }
+ printk("Serial init done.\n");
+ printk(KERN_DEBUG "Serial init done.\n");
_machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt;

View File

@ -1,4 +1,4 @@
From 4863132bcb6c87152ea474297329048cc8516ad2 Mon Sep 17 00:00:00 2001
From 83b4ed2d1789609565822335ea27026d46fbb477 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 18 Jul 2010 15:11:26 +0200
Subject: [PATCH 5/5] MIPS: BCM47xx: Remove CFE console

View File

@ -33,7 +33,7 @@
+EXPORT_SYMBOL(nvram_get);
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -229,3 +229,20 @@ void __init plat_mem_setup(void)
@@ -235,3 +235,20 @@ void __init plat_mem_setup(void)
_machine_halt = bcm47xx_machine_halt;
pm_power_off = bcm47xx_machine_halt;
}