blob: 17be1e7e2df296dae497bebb81cd45d25184bd6d [file] [log] [blame]
Roman Zippel0aa78102006-06-25 05:47:02 -07001#include <linux/interrupt.h>
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +02002#include <linux/irq.h>
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +02003
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <asm/traps.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <asm/apollohw.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +02007unsigned int apollo_irq_startup(struct irq_data *data)
Roman Zippel0aa78102006-06-25 05:47:02 -07008{
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +02009 unsigned int irq = data->irq;
10
Roman Zippel0aa78102006-06-25 05:47:02 -070011 if (irq < 8)
12 *(volatile unsigned char *)(pica+1) &= ~(1 << irq);
13 else
14 *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8));
15 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070016}
17
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020018void apollo_irq_shutdown(struct irq_data *data)
Roman Zippel0aa78102006-06-25 05:47:02 -070019{
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020020 unsigned int irq = data->irq;
21
Roman Zippel0aa78102006-06-25 05:47:02 -070022 if (irq < 8)
23 *(volatile unsigned char *)(pica+1) |= (1 << irq);
24 else
25 *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8));
Linus Torvalds1da177e2005-04-16 15:20:36 -070026}
27
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020028void apollo_irq_eoi(struct irq_data *data)
29{
30 *(volatile unsigned char *)(pica) = 0x20;
31 *(volatile unsigned char *)(picb) = 0x20;
32}
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020033
Geert Uytterhoevenc288bf22011-04-13 22:31:28 +020034static struct irq_chip apollo_irq_chip = {
Roman Zippel0aa78102006-06-25 05:47:02 -070035 .name = "apollo",
Geert Uytterhoevenc288bf22011-04-13 22:31:28 +020036 .irq_startup = apollo_irq_startup,
37 .irq_shutdown = apollo_irq_shutdown,
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020038 .irq_eoi = apollo_irq_eoi,
Roman Zippel0aa78102006-06-25 05:47:02 -070039};
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Al Viro66a3f822007-07-20 04:33:28 +010042void __init dn_init_IRQ(void)
Roman Zippel0aa78102006-06-25 05:47:02 -070043{
Geert Uytterhoevenf30a6482011-09-11 11:54:50 +020044 m68k_setup_user_interrupt(VEC_USER + 96, 16);
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020045 m68k_setup_irq_controller(&apollo_irq_chip, handle_fasteoi_irq,
Geert Uytterhoevenedb34722011-06-01 11:15:21 +020046 IRQ_APOLLO, 16);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047}