[brcm63xx] refresh kernel patches
[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 Index: linux-2.6.25.4/arch/mips/bcm963xx/setup.c
21 ===================================================================
22 --- linux-2.6.25.4.orig/arch/mips/bcm963xx/setup.c
23 +++ linux-2.6.25.4/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 Index: linux-2.6.25.4/arch/mips/bcm963xx/time.c
45 ===================================================================
46 --- linux-2.6.25.4.orig/arch/mips/bcm963xx/time.c
47 +++ linux-2.6.25.4/arch/mips/bcm963xx/time.c
48 @@ -40,6 +40,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 @@ -63,11 +65,12 @@ static inline unsigned long __init calcu
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 Index: linux-2.6.25.4/arch/mips/pci/pci-bcm96348.c
72 ===================================================================
73 --- linux-2.6.25.4.orig/arch/mips/pci/pci-bcm96348.c
74 +++ linux-2.6.25.4/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_controlle
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 -
92 -       /* Set I/O resource limits.  */
93 -       ioport_resource.end = 0x1fffffff;
94 -       iomem_resource.end = 0xffffffff;
95 +       if (!ISBCM(0x6345)) {
96 +               /* Avoid ISA compat ranges.  */
97 +               PCIBIOS_MIN_IO = 0x00000000;
98 +               PCIBIOS_MIN_MEM = 0x00000000;
99 +
100 +               /* Set I/O resource limits.  */
101 +               ioport_resource.end = 0x1fffffff;
102 +               iomem_resource.end = 0xffffffff;
103  
104 -       register_pci_controller(&bcm96348_controller);
105 -        return 0;
106 +               register_pci_controller(&bcm96348_controller);
107 +       }
108 +
109 +       return 0;
110  }
111  
112  arch_initcall(bcm96348_pci_init);
113 Index: linux-2.6.25.4/include/asm-mips/mach-bcm963xx/board.h
114 ===================================================================
115 --- linux-2.6.25.4.orig/include/asm-mips/mach-bcm963xx/board.h
116 +++ linux-2.6.25.4/include/asm-mips/mach-bcm963xx/board.h
117 @@ -369,5 +369,7 @@ void kerSysWakeupMonitorTask( void );
118  
119  extern int boot_loader_type;
120  
121 +#define ISBCM(x) (((PERF->RevID & 0xFFFF0000) >> 16) == x)
122 +
123  #endif /* _BOARD_H */
124