kernel-fxtec-pro1x/arch/m68k/mac/baboon.c
Linus Torvalds 9e09d05cfe m68k updates for 4.15
- More printk modernization,
   - Various cleanups and fixes (incl. a race condition) for Mac,
   - Defconfig updates.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJaCVjAAAoJEEgEtLw/Ve77REQQAK/cc/6wM6/X2gAYgBucSNkH
 qtI4jvwYtuezhzWRCq/Jb6KNljkq/QutpGsoRGJdxLyAOGTsRj7+6+issCKjnznu
 ESiLWLcttGjAPRQKM1OEP/KuyOKDT4EHARoTKFNxV4ld76Emh866YS9mBpYNpVzt
 Z+rNIrB69iCUlczlqzavKqfhz7jFeuTyQBrwV8K4mG+x2mCnDgIE3rMF9HwPWoyj
 C8dQnpdOJ7vB9iaLD3CLip5Ddqve8PXRU4y1vkspseriADPsaFBBTmJdMQtMhE8g
 ynx8ATowOk/vpNqq+G63GZGHoEIhmfECaXm0lcnt0P3cdYAkz5wFIRrP/O9lglUL
 M6ygVFAca/gsiYQfXmZ8wPo/9UYltUn0ZPHhKLckjJJH3GmlQJ2cKkHcrugMF3kN
 oz2T3ltSqxEj/EetXBWx3o+XtIfIR1kbgulcJhARTptOczhfPRN0k/A6PHKz7JKf
 el2gNubB8RUakL7SyICYmf8mKw2++VIipQn1yU6bnzA6nEDNX10ifo3W0aJRTfDb
 C71GmR76UBZ8bcbP4iomlrO9UHzd2FKy+sOtgIkPXmsRi2g8AJYLoEqwNmsLbl7n
 CHm66bbzfZWnE9X7FfJLekMxMVP/TRWVctl7aYeUB2ilddEnw74xHRB4j3YS388V
 U00CtU2+2zp40tIj5o0/
 =cuxe
 -----END PGP SIGNATURE-----

Merge tag 'm68k-for-v4.15-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k

Pull m68k updates from Geert Uytterhoeven:

  - more printk modernization

  - various cleanups and fixes (incl. a race condition) for Mac

  - defconfig updates

* tag 'm68k-for-v4.15-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
  m68k/defconfig: Update defconfigs for v4.14-rc7
  m68k/mac: Add mutual exclusion for IOP interrupt polling
  m68k/mac: Disentangle VIA/RBV and NuBus initialization
  m68k/mac: Disentangle VIA and OSS initialization
  m68k/mac: More printk modernization
2017-11-13 12:10:24 -08:00

99 lines
2.1 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* 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/irq.h>
#include <asm/macintosh.h>
#include <asm/macints.h>
#include <asm/mac_baboon.h>
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;
pr_debug("Baboon detected at %p\n", baboon);
}
/*
* Baboon interrupt handler. This works a lot like a VIA.
*/
static void baboon_irq(struct irq_desc *desc)
{
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
}
/*
* Register the Baboon interrupt dispatcher on nubus slot $C.
*/
void __init baboon_register_interrupts(void)
{
irq_set_chained_handler(IRQ_NUBUS_C, baboon_irq);
}
/*
* 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).
*/
void baboon_irq_enable(int irq)
{
mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
}
void baboon_irq_disable(int irq)
{
mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
}