Anoop P A | 088f387 | 2011-01-25 13:51:03 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. |
| 3 | * Copyright (C) 2001 Ralf Baechle |
| 4 | * Copyright (C) 2010 PMC-Sierra, Inc. |
| 5 | * |
| 6 | * VSMP support for MSP platforms . Derived from malta vsmp support. |
| 7 | * |
| 8 | * This program is free software; you can distribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License (Version 2) as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | * for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 20 | * |
| 21 | */ |
| 22 | #include <linux/smp.h> |
| 23 | #include <linux/interrupt.h> |
| 24 | |
| 25 | #ifdef CONFIG_MIPS_MT_SMP |
| 26 | #define MIPS_CPU_IPI_RESCHED_IRQ 0 /* SW int 0 for resched */ |
| 27 | #define MIPS_CPU_IPI_CALL_IRQ 1 /* SW int 1 for call */ |
| 28 | |
| 29 | |
| 30 | static void ipi_resched_dispatch(void) |
| 31 | { |
| 32 | do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ); |
| 33 | } |
| 34 | |
| 35 | static void ipi_call_dispatch(void) |
| 36 | { |
| 37 | do_IRQ(MIPS_CPU_IPI_CALL_IRQ); |
| 38 | } |
| 39 | |
| 40 | static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) |
| 41 | { |
| 42 | return IRQ_HANDLED; |
| 43 | } |
| 44 | |
| 45 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) |
| 46 | { |
| 47 | smp_call_function_interrupt(); |
| 48 | |
| 49 | return IRQ_HANDLED; |
| 50 | } |
| 51 | |
| 52 | static struct irqaction irq_resched = { |
| 53 | .handler = ipi_resched_interrupt, |
Yong Zhang | 8b5690f | 2011-11-22 14:38:03 +0000 | [diff] [blame] | 54 | .flags = IRQF_PERCPU, |
Anoop P A | 088f387 | 2011-01-25 13:51:03 +0530 | [diff] [blame] | 55 | .name = "IPI_resched" |
| 56 | }; |
| 57 | |
| 58 | static struct irqaction irq_call = { |
| 59 | .handler = ipi_call_interrupt, |
Yong Zhang | 8b5690f | 2011-11-22 14:38:03 +0000 | [diff] [blame] | 60 | .flags = IRQF_PERCPU, |
Anoop P A | 088f387 | 2011-01-25 13:51:03 +0530 | [diff] [blame] | 61 | .name = "IPI_call" |
| 62 | }; |
| 63 | |
| 64 | void __init arch_init_ipiirq(int irq, struct irqaction *action) |
| 65 | { |
| 66 | setup_irq(irq, action); |
Thomas Gleixner | e4ec798 | 2011-03-27 15:19:28 +0200 | [diff] [blame] | 67 | irq_set_handler(irq, handle_percpu_irq); |
Anoop P A | 088f387 | 2011-01-25 13:51:03 +0530 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | void __init msp_vsmp_int_init(void) |
| 71 | { |
| 72 | set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); |
| 73 | set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); |
| 74 | arch_init_ipiirq(MIPS_CPU_IPI_RESCHED_IRQ, &irq_resched); |
| 75 | arch_init_ipiirq(MIPS_CPU_IPI_CALL_IRQ, &irq_call); |
| 76 | } |
| 77 | #endif /* CONFIG_MIPS_MT_SMP */ |