blob: d4675e04a634771e24c58bed6ec4c8cf5eed907a [file] [log] [blame]
Sergey Ryazanov43cc7392014-10-29 03:18:38 +04001/*
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
Sergey Ryazanov3b12308f2014-10-29 03:18:39 +040019#include "devices.h"
20#include "ar5312.h"
Sergey Ryazanovba910342014-10-29 03:18:40 +040021#include "ar2315.h"
Sergey Ryazanov3b12308f2014-10-29 03:18:39 +040022
Sergey Ryazanov1753e742014-10-29 03:18:41 +040023void (*ath25_irq_dispatch)(void);
24
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040025static void ath25_halt(void)
26{
27 local_irq_disable();
28 unreachable();
29}
30
31void __init plat_mem_setup(void)
32{
33 _machine_halt = ath25_halt;
34 pm_power_off = ath25_halt;
35
Sergey Ryazanov3b12308f2014-10-29 03:18:39 +040036 if (is_ar5312())
37 ar5312_plat_mem_setup();
Sergey Ryazanovba910342014-10-29 03:18:40 +040038 else
39 ar2315_plat_mem_setup();
Sergey Ryazanov3b12308f2014-10-29 03:18:39 +040040
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040041 /* Disable data watchpoints */
42 write_c0_watchlo0(0);
43}
44
45asmlinkage void plat_irq_dispatch(void)
46{
Sergey Ryazanov1753e742014-10-29 03:18:41 +040047 ath25_irq_dispatch();
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040048}
49
50void __init plat_time_init(void)
51{
Sergey Ryazanov3b12308f2014-10-29 03:18:39 +040052 if (is_ar5312())
53 ar5312_plat_time_init();
Sergey Ryazanovba910342014-10-29 03:18:40 +040054 else
55 ar2315_plat_time_init();
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040056}
57
58unsigned int __cpuinit get_c0_compare_int(void)
59{
60 return CP0_LEGACY_COMPARE_IRQ;
61}
62
63void __init arch_init_irq(void)
64{
65 clear_c0_status(ST0_IM);
66 mips_cpu_irq_init();
Sergey Ryazanov1753e742014-10-29 03:18:41 +040067
68 /* Initialize interrupt controllers */
69 if (is_ar5312())
70 ar5312_arch_init_irq();
71 else
72 ar2315_arch_init_irq();
Sergey Ryazanov43cc7392014-10-29 03:18:38 +040073}