1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#include <linux/bootmem.h>
30#include <linux/init.h>
31#include <linux/irq.h>
32
33#include <asm/bootinfo.h>
34#include <asm/mc146818-time.h>
35#include <asm/time.h>
36#include <asm/wbflush.h>
37
38#ifdef CONFIG_VT
39#include <linux/console.h>
40#include <linux/screen_info.h>
41#endif
42
43extern void mips_reboot_setup(void);
44
45#ifdef CONFIG_64BIT
46#define PTR_PAD(p) ((0xffffffff00000000)|((unsigned long long)(p)))
47#else
48#define PTR_PAD(p) (p)
49#endif
50
51unsigned long cpu_clock_freq;
52unsigned long bus_clock;
53unsigned int memsize;
54unsigned int highmemsize = 0;
55
56void __init plat_time_init(void)
57{
58
59 mips_hpt_frequency = cpu_clock_freq / 2;
60}
61
62unsigned long read_persistent_clock(void)
63{
64 return mc146818_get_cmos_time();
65}
66
67void (*__wbflush)(void);
68EXPORT_SYMBOL(__wbflush);
69
70static void wbflush_loongson2e(void)
71{
72 asm(".set\tpush\n\t"
73 ".set\tnoreorder\n\t"
74 ".set mips3\n\t"
75 "sync\n\t"
76 "nop\n\t"
77 ".set\tpop\n\t"
78 ".set mips0\n\t");
79}
80
81void __init plat_mem_setup(void)
82{
83 set_io_port_base(PTR_PAD(0xbfd00000));
84
85 mips_reboot_setup();
86
87 __wbflush = wbflush_loongson2e;
88
89 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
90#ifdef CONFIG_64BIT
91 if (highmemsize > 0) {
92 add_memory_region(0x20000000, highmemsize << 20, BOOT_MEM_RAM);
93 }
94#endif
95
96#ifdef CONFIG_VT
97#if defined(CONFIG_VGA_CONSOLE)
98 conswitchp = &vga_con;
99
100 screen_info = (struct screen_info) {
101 0, 25,
102 0,
103 0,
104 0,
105 80,
106 0, 0, 0,
107 25,
108 VIDEO_TYPE_VGAC,
109 16
110 };
111#elif defined(CONFIG_DUMMY_CONSOLE)
112 conswitchp = &dummy_con;
113#endif
114#endif
115
116}
117