Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a973592 authored by Finn Thain's avatar Finn Thain Committed by Geert Uytterhoeven
Browse files

m68k: Mac via cleanup and commentry



No behavioural changes, just cleanups and better documentation.

Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 40f7f9c1
Loading
Loading
Loading
Loading
+32 −47
Original line number Diff line number Diff line
@@ -37,10 +37,6 @@
#include <asm/mac_psc.h>

volatile __u8 *via1, *via2;
#if 0
/* See note in mac_via.h about how this is possibly not useful */
volatile long *via_memory_bogon=(long *)&via_memory_bogon;
#endif
int rbv_present;
int via_alt_mapping;
EXPORT_SYMBOL(via_alt_mapping);
@@ -66,7 +62,7 @@ static int gIER,gIFR,gBufA,gBufB;
#define MAC_CLOCK_LOW		(MAC_CLOCK_TICK&0xFF)
#define MAC_CLOCK_HIGH		(MAC_CLOCK_TICK>>8)

/* To disable a NuBus slot on Quadras we make the slot IRQ lines outputs, set
/* To disable a NuBus slot on Quadras we make that slot IRQ line an output set
 * high. On RBV we just use the slot interrupt enable register. On Macs with
 * genuine VIA chips we must use nubus_disabled to keep track of disabled slot
 * interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1
@@ -180,7 +176,7 @@ void __init via_init(void)
	via1[vT1CH] = 0;
	via1[vT2CL] = 0;
	via1[vT2CH] = 0;
	via1[vACR] &= 0x3F;
	via1[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
	via1[vACR] &= ~0x03; /* disable port A & B latches */

	/*
@@ -203,40 +199,41 @@ void __init via_init(void)

	/* Everything below this point is VIA2/RBV only... */

	if (oss_present) return;
	if (oss_present)
		return;

#if 1
	/* Some machines support an alternate IRQ mapping that spreads  */
	/* Ethernet and Sound out to their own autolevel IRQs and moves */
	/* VIA1 to level 6. A/UX uses this mapping and we do too.  Note */
	/* that the IIfx emulates this alternate mapping using the OSS. */

	via_alt_mapping = 0;
	if (macintosh_config->via_type == MAC_VIA_QUADRA)
		switch (macintosh_config->ident) {
		case MAC_MODEL_P475:
		case MAC_MODEL_P475F:
		case MAC_MODEL_P575:
		case MAC_MODEL_Q605:
		case MAC_MODEL_Q605_ACC:
		case MAC_MODEL_C610:
		case MAC_MODEL_Q610:
		case MAC_MODEL_Q630:
		case MAC_MODEL_C650:
		case MAC_MODEL_Q650:
		case MAC_MODEL_Q700:
		case MAC_MODEL_Q800:
		case MAC_MODEL_Q900:
		case MAC_MODEL_Q950:
		case MAC_MODEL_C660:
		case MAC_MODEL_Q840:
			/* not applicable */
			break;
		case MAC_MODEL_P588:
		case MAC_MODEL_TV:
		case MAC_MODEL_PB140:
		case MAC_MODEL_PB145:
		case MAC_MODEL_PB160:
		case MAC_MODEL_PB165:
		case MAC_MODEL_PB165C:
		case MAC_MODEL_PB170:
		case MAC_MODEL_PB180:
		case MAC_MODEL_PB180C:
		case MAC_MODEL_PB190:
		case MAC_MODEL_PB520:
			/* not yet tested */
			break;
		default:
			via_alt_mapping = 1;
			via1[vDirB] |= 0x40;
			via1[vBufB] &= ~0x40;
			break;
		default:
			via_alt_mapping = 0;
			break;
		}
#else
	via_alt_mapping = 0;
#endif

	/*
	 * Now initialize VIA2. For RBV we just kill all interrupts;
@@ -252,14 +249,17 @@ void __init via_init(void)
		via2[vT1CH] = 0;
		via2[vT2CL] = 0;
		via2[vT2CH] = 0;
		via2[vACR] &= 0x3F;
		via2[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
		via2[vACR] &= ~0x03; /* disable port A & B latches */
	}

	/*
	 * Set vPCR for SCSI interrupts (but not on RBV)
	 * Set vPCR for control line interrupts (but not on RBV)
	 */
	if (!rbv_present) {
		/* For all VIA types, CA1 (SLOTS IRQ) and CB1 (ASC IRQ)
		 * are made negative edge triggered here.
		 */
		if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
			/* CB2 (IRQ) indep. input, positive edge */
			/* CA2 (DRQ) indep. input, positive edge */
@@ -466,21 +466,6 @@ irqreturn_t via1_irq(int irq, void *dev_id)
		++irq_num;
		irq_bit <<= 1;
	} while (events >= irq_bit);

#if 0 /* freakin' pmu is doing weird stuff */
	if (!oss_present) {
		/* This (still) seems to be necessary to get IDE
		   working.  However, if you enable VBL interrupts,
		   you're screwed... */
		/* FIXME: should we check the SLOTIRQ bit before
                   pulling this stunt? */
		/* No, it won't be set. that's why we're doing this. */
		via_irq_disable(IRQ_MAC_NUBUS);
		via_irq_clear(IRQ_MAC_NUBUS);
		m68k_handle_int(IRQ_MAC_NUBUS);
		via_irq_enable(IRQ_MAC_NUBUS);
	}
#endif
	return IRQ_HANDLED;
}