Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 1 | #include <linux/interrupt.h> |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 2 | #ifdef CONFIG_GENERIC_HARDIRQS |
| 3 | #include <linux/irq.h> |
| 4 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <asm/irq.h> |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 6 | #endif |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <asm/traps.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <asm/apollohw.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 11 | #ifndef CONFIG_GENERIC_HARDIRQS |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 12 | void dn_process_int(unsigned int irq, struct pt_regs *fp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | { |
Geert Uytterhoeven | 1425df8 | 2011-07-01 20:39:19 +0200 | [diff] [blame] | 14 | do_IRQ(irq, fp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 16 | *(volatile unsigned char *)(pica)=0x20; |
| 17 | *(volatile unsigned char *)(picb)=0x20; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | } |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 19 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Geert Uytterhoeven | e8abf5e | 2011-04-17 22:53:04 +0200 | [diff] [blame] | 21 | unsigned int apollo_irq_startup(struct irq_data *data) |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 22 | { |
Geert Uytterhoeven | e8abf5e | 2011-04-17 22:53:04 +0200 | [diff] [blame] | 23 | unsigned int irq = data->irq; |
| 24 | |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 25 | if (irq < 8) |
| 26 | *(volatile unsigned char *)(pica+1) &= ~(1 << irq); |
| 27 | else |
| 28 | *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8)); |
| 29 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | } |
| 31 | |
Geert Uytterhoeven | e8abf5e | 2011-04-17 22:53:04 +0200 | [diff] [blame] | 32 | void apollo_irq_shutdown(struct irq_data *data) |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 33 | { |
Geert Uytterhoeven | e8abf5e | 2011-04-17 22:53:04 +0200 | [diff] [blame] | 34 | unsigned int irq = data->irq; |
| 35 | |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 36 | if (irq < 8) |
| 37 | *(volatile unsigned char *)(pica+1) |= (1 << irq); |
| 38 | else |
| 39 | *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | } |
| 41 | |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 42 | #ifdef CONFIG_GENERIC_HARDIRQS |
| 43 | void apollo_irq_eoi(struct irq_data *data) |
| 44 | { |
| 45 | *(volatile unsigned char *)(pica) = 0x20; |
| 46 | *(volatile unsigned char *)(picb) = 0x20; |
| 47 | } |
| 48 | #endif |
| 49 | |
Geert Uytterhoeven | c288bf2 | 2011-04-13 22:31:28 +0200 | [diff] [blame] | 50 | static struct irq_chip apollo_irq_chip = { |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 51 | .name = "apollo", |
Geert Uytterhoeven | c288bf2 | 2011-04-13 22:31:28 +0200 | [diff] [blame] | 52 | .irq_startup = apollo_irq_startup, |
| 53 | .irq_shutdown = apollo_irq_shutdown, |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 54 | #ifdef CONFIG_GENERIC_HARDIRQS |
| 55 | .irq_eoi = apollo_irq_eoi, |
| 56 | #endif |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 57 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
Al Viro | 66a3f82 | 2007-07-20 04:33:28 +0100 | [diff] [blame] | 60 | void __init dn_init_IRQ(void) |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 61 | { |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 62 | #ifdef CONFIG_GENERIC_HARDIRQS |
| 63 | m68k_setup_user_interrupt(VEC_USER + 96, 16, NULL); |
| 64 | #else |
Roman Zippel | 0aa7810 | 2006-06-25 05:47:02 -0700 | [diff] [blame] | 65 | m68k_setup_user_interrupt(VEC_USER + 96, 16, dn_process_int); |
Geert Uytterhoeven | bc7485a | 2011-08-18 14:45:57 +0200 | [diff] [blame^] | 66 | #endif |
| 67 | m68k_setup_irq_controller(&apollo_irq_chip, handle_fasteoi_irq, |
Geert Uytterhoeven | edb3472 | 2011-06-01 11:15:21 +0200 | [diff] [blame] | 68 | IRQ_APOLLO, 16); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } |