xref: /openbmc/linux/arch/mips/ath25/board.c (revision 1753e74e)
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2003 Atheros Communications, Inc.,  All Rights Reserved.
7  * Copyright (C) 2006 FON Technology, SL.
8  * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
9  * Copyright (C) 2006-2009 Felix Fietkau <nbd@openwrt.org>
10  */
11 
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
14 #include <asm/irq_cpu.h>
15 #include <asm/reboot.h>
16 #include <asm/bootinfo.h>
17 #include <asm/time.h>
18 
19 #include "devices.h"
20 #include "ar5312.h"
21 #include "ar2315.h"
22 
23 void (*ath25_irq_dispatch)(void);
24 
25 static void ath25_halt(void)
26 {
27 	local_irq_disable();
28 	unreachable();
29 }
30 
31 void __init plat_mem_setup(void)
32 {
33 	_machine_halt = ath25_halt;
34 	pm_power_off = ath25_halt;
35 
36 	if (is_ar5312())
37 		ar5312_plat_mem_setup();
38 	else
39 		ar2315_plat_mem_setup();
40 
41 	/* Disable data watchpoints */
42 	write_c0_watchlo0(0);
43 }
44 
45 asmlinkage void plat_irq_dispatch(void)
46 {
47 	ath25_irq_dispatch();
48 }
49 
50 void __init plat_time_init(void)
51 {
52 	if (is_ar5312())
53 		ar5312_plat_time_init();
54 	else
55 		ar2315_plat_time_init();
56 }
57 
58 unsigned int __cpuinit get_c0_compare_int(void)
59 {
60 	return CP0_LEGACY_COMPARE_IRQ;
61 }
62 
63 void __init arch_init_irq(void)
64 {
65 	clear_c0_status(ST0_IM);
66 	mips_cpu_irq_init();
67 
68 	/* Initialize interrupt controllers */
69 	if (is_ar5312())
70 		ar5312_arch_init_irq();
71 	else
72 		ar2315_arch_init_irq();
73 }
74