Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 1 | /* |
| 2 | * OpenRISC irq.c |
| 3 | * |
| 4 | * Linux architectural port borrowing liberally from similar works of |
| 5 | * others. All original copyrights apply as per the original source |
| 6 | * declaration. |
| 7 | * |
| 8 | * Modifications for the OpenRISC architecture: |
| 9 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version |
| 14 | * 2 of the License, or (at your option) any later version. |
| 15 | */ |
| 16 | |
Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/init.h> |
Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 19 | #include <linux/ftrace.h> |
| 20 | #include <linux/irq.h> |
Stefan Kristiansson | 4db8e6d | 2014-05-26 23:31:42 +0300 | [diff] [blame] | 21 | #include <linux/irqchip.h> |
Jonas Bonn | abdf8b5 | 2012-02-15 15:00:32 +0100 | [diff] [blame] | 22 | #include <linux/export.h> |
Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 23 | #include <linux/irqflags.h> |
| 24 | |
| 25 | /* read interrupt enabled status */ |
| 26 | unsigned long arch_local_save_flags(void) |
| 27 | { |
| 28 | return mfspr(SPR_SR) & (SPR_SR_IEE|SPR_SR_TEE); |
| 29 | } |
| 30 | EXPORT_SYMBOL(arch_local_save_flags); |
| 31 | |
| 32 | /* set interrupt enabled status */ |
| 33 | void arch_local_irq_restore(unsigned long flags) |
| 34 | { |
| 35 | mtspr(SPR_SR, ((mfspr(SPR_SR) & ~(SPR_SR_IEE|SPR_SR_TEE)) | flags)); |
| 36 | } |
| 37 | EXPORT_SYMBOL(arch_local_irq_restore); |
| 38 | |
Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 39 | void __init init_IRQ(void) |
| 40 | { |
Stefan Kristiansson | 4db8e6d | 2014-05-26 23:31:42 +0300 | [diff] [blame] | 41 | irqchip_init(); |
Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 42 | } |
| 43 | |
Stefan Kristiansson | 4db8e6d | 2014-05-26 23:31:42 +0300 | [diff] [blame] | 44 | static void (*handle_arch_irq)(struct pt_regs *); |
| 45 | |
| 46 | void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) |
Jonas Bonn | 816ebaa | 2011-06-04 22:18:56 +0300 | [diff] [blame] | 47 | { |
Stefan Kristiansson | 4db8e6d | 2014-05-26 23:31:42 +0300 | [diff] [blame] | 48 | handle_arch_irq = handle_irq; |
| 49 | } |
| 50 | |
Stefan Kristiansson | 4db8e6d | 2014-05-26 23:31:42 +0300 | [diff] [blame] | 51 | void __irq_entry do_IRQ(struct pt_regs *regs) |
| 52 | { |
| 53 | handle_arch_irq(regs); |
| 54 | } |