aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-2.6.25/500-bcm96345_fixes.patch
blob: 1f8dd96f0c192bd07c7488f08d45a4d7c8aea2ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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(-)

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 <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();
+	}
 }
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 <bcm_map_part.h>
 #include <bcm_intr.h>
+#include <asm/mach-bcm963xx/board.h>
+
 
 /*
  * 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 <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_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 */