blob: 8a8614d11a32f0a7355dd03243931a062df984ab [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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>
Mark A. Greerf54bef92005-09-03 15:55:57 -070013#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <platforms/cpci690.h>
15
Mark A. Greerf54bef92005-09-03 15:55:57 -070016#define KB (1024UL)
17#define MB (1024UL*KB)
18#define GB (1024UL*MB)
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020extern u32 mv64x60_console_baud;
21extern u32 mv64x60_mpsc_clk_src;
22extern u32 mv64x60_mpsc_clk_freq;
23
Mark A. Greerf54bef92005-09-03 15:55:57 -070024u32 mag = 0xffff;
25
26unsigned long
27get_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
Linus Torvalds1da177e2005-04-16 15:20:36 -070058void
59mv64x60_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;
Mark A. Greerf54bef92005-09-03 15:55:57 -070063 mv64x60_mpsc_clk_freq =
64 (get_mem_size() >= (1*GB)) ? 100000000 : 133333333;
Linus Torvalds1da177e2005-04-16 15:20:36 -070065}