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