| 1 | /* |
| 2 | * linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code |
| 3 | * |
| 4 | * This file is subject to the terms and conditions of the GNU General Public |
| 5 | * License. See the file COPYING in the main directory of this archive |
| 6 | * for more details. |
| 7 | */ |
| 8 | |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/sched.h> |
| 12 | #include <linux/kernel_stat.h> |
| 13 | #include <linux/interrupt.h> |
| 14 | #include <asm/intersil.h> |
| 15 | #include <asm/oplib.h> |
| 16 | #include <asm/sun3ints.h> |
| 17 | #include <asm/irq_regs.h> |
| 18 | #include <linux/seq_file.h> |
| 19 | |
| 20 | #include "sun3.h" |
| 21 | |
| 22 | void sun3_disable_interrupts(void) |
| 23 | { |
| 24 | sun3_disable_irq(0); |
| 25 | } |
| 26 | |
| 27 | void sun3_enable_interrupts(void) |
| 28 | { |
| 29 | sun3_enable_irq(0); |
| 30 | } |
| 31 | |
| 32 | static unsigned char led_pattern[8] = { |
| 33 | (u8)~(0x80), (u8)~(0x01), |
| 34 | (u8)~(0x40), (u8)~(0x02), |
| 35 | (u8)~(0x20), (u8)~(0x04), |
| 36 | (u8)~(0x10), (u8)~(0x08) |
| 37 | }; |
| 38 | |
| 39 | volatile unsigned char* sun3_intreg; |
| 40 | |
| 41 | void sun3_enable_irq(unsigned int irq) |
| 42 | { |
| 43 | *sun3_intreg |= (1 << irq); |
| 44 | } |
| 45 | |
| 46 | void sun3_disable_irq(unsigned int irq) |
| 47 | { |
| 48 | *sun3_intreg &= ~(1 << irq); |
| 49 | } |
| 50 | |
| 51 | static irqreturn_t sun3_int7(int irq, void *dev_id) |
| 52 | { |
| 53 | unsigned int cnt; |
| 54 | |
| 55 | cnt = kstat_irqs_cpu(irq, 0); |
| 56 | if (!(cnt % 2000)) |
| 57 | sun3_leds(led_pattern[cnt % 16000 / 2000]); |
| 58 | return IRQ_HANDLED; |
| 59 | } |
| 60 | |
| 61 | static irqreturn_t sun3_int5(int irq, void *dev_id) |
| 62 | { |
| 63 | unsigned long flags; |
| 64 | unsigned int cnt; |
| 65 | |
| 66 | local_irq_save(flags); |
| 67 | #ifdef CONFIG_SUN3 |
| 68 | intersil_clear(); |
| 69 | #endif |
| 70 | sun3_disable_irq(5); |
| 71 | sun3_enable_irq(5); |
| 72 | #ifdef CONFIG_SUN3 |
| 73 | intersil_clear(); |
| 74 | #endif |
| 75 | legacy_timer_tick(1); |
| 76 | cnt = kstat_irqs_cpu(irq, 0); |
| 77 | if (!(cnt % 20)) |
| 78 | sun3_leds(led_pattern[cnt % 160 / 20]); |
| 79 | local_irq_restore(flags); |
| 80 | return IRQ_HANDLED; |
| 81 | } |
| 82 | |
| 83 | static irqreturn_t sun3_vec255(int irq, void *dev_id) |
| 84 | { |
| 85 | return IRQ_HANDLED; |
| 86 | } |
| 87 | |
| 88 | void __init sun3_init_IRQ(void) |
| 89 | { |
| 90 | *sun3_intreg = 1; |
| 91 | |
| 92 | m68k_setup_user_interrupt(VEC_USER, 128); |
| 93 | |
| 94 | if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "clock", NULL)) |
| 95 | pr_err("Couldn't register %s interrupt\n", "int5"); |
| 96 | if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "nmi", NULL)) |
| 97 | pr_err("Couldn't register %s interrupt\n", "int7"); |
| 98 | if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL)) |
| 99 | pr_err("Couldn't register %s interrupt\n", "vec255"); |
| 100 | } |