2 * Baboon Custom IC Management
4 * The Baboon custom IC controls the IDE, PCMCIA and media bay on the
5 * PowerBook 190. It multiplexes multiple interrupt sources onto the
6 * Nubus slot $C interrupt.
9 #include <linux/types.h>
10 #include <linux/kernel.h>
12 #include <linux/delay.h>
13 #include <linux/init.h>
15 #include <asm/traps.h>
16 #include <asm/bootinfo.h>
17 #include <asm/macintosh.h>
18 #include <asm/macints.h>
19 #include <asm/mac_baboon.h>
21 /* #define DEBUG_BABOON */
22 /* #define DEBUG_IRQS */
25 static volatile struct baboon *baboon;
28 extern int macide_ack_intr(struct ata_channel *);
32 * Baboon initialization.
35 void __init baboon_init(void)
37 if (macintosh_config->ident != MAC_MODEL_PB190) {
43 baboon = (struct baboon *) BABOON_BASE;
46 printk("Baboon detected at %p\n", baboon);
50 * Baboon interrupt handler. This works a lot like a VIA.
53 static irqreturn_t baboon_irq(int irq, void *dev_id)
59 printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
60 (uint) baboon->mb_control, (uint) baboon->mb_ifr,
61 (uint) baboon->mb_status);
64 if (!(events = baboon->mb_ifr & 0x07))
67 irq_num = IRQ_BABOON_0;
70 if (events & irq_bit) {
71 baboon->mb_ifr &= ~irq_bit;
72 m68k_handle_int(irq_num);
76 } while(events >= irq_bit);
78 if (baboon->mb_ifr & 0x02) macide_ack_intr(NULL);
79 /* for now we need to smash all interrupts */
80 baboon->mb_ifr &= ~events;
86 * Register the Baboon interrupt dispatcher on nubus slot $C.
89 void __init baboon_register_interrupts(void)
91 request_irq(IRQ_NUBUS_C, baboon_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
92 "baboon", (void *) baboon);
95 void baboon_irq_enable(int irq) {
97 printk("baboon_irq_enable(%d)\n", irq);
99 /* FIXME: figure out how to mask and unmask baboon interrupt sources */
100 enable_irq(IRQ_NUBUS_C);
103 void baboon_irq_disable(int irq) {
105 printk("baboon_irq_disable(%d)\n", irq);
107 disable_irq(IRQ_NUBUS_C);
110 void baboon_irq_clear(int irq) {
111 int irq_idx = IRQ_IDX(irq);
113 baboon->mb_ifr &= ~(1 << irq_idx);
116 int baboon_irq_pending(int irq)
118 int irq_idx = IRQ_IDX(irq);
120 return baboon->mb_ifr & (1 << irq_idx);