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*55775fe9SGeert Uytterhoeven static unsigned int apollo_irq_startup(struct irq_data *data) 90aa78106SRoman Zippel { 10e8abf5e7SGeert Uytterhoeven unsigned int irq = data->irq; 11e8abf5e7SGeert Uytterhoeven 121da177e4SLinus Torvalds if (irq < 8) 131da177e4SLinus Torvalds *(volatile unsigned char *)(pica+1) &= ~(1 << irq); 141da177e4SLinus Torvalds else 151da177e4SLinus Torvalds *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8)); 161da177e4SLinus Torvalds return 0; 171da177e4SLinus Torvalds } 181da177e4SLinus Torvalds 19*55775fe9SGeert Uytterhoeven static void apollo_irq_shutdown(struct irq_data *data) 200aa78106SRoman Zippel { 21e8abf5e7SGeert Uytterhoeven unsigned int irq = data->irq; 22e8abf5e7SGeert Uytterhoeven 231da177e4SLinus Torvalds if (irq < 8) 241da177e4SLinus Torvalds *(volatile unsigned char *)(pica+1) |= (1 << irq); 251da177e4SLinus Torvalds else 261da177e4SLinus Torvalds *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8)); 271da177e4SLinus Torvalds } 281da177e4SLinus Torvalds 29*55775fe9SGeert Uytterhoeven static void apollo_irq_eoi(struct irq_data *data) 30bc7485acSGeert Uytterhoeven { 31bc7485acSGeert Uytterhoeven *(volatile unsigned char *)(pica) = 0x20; 32bc7485acSGeert Uytterhoeven *(volatile unsigned char *)(picb) = 0x20; 33bc7485acSGeert Uytterhoeven } 34bc7485acSGeert Uytterhoeven 35c288bf25SGeert Uytterhoeven static struct irq_chip apollo_irq_chip = { 360aa78106SRoman Zippel .name = "apollo", 37c288bf25SGeert Uytterhoeven .irq_startup = apollo_irq_startup, 38c288bf25SGeert Uytterhoeven .irq_shutdown = apollo_irq_shutdown, 39bc7485acSGeert Uytterhoeven .irq_eoi = apollo_irq_eoi, 400aa78106SRoman Zippel }; 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds 4366a3f820SAl Viro void __init dn_init_IRQ(void) 440aa78106SRoman Zippel { 45f30a6484SGeert Uytterhoeven m68k_setup_user_interrupt(VEC_USER + 96, 16); 46bc7485acSGeert Uytterhoeven m68k_setup_irq_controller(&apollo_irq_chip, handle_fasteoi_irq, 47edb34725SGeert Uytterhoeven IRQ_APOLLO, 16); 481da177e4SLinus Torvalds } 49