bcm96345: correct some 6345 specific stuff
[openwrt.git] / target / linux / brcm63xx / patches-2.6.25 / 500-bcm96345_fixes.patch
1 From d1259cf42ce84246c695f06b44d58e3aca0a480b Mon Sep 17 00:00:00 2001
2 From: Axel Gembe <ago@bastart.eu.org>
3 Date: Sat, 17 May 2008 14:59:35 +0200
4 Subject: [PATCH] bcm96345: correct some 6345 specific stuff
5
6 This fixes some problems with the 6345 support and adds a macro for CPU
7 identification that is easier on the eyes. The first thing it does is to not
8 initialize MPI on the 6345 as it does not have PCI. The second thing it does is
9 to use a static value for the CPU frequency of the 6345 chip to provide an
10 accurate timer.
11
12 Signed-off-by: Axel Gembe <ago@bastart.eu.org>
13 ---
14 arch/mips/bcm963xx/setup.c | 8 ++++++--
15 arch/mips/bcm963xx/time.c | 5 ++++-
16 arch/mips/pci/pci-bcm96348.c | 21 +++++++++++++--------
17 include/asm-mips/mach-bcm963xx/board.h | 2 ++
18 4 files changed, 25 insertions(+), 11 deletions(-)
19
20 diff --git a/arch/mips/bcm963xx/setup.c b/arch/mips/bcm963xx/setup.c
21 index 982cba0..c12c9c3 100644
22 --- a/arch/mips/bcm963xx/setup.c
23 +++ b/arch/mips/bcm963xx/setup.c
24 @@ -43,6 +43,7 @@
25 #include <asm/bootinfo.h>
26 #include <asm/cpu.h>
27 #include <asm/mach-bcm963xx/bootloaders.h>
28 +#include <asm/mach-bcm963xx/board.h>
29
30 extern void brcm_time_init(void);
31 extern int boot_loader_type;
32 @@ -465,6 +466,9 @@ void __init plat_mem_setup(void)
33 _machine_halt = brcm_machine_halt;
34 pm_power_off = brcm_machine_halt;
35
36 - /* mpi initialization */
37 - mpi_init();
38 + /* BCM96345 has no MPI */
39 + if (!ISBCM(0x6345)) {
40 + /* mpi initialization */
41 + mpi_init();
42 + }
43 }
44 diff --git a/arch/mips/bcm963xx/time.c b/arch/mips/bcm963xx/time.c
45 index 75f751a..22ad56d 100644
46 --- a/arch/mips/bcm963xx/time.c
47 +++ b/arch/mips/bcm963xx/time.c
48 @@ -39,6 +39,8 @@
49 #include <6348_intr.h>
50 #include <bcm_map_part.h>
51 #include <bcm_intr.h>
52 +#include <asm/mach-bcm963xx/board.h>
53 +
54
55 /*
56 * calculateCpuSpeed()
57 @@ -62,11 +64,12 @@ static inline unsigned long __init calculateCpuSpeed(void)
58 }
59
60
61 +#define BCM96345_CPU_CLOCK 140000000
62 void __init plat_time_init(void)
63 {
64 unsigned long cpu_clock;
65
66 - cpu_clock = calculateCpuSpeed();
67 + cpu_clock = ISBCM(0x6345) ? BCM96345_CPU_CLOCK : calculateCpuSpeed();
68
69 printk("CPU frequency %lu.%02lu MHz\n", cpu_clock / 1000000,
70 (cpu_clock % 1000000) * 100 / 1000000);
71 diff --git a/arch/mips/pci/pci-bcm96348.c b/arch/mips/pci/pci-bcm96348.c
72 index bea3b7b..1e82283 100644
73 --- a/arch/mips/pci/pci-bcm96348.c
74 +++ b/arch/mips/pci/pci-bcm96348.c
75 @@ -21,6 +21,8 @@
76 #include <linux/kernel.h>
77 #include <linux/init.h>
78
79 +#include <asm/mach-bcm963xx/6348_map_part.h>
80 +#include <asm/mach-bcm963xx/board.h>
81 #include <bcmpci.h>
82
83 static struct resource bcm_pci_io_resource = {
84 @@ -47,16 +49,19 @@ struct pci_controller bcm96348_controller = {
85
86 static __init int bcm96348_pci_init(void)
87 {
88 - /* Avoid ISA compat ranges. */
89 - PCIBIOS_MIN_IO = 0x00000000;
90 - PCIBIOS_MIN_MEM = 0x00000000;
91 + if (!ISBCM(0x6345)) {
92 + /* Avoid ISA compat ranges. */
93 + PCIBIOS_MIN_IO = 0x00000000;
94 + PCIBIOS_MIN_MEM = 0x00000000;
95
96 - /* Set I/O resource limits. */
97 - ioport_resource.end = 0x1fffffff;
98 - iomem_resource.end = 0xffffffff;
99 + /* Set I/O resource limits. */
100 + ioport_resource.end = 0x1fffffff;
101 + iomem_resource.end = 0xffffffff;
102
103 - register_pci_controller(&bcm96348_controller);
104 - return 0;
105 + register_pci_controller(&bcm96348_controller);
106 + }
107 +
108 + return 0;
109 }
110
111 arch_initcall(bcm96348_pci_init);
112 diff --git a/include/asm-mips/mach-bcm963xx/board.h b/include/asm-mips/mach-bcm963xx/board.h
113 index e674cb1..73fa924 100644
114 --- a/include/asm-mips/mach-bcm963xx/board.h
115 +++ b/include/asm-mips/mach-bcm963xx/board.h
116 @@ -369,5 +369,7 @@ void kerSysWakeupMonitorTask( void );
117
118 extern int boot_loader_type;
119
120 +#define ISBCM(x) (((PERF->RevID & 0xFFFF0000) >> 16) == x)
121 +
122 #endif /* _BOARD_H */
123
124 --
125 1.5.5.1
126
This page took 0.066716 seconds and 5 git commands to generate.