blob: c6a6c7afddab41f00475bce99e53f861dc10db58 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Steven J. Hill5792bf62014-01-01 16:35:32 +01002 * 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 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Carsten Langgaard, carstenl@mips.com
7 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
8 * Copyright (C) 2001 Ralf Baechle
Deng-Cheng Zhu13361132013-10-30 15:52:10 -05009 * Copyright (C) 2013 Imagination Technologies Ltd.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 * Routines for generic manipulation of the interrupts found on the MIPS
Steven J. Hill5792bf62014-01-01 16:35:32 +010012 * Malta board. The interrupt controller is located in the South Bridge
13 * a PIIX4 device with two internal 82C95 interrupt controllers.
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 */
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/sched.h>
Ralf Baechle631330f2009-06-19 14:05:26 +010018#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/interrupt.h>
Dmitri Vorobiev54bf0382008-01-24 19:52:49 +030020#include <linux/io.h>
Andrew Bresticker4060bbe2014-10-20 12:03:53 -070021#include <linux/irqchip/mips-gic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/kernel_stat.h>
Ahmed S. Darwish25b8ac32007-02-05 04:42:11 +020023#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <linux/random.h>
25
Ralf Baechle39b8d522008-04-28 17:14:26 +010026#include <asm/traps.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <asm/i8259.h>
Ralf Baechlee01402b2005-07-14 15:57:16 +000028#include <asm/irq_cpu.h>
Ralf Baechleba38cdf2006-10-15 09:17:43 +010029#include <asm/irq_regs.h>
Paul Burton237036d2014-01-15 10:31:54 +000030#include <asm/mips-cm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/mips-boards/malta.h>
32#include <asm/mips-boards/maltaint.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include <asm/gt64120.h>
34#include <asm/mips-boards/generic.h>
35#include <asm/mips-boards/msc01_pci.h>
Ralf Baechlee01402b2005-07-14 15:57:16 +000036#include <asm/msc01_ic.h>
David Howellsb81947c2012-03-28 18:30:02 +010037#include <asm/setup.h>
Deng-Cheng Zhu13361132013-10-30 15:52:10 -050038#include <asm/rtlx.h>
Ralf Baechle39b8d522008-04-28 17:14:26 +010039
Andrew Bresticker609ead02014-10-20 12:03:51 -070040static void __iomem *_msc01_biu_base;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Ralf Baechlea963dc72010-02-27 12:53:32 +010042static DEFINE_RAW_SPINLOCK(mips_irq_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
44static inline int mips_pcibios_iack(void)
45{
46 int irq;
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48 /*
49 * Determine highest priority pending interrupt by performing
50 * a PCI Interrupt Acknowledge cycle.
51 */
Chris Dearmanb72c0522007-04-27 15:58:41 +010052 switch (mips_revision_sconid) {
53 case MIPS_REVISION_SCON_SOCIT:
54 case MIPS_REVISION_SCON_ROCIT:
55 case MIPS_REVISION_SCON_SOCITSC:
56 case MIPS_REVISION_SCON_SOCITSCP:
Dmitri Vorobievaf825582008-01-24 19:52:45 +030057 MSC_READ(MSC01_PCI_IACK, irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 irq &= 0xff;
59 break;
Chris Dearmanb72c0522007-04-27 15:58:41 +010060 case MIPS_REVISION_SCON_GT64120:
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 irq = GT_READ(GT_PCI0_IACK_OFS);
62 irq &= 0xff;
63 break;
Chris Dearmanb72c0522007-04-27 15:58:41 +010064 case MIPS_REVISION_SCON_BONITO:
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 /* The following will generate a PCI IACK cycle on the
66 * Bonito controller. It's a little bit kludgy, but it
67 * was the easiest way to implement it in hardware at
68 * the given time.
69 */
70 BONITO_PCIMAP_CFG = 0x20000;
71
72 /* Flush Bonito register block */
Ralf Baechle6be63bb2011-03-29 11:48:22 +020073 (void) BONITO_PCIMAP_CFG;
Ralf Baechle70342282013-01-22 12:59:30 +010074 iob(); /* sync */
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Chris Dearmanaccfd352009-07-10 01:53:54 -070076 irq = __raw_readl((u32 *)_pcictrl_bonito_pcicfg);
Ralf Baechle70342282013-01-22 12:59:30 +010077 iob(); /* sync */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 irq &= 0xff;
79 BONITO_PCIMAP_CFG = 0;
80 break;
81 default:
Steven J. Hill5792bf62014-01-01 16:35:32 +010082 pr_emerg("Unknown system controller.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 return -1;
84 }
85 return irq;
86}
87
Ralf Baechlee01402b2005-07-14 15:57:16 +000088static inline int get_int(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070089{
90 unsigned long flags;
Ralf Baechlee01402b2005-07-14 15:57:16 +000091 int irq;
Ralf Baechlea963dc72010-02-27 12:53:32 +010092 raw_spin_lock_irqsave(&mips_irq_lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Ralf Baechlee01402b2005-07-14 15:57:16 +000094 irq = mips_pcibios_iack();
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
96 /*
Ralf Baechle479a0e32005-08-16 15:44:06 +000097 * The only way we can decide if an interrupt is spurious
98 * is by checking the 8259 registers. This needs a spinlock
99 * on an SMP system, so leave it up to the generic code...
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Ralf Baechlea963dc72010-02-27 12:53:32 +0100102 raw_spin_unlock_irqrestore(&mips_irq_lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Ralf Baechlee01402b2005-07-14 15:57:16 +0000104 return irq;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105}
106
Ralf Baechle937a8012006-10-07 19:44:33 +0100107static void malta_hw0_irqdispatch(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108{
109 int irq;
110
Ralf Baechlee01402b2005-07-14 15:57:16 +0000111 irq = get_int();
Ralf Baechle41c594a2006-04-05 09:45:45 +0100112 if (irq < 0) {
Dmitri Vorobievcd80d542008-01-24 19:52:54 +0300113 /* interrupt has already been cleared */
114 return;
Ralf Baechle41c594a2006-04-05 09:45:45 +0100115 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Ralf Baechle937a8012006-10-07 19:44:33 +0100117 do_IRQ(MALTA_INT_BASE + irq);
Deng-Cheng Zhu13361132013-10-30 15:52:10 -0500118
Deng-Cheng Zhu9c1f6e02014-02-28 10:23:01 -0800119#ifdef CONFIG_MIPS_VPE_APSP_API_MT
Deng-Cheng Zhu13361132013-10-30 15:52:10 -0500120 if (aprp_hook)
121 aprp_hook();
122#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123}
124
Andrew Bresticker18743d22014-09-18 14:47:24 -0700125static irqreturn_t i8259_handler(int irq, void *dev_id)
Ralf Baechle39b8d522008-04-28 17:14:26 +0100126{
Andrew Bresticker18743d22014-09-18 14:47:24 -0700127 malta_hw0_irqdispatch();
128 return IRQ_HANDLED;
Ralf Baechle39b8d522008-04-28 17:14:26 +0100129}
130
Ralf Baechle937a8012006-10-07 19:44:33 +0100131static void corehi_irqdispatch(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132{
Ralf Baechle937a8012006-10-07 19:44:33 +0100133 unsigned int intedge, intsteer, pcicmd, pcibadaddr;
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300134 unsigned int pcimstat, intisr, inten, intpol;
Ralf Baechle21a151d2007-10-11 23:46:15 +0100135 unsigned int intrcause, datalo, datahi;
Ralf Baechleba38cdf2006-10-15 09:17:43 +0100136 struct pt_regs *regs = get_irq_regs();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Steven J. Hill5792bf62014-01-01 16:35:32 +0100138 pr_emerg("CoreHI interrupt, shouldn't happen, we die here!\n");
139 pr_emerg("epc : %08lx\nStatus: %08lx\n"
140 "Cause : %08lx\nbadVaddr : %08lx\n",
141 regs->cp0_epc, regs->cp0_status,
142 regs->cp0_cause, regs->cp0_badvaddr);
Ralf Baechlee01402b2005-07-14 15:57:16 +0000143
144 /* Read all the registers and then print them as there is a
145 problem with interspersed printk's upsetting the Bonito controller.
146 Do it for the others too.
147 */
148
Chris Dearmanb72c0522007-04-27 15:58:41 +0100149 switch (mips_revision_sconid) {
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300150 case MIPS_REVISION_SCON_SOCIT:
Chris Dearmanb72c0522007-04-27 15:58:41 +0100151 case MIPS_REVISION_SCON_ROCIT:
152 case MIPS_REVISION_SCON_SOCITSC:
153 case MIPS_REVISION_SCON_SOCITSCP:
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300154 ll_msc_irq();
155 break;
156 case MIPS_REVISION_SCON_GT64120:
157 intrcause = GT_READ(GT_INTRCAUSE_OFS);
158 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
159 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
Steven J. Hill5792bf62014-01-01 16:35:32 +0100160 pr_emerg("GT_INTRCAUSE = %08x\n", intrcause);
161 pr_emerg("GT_CPUERR_ADDR = %02x%08x\n",
Dmitri Vorobiev8216d342008-01-24 19:52:42 +0300162 datahi, datalo);
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300163 break;
164 case MIPS_REVISION_SCON_BONITO:
165 pcibadaddr = BONITO_PCIBADADDR;
166 pcimstat = BONITO_PCIMSTAT;
167 intisr = BONITO_INTISR;
168 inten = BONITO_INTEN;
169 intpol = BONITO_INTPOL;
170 intedge = BONITO_INTEDGE;
171 intsteer = BONITO_INTSTEER;
172 pcicmd = BONITO_PCICMD;
Steven J. Hill5792bf62014-01-01 16:35:32 +0100173 pr_emerg("BONITO_INTISR = %08x\n", intisr);
174 pr_emerg("BONITO_INTEN = %08x\n", inten);
175 pr_emerg("BONITO_INTPOL = %08x\n", intpol);
176 pr_emerg("BONITO_INTEDGE = %08x\n", intedge);
177 pr_emerg("BONITO_INTSTEER = %08x\n", intsteer);
178 pr_emerg("BONITO_PCICMD = %08x\n", pcicmd);
179 pr_emerg("BONITO_PCIBADADDR = %08x\n", pcibadaddr);
180 pr_emerg("BONITO_PCIMSTAT = %08x\n", pcimstat);
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300181 break;
182 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300184 die("CoreHi interrupt", regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185}
186
Andrew Bresticker18743d22014-09-18 14:47:24 -0700187static irqreturn_t corehi_handler(int irq, void *dev_id)
188{
189 corehi_irqdispatch();
190 return IRQ_HANDLED;
191}
192
Ralf Baechle39b8d522008-04-28 17:14:26 +0100193#ifdef CONFIG_MIPS_MT_SMP
194
Ralf Baechle39b8d522008-04-28 17:14:26 +0100195#define MIPS_CPU_IPI_RESCHED_IRQ 0 /* SW int 0 for resched */
196#define C_RESCHED C_SW0
197#define MIPS_CPU_IPI_CALL_IRQ 1 /* SW int 1 for resched */
198#define C_CALL C_SW1
199static int cpu_ipi_resched_irq, cpu_ipi_call_irq;
200
201static void ipi_resched_dispatch(void)
202{
203 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ);
204}
205
206static void ipi_call_dispatch(void)
207{
208 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ);
209}
210
211static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
212{
Deng-Cheng Zhu9c1f6e02014-02-28 10:23:01 -0800213#ifdef CONFIG_MIPS_VPE_APSP_API_CMP
Deng-Cheng Zhu13361132013-10-30 15:52:10 -0500214 if (aprp_hook)
215 aprp_hook();
216#endif
217
Peter Zijlstra184748c2011-04-05 17:23:39 +0200218 scheduler_ipi();
219
Ralf Baechle39b8d522008-04-28 17:14:26 +0100220 return IRQ_HANDLED;
221}
222
223static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
224{
Alex Smith4ace6132015-07-24 16:57:49 +0100225 generic_smp_call_function_interrupt();
Ralf Baechle39b8d522008-04-28 17:14:26 +0100226
227 return IRQ_HANDLED;
228}
229
230static struct irqaction irq_resched = {
231 .handler = ipi_resched_interrupt,
Yong Zhang8b5690f2011-11-22 14:38:03 +0000232 .flags = IRQF_PERCPU,
Ralf Baechle39b8d522008-04-28 17:14:26 +0100233 .name = "IPI_resched"
234};
235
236static struct irqaction irq_call = {
237 .handler = ipi_call_interrupt,
Yong Zhang8b5690f2011-11-22 14:38:03 +0000238 .flags = IRQF_PERCPU,
Ralf Baechle39b8d522008-04-28 17:14:26 +0100239 .name = "IPI_call"
240};
Andrew Bresticker18743d22014-09-18 14:47:24 -0700241#endif /* CONFIG_MIPS_MT_SMP */
Ralf Baechle39b8d522008-04-28 17:14:26 +0100242
Ralf Baechlee01402b2005-07-14 15:57:16 +0000243static struct irqaction i8259irq = {
Andrew Bresticker18743d22014-09-18 14:47:24 -0700244 .handler = i8259_handler,
Wu Zhangjin5a4a4ad2011-07-23 12:41:24 +0000245 .name = "XT-PIC cascade",
246 .flags = IRQF_NO_THREAD,
Ralf Baechlee01402b2005-07-14 15:57:16 +0000247};
248
249static struct irqaction corehi_irqaction = {
Andrew Bresticker18743d22014-09-18 14:47:24 -0700250 .handler = corehi_handler,
Wu Zhangjin5a4a4ad2011-07-23 12:41:24 +0000251 .name = "CoreHi",
252 .flags = IRQF_NO_THREAD,
Ralf Baechlee01402b2005-07-14 15:57:16 +0000253};
254
Steven J. Hill5792bf62014-01-01 16:35:32 +0100255static msc_irqmap_t msc_irqmap[] __initdata = {
Ralf Baechlee01402b2005-07-14 15:57:16 +0000256 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
257 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
258};
Steven J. Hill5792bf62014-01-01 16:35:32 +0100259static int msc_nr_irqs __initdata = ARRAY_SIZE(msc_irqmap);
Ralf Baechlee01402b2005-07-14 15:57:16 +0000260
Steven J. Hill5792bf62014-01-01 16:35:32 +0100261static msc_irqmap_t msc_eicirqmap[] __initdata = {
Ralf Baechlee01402b2005-07-14 15:57:16 +0000262 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
263 {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0},
264 {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0},
265 {MSC01E_INT_SMI, MSC01_IRQ_LEVEL, 0},
266 {MSC01E_INT_COREHI, MSC01_IRQ_LEVEL, 0},
267 {MSC01E_INT_CORELO, MSC01_IRQ_LEVEL, 0},
268 {MSC01E_INT_TMR, MSC01_IRQ_EDGE, 0},
269 {MSC01E_INT_PCI, MSC01_IRQ_LEVEL, 0},
270 {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0},
271 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
272};
Ralf Baechle39b8d522008-04-28 17:14:26 +0100273
Steven J. Hill5792bf62014-01-01 16:35:32 +0100274static int msc_nr_eicirqs __initdata = ARRAY_SIZE(msc_eicirqmap);
Ralf Baechlee01402b2005-07-14 15:57:16 +0000275
Chris Dearman7098f742009-07-10 01:54:09 -0700276void __init arch_init_ipiirq(int irq, struct irqaction *action)
277{
278 setup_irq(irq, action);
Thomas Gleixnere4ec7982011-03-27 15:19:28 +0200279 irq_set_handler(irq, handle_percpu_irq);
Chris Dearman7098f742009-07-10 01:54:09 -0700280}
281
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282void __init arch_init_irq(void)
283{
Andrew Bresticker18743d22014-09-18 14:47:24 -0700284 int corehi_irq, i8259_irq;
285
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 init_i8259_irqs();
Ralf Baechlee01402b2005-07-14 15:57:16 +0000287
288 if (!cpu_has_veic)
Atsushi Nemoto97dcb822007-01-08 02:14:29 +0900289 mips_cpu_irq_init();
Ralf Baechlee01402b2005-07-14 15:57:16 +0000290
Paul Burton237036d2014-01-15 10:31:54 +0000291 if (mips_cm_present()) {
292 write_gcr_gic_base(GIC_BASE_ADDR | CM_GCR_GIC_BASE_GICEN_MSK);
Ralf Baechle39b8d522008-04-28 17:14:26 +0100293 gic_present = 1;
294 } else {
Jaidev Patwardhan05cf2072009-07-10 01:54:25 -0700295 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) {
Andrew Bresticker609ead02014-10-20 12:03:51 -0700296 _msc01_biu_base = ioremap_nocache(MSC01_BIU_REG_BASE,
Jaidev Patwardhan05cf2072009-07-10 01:54:25 -0700297 MSC01_BIU_ADDRSPACE_SZ);
Andrew Bresticker609ead02014-10-20 12:03:51 -0700298 gic_present =
299 (__raw_readl(_msc01_biu_base + MSC01_SC_CFG_OFS) &
300 MSC01_SC_CFG_GICPRES_MSK) >>
301 MSC01_SC_CFG_GICPRES_SHF;
Jaidev Patwardhan05cf2072009-07-10 01:54:25 -0700302 }
Ralf Baechle39b8d522008-04-28 17:14:26 +0100303 }
304 if (gic_present)
Chris Dearman7098f742009-07-10 01:54:09 -0700305 pr_debug("GIC present\n");
Ralf Baechle39b8d522008-04-28 17:14:26 +0100306
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300307 switch (mips_revision_sconid) {
308 case MIPS_REVISION_SCON_SOCIT:
309 case MIPS_REVISION_SCON_ROCIT:
Ralf Baechlee01402b2005-07-14 15:57:16 +0000310 if (cpu_has_veic)
Dmitri Vorobievf8071492008-01-24 19:52:47 +0300311 init_msc_irqs(MIPS_MSC01_IC_REG_BASE,
312 MSC01E_INT_BASE, msc_eicirqmap,
313 msc_nr_eicirqs);
Ralf Baechlee01402b2005-07-14 15:57:16 +0000314 else
Dmitri Vorobievf8071492008-01-24 19:52:47 +0300315 init_msc_irqs(MIPS_MSC01_IC_REG_BASE,
316 MSC01C_INT_BASE, msc_irqmap,
317 msc_nr_irqs);
Chris Dearmand725cf32007-05-08 14:05:39 +0100318 break;
319
Dmitri Vorobievaf825582008-01-24 19:52:45 +0300320 case MIPS_REVISION_SCON_SOCITSC:
321 case MIPS_REVISION_SCON_SOCITSCP:
Chris Dearmand725cf32007-05-08 14:05:39 +0100322 if (cpu_has_veic)
Dmitri Vorobievf8071492008-01-24 19:52:47 +0300323 init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE,
324 MSC01E_INT_BASE, msc_eicirqmap,
325 msc_nr_eicirqs);
Chris Dearmand725cf32007-05-08 14:05:39 +0100326 else
Dmitri Vorobievf8071492008-01-24 19:52:47 +0300327 init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE,
328 MSC01C_INT_BASE, msc_irqmap,
329 msc_nr_irqs);
Ralf Baechlee01402b2005-07-14 15:57:16 +0000330 }
331
Ralf Baechle39b8d522008-04-28 17:14:26 +0100332 if (gic_present) {
Ralf Baechle39b8d522008-04-28 17:14:26 +0100333 int i;
Andrew Bresticker18743d22014-09-18 14:47:24 -0700334
335 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, MIPSCPU_INT_GIC,
336 MIPS_GIC_IRQ_BASE);
Paul Burton237036d2014-01-15 10:31:54 +0000337 if (!mips_cm_present()) {
Ralf Baechle39b8d522008-04-28 17:14:26 +0100338 /* Enable the GIC */
Andrew Bresticker609ead02014-10-20 12:03:51 -0700339 i = __raw_readl(_msc01_biu_base + MSC01_SC_CFG_OFS);
340 __raw_writel(i | (0x1 << MSC01_SC_CFG_GICENA_SHF),
341 _msc01_biu_base + MSC01_SC_CFG_OFS);
Ralf Baechle39b8d522008-04-28 17:14:26 +0100342 pr_debug("GIC Enabled\n");
343 }
Andrew Bresticker18743d22014-09-18 14:47:24 -0700344 i8259_irq = MIPS_GIC_IRQ_BASE + GIC_INT_I8259A;
345 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI;
Ralf Baechle39b8d522008-04-28 17:14:26 +0100346 } else {
Chris Dearman7098f742009-07-10 01:54:09 -0700347#if defined(CONFIG_MIPS_MT_SMP)
Ralf Baechle39b8d522008-04-28 17:14:26 +0100348 /* set up ipi interrupts */
349 if (cpu_has_veic) {
350 set_vi_handler (MSC01E_INT_SW0, ipi_resched_dispatch);
351 set_vi_handler (MSC01E_INT_SW1, ipi_call_dispatch);
352 cpu_ipi_resched_irq = MSC01E_INT_SW0;
353 cpu_ipi_call_irq = MSC01E_INT_SW1;
354 } else {
Steven J. Hill5792bf62014-01-01 16:35:32 +0100355 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE +
356 MIPS_CPU_IPI_RESCHED_IRQ;
357 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE +
358 MIPS_CPU_IPI_CALL_IRQ;
Ralf Baechle39b8d522008-04-28 17:14:26 +0100359 }
Chris Dearman7098f742009-07-10 01:54:09 -0700360 arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched);
361 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call);
Ralf Baechle39b8d522008-04-28 17:14:26 +0100362#endif
Andrew Bresticker18743d22014-09-18 14:47:24 -0700363 if (cpu_has_veic) {
364 set_vi_handler(MSC01E_INT_I8259A,
365 malta_hw0_irqdispatch);
366 set_vi_handler(MSC01E_INT_COREHI,
367 corehi_irqdispatch);
368 i8259_irq = MSC01E_INT_BASE + MSC01E_INT_I8259A;
369 corehi_irq = MSC01E_INT_BASE + MSC01E_INT_COREHI;
370 } else {
371 i8259_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_I8259A;
372 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI;
373 }
Chris Dearman7098f742009-07-10 01:54:09 -0700374 }
Andrew Bresticker18743d22014-09-18 14:47:24 -0700375
376 setup_irq(i8259_irq, &i8259irq);
377 setup_irq(corehi_irq, &corehi_irqaction);
Ralf Baechle39b8d522008-04-28 17:14:26 +0100378}
379
380void malta_be_init(void)
381{
Steven J. Hill5792bf62014-01-01 16:35:32 +0100382 /* Could change CM error mask register. */
Ralf Baechle39b8d522008-04-28 17:14:26 +0100383}
384
Ralf Baechle39b8d522008-04-28 17:14:26 +0100385int malta_be_handler(struct pt_regs *regs, int is_fixup)
386{
387 /* This duplicates the handling in do_be which seems wrong */
388 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
389
Markos Chandras3885c2b2015-07-09 10:40:47 +0100390 mips_cm_error_report();
Ralf Baechle39b8d522008-04-28 17:14:26 +0100391
392 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393}