blob: fc190b34b621f41021492b3ddbbbec1d63406185 [file] [log] [blame]
Roman Zippel0aa78102006-06-25 05:47:02 -07001#include <linux/interrupt.h>
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +02002#ifdef CONFIG_GENERIC_HARDIRQS
3#include <linux/irq.h>
4#else
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <asm/irq.h>
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +02006#endif
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <asm/traps.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <asm/apollohw.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020011#ifndef CONFIG_GENERIC_HARDIRQS
Roman Zippel0aa78102006-06-25 05:47:02 -070012void dn_process_int(unsigned int irq, struct pt_regs *fp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070013{
Geert Uytterhoeven1425df82011-07-01 20:39:19 +020014 do_IRQ(irq, fp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Roman Zippel0aa78102006-06-25 05:47:02 -070016 *(volatile unsigned char *)(pica)=0x20;
17 *(volatile unsigned char *)(picb)=0x20;
Linus Torvalds1da177e2005-04-16 15:20:36 -070018}
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020019#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020021unsigned int apollo_irq_startup(struct irq_data *data)
Roman Zippel0aa78102006-06-25 05:47:02 -070022{
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020023 unsigned int irq = data->irq;
24
Roman Zippel0aa78102006-06-25 05:47:02 -070025 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 Torvalds1da177e2005-04-16 15:20:36 -070030}
31
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020032void apollo_irq_shutdown(struct irq_data *data)
Roman Zippel0aa78102006-06-25 05:47:02 -070033{
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020034 unsigned int irq = data->irq;
35
Roman Zippel0aa78102006-06-25 05:47:02 -070036 if (irq < 8)
37 *(volatile unsigned char *)(pica+1) |= (1 << irq);
38 else
39 *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8));
Linus Torvalds1da177e2005-04-16 15:20:36 -070040}
41
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020042#ifdef CONFIG_GENERIC_HARDIRQS
43void 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 Uytterhoevenc288bf22011-04-13 22:31:28 +020050static struct irq_chip apollo_irq_chip = {
Roman Zippel0aa78102006-06-25 05:47:02 -070051 .name = "apollo",
Geert Uytterhoevenc288bf22011-04-13 22:31:28 +020052 .irq_startup = apollo_irq_startup,
53 .irq_shutdown = apollo_irq_shutdown,
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020054#ifdef CONFIG_GENERIC_HARDIRQS
55 .irq_eoi = apollo_irq_eoi,
56#endif
Roman Zippel0aa78102006-06-25 05:47:02 -070057};
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Al Viro66a3f822007-07-20 04:33:28 +010060void __init dn_init_IRQ(void)
Roman Zippel0aa78102006-06-25 05:47:02 -070061{
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020062#ifdef CONFIG_GENERIC_HARDIRQS
63 m68k_setup_user_interrupt(VEC_USER + 96, 16, NULL);
64#else
Roman Zippel0aa78102006-06-25 05:47:02 -070065 m68k_setup_user_interrupt(VEC_USER + 96, 16, dn_process_int);
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020066#endif
67 m68k_setup_irq_controller(&apollo_irq_chip, handle_fasteoi_irq,
Geert Uytterhoevenedb34722011-06-01 11:15:21 +020068 IRQ_APOLLO, 16);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069}