Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[pandora-kernel.git] / arch / ppc / boot / simple / misc-cpci690.c
1 /*
2  * arch/ppc/boot/simple/misc-cpci690.c
3  *
4  * Add birec data for Force CPCI690 board.
5  *
6  * Author: Mark A. Greer <source@mvista.com>
7  *
8  * 2003 (c) MontaVista Software, Inc.  This file is licensed under
9  * the terms of the GNU General Public License version 2.  This program
10  * is licensed "as is" without any warranty of any kind, whether express
11  * or implied.
12  */
13
14 #include <linux/types.h>
15 #include <asm/io.h>
16 #include <platforms/cpci690.h>
17
18 #define KB      (1024UL)
19 #define MB      (1024UL*KB)
20 #define GB      (1024UL*MB)
21
22 extern u32 mv64x60_console_baud;
23 extern u32 mv64x60_mpsc_clk_src;
24 extern u32 mv64x60_mpsc_clk_freq;
25
26 u32 mag = 0xffff;
27
28 unsigned long
29 get_mem_size(void)
30 {
31         u32     size;
32
33         switch (in_8(((void __iomem *)CPCI690_BR_BASE + CPCI690_BR_MEM_CTLR))
34                         & 0x07) {
35         case 0x01:
36                 size = 256*MB;
37                 break;
38         case 0x02:
39                 size = 512*MB;
40                 break;
41         case 0x03:
42                 size = 768*MB;
43                 break;
44         case 0x04:
45                 size = 1*GB;
46                 break;
47         case 0x05:
48                 size = 1*GB + 512*MB;
49                 break;
50         case 0x06:
51                 size = 2*GB;
52                 break;
53         default:
54                 size = 0;
55         }
56
57         return size;
58 }
59
60 void
61 mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
62 {
63         mv64x60_console_baud = CPCI690_MPSC_BAUD;
64         mv64x60_mpsc_clk_src = CPCI690_MPSC_CLK_SRC;
65         mv64x60_mpsc_clk_freq =
66                 (get_mem_size() >= (1*GB)) ? 100000000 : 133333333;
67 }