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>
11 #include <linux/irq.h>
13 #include <asm/macintosh.h>
14 #include <asm/macints.h>
15 #include <asm/mac_baboon.h>
18 static volatile struct baboon
*baboon
;
21 extern int macide_ack_intr(struct ata_channel
*);
25 * Baboon initialization.
28 void __init
baboon_init(void)
30 if (macintosh_config
->ident
!= MAC_MODEL_PB190
) {
36 baboon
= (struct baboon
*) BABOON_BASE
;
39 printk("Baboon detected at %p\n", baboon
);
43 * Baboon interrupt handler. This works a lot like a VIA.
46 static void baboon_irq(struct irq_desc
*desc
)
51 events
= baboon
->mb_ifr
& 0x07;
55 irq_num
= IRQ_BABOON_0
;
58 if (events
& irq_bit
) {
59 baboon
->mb_ifr
&= ~irq_bit
;
60 generic_handle_irq(irq_num
);
64 } while(events
>= irq_bit
);
66 if (baboon
->mb_ifr
& 0x02) macide_ack_intr(NULL
);
67 /* for now we need to smash all interrupts */
68 baboon
->mb_ifr
&= ~events
;
73 * Register the Baboon interrupt dispatcher on nubus slot $C.
76 void __init
baboon_register_interrupts(void)
78 irq_set_chained_handler(IRQ_NUBUS_C
, baboon_irq
);
82 * The means for masking individual Baboon interrupts remains a mystery.
83 * However, since we only use the IDE IRQ, we can just enable/disable all
84 * Baboon interrupts. If/when we handle more than one Baboon IRQ, we must
85 * either figure out how to mask them individually or else implement the
86 * same workaround that's used for NuBus slots (see nubus_disabled and
87 * via_nubus_irq_shutdown).
90 void baboon_irq_enable(int irq
)
92 mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C
));
95 void baboon_irq_disable(int irq
)
97 mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C
));