1 // SPDX-License-Identifier: GPL-2.0
3 * Baboon Custom IC Management
5 * The Baboon custom IC controls the IDE, PCMCIA and media bay on the
6 * PowerBook 190. It multiplexes multiple interrupt sources onto the
7 * Nubus slot $C interrupt.
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/irq.h>
14 #include <asm/macintosh.h>
15 #include <asm/macints.h>
16 #include <asm/mac_baboon.h>
19 static volatile struct baboon
*baboon
;
22 extern int macide_ack_intr(struct ata_channel
*);
26 * Baboon initialization.
29 void __init
baboon_init(void)
31 if (macintosh_config
->ident
!= MAC_MODEL_PB190
) {
37 baboon
= (struct baboon
*) BABOON_BASE
;
40 pr_debug("Baboon detected at %p\n", baboon
);
44 * Baboon interrupt handler. This works a lot like a VIA.
47 static void baboon_irq(struct irq_desc
*desc
)
52 events
= baboon
->mb_ifr
& 0x07;
56 irq_num
= IRQ_BABOON_0
;
59 if (events
& irq_bit
) {
60 baboon
->mb_ifr
&= ~irq_bit
;
61 generic_handle_irq(irq_num
);
65 } while(events
>= irq_bit
);
67 if (baboon
->mb_ifr
& 0x02) macide_ack_intr(NULL
);
68 /* for now we need to smash all interrupts */
69 baboon
->mb_ifr
&= ~events
;
74 * Register the Baboon interrupt dispatcher on nubus slot $C.
77 void __init
baboon_register_interrupts(void)
79 irq_set_chained_handler(IRQ_NUBUS_C
, baboon_irq
);
83 * The means for masking individual Baboon interrupts remains a mystery.
84 * However, since we only use the IDE IRQ, we can just enable/disable all
85 * Baboon interrupts. If/when we handle more than one Baboon IRQ, we must
86 * either figure out how to mask them individually or else implement the
87 * same workaround that's used for NuBus slots (see nubus_disabled and
88 * via_nubus_irq_shutdown).
91 void baboon_irq_enable(int irq
)
93 mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C
));
96 void baboon_irq_disable(int irq
)
98 mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C
));