blob: 02cff7efc8342aa6ea302c4aa46b21269ebf3561 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Roman Zippel0aa78102006-06-25 05:47:02 -07002#include <linux/interrupt.h>
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +02003#include <linux/irq.h>
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +02004
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <asm/traps.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <asm/apollohw.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +02008unsigned int apollo_irq_startup(struct irq_data *data)
Roman Zippel0aa78102006-06-25 05:47:02 -07009{
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020010 unsigned int irq = data->irq;
11
Roman Zippel0aa78102006-06-25 05:47:02 -070012 if (irq < 8)
13 *(volatile unsigned char *)(pica+1) &= ~(1 << irq);
14 else
15 *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8));
16 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070017}
18
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020019void apollo_irq_shutdown(struct irq_data *data)
Roman Zippel0aa78102006-06-25 05:47:02 -070020{
Geert Uytterhoevene8abf5e2011-04-17 22:53:04 +020021 unsigned int irq = data->irq;
22
Roman Zippel0aa78102006-06-25 05:47:02 -070023 if (irq < 8)
24 *(volatile unsigned char *)(pica+1) |= (1 << irq);
25 else
26 *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8));
Linus Torvalds1da177e2005-04-16 15:20:36 -070027}
28
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020029void apollo_irq_eoi(struct irq_data *data)
30{
31 *(volatile unsigned char *)(pica) = 0x20;
32 *(volatile unsigned char *)(picb) = 0x20;
33}
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020034
Geert Uytterhoevenc288bf22011-04-13 22:31:28 +020035static struct irq_chip apollo_irq_chip = {
Roman Zippel0aa78102006-06-25 05:47:02 -070036 .name = "apollo",
Geert Uytterhoevenc288bf22011-04-13 22:31:28 +020037 .irq_startup = apollo_irq_startup,
38 .irq_shutdown = apollo_irq_shutdown,
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020039 .irq_eoi = apollo_irq_eoi,
Roman Zippel0aa78102006-06-25 05:47:02 -070040};
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Al Viro66a3f822007-07-20 04:33:28 +010043void __init dn_init_IRQ(void)
Roman Zippel0aa78102006-06-25 05:47:02 -070044{
Geert Uytterhoevenf30a6482011-09-11 11:54:50 +020045 m68k_setup_user_interrupt(VEC_USER + 96, 16);
Geert Uytterhoevenbc7485a2011-08-18 14:45:57 +020046 m68k_setup_irq_controller(&apollo_irq_chip, handle_fasteoi_irq,
Geert Uytterhoevenedb34722011-06-01 11:15:21 +020047 IRQ_APOLLO, 16);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}