Skip to content

Commit 4a97359

Browse files
Finn Thaingeertu
authored andcommitted
m68k: Mac via cleanup and commentry
No behavioural changes, just cleanups and better documentation. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
1 parent 40f7f9c commit 4a97359

1 file changed

Lines changed: 32 additions & 47 deletions

File tree

‎arch/m68k/mac/via.c‎

Lines changed: 32 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#include <asm/mac_psc.h>
3838

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

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

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

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

206-
if (oss_present) return;
202+
if (oss_present)
203+
return;
207204

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

214-
switch(macintosh_config->ident) {
215-
case MAC_MODEL_P475:
216-
case MAC_MODEL_P475F:
217-
case MAC_MODEL_P575:
218-
case MAC_MODEL_Q605:
219-
case MAC_MODEL_Q605_ACC:
220-
case MAC_MODEL_C610:
221-
case MAC_MODEL_Q610:
222-
case MAC_MODEL_Q630:
223-
case MAC_MODEL_C650:
224-
case MAC_MODEL_Q650:
225-
case MAC_MODEL_Q700:
226-
case MAC_MODEL_Q800:
227-
case MAC_MODEL_Q900:
228-
case MAC_MODEL_Q950:
210+
via_alt_mapping = 0;
211+
if (macintosh_config->via_type == MAC_VIA_QUADRA)
212+
switch (macintosh_config->ident) {
213+
case MAC_MODEL_C660:
214+
case MAC_MODEL_Q840:
215+
/* not applicable */
216+
break;
217+
case MAC_MODEL_P588:
218+
case MAC_MODEL_TV:
219+
case MAC_MODEL_PB140:
220+
case MAC_MODEL_PB145:
221+
case MAC_MODEL_PB160:
222+
case MAC_MODEL_PB165:
223+
case MAC_MODEL_PB165C:
224+
case MAC_MODEL_PB170:
225+
case MAC_MODEL_PB180:
226+
case MAC_MODEL_PB180C:
227+
case MAC_MODEL_PB190:
228+
case MAC_MODEL_PB520:
229+
/* not yet tested */
230+
break;
231+
default:
229232
via_alt_mapping = 1;
230233
via1[vDirB] |= 0x40;
231234
via1[vBufB] &= ~0x40;
232235
break;
233-
default:
234-
via_alt_mapping = 0;
235-
break;
236-
}
237-
#else
238-
via_alt_mapping = 0;
239-
#endif
236+
}
240237

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

259256
/*
260-
* Set vPCR for SCSI interrupts (but not on RBV)
257+
* Set vPCR for control line interrupts (but not on RBV)
261258
*/
262259
if (!rbv_present) {
260+
/* For all VIA types, CA1 (SLOTS IRQ) and CB1 (ASC IRQ)
261+
* are made negative edge triggered here.
262+
*/
263263
if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
264264
/* CB2 (IRQ) indep. input, positive edge */
265265
/* CA2 (DRQ) indep. input, positive edge */
@@ -466,21 +466,6 @@ irqreturn_t via1_irq(int irq, void *dev_id)
466466
++irq_num;
467467
irq_bit <<= 1;
468468
} while (events >= irq_bit);
469-
470-
#if 0 /* freakin' pmu is doing weird stuff */
471-
if (!oss_present) {
472-
/* This (still) seems to be necessary to get IDE
473-
working. However, if you enable VBL interrupts,
474-
you're screwed... */
475-
/* FIXME: should we check the SLOTIRQ bit before
476-
pulling this stunt? */
477-
/* No, it won't be set. that's why we're doing this. */
478-
via_irq_disable(IRQ_MAC_NUBUS);
479-
via_irq_clear(IRQ_MAC_NUBUS);
480-
m68k_handle_int(IRQ_MAC_NUBUS);
481-
via_irq_enable(IRQ_MAC_NUBUS);
482-
}
483-
#endif
484469
return IRQ_HANDLED;
485470
}
486471

0 commit comments

Comments
 (0)