dd55cd163a2c5a62ea2c6f238c7c3ad3e2c7befd
[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 --- a/arch/mips/bcm963xx/setup.c
21 +++ b/arch/mips/bcm963xx/setup.c
22 @@ -43,6 +43,7 @@
23  #include <asm/bootinfo.h>
24  #include <asm/cpu.h>
25  #include <asm/mach-bcm963xx/bootloaders.h>
26 +#include <asm/mach-bcm963xx/board.h>
27  
28  extern void brcm_time_init(void);
29  extern int boot_loader_type;
30 @@ -465,6 +466,9 @@
31         _machine_halt = brcm_machine_halt;
32         pm_power_off = brcm_machine_halt;
33  
34 -       /* mpi initialization */
35 -       mpi_init();
36 +       /* BCM96345 has no MPI */
37 +       if (!ISBCM(0x6345)) {
38 +               /* mpi initialization */
39 +               mpi_init();
40 +       }
41  }
42 --- a/arch/mips/bcm963xx/time.c
43 +++ b/arch/mips/bcm963xx/time.c
44 @@ -40,6 +40,8 @@
45  #include <6348_intr.h>
46  #include <bcm_map_part.h>
47  #include <bcm_intr.h>
48 +#include <asm/mach-bcm963xx/board.h>
49 +
50  
51  /*
52   * calculateCpuSpeed()
53 @@ -63,11 +65,12 @@
54  }
55  
56  
57 +#define BCM96345_CPU_CLOCK 140000000
58  void __init plat_time_init(void)
59  {
60         unsigned long cpu_clock;
61  
62 -       cpu_clock = calculateCpuSpeed();
63 +       cpu_clock = ISBCM(0x6345) ? BCM96345_CPU_CLOCK : calculateCpuSpeed();
64  
65         printk("CPU frequency %lu.%02lu MHz\n", cpu_clock / 1000000,
66                 (cpu_clock % 1000000) * 100 / 1000000);
67 --- a/arch/mips/pci/pci-bcm96348.c
68 +++ b/arch/mips/pci/pci-bcm96348.c
69 @@ -21,6 +21,8 @@
70  #include <linux/kernel.h>
71  #include <linux/init.h>
72  
73 +#include <asm/mach-bcm963xx/6348_map_part.h>
74 +#include <asm/mach-bcm963xx/board.h>
75  #include <bcmpci.h>
76  
77  static struct resource bcm_pci_io_resource = {
78 @@ -47,16 +49,19 @@
79  
80  static __init int bcm96348_pci_init(void)
81  {
82 -       /* Avoid ISA compat ranges.  */
83 -       PCIBIOS_MIN_IO = 0x00000000;
84 -       PCIBIOS_MIN_MEM = 0x00000000;
85 -
86 -       /* Set I/O resource limits.  */
87 -       ioport_resource.end = 0x1fffffff;
88 -       iomem_resource.end = 0xffffffff;
89 +       if (!ISBCM(0x6345)) {
90 +               /* Avoid ISA compat ranges.  */
91 +               PCIBIOS_MIN_IO = 0x00000000;
92 +               PCIBIOS_MIN_MEM = 0x00000000;
93 +
94 +               /* Set I/O resource limits.  */
95 +               ioport_resource.end = 0x1fffffff;
96 +               iomem_resource.end = 0xffffffff;
97  
98 -       register_pci_controller(&bcm96348_controller);
99 -        return 0;
100 +               register_pci_controller(&bcm96348_controller);
101 +       }
102 +
103 +       return 0;
104  }
105  
106  arch_initcall(bcm96348_pci_init);
107 --- a/include/asm-mips/mach-bcm963xx/board.h
108 +++ b/include/asm-mips/mach-bcm963xx/board.h
109 @@ -369,5 +369,7 @@
110  
111  extern int boot_loader_type;
112  
113 +#define ISBCM(x) (((PERF->RevID & 0xFFFF0000) >> 16) == x)
114 +
115  #endif /* _BOARD_H */
116