summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-03-08 16:03:07 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-03-08 16:03:07 +0000
commit8bf8b25918bb1c74ae807996c744e3d08724ad07 (patch)
treee8c6410a0835e2e1d007ef4fb7fcb6f8d7c17ccc /sys
parent8788b9131f3e6fc259dabae38425c1b059e8914e (diff)
Move more z8536 defines from MVME188 specific code to the MI header and use it.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme88k/include/mvme188.h54
-rw-r--r--sys/arch/mvme88k/mvme88k/m188_machdep.c39
-rw-r--r--sys/dev/ic/z8536reg.h47
3 files changed, 67 insertions, 73 deletions
diff --git a/sys/arch/mvme88k/include/mvme188.h b/sys/arch/mvme88k/include/mvme188.h
index 6ef8921c8ae..817af7bb040 100644
--- a/sys/arch/mvme88k/include/mvme188.h
+++ b/sys/arch/mvme88k/include/mvme188.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mvme188.h,v 1.32 2007/12/27 23:17:55 miod Exp $ */
+/* $OpenBSD: mvme188.h,v 1.33 2009/03/08 16:03:05 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* All rights reserved.
@@ -200,58 +200,6 @@
#define CIO_PORTA 0xfff83008
#define CIO_CTRL 0xfff8300c
-#define CIO_MICR 0x00 /* Master interrupt control register */
-#define CIO_MICR_MIE 0x80
-#define CIO_MICR_DLC 0x40
-#define CIO_MICR_NV 0x20
-#define CIO_MICR_PAVIS 0x10
-#define CIO_MICR_PBVIS 0x08
-#define CIO_MICR_CTVIS 0x04
-#define CIO_MICR_RJA 0x02
-#define CIO_MICR_RESET 0x01
-
-#define CIO_MCCR 0x01 /* Master config control register */
-#define CIO_MCCR_PBE 0x80
-#define CIO_MCCR_CT1E 0x40
-#define CIO_MCCR_CT2E 0x20
-#define CIO_MCCR_CT3E 0x10
-#define CIO_MCCR_PLC 0x08
-#define CIO_MCCR_PAE 0x04
-
-#define CIO_CTMS1 0x1c /* Counter/timer mode specification #1 */
-#define CIO_CTMS2 0x1d /* Counter/timer mode specification #2 */
-#define CIO_CTMS3 0x1e /* Counter/timer mode specification #3 */
-#define CIO_CTMS_CSC 0x80 /* Continuous Single Cycle */
-#define CIO_CTMS_EOE 0x40 /* External Output Enable */
-#define CIO_CTMS_ECE 0x20 /* External Count Enable */
-#define CIO_CTMS_ETE 0x10 /* External Trigger Enable */
-#define CIO_CTMS_EGE 0x08 /* External Gate Enable */
-#define CIO_CTMS_REB 0x04 /* Retrigger Enable Bit */
-#define CIO_CTMS_PO 0x00 /* Pulse Output */
-#define CIO_CTMS_OSO 0x01 /* One Shot Output */
-#define CIO_CTMS_SWO 0x02 /* Square Wave Output */
-
-#define CIO_IVR 0x04 /* Interrupt vector register */
-
-#define CIO_CSR1 0x0a /* Command and status register CTC #1 */
-#define CIO_CSR2 0x0b /* Command and status register CTC #2 */
-#define CIO_CSR3 0x0c /* Command and status register CTC #3 */
-
-#define CIO_CT1MSB 0x16 /* CTC #1 Timer constant - MSB */
-#define CIO_CT1LSB 0x17 /* CTC #1 Timer constant - LSB */
-#define CIO_CT2MSB 0x18 /* CTC #2 Timer constant - MSB */
-#define CIO_CT2LSB 0x19 /* CTC #2 Timer constant - LSB */
-#define CIO_CT3MSB 0x1a /* CTC #3 Timer constant - MSB */
-#define CIO_CT3LSB 0x1b /* CTC #3 Timer constant - LSB */
-#define CIO_PDCA 0x23 /* Port A data direction control */
-#define CIO_PDCB 0x2b /* Port B data direction control */
-
-#define CIO_GCB 0x04 /* CTC Gate command bit */
-#define CIO_TCB 0x02 /* CTC Trigger command bit */
-#define CIO_IE 0xc0 /* CTC Interrupt enable (set) */
-#define CIO_CIP 0x20 /* CTC Clear interrupt pending */
-#define CIO_IP 0x20 /* CTC Interrupt pending */
-
#define DART_BASE 0xfff82000
/*
diff --git a/sys/arch/mvme88k/mvme88k/m188_machdep.c b/sys/arch/mvme88k/mvme88k/m188_machdep.c
index 9ed61c605d1..d2c9b3fbabc 100644
--- a/sys/arch/mvme88k/mvme88k/m188_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m188_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m188_machdep.c,v 1.50 2009/02/21 18:37:48 miod Exp $ */
+/* $OpenBSD: m188_machdep.c,v 1.51 2009/03/08 16:03:06 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -127,6 +127,7 @@
#include <machine/mvme188.h>
#include <mvme88k/dev/sysconvar.h>
+#include <dev/ic/z8536reg.h>
#include <mvme88k/mvme88k/clockvar.h>
#ifdef MULTIPROCESSOR
@@ -854,10 +855,10 @@ int
m188_calibrateintr(void *eframe)
{
CIO_LOCK();
- write_cio(CIO_CSR1, CIO_GCB | CIO_CIP); /* Ack the interrupt */
-
+ /* ack the interrupt */
+ write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_C_IP);
/* restart counter */
- write_cio(CIO_CSR1, CIO_GCB | CIO_TCB | CIO_IE);
+ write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_TCB | ZCIO_CTCS_S_IE);
CIO_UNLOCK();
m188_calibrate_phase++;
@@ -869,10 +870,10 @@ int
m188_clockintr(void *eframe)
{
CIO_LOCK();
- write_cio(CIO_CSR1, CIO_GCB | CIO_CIP); /* Ack the interrupt */
-
+ /* ack the interrupt */
+ write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_C_IP);
/* restart counter */
- write_cio(CIO_CSR1, CIO_GCB | CIO_TCB | CIO_IE);
+ write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_TCB | ZCIO_CTCS_S_IE);
CIO_UNLOCK();
hardclock(eframe);
@@ -971,28 +972,28 @@ m188_cio_init(u_int period)
volatile int i;
/* Start by forcing chip into known state */
- read_cio(CIO_MICR);
- write_cio(CIO_MICR, CIO_MICR_RESET); /* Reset the CTC */
+ read_cio(ZCIO_MIC);
+ write_cio(ZCIO_MIC, ZCIO_MIC_RESET); /* Reset the CTC */
for (i = 0; i < 1000; i++) /* Loop to delay */
;
/* Clear reset and start init seq. */
- write_cio(CIO_MICR, 0x00);
+ write_cio(ZCIO_MIC, 0x00);
/* Wait for chip to come ready */
- while ((read_cio(CIO_MICR) & CIO_MICR_RJA) == 0)
+ while ((read_cio(ZCIO_MIC) & ZCIO_MIC_RJA) == 0)
;
/* Initialize the 8536 for real */
- write_cio(CIO_MICR,
- CIO_MICR_MIE /* | CIO_MICR_NV */ | CIO_MICR_RJA | CIO_MICR_DLC);
- write_cio(CIO_CTMS1, CIO_CTMS_CSC); /* Continuous count */
- write_cio(CIO_PDCB, 0xff); /* set port B to input */
+ write_cio(ZCIO_MIC,
+ ZCIO_MIC_MIE /* | ZCIO_MIC_NV */ | ZCIO_MIC_RJA | ZCIO_MIC_DLC);
+ write_cio(ZCIO_CT1MD, ZCIO_CTMD_CSC); /* Continuous count */
+ write_cio(ZCIO_PBDIR, 0xff); /* set port B to input */
period <<= 1; /* CT#1 runs at PCLK/2, hence 2MHz */
- write_cio(CIO_CT1MSB, period >> 8);
- write_cio(CIO_CT1LSB, period);
+ write_cio(ZCIO_CT1TCM, period >> 8);
+ write_cio(ZCIO_CT1TCL, period);
/* enable counter #1 */
- write_cio(CIO_MCCR, CIO_MCCR_CT1E | CIO_MCCR_PBE);
- write_cio(CIO_CSR1, CIO_GCB | CIO_TCB | CIO_IE);
+ write_cio(ZCIO_MCC, ZCIO_MCC_CT1E | ZCIO_MCC_PBE);
+ write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_TCB | ZCIO_CTCS_S_IE);
}
diff --git a/sys/dev/ic/z8536reg.h b/sys/dev/ic/z8536reg.h
index bada648745e..fdc9783bfdf 100644
--- a/sys/dev/ic/z8536reg.h
+++ b/sys/dev/ic/z8536reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8536reg.h,v 1.2 2003/06/09 16:34:22 deraadt Exp $ */
+/* $OpenBSD: z8536reg.h,v 1.3 2009/03/08 16:03:06 miod Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -81,3 +81,48 @@
#define ZCIO_PBSPP 45 /* Port B Pattern Polarity Specification */
#define ZCIO_PBSPT 46 /* Port B Pattern Transition Specification */
#define ZCIO_PBSPM 47 /* Port B Pattern MASK Specification */
+
+#define ZCIO_MIC_MIE 0x80 /* Master Interrupt Enable */
+#define ZCIO_MIC_DLC 0x40 /* Disable Lower Chain */
+#define ZCIO_MIC_NV 0x20 /* No Vector */
+#define ZCIO_MIC_PAVIS 0x10 /* Port A Vector Includes Status */
+#define ZCIO_MIC_PBVIS 0x08 /* Port B Vector Includes Status */
+#define ZCIO_MIC_CTVIS 0x04 /* C/T Vector Includes Status */
+#define ZCIO_MIC_RJA 0x02 /* Right Justified Addresses */
+#define ZCIO_MIC_RESET 0x01 /* Reset */
+
+#define ZCIO_MCC_PBE 0x80 /* Port B Enable */
+#define ZCIO_MCC_CT1E 0x40 /* Counter/Timer 1 Enable */
+#define ZCIO_MCC_CT2E 0x20 /* Counter/Timer 2 Enable */
+#define ZCIO_MCC_CT3E 0x10 /* Counter/Timer 3 Enable */
+#define ZCIO_MCC_PLC 0x08 /* Port Link Control */
+#define ZCIO_MCC_PAE 0x04 /* Port A Enable */
+
+#define ZCIO_CTMD_CSC 0x80 /* Continuous Single Cycle */
+#define ZCIO_CTMD_EOE 0x40 /* External Output Enable */
+#define ZCIO_CTMD_ECE 0x20 /* External Count Enable */
+#define ZCIO_CTMD_ETE 0x10 /* External Trigger Enable */
+#define ZCIO_CTMD_EGE 0x08 /* External Gate Enable */
+#define ZCIO_CTMD_REB 0x04 /* Retrigger Enable Bit */
+#define ZCIO_CTMD_PO 0x00 /* Pulse Output */
+#define ZCIO_CTMD_OSO 0x01 /* One Shot Output */
+#define ZCIO_CTMD_SWO 0x02 /* Square Wave Output */
+
+/* CTCS read values */
+#define ZCIO_CTCS_IUS 0x80 /* Interrupt Under Service */
+#define ZCIO_CTCS_IE 0x40 /* Interrupt Enable */
+#define ZCIO_CTCS_IP 0x20 /* Interrupt Pending */
+#define ZCIO_CTCS_IERR 0x10 /* Interrupt Error */
+#define ZCIO_CTCS_CIP 0x01 /* Count In Progress */
+
+/* CTCS write values */
+#define ZCIO_CTCS_C_IE 0xe0 /* Clear IE */
+#define ZCIO_CTCS_S_IE 0xc0 /* Set IE */
+#define ZCIO_CTCS_C_IP 0xa0 /* Clear IP */
+#define ZCIO_CTCS_S_IP 0x80 /* Set IP */
+#define ZCIO_CTCS_C_IUS 0x60 /* Clear IUS */
+#define ZCIO_CTCS_S_IUS 0x40 /* Set IUS */
+#define ZCIO_CTCS_C_IUS_IP 0x20 /* Clear IUS and IP */
+#define ZCIO_CTCS_RCC 0x08 /* Read Counter Control */
+#define ZCIO_CTCS_GCB 0x04 /* Gate Command Bit */
+#define ZCIO_CTCS_TCB 0x02 /* Trigger Command Bit */