2 * 6522 Versatile Interface Adapter (VIA)
4 * There are two of these on the Mac II. Some IRQ's are vectored
5 * via them as are assorted bits and bobs - eg rtc, adb. The picture
6 * is a bit incomplete as the Mac documentation doesnt cover this well
9 #ifndef _ASM_VIA6522_H_
10 #define _ASM_VIA6522_H_
12 #define VIABASE 0x50F00000
13 #define VIABASE2 0x50F02000
16 * Not all of these are true post MacII I think
19 #define VIA1A_vSccWrReq 0x80 /* SCC write */
20 #define VIA1A_vRev8 0x40 /* Revision 8 board ??? */
21 #define VIA1A_vHeadSel 0x20 /* Head select for IWM */
22 #define VIA1A_vOverlay 0x10
23 #define VIA1A_vSync 0x08
24 #define VIA1A_vVolume 0x07 /* Audio volume mask */
26 #define VIA1B_vSound 0x80 /* Audio on/off */
27 #define VIA1B_vMystery 0x40
28 #define VIA1B_vADBS2 0x20 /* ADB state 2 */
29 #define VIA1B_vADBS1 0x10 /* ADB state 1 */
30 #define VIA1B_vADBInt 0x08 /* ADB interrupt */
31 #define VIA1B_vRTCEnb 0x04 /* Real time clock */
32 #define VIA1B_vRTCClk 0x02
33 #define VIA1B_vRTCData 0x01
36 * VIA2 A register is the interrupt lines raised off the nubus
40 #define VIA2A_vIRQE 0x20
41 #define VIA2A_vIRQD 0x10
42 #define VIA2A_vIRQC 0x08
43 #define VIA2A_vIRQB 0x04
44 #define VIA2A_vIRQA 0x02
45 #define VIA2A_vIRQ9 0x01
48 * Register B has the fun stuff in it
51 #define VIA2B_vMode32 0x08 /* 24/32bit switch - doubles as cache flush */
52 #define VIA2B_vPower 0x04 /* Off switch */
53 #define VIA2B_vBusLk 0x02 /* Nubus in use ?? */
54 #define VIA2B_vCDis 0x01 /* Cache disable */
57 * The 6522 via is a 2MHz part, and needs a delay. MacOS seems to
58 * execute MOV (Ax),(Ax) for this... Oh and we can't use udelay
59 * here... see we need the via to calibrate the udelay loop ...
62 extern volatile long *via_memory_bogon
;
64 extern __inline__
void via_write(volatile unsigned char *via
,int reg
, int v
)
72 extern __inline__
int via_read(volatile unsigned char *via
,int reg
)
80 extern volatile unsigned char *via1
,*via2
;
83 * 6522 registers - see databook
101 #define vANH 0x1e00 /* register A (no shake) */
105 /*#define rIFR 0x03*/
109 /*#define rIER 0x13*/
114 #define W_rIFR 0x1A03
115 #define W_rIER 0x1C13
123 void (*vector
[8])(int, void *, struct pt_regs
*);
126 extern void via1_irq(int, void *, struct pt_regs
*);
127 extern void via2_irq(int, void *, struct pt_regs
*);
129 extern void via_setup_keyboard(void);
131 #endif /* _ASM_VIA6522_H_ */