xref: /linux/arch/m68k/apollo/dn_ints.c (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
20aa78106SRoman Zippel #include <linux/interrupt.h>
3bc7485acSGeert Uytterhoeven #include <linux/irq.h>
4bc7485acSGeert Uytterhoeven 
51da177e4SLinus Torvalds #include <asm/traps.h>
61da177e4SLinus Torvalds #include <asm/apollohw.h>
71da177e4SLinus Torvalds 
8*676ca3c3SGeert Uytterhoeven #include "apollo.h"
9*676ca3c3SGeert Uytterhoeven 
apollo_irq_startup(struct irq_data * data)1055775fe9SGeert Uytterhoeven static unsigned int apollo_irq_startup(struct irq_data *data)
110aa78106SRoman Zippel {
12e8abf5e7SGeert Uytterhoeven 	unsigned int irq = data->irq;
13e8abf5e7SGeert Uytterhoeven 
141da177e4SLinus Torvalds 	if (irq < 8)
151da177e4SLinus Torvalds 		*(volatile unsigned char *)(pica+1) &= ~(1 << irq);
161da177e4SLinus Torvalds 	else
171da177e4SLinus Torvalds 		*(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8));
181da177e4SLinus Torvalds 	return 0;
191da177e4SLinus Torvalds }
201da177e4SLinus Torvalds 
apollo_irq_shutdown(struct irq_data * data)2155775fe9SGeert Uytterhoeven static void apollo_irq_shutdown(struct irq_data *data)
220aa78106SRoman Zippel {
23e8abf5e7SGeert Uytterhoeven 	unsigned int irq = data->irq;
24e8abf5e7SGeert Uytterhoeven 
251da177e4SLinus Torvalds 	if (irq < 8)
261da177e4SLinus Torvalds 		*(volatile unsigned char *)(pica+1) |= (1 << irq);
271da177e4SLinus Torvalds 	else
281da177e4SLinus Torvalds 		*(volatile unsigned char *)(picb+1) |= (1 << (irq - 8));
291da177e4SLinus Torvalds }
301da177e4SLinus Torvalds 
apollo_irq_eoi(struct irq_data * data)3155775fe9SGeert Uytterhoeven static void apollo_irq_eoi(struct irq_data *data)
32bc7485acSGeert Uytterhoeven {
33bc7485acSGeert Uytterhoeven 	*(volatile unsigned char *)(pica) = 0x20;
34bc7485acSGeert Uytterhoeven 	*(volatile unsigned char *)(picb) = 0x20;
35bc7485acSGeert Uytterhoeven }
36bc7485acSGeert Uytterhoeven 
37c288bf25SGeert Uytterhoeven static struct irq_chip apollo_irq_chip = {
380aa78106SRoman Zippel 	.name           = "apollo",
39c288bf25SGeert Uytterhoeven 	.irq_startup    = apollo_irq_startup,
40c288bf25SGeert Uytterhoeven 	.irq_shutdown   = apollo_irq_shutdown,
41bc7485acSGeert Uytterhoeven 	.irq_eoi	= apollo_irq_eoi,
420aa78106SRoman Zippel };
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds 
dn_init_IRQ(void)4566a3f820SAl Viro void __init dn_init_IRQ(void)
460aa78106SRoman Zippel {
47f30a6484SGeert Uytterhoeven 	m68k_setup_user_interrupt(VEC_USER + 96, 16);
48bc7485acSGeert Uytterhoeven 	m68k_setup_irq_controller(&apollo_irq_chip, handle_fasteoi_irq,
49edb34725SGeert Uytterhoeven 				  IRQ_APOLLO, 16);
501da177e4SLinus Torvalds }
51