aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2009-07-02 11:26:45 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-09-17 14:07:47 -0400
commit85749d24bcf90440b10394312e5b1c96d1a62cdb (patch)
treee244d0d79d24e066871ae207a851d38973d57345 /arch/mips/loongson
parent8e4971175acc910eb4258df82a6bd8f2c4e4e5b5 (diff)
MIPS: Loongson: Split common loongson source code out
To share common loongson source code between all of the loongson-based machines. there is a need to split it out of the fuloong-2e/ directory. at the same time, other according tuning is needed. the machine-specific parts are defined as macros in relative header file, pci.h, mem.h, machine.h. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson')
-rw-r--r--arch/mips/loongson/Kconfig31
-rw-r--r--arch/mips/loongson/Makefile11
-rw-r--r--arch/mips/loongson/common/Makefile11
-rw-r--r--arch/mips/loongson/common/bonito-irq.c (renamed from arch/mips/loongson/fuloong-2e/bonito-irq.c)0
-rw-r--r--arch/mips/loongson/common/cmdline.c (renamed from arch/mips/loongson/fuloong-2e/cmdline.c)0
-rw-r--r--arch/mips/loongson/common/early_printk.c (renamed from arch/mips/loongson/fuloong-2e/early_printk.c)5
-rw-r--r--arch/mips/loongson/common/env.c (renamed from arch/mips/loongson/fuloong-2e/env.c)0
-rw-r--r--arch/mips/loongson/common/init.c (renamed from arch/mips/loongson/fuloong-2e/init.c)0
-rw-r--r--arch/mips/loongson/common/irq.c74
-rw-r--r--arch/mips/loongson/common/machtype.c (renamed from arch/mips/loongson/fuloong-2e/machtype.c)4
-rw-r--r--arch/mips/loongson/common/mem.c (renamed from arch/mips/loongson/fuloong-2e/mem.c)11
-rw-r--r--arch/mips/loongson/common/pci.c (renamed from arch/mips/loongson/fuloong-2e/pci.c)24
-rw-r--r--arch/mips/loongson/common/reset.c44
-rw-r--r--arch/mips/loongson/common/setup.c58
-rw-r--r--arch/mips/loongson/common/time.c (renamed from arch/mips/loongson/fuloong-2e/time.c)0
-rw-r--r--arch/mips/loongson/fuloong-2e/Makefile8
-rw-r--r--arch/mips/loongson/fuloong-2e/irq.c52
-rw-r--r--arch/mips/loongson/fuloong-2e/reset.c37
18 files changed, 266 insertions, 104 deletions
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
new file mode 100644
index 000000000000..376712a0e2f1
--- /dev/null
+++ b/arch/mips/loongson/Kconfig
@@ -0,0 +1,31 @@
1choice
2 prompt "Machine Type"
3 depends on MACH_LOONGSON
4
5config LEMOTE_FULOONG2E
6 bool "Lemote Fuloong(2e) mini-PC"
7 select ARCH_SPARSEMEM_ENABLE
8 select CEVT_R4K
9 select CSRC_R4K
10 select SYS_HAS_CPU_LOONGSON2
11 select DMA_NONCOHERENT
12 select BOOT_ELF32
13 select BOARD_SCACHE
14 select HW_HAS_PCI
15 select I8259
16 select ISA
17 select IRQ_CPU
18 select SYS_SUPPORTS_32BIT_KERNEL
19 select SYS_SUPPORTS_64BIT_KERNEL
20 select SYS_SUPPORTS_LITTLE_ENDIAN
21 select SYS_SUPPORTS_HIGHMEM
22 select SYS_HAS_EARLY_PRINTK
23 select GENERIC_HARDIRQS_NO__DO_IRQ
24 select GENERIC_ISA_DMA_SUPPORT_BROKEN
25 select CPU_HAS_WB
26 help
27 Lemote Fuloong(2e) mini-PC board based on the Chinese Loongson-2E CPU and
28 an FPGA northbridge
29
30 Lemote Fuloong(2e) mini PC have a VIA686B south bridge.
31endchoice
diff --git a/arch/mips/loongson/Makefile b/arch/mips/loongson/Makefile
new file mode 100644
index 000000000000..39048c455d7d
--- /dev/null
+++ b/arch/mips/loongson/Makefile
@@ -0,0 +1,11 @@
1#
2# Common code for all Loongson based systems
3#
4
5obj-$(CONFIG_MACH_LOONGSON) += common/
6
7#
8# Lemote Fuloong mini-PC (Loongson 2E-based)
9#
10
11obj-$(CONFIG_LEMOTE_FULOONG2E) += fuloong-2e/
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
new file mode 100644
index 000000000000..4e3889dec39e
--- /dev/null
+++ b/arch/mips/loongson/common/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for loongson based machines.
3#
4
5obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \
6 pci.o bonito-irq.o mem.o
7
8#
9# Early printk support
10#
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/mips/loongson/fuloong-2e/bonito-irq.c b/arch/mips/loongson/common/bonito-irq.c
index 3e31e7ad713e..3e31e7ad713e 100644
--- a/arch/mips/loongson/fuloong-2e/bonito-irq.c
+++ b/arch/mips/loongson/common/bonito-irq.c
diff --git a/arch/mips/loongson/fuloong-2e/cmdline.c b/arch/mips/loongson/common/cmdline.c
index 75f1b243ee4e..75f1b243ee4e 100644
--- a/arch/mips/loongson/fuloong-2e/cmdline.c
+++ b/arch/mips/loongson/common/cmdline.c
diff --git a/arch/mips/loongson/fuloong-2e/early_printk.c b/arch/mips/loongson/common/early_printk.c
index 3e0a6eaa4041..bc73edc0cfd8 100644
--- a/arch/mips/loongson/fuloong-2e/early_printk.c
+++ b/arch/mips/loongson/common/early_printk.c
@@ -12,8 +12,7 @@
12#include <linux/serial_reg.h> 12#include <linux/serial_reg.h>
13 13
14#include <loongson.h> 14#include <loongson.h>
15 15#include <machine.h>
16#define UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
17 16
18#define PORT(base, offset) (u8 *)(base + offset) 17#define PORT(base, offset) (u8 *)(base + offset)
19 18
@@ -30,7 +29,7 @@ static inline void serial_out(phys_addr_t base, int offset, int value)
30void prom_putchar(char c) 29void prom_putchar(char c)
31{ 30{
32 phys_addr_t uart_base = 31 phys_addr_t uart_base =
33 (phys_addr_t) ioremap_nocache(UART_BASE, 8); 32 (phys_addr_t) ioremap_nocache(LOONGSON_UART_BASE, 8);
34 33
35 while ((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) 34 while ((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0)
36 ; 35 ;
diff --git a/arch/mips/loongson/fuloong-2e/env.c b/arch/mips/loongson/common/env.c
index b9ef50385541..b9ef50385541 100644
--- a/arch/mips/loongson/fuloong-2e/env.c
+++ b/arch/mips/loongson/common/env.c
diff --git a/arch/mips/loongson/fuloong-2e/init.c b/arch/mips/loongson/common/init.c
index 3abe927422a3..3abe927422a3 100644
--- a/arch/mips/loongson/fuloong-2e/init.c
+++ b/arch/mips/loongson/common/init.c
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson/common/irq.c
new file mode 100644
index 000000000000..f368c735cbd3
--- /dev/null
+++ b/arch/mips/loongson/common/irq.c
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/delay.h>
11#include <linux/interrupt.h>
12
13#include <loongson.h>
14/*
15 * the first level int-handler will jump here if it is a bonito irq
16 */
17void bonito_irqdispatch(void)
18{
19 u32 int_status;
20 int i;
21
22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
23 int_status = BONITO_INTISR;
24 if (int_status & (1 << 10)) {
25 while (int_status & (1 << 10)) {
26 udelay(1);
27 int_status = BONITO_INTISR;
28 }
29 }
30
31 /* Get pending sources, masked by current enables */
32 int_status = BONITO_INTISR & BONITO_INTEN;
33
34 if (int_status != 0) {
35 i = __ffs(int_status);
36 int_status &= ~(1 << i);
37 do_IRQ(BONITO_IRQ_BASE + i);
38 }
39}
40
41asmlinkage void plat_irq_dispatch(void)
42{
43 unsigned int pending;
44
45 pending = read_c0_cause() & read_c0_status() & ST0_IM;
46
47 /* machine-specific plat_irq_dispatch */
48 mach_irq_dispatch(pending);
49}
50
51void __init arch_init_irq(void)
52{
53 /*
54 * Clear all of the interrupts while we change the able around a bit.
55 * int-handler is not on bootstrap
56 */
57 clear_c0_status(ST0_IM | ST0_BEV);
58 local_irq_disable();
59
60 /* setting irq trigger mode */
61 set_irq_trigger_mode();
62
63 /* no steer */
64 BONITO_INTSTEER = 0;
65
66 /*
67 * Mask out all interrupt by writing "1" to all bit position in
68 * the interrupt reset reg.
69 */
70 BONITO_INTENCLR = ~0;
71
72 /* machine specific irq init */
73 mach_init_irq();
74}
diff --git a/arch/mips/loongson/fuloong-2e/machtype.c b/arch/mips/loongson/common/machtype.c
index e03aa0de6176..845b3fb47e0f 100644
--- a/arch/mips/loongson/fuloong-2e/machtype.c
+++ b/arch/mips/loongson/common/machtype.c
@@ -8,8 +8,10 @@
8 * option) any later version. 8 * option) any later version.
9 */ 9 */
10 10
11#include <machine.h>
12
11const char *get_system_type(void) 13const char *get_system_type(void)
12{ 14{
13 return "lemote-fuloong-2e-box"; 15 return LOONGSON_MACHNAME;
14} 16}
15 17
diff --git a/arch/mips/loongson/fuloong-2e/mem.c b/arch/mips/loongson/common/mem.c
index 6a7feb178fa5..7c92f79b6480 100644
--- a/arch/mips/loongson/fuloong-2e/mem.c
+++ b/arch/mips/loongson/common/mem.c
@@ -11,13 +11,15 @@
11#include <asm/bootinfo.h> 11#include <asm/bootinfo.h>
12 12
13#include <loongson.h> 13#include <loongson.h>
14#include <mem.h>
14 15
15void __init prom_init_memory(void) 16void __init prom_init_memory(void)
16{ 17{
17 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM); 18 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
18#ifdef CONFIG_64BIT 19#ifdef CONFIG_64BIT
19 if (highmemsize > 0) 20 if (highmemsize > 0)
20 add_memory_region(0x20000000, highmemsize << 20, BOOT_MEM_RAM); 21 add_memory_region(LOONGSON_HIGHMEM_START,
22 highmemsize << 20, BOOT_MEM_RAM);
21#endif /* CONFIG_64BIT */ 23#endif /* CONFIG_64BIT */
22} 24}
23 25
@@ -27,10 +29,7 @@ int __uncached_access(struct file *file, unsigned long addr)
27 if (file->f_flags & O_SYNC) 29 if (file->f_flags & O_SYNC)
28 return 1; 30 return 1;
29 31
30 /*
31 * On the Lemote Loongson 2e system, the peripheral registers
32 * reside between 0x1000:0000 and 0x2000:0000.
33 */
34 return addr >= __pa(high_memory) || 32 return addr >= __pa(high_memory) ||
35 ((addr >= 0x10000000) && (addr < 0x20000000)); 33 ((addr >= LOONGSON_MMIO_MEM_START) &&
34 (addr < LOONGSON_MMIO_MEM_END));
36} 35}
diff --git a/arch/mips/loongson/fuloong-2e/pci.c b/arch/mips/loongson/common/pci.c
index 9812c30cc6eb..a3a4abfb6c9a 100644
--- a/arch/mips/loongson/fuloong-2e/pci.c
+++ b/arch/mips/loongson/common/pci.c
@@ -12,24 +12,24 @@
12#include <pci.h> 12#include <pci.h>
13#include <loongson.h> 13#include <loongson.h>
14 14
15static struct resource loongson2e_pci_mem_resource = { 15static struct resource loongson_pci_mem_resource = {
16 .name = "LOONGSON2E PCI MEM", 16 .name = "pci memory space",
17 .start = LOONGSON2E_PCI_MEM_START, 17 .start = LOONGSON_PCI_MEM_START,
18 .end = LOONGSON2E_PCI_MEM_END, 18 .end = LOONGSON_PCI_MEM_END,
19 .flags = IORESOURCE_MEM, 19 .flags = IORESOURCE_MEM,
20}; 20};
21 21
22static struct resource loongson2e_pci_io_resource = { 22static struct resource loongson_pci_io_resource = {
23 .name = "LOONGSON2E PCI IO MEM", 23 .name = "pci io space",
24 .start = LOONGSON2E_PCI_IO_START, 24 .start = LOONGSON_PCI_IO_START,
25 .end = IO_SPACE_LIMIT, 25 .end = IO_SPACE_LIMIT,
26 .flags = IORESOURCE_IO, 26 .flags = IORESOURCE_IO,
27}; 27};
28 28
29static struct pci_controller loongson2e_pci_controller = { 29static struct pci_controller loongson_pci_controller = {
30 .pci_ops = &bonito64_pci_ops, 30 .pci_ops = &bonito64_pci_ops,
31 .io_resource = &loongson2e_pci_io_resource, 31 .io_resource = &loongson_pci_io_resource,
32 .mem_resource = &loongson2e_pci_mem_resource, 32 .mem_resource = &loongson_pci_mem_resource,
33 .mem_offset = 0x00000000UL, 33 .mem_offset = 0x00000000UL,
34 .io_offset = 0x00000000UL, 34 .io_offset = 0x00000000UL,
35}; 35};
@@ -73,9 +73,9 @@ static int __init pcibios_init(void)
73{ 73{
74 setup_pcimap(); 74 setup_pcimap();
75 75
76 loongson2e_pci_controller.io_map_base = mips_io_port_base; 76 loongson_pci_controller.io_map_base = mips_io_port_base;
77 77
78 register_pci_controller(&loongson2e_pci_controller); 78 register_pci_controller(&loongson_pci_controller);
79 79
80 return 0; 80 return 0;
81} 81}
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c
new file mode 100644
index 000000000000..97e918251edd
--- /dev/null
+++ b/arch/mips/loongson/common/reset.c
@@ -0,0 +1,44 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8 * Author: Fuxin Zhang, zhangfx@lemote.com
9 * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
10 * Author: Zhangjin Wu, wuzj@lemote.com
11 */
12#include <linux/init.h>
13#include <linux/pm.h>
14
15#include <asm/reboot.h>
16
17#include <loongson.h>
18
19static void loongson_restart(char *command)
20{
21 /* do preparation for reboot */
22 mach_prepare_reboot();
23
24 /* reboot via jumping to boot base address */
25 ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
26}
27
28static void loongson_halt(void)
29{
30 mach_prepare_shutdown();
31 while (1)
32 ;
33}
34
35static int __init mips_reboot_setup(void)
36{
37 _machine_restart = loongson_restart;
38 _machine_halt = loongson_halt;
39 pm_power_off = loongson_halt;
40
41 return 0;
42}
43
44arch_initcall(mips_reboot_setup);
diff --git a/arch/mips/loongson/common/setup.c b/arch/mips/loongson/common/setup.c
new file mode 100644
index 000000000000..4cd2aa9a342c
--- /dev/null
+++ b/arch/mips/loongson/common/setup.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/module.h>
11
12#include <asm/wbflush.h>
13
14#include <loongson.h>
15
16#ifdef CONFIG_VT
17#include <linux/console.h>
18#include <linux/screen_info.h>
19#endif
20
21void (*__wbflush)(void);
22EXPORT_SYMBOL(__wbflush);
23
24static void wbflush_loongson(void)
25{
26 asm(".set\tpush\n\t"
27 ".set\tnoreorder\n\t"
28 ".set mips3\n\t"
29 "sync\n\t"
30 "nop\n\t"
31 ".set\tpop\n\t"
32 ".set mips0\n\t");
33}
34
35void __init plat_mem_setup(void)
36{
37 __wbflush = wbflush_loongson;
38
39#ifdef CONFIG_VT
40#if defined(CONFIG_VGA_CONSOLE)
41 conswitchp = &vga_con;
42
43 screen_info = (struct screen_info) {
44 0, 25, /* orig-x, orig-y */
45 0, /* unused */
46 0, /* orig-video-page */
47 0, /* orig-video-mode */
48 80, /* orig-video-cols */
49 0, 0, 0, /* ega_ax, ega_bx, ega_cx */
50 25, /* orig-video-lines */
51 VIDEO_TYPE_VGAC, /* orig-video-isVGA */
52 16 /* orig-video-points */
53 };
54#elif defined(CONFIG_DUMMY_CONSOLE)
55 conswitchp = &dummy_con;
56#endif
57#endif
58}
diff --git a/arch/mips/loongson/fuloong-2e/time.c b/arch/mips/loongson/common/time.c
index b13d17174654..b13d17174654 100644
--- a/arch/mips/loongson/fuloong-2e/time.c
+++ b/arch/mips/loongson/common/time.c
diff --git a/arch/mips/loongson/fuloong-2e/Makefile b/arch/mips/loongson/fuloong-2e/Makefile
index feb1d6bba499..96e45c13c850 100644
--- a/arch/mips/loongson/fuloong-2e/Makefile
+++ b/arch/mips/loongson/fuloong-2e/Makefile
@@ -2,12 +2,6 @@
2# Makefile for Lemote Fuloong2e mini-PC board. 2# Makefile for Lemote Fuloong2e mini-PC board.
3# 3#
4 4
5obj-y += setup.o init.o reset.o irq.o pci.o bonito-irq.o mem.o \ 5obj-y += irq.o reset.o machtype.o
6 env.o cmdline.o time.o machtype.o
7
8#
9# Early printk support
10#
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
12 6
13EXTRA_CFLAGS += -Werror 7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/loongson/fuloong-2e/irq.c b/arch/mips/loongson/fuloong-2e/irq.c
index 9585f5aa7cce..7888cf69424a 100644
--- a/arch/mips/loongson/fuloong-2e/irq.c
+++ b/arch/mips/loongson/fuloong-2e/irq.c
@@ -7,39 +7,12 @@
7 * Free Software Foundation; either version 2 of the License, or (at your 7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. 8 * option) any later version.
9 */ 9 */
10#include <linux/delay.h>
11#include <linux/interrupt.h> 10#include <linux/interrupt.h>
12 11
13#include <asm/irq_cpu.h> 12#include <asm/irq_cpu.h>
14#include <asm/i8259.h> 13#include <asm/i8259.h>
15 14
16#include <loongson.h> 15#include <loongson.h>
17/*
18 * the first level int-handler will jump here if it is a bonito irq
19 */
20static void bonito_irqdispatch(void)
21{
22 u32 int_status;
23 int i;
24
25 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
26 int_status = BONITO_INTISR;
27 if (int_status & (1 << 10)) {
28 while (int_status & (1 << 10)) {
29 udelay(1);
30 int_status = BONITO_INTISR;
31 }
32 }
33
34 /* Get pending sources, masked by current enables */
35 int_status = BONITO_INTISR & BONITO_INTEN;
36
37 if (int_status != 0) {
38 i = __ffs(int_status);
39 int_status &= ~(1 << i);
40 do_IRQ(BONITO_IRQ_BASE + i);
41 }
42}
43 16
44static void i8259_irqdispatch(void) 17static void i8259_irqdispatch(void)
45{ 18{
@@ -52,10 +25,8 @@ static void i8259_irqdispatch(void)
52 spurious_interrupt(); 25 spurious_interrupt();
53} 26}
54 27
55asmlinkage void plat_irq_dispatch(void) 28asmlinkage void mach_irq_dispatch(unsigned int pending)
56{ 29{
57 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
58
59 if (pending & CAUSEF_IP7) 30 if (pending & CAUSEF_IP7)
60 do_IRQ(MIPS_CPU_IRQ_BASE + 7); 31 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
61 else if (pending & CAUSEF_IP6) /* perf counter loverflow */ 32 else if (pending & CAUSEF_IP6) /* perf counter loverflow */
@@ -73,26 +44,15 @@ static struct irqaction cascade_irqaction = {
73 .name = "cascade", 44 .name = "cascade",
74}; 45};
75 46
76void __init arch_init_irq(void) 47void __init set_irq_trigger_mode(void)
77{ 48{
78 /*
79 * Clear all of the interrupts while we change the able around a bit.
80 * int-handler is not on bootstrap
81 */
82 clear_c0_status(ST0_IM | ST0_BEV);
83 local_irq_disable();
84
85 /* most bonito irq should be level triggered */ 49 /* most bonito irq should be level triggered */
86 BONITO_INTEDGE = BONITO_ICU_SYSTEMERR | BONITO_ICU_MASTERERR | 50 BONITO_INTEDGE = BONITO_ICU_SYSTEMERR | BONITO_ICU_MASTERERR |
87 BONITO_ICU_RETRYERR | BONITO_ICU_MBOXES; 51 BONITO_ICU_RETRYERR | BONITO_ICU_MBOXES;
88 BONITO_INTSTEER = 0; 52}
89
90 /*
91 * Mask out all interrupt by writing "1" to all bit position in
92 * the interrupt reset reg.
93 */
94 BONITO_INTENCLR = ~0;
95 53
54void __init mach_init_irq(void)
55{
96 /* init all controller 56 /* init all controller
97 * 0-15 ------> i8259 interrupt 57 * 0-15 ------> i8259 interrupt
98 * 16-23 ------> mips cpu interrupt 58 * 16-23 ------> mips cpu interrupt
diff --git a/arch/mips/loongson/fuloong-2e/reset.c b/arch/mips/loongson/fuloong-2e/reset.c
index c21299af7f64..677fe186db95 100644
--- a/arch/mips/loongson/fuloong-2e/reset.c
+++ b/arch/mips/loongson/fuloong-2e/reset.c
@@ -1,44 +1,23 @@
1/* 1/* Board-specific reboot/shutdown routines
2 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
3 *
4 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
5 * Author: Wu Zhangjin, wuzj@lemote.com
6 *
2 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your 9 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version. 10 * option) any later version.
6 *
7 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8 * Author: Fuxin Zhang, zhangfx@lemote.com
9 * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
10 * Author: Zhangjin Wu, wuzj@lemote.com
11 */ 11 */
12#include <linux/init.h>
13#include <linux/pm.h>
14
15#include <asm/reboot.h>
16 12
17#include <loongson.h> 13#include <loongson.h>
18 14
19static void loongson2e_restart(char *command) 15void mach_prepare_reboot(void)
20{ 16{
21 /* do preparation for reboot */
22 BONITO_BONGENCFG &= ~(1 << 2); 17 BONITO_BONGENCFG &= ~(1 << 2);
23 BONITO_BONGENCFG |= (1 << 2); 18 BONITO_BONGENCFG |= (1 << 2);
24
25 /* reboot via jumping to boot base address */
26 ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
27} 19}
28 20
29static void loongson2e_halt(void) 21void mach_prepare_shutdown(void)
30{ 22{
31 while (1)
32 ;
33} 23}
34
35static int __init mips_reboot_setup(void)
36{
37 _machine_restart = loongson2e_restart;
38 _machine_halt = loongson2e_halt;
39 pm_power_off = loongson2e_halt;
40
41 return 0;
42}
43
44arch_initcall(mips_reboot_setup);