2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* Baboon Custom IC Management
|
|
|
|
*
|
|
|
|
* The Baboon custom IC controls the IDE, PCMCIA and media bay on the
|
|
|
|
* PowerBook 190. It multiplexes multiple interrupt sources onto the
|
|
|
|
* Nubus slot $C interrupt.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
2011-07-14 02:48:30 +07:00
|
|
|
#include <linux/irq.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include <asm/macintosh.h>
|
|
|
|
#include <asm/macints.h>
|
|
|
|
#include <asm/mac_baboon.h>
|
|
|
|
|
2007-05-02 03:32:58 +07:00
|
|
|
int baboon_present;
|
2008-07-18 02:16:25 +07:00
|
|
|
static volatile struct baboon *baboon;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
extern int macide_ack_intr(struct ata_channel *);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Baboon initialization.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void __init baboon_init(void)
|
|
|
|
{
|
|
|
|
if (macintosh_config->ident != MAC_MODEL_PB190) {
|
|
|
|
baboon = NULL;
|
|
|
|
baboon_present = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
baboon = (struct baboon *) BABOON_BASE;
|
|
|
|
baboon_present = 1;
|
|
|
|
|
|
|
|
printk("Baboon detected at %p\n", baboon);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Baboon interrupt handler. This works a lot like a VIA.
|
|
|
|
*/
|
|
|
|
|
2015-09-14 15:42:37 +07:00
|
|
|
static void baboon_irq(struct irq_desc *desc)
|
2011-08-10 17:48:29 +07:00
|
|
|
{
|
|
|
|
int irq_bit, irq_num;
|
|
|
|
unsigned char events;
|
|
|
|
|
|
|
|
events = baboon->mb_ifr & 0x07;
|
|
|
|
if (!events)
|
|
|
|
return;
|
|
|
|
|
|
|
|
irq_num = IRQ_BABOON_0;
|
|
|
|
irq_bit = 1;
|
|
|
|
do {
|
|
|
|
if (events & irq_bit) {
|
|
|
|
baboon->mb_ifr &= ~irq_bit;
|
|
|
|
generic_handle_irq(irq_num);
|
|
|
|
}
|
|
|
|
irq_bit <<= 1;
|
|
|
|
irq_num++;
|
|
|
|
} while(events >= irq_bit);
|
|
|
|
#if 0
|
|
|
|
if (baboon->mb_ifr & 0x02) macide_ack_intr(NULL);
|
|
|
|
/* for now we need to smash all interrupts */
|
|
|
|
baboon->mb_ifr &= ~events;
|
|
|
|
#endif
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-07-18 02:16:25 +07:00
|
|
|
/*
|
|
|
|
* Register the Baboon interrupt dispatcher on nubus slot $C.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void __init baboon_register_interrupts(void)
|
|
|
|
{
|
2011-08-10 17:48:29 +07:00
|
|
|
irq_set_chained_handler(IRQ_NUBUS_C, baboon_irq);
|
2008-07-18 02:16:25 +07:00
|
|
|
}
|
|
|
|
|
2008-11-19 02:45:21 +07:00
|
|
|
/*
|
2011-10-23 21:11:19 +07:00
|
|
|
* The means for masking individual Baboon interrupts remains a mystery.
|
|
|
|
* However, since we only use the IDE IRQ, we can just enable/disable all
|
|
|
|
* Baboon interrupts. If/when we handle more than one Baboon IRQ, we must
|
|
|
|
* either figure out how to mask them individually or else implement the
|
|
|
|
* same workaround that's used for NuBus slots (see nubus_disabled and
|
|
|
|
* via_nubus_irq_shutdown).
|
2008-11-19 02:45:21 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
void baboon_irq_enable(int irq)
|
|
|
|
{
|
2011-10-23 21:11:19 +07:00
|
|
|
mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2008-11-19 02:45:21 +07:00
|
|
|
void baboon_irq_disable(int irq)
|
|
|
|
{
|
2011-10-23 21:11:19 +07:00
|
|
|
mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|