blob: 26860300fa090e9302570811475afad8ab768dc2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
Mark A. Greerf54bef92005-09-03 15:55:57 -070015#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <platforms/cpci690.h>
17
Mark A. Greerf54bef92005-09-03 15:55:57 -070018#define KB (1024UL)
19#define MB (1024UL*KB)
20#define GB (1024UL*MB)
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022extern u32 mv64x60_console_baud;
23extern u32 mv64x60_mpsc_clk_src;
24extern u32 mv64x60_mpsc_clk_freq;
25
Mark A. Greerf54bef92005-09-03 15:55:57 -070026u32 mag = 0xffff;
27
28unsigned long
29get_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
Linus Torvalds1da177e2005-04-16 15:20:36 -070060void
61mv64x60_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;
Mark A. Greerf54bef92005-09-03 15:55:57 -070065 mv64x60_mpsc_clk_freq =
66 (get_mem_size() >= (1*GB)) ? 100000000 : 133333333;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067}