Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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/segment.h> |
| 15 | #include <asm/intersil.h> |
| 16 | #include <asm/oplib.h> |
| 17 | #include <asm/sun3ints.h> |
| 18 | #include <linux/seq_file.h> |
| 19 | |
| 20 | extern void sun3_leds (unsigned char); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | int led_pattern[8] = { |
| 33 | ~(0x80), ~(0x01), |
| 34 | ~(0x40), ~(0x02), |
| 35 | ~(0x20), ~(0x04), |
| 36 | ~(0x10), ~(0x08) |
| 37 | }; |
| 38 | |
| 39 | volatile unsigned char* sun3_intreg; |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | void sun3_enable_irq(unsigned int irq) |
| 42 | { |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 43 | *sun3_intreg |= (1 << irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | void sun3_disable_irq(unsigned int irq) |
| 47 | { |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 48 | *sun3_intreg &= ~(1 << irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp) |
| 52 | { |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 53 | *sun3_intreg |= (1 << irq); |
| 54 | if (!(kstat_cpu(0).irqs[irq] % 2000)) |
| 55 | sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 16000) / 2000]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | return IRQ_HANDLED; |
| 57 | } |
| 58 | |
| 59 | static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp) |
| 60 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | #ifdef CONFIG_SUN3 |
| 62 | intersil_clear(); |
| 63 | #endif |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 64 | *sun3_intreg |= (1 << irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | #ifdef CONFIG_SUN3 |
| 66 | intersil_clear(); |
| 67 | #endif |
Atsushi Nemoto | 3171a03 | 2006-09-29 02:00:32 -0700 | [diff] [blame^] | 68 | do_timer(1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | #ifndef CONFIG_SMP |
| 70 | update_process_times(user_mode(fp)); |
| 71 | #endif |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 72 | if (!(kstat_cpu(0).irqs[irq] % 20)) |
| 73 | sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | return IRQ_HANDLED; |
| 75 | } |
| 76 | |
| 77 | static irqreturn_t sun3_vec255(int irq, void *dev_id, struct pt_regs *fp) |
| 78 | { |
| 79 | // intersil_clear(); |
| 80 | return IRQ_HANDLED; |
| 81 | } |
| 82 | |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 83 | static void sun3_inthandle(unsigned int irq, struct pt_regs *fp) |
| 84 | { |
| 85 | *sun3_intreg &= ~(1 << irq); |
| 86 | |
| 87 | m68k_handle_int(irq, fp); |
| 88 | } |
| 89 | |
| 90 | static struct irq_controller sun3_irq_controller = { |
| 91 | .name = "sun3", |
| 92 | .lock = SPIN_LOCK_UNLOCKED, |
| 93 | .startup = m68k_irq_startup, |
| 94 | .shutdown = m68k_irq_shutdown, |
| 95 | .enable = sun3_enable_irq, |
| 96 | .disable = sun3_disable_irq, |
| 97 | }; |
| 98 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | void sun3_init_IRQ(void) |
| 100 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | *sun3_intreg = 1; |
| 102 | |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 103 | m68k_setup_auto_interrupt(sun3_inthandle); |
| 104 | m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7); |
| 105 | m68k_setup_user_interrupt(VEC_USER, 192, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
Roman Zippel | ebba61d | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 107 | request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL); |
| 108 | request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL); |
| 109 | request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | } |