aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lemote/lm2e/setup.c
diff options
context:
space:
mode:
authorSongmao Tian <tiansm@lemote.com>2007-06-06 02:52:38 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-07-10 12:33:02 -0400
commit42d226c7248a28ff8c478c06b7e9bd9ef5d73574 (patch)
tree7749c1204cbdb481ddece008dc09234c48b769db /arch/mips/lemote/lm2e/setup.c
parent2a21c7300b53b744d16903256a172d9cbcfdd03e (diff)
[MIPS] New files for lemote fulong mini-PC support
Signed-off-by: Fuxin Zhang <zhangfx@lemote.com> Signed-off-by: Songmao Tian <tiansm@lemote.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lemote/lm2e/setup.c')
-rw-r--r--arch/mips/lemote/lm2e/setup.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/arch/mips/lemote/lm2e/setup.c b/arch/mips/lemote/lm2e/setup.c
new file mode 100644
index 000000000000..0e4d1fa572b5
--- /dev/null
+++ b/arch/mips/lemote/lm2e/setup.c
@@ -0,0 +1,134 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * setup.c - board dependent boot routines
4 *
5 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
6 * Author: Fuxin Zhang, zhangfx@lemote.com
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 *
28 */
29#include <linux/bootmem.h>
30#include <linux/init.h>
31#include <linux/io.h>
32#include <linux/ioport.h>
33#include <linux/interrupt.h>
34#include <linux/irq.h>
35#include <linux/kernel.h>
36#include <linux/mc146818rtc.h>
37#include <linux/mm.h>
38#include <linux/module.h>
39#include <linux/pci.h>
40#include <linux/tty.h>
41#include <linux/types.h>
42
43#include <asm/bootinfo.h>
44#include <asm/mc146818-time.h>
45#include <asm/time.h>
46#include <asm/wbflush.h>
47
48#ifdef CONFIG_VT
49#include <linux/console.h>
50#include <linux/screen_info.h>
51#endif
52
53extern void mips_reboot_setup(void);
54
55#ifdef CONFIG_64BIT
56#define PTR_PAD(p) ((0xffffffff00000000)|((unsigned long long)(p)))
57#else
58#define PTR_PAD(p) (p)
59#endif
60
61unsigned long cpu_clock;
62unsigned long bus_clock;
63unsigned int memsize;
64unsigned int highmemsize = 0;
65
66void __init plat_timer_setup(struct irqaction *irq)
67{
68 setup_irq(MIPS_CPU_IRQ_BASE + 7, irq);
69}
70
71static void __init loongson2e_time_init(void)
72{
73 /* setup mips r4k timer */
74 mips_hpt_frequency = cpu_clock / 2;
75}
76
77static unsigned long __init mips_rtc_get_time(void)
78{
79 return mc146818_get_cmos_time();
80}
81
82void (*__wbflush)(void);
83EXPORT_SYMBOL(__wbflush);
84
85static void wbflush_loongson2e(void)
86{
87 asm(".set\tpush\n\t"
88 ".set\tnoreorder\n\t"
89 ".set mips3\n\t"
90 "sync\n\t"
91 "nop\n\t"
92 ".set\tpop\n\t"
93 ".set mips0\n\t");
94}
95
96void __init plat_mem_setup(void)
97{
98 set_io_port_base(PTR_PAD(0xbfd00000));
99
100 mips_reboot_setup();
101
102 board_time_init = loongson2e_time_init;
103 rtc_mips_get_time = mips_rtc_get_time;
104
105 __wbflush = wbflush_loongson2e;
106
107 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
108#ifdef CONFIG_64BIT
109 if (highmemsize > 0) {
110 add_memory_region(0x20000000, highmemsize << 20, BOOT_MEM_RAM);
111 }
112#endif
113
114#ifdef CONFIG_VT
115#if defined(CONFIG_VGA_CONSOLE)
116 conswitchp = &vga_con;
117
118 screen_info = (struct screen_info) {
119 0, 25, /* orig-x, orig-y */
120 0, /* unused */
121 0, /* orig-video-page */
122 0, /* orig-video-mode */
123 80, /* orig-video-cols */
124 0, 0, 0, /* ega_ax, ega_bx, ega_cx */
125 25, /* orig-video-lines */
126 VIDEO_TYPE_VGAC, /* orig-video-isVGA */
127 16 /* orig-video-points */
128 };
129#elif defined(CONFIG_DUMMY_CONSOLE)
130 conswitchp = &dummy_con;
131#endif
132#endif
133
134}