8dfbdf4aba
This patch contains the following possible cleanups: - make the following needlessly global code (always) static: - baboon.c: struct baboon - baboon.c: baboon_irq() - config.c: mac_orig_videoaddr - config.c: mac_identify() - config.c: mac_report_hardware() - config.c: mac_debug_console_write() - config.c: mac_sccb_console_write() - config.c: mac_scca_console_write() - config.c: mac_init_scc_port() - oss.c: oss_irq() - oss.c: oss_nubus_irq() - psc.c: psc_debug_dump() - psc.c: psc_dma_die_die_die() - via.c: rbv_clear - remove the unused bootparse.c - #if 0 the following unused functions: - config.c: mac_debugging_short() - config.c: mac_debugging_long() - remove the following unused code: - config.c: mac_bisize - config.c: mac_env - config.c: mac_SCC_init_done - config.c: mac_SCC_reset_done - config.c: mac_init_scca_port() - config.c: mac_init_sccb_port() Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
123 lines
2.4 KiB
C
123 lines
2.4 KiB
C
/*
|
|
* 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>
|
|
#include <linux/mm.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/init.h>
|
|
#include <linux/ide.h>
|
|
|
|
#include <asm/traps.h>
|
|
#include <asm/bootinfo.h>
|
|
#include <asm/macintosh.h>
|
|
#include <asm/macints.h>
|
|
#include <asm/mac_baboon.h>
|
|
|
|
/* #define DEBUG_BABOON */
|
|
/* #define DEBUG_IRQS */
|
|
|
|
int baboon_present;
|
|
static volatile struct baboon *baboon;
|
|
|
|
#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.
|
|
*/
|
|
|
|
static irqreturn_t baboon_irq(int irq, void *dev_id)
|
|
{
|
|
int irq_bit, irq_num;
|
|
unsigned char events;
|
|
|
|
#ifdef DEBUG_IRQS
|
|
printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
|
|
(uint) baboon->mb_control, (uint) baboon->mb_ifr,
|
|
(uint) baboon->mb_status);
|
|
#endif
|
|
|
|
if (!(events = baboon->mb_ifr & 0x07))
|
|
return IRQ_NONE;
|
|
|
|
irq_num = IRQ_BABOON_0;
|
|
irq_bit = 1;
|
|
do {
|
|
if (events & irq_bit) {
|
|
baboon->mb_ifr &= ~irq_bit;
|
|
m68k_handle_int(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
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
/*
|
|
* Register the Baboon interrupt dispatcher on nubus slot $C.
|
|
*/
|
|
|
|
void __init baboon_register_interrupts(void)
|
|
{
|
|
request_irq(IRQ_NUBUS_C, baboon_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
|
|
"baboon", (void *) baboon);
|
|
}
|
|
|
|
void baboon_irq_enable(int irq) {
|
|
#ifdef DEBUG_IRQUSE
|
|
printk("baboon_irq_enable(%d)\n", irq);
|
|
#endif
|
|
/* FIXME: figure out how to mask and unmask baboon interrupt sources */
|
|
enable_irq(IRQ_NUBUS_C);
|
|
}
|
|
|
|
void baboon_irq_disable(int irq) {
|
|
#ifdef DEBUG_IRQUSE
|
|
printk("baboon_irq_disable(%d)\n", irq);
|
|
#endif
|
|
disable_irq(IRQ_NUBUS_C);
|
|
}
|
|
|
|
void baboon_irq_clear(int irq) {
|
|
int irq_idx = IRQ_IDX(irq);
|
|
|
|
baboon->mb_ifr &= ~(1 << irq_idx);
|
|
}
|
|
|
|
int baboon_irq_pending(int irq)
|
|
{
|
|
int irq_idx = IRQ_IDX(irq);
|
|
|
|
return baboon->mb_ifr & (1 << irq_idx);
|
|
}
|