bcm96345: correct some 6345 specific stuff
authorFelix Fietkau <nbd@openwrt.org>
Sun, 18 May 2008 17:32:16 +0000 (17:32 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 18 May 2008 17:32:16 +0000 (17:32 +0000)
This fixes some problems with the 6345 support and adds a macro for CPU
identification that is easier on the eyes. The first thing it does is to not
initialize MPI on the 6345 as it does not have PCI. The second thing it does is
to use a static value for the CPU frequency of the 6345 chip to provide an
accurate timer.

Signed-off-by: Axel Gembe <ago@bastart.eu.org>
SVN-Revision: 11183

target/linux/brcm63xx/patches-2.6.25/500-bcm96345_fixes.patch [new file with mode: 0644]

diff --git a/target/linux/brcm63xx/patches-2.6.25/500-bcm96345_fixes.patch b/target/linux/brcm63xx/patches-2.6.25/500-bcm96345_fixes.patch
new file mode 100644 (file)
index 0000000..2aebb29
--- /dev/null
@@ -0,0 +1,126 @@
+From d1259cf42ce84246c695f06b44d58e3aca0a480b Mon Sep 17 00:00:00 2001
+From: Axel Gembe <ago@bastart.eu.org>
+Date: Sat, 17 May 2008 14:59:35 +0200
+Subject: [PATCH] bcm96345: correct some 6345 specific stuff
+
+This fixes some problems with the 6345 support and adds a macro for CPU
+identification that is easier on the eyes. The first thing it does is to not
+initialize MPI on the 6345 as it does not have PCI. The second thing it does is
+to use a static value for the CPU frequency of the 6345 chip to provide an
+accurate timer.
+
+Signed-off-by: Axel Gembe <ago@bastart.eu.org>
+---
+ arch/mips/bcm963xx/setup.c             |    8 ++++++--
+ arch/mips/bcm963xx/time.c              |    5 ++++-
+ arch/mips/pci/pci-bcm96348.c           |   21 +++++++++++++--------
+ include/asm-mips/mach-bcm963xx/board.h |    2 ++
+ 4 files changed, 25 insertions(+), 11 deletions(-)
+
+diff --git a/arch/mips/bcm963xx/setup.c b/arch/mips/bcm963xx/setup.c
+index 982cba0..c12c9c3 100644
+--- a/arch/mips/bcm963xx/setup.c
++++ b/arch/mips/bcm963xx/setup.c
+@@ -43,6 +43,7 @@
+ #include <asm/bootinfo.h>
+ #include <asm/cpu.h>
+ #include <asm/mach-bcm963xx/bootloaders.h>
++#include <asm/mach-bcm963xx/board.h>
+ extern void brcm_time_init(void);
+ extern int boot_loader_type;
+@@ -465,6 +466,9 @@ void __init plat_mem_setup(void)
+       _machine_halt = brcm_machine_halt;
+       pm_power_off = brcm_machine_halt;
+-      /* mpi initialization */
+-      mpi_init();
++      /* BCM96345 has no MPI */
++      if (!ISBCM(0x6345)) {
++              /* mpi initialization */
++              mpi_init();
++      }
+ }
+diff --git a/arch/mips/bcm963xx/time.c b/arch/mips/bcm963xx/time.c
+index 75f751a..22ad56d 100644
+--- a/arch/mips/bcm963xx/time.c
++++ b/arch/mips/bcm963xx/time.c
+@@ -39,6 +39,8 @@
+ #include <6348_intr.h>
+ #include <bcm_map_part.h>
+ #include <bcm_intr.h>
++#include <asm/mach-bcm963xx/board.h>
++
+ /*
+  * calculateCpuSpeed()
+@@ -62,11 +64,12 @@ static inline unsigned long __init calculateCpuSpeed(void)
+ }
++#define BCM96345_CPU_CLOCK 140000000
+ void __init plat_time_init(void)
+ {
+       unsigned long cpu_clock;
+-      cpu_clock = calculateCpuSpeed();
++      cpu_clock = ISBCM(0x6345) ? BCM96345_CPU_CLOCK : calculateCpuSpeed();
+       printk("CPU frequency %lu.%02lu MHz\n", cpu_clock / 1000000,
+               (cpu_clock % 1000000) * 100 / 1000000);
+diff --git a/arch/mips/pci/pci-bcm96348.c b/arch/mips/pci/pci-bcm96348.c
+index bea3b7b..1e82283 100644
+--- a/arch/mips/pci/pci-bcm96348.c
++++ b/arch/mips/pci/pci-bcm96348.c
+@@ -21,6 +21,8 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
++#include <asm/mach-bcm963xx/6348_map_part.h>
++#include <asm/mach-bcm963xx/board.h>
+ #include <bcmpci.h>
+ static struct resource bcm_pci_io_resource = {
+@@ -47,16 +49,19 @@ struct pci_controller bcm96348_controller = {
+ static __init int bcm96348_pci_init(void)
+ {
+-      /* Avoid ISA compat ranges.  */
+-      PCIBIOS_MIN_IO = 0x00000000;
+-      PCIBIOS_MIN_MEM = 0x00000000;
++      if (!ISBCM(0x6345)) {
++              /* Avoid ISA compat ranges.  */
++              PCIBIOS_MIN_IO = 0x00000000;
++              PCIBIOS_MIN_MEM = 0x00000000;
+-      /* Set I/O resource limits.  */
+-      ioport_resource.end = 0x1fffffff;
+-      iomem_resource.end = 0xffffffff;
++              /* Set I/O resource limits.  */
++              ioport_resource.end = 0x1fffffff;
++              iomem_resource.end = 0xffffffff;
+-      register_pci_controller(&bcm96348_controller);
+-        return 0;
++              register_pci_controller(&bcm96348_controller);
++      }
++
++      return 0;
+ }
+ arch_initcall(bcm96348_pci_init);
+diff --git a/include/asm-mips/mach-bcm963xx/board.h b/include/asm-mips/mach-bcm963xx/board.h
+index e674cb1..73fa924 100644
+--- a/include/asm-mips/mach-bcm963xx/board.h
++++ b/include/asm-mips/mach-bcm963xx/board.h
+@@ -369,5 +369,7 @@ void kerSysWakeupMonitorTask( void );
+ extern int boot_loader_type;
++#define ISBCM(x) (((PERF->RevID & 0xFFFF0000) >> 16) == x)
++
+ #endif /* _BOARD_H */
+-- 
+1.5.5.1
+