From d1259cf42ce84246c695f06b44d58e3aca0a480b Mon Sep 17 00:00:00 2001 From: Axel Gembe 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 --- 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(-) Index: linux-2.6.25.4/arch/mips/bcm963xx/setup.c =================================================================== --- linux-2.6.25.4.orig/arch/mips/bcm963xx/setup.c +++ linux-2.6.25.4/arch/mips/bcm963xx/setup.c @@ -43,6 +43,7 @@ #include #include #include +#include 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(); + } } Index: linux-2.6.25.4/arch/mips/bcm963xx/time.c =================================================================== --- linux-2.6.25.4.orig/arch/mips/bcm963xx/time.c +++ linux-2.6.25.4/arch/mips/bcm963xx/time.c @@ -40,6 +40,8 @@ #include <6348_intr.h> #include #include +#include + /* * calculateCpuSpeed() @@ -63,11 +65,12 @@ static inline unsigned long __init calcu } +#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); Index: linux-2.6.25.4/arch/mips/pci/pci-bcm96348.c =================================================================== --- linux-2.6.25.4.orig/arch/mips/pci/pci-bcm96348.c +++ linux-2.6.25.4/arch/mips/pci/pci-bcm96348.c @@ -21,6 +21,8 @@ #include #include +#include +#include #include static struct resource bcm_pci_io_resource = { @@ -47,16 +49,19 @@ struct pci_controller bcm96348_controlle static __init int bcm96348_pci_init(void) { - /* 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; + 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; - register_pci_controller(&bcm96348_controller); - return 0; + register_pci_controller(&bcm96348_controller); + } + + return 0; } arch_initcall(bcm96348_pci_init); Index: linux-2.6.25.4/include/asm-mips/mach-bcm963xx/board.h =================================================================== --- linux-2.6.25.4.orig/include/asm-mips/mach-bcm963xx/board.h +++ linux-2.6.25.4/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 */