pccreg.h revision 1.5.38.1 1 1.5.38.1 scw /* $NetBSD: pccreg.h,v 1.5.38.1 2000/03/11 20:51:50 scw Exp $ */
2 1.1 chuck
3 1.1 chuck /*
4 1.1 chuck *
5 1.1 chuck * Copyright (c) 1995 Charles D. Cranor
6 1.1 chuck * All rights reserved.
7 1.1 chuck *
8 1.1 chuck * Redistribution and use in source and binary forms, with or without
9 1.1 chuck * modification, are permitted provided that the following conditions
10 1.1 chuck * are met:
11 1.1 chuck * 1. Redistributions of source code must retain the above copyright
12 1.1 chuck * notice, this list of conditions and the following disclaimer.
13 1.1 chuck * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 chuck * notice, this list of conditions and the following disclaimer in the
15 1.1 chuck * documentation and/or other materials provided with the distribution.
16 1.1 chuck * 3. All advertising materials mentioning features or use of this software
17 1.1 chuck * must display the following acknowledgement:
18 1.1 chuck * This product includes software developed by Charles D. Cranor.
19 1.1 chuck * 4. The name of the author may not be used to endorse or promote products
20 1.1 chuck * derived from this software without specific prior written permission.
21 1.1 chuck *
22 1.1 chuck * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 chuck * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 chuck * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 chuck * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 chuck * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 chuck * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 chuck * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 chuck * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 chuck * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 chuck * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 chuck */
33 1.1 chuck
34 1.1 chuck /*
35 1.5.38.1 scw * peripheral channel controller on mvme147
36 1.1 chuck */
37 1.5.38.1 scw #ifndef __MVME68K_PCCREG_H
38 1.5.38.1 scw #define __MVME68K_PCCREG_H
39 1.1 chuck
40 1.5.38.1 scw /*
41 1.5.38.1 scw * Offsets to the MVME147's onboard device registers.
42 1.5.38.1 scw * (Relative to the bus_space_tag_t passed in from 'mainbus')
43 1.5.38.1 scw */
44 1.5.38.1 scw #define PCC_NVRAM_OFF 0x0000 /* offset of Mostek NVRAM/RTC chip */
45 1.5.38.1 scw #define PCC_RTC_OFF 0x07f8 /* offset of clock registers NVRAM */
46 1.3 chuck #define PCC_REG_OFF 0x1000 /* offset of PCC chip registers */
47 1.3 chuck #define PCC_LE_OFF 0x1800 /* offset of LANCE ethernet chip */
48 1.3 chuck #define PCC_VME_OFF 0x2000 /* offset of VME chip */
49 1.3 chuck #define PCC_LPT_OFF 0x2800 /* offset of parallel port register */
50 1.3 chuck #define PCC_ZS0_OFF 0x3000 /* offset of first 8530 UART */
51 1.3 chuck #define PCC_ZS1_OFF 0x3800 /* offset of second 8530 UART */
52 1.3 chuck #define PCC_WDSC_OFF 0x4000 /* offset of 33c93 SCSI chip */
53 1.3 chuck
54 1.1 chuck
55 1.5.38.1 scw #if 1
56 1.1 chuck /*
57 1.5.38.1 scw * XXXSCW: Temp. needed until all onboard drivers are bus-spaced
58 1.1 chuck */
59 1.5.38.1 scw #define PCC_BASE 0xfffe0000u
60 1.5.38.1 scw #define PCC_PADDR(off) ((void *)(PCC_BASE + (off)))
61 1.5.38.1 scw #define PCC_VADDR(off) ((void *)IIOV(PCC_BASE + (off)))
62 1.5.38.1 scw #endif
63 1.5.38.1 scw
64 1.5.38.1 scw /*
65 1.5.38.1 scw * The PCC chip's own registers. These are 8-bits wide, unless
66 1.5.38.1 scw * otherwise indicated.
67 1.5.38.1 scw */
68 1.5.38.1 scw #define PCCREG_DMA_TABLE_ADDR 0x00 /* DMA table address (32-bit) */
69 1.5.38.1 scw #define PCCREG_DMA_DATA_ADDR 0x04 /* DMA data address (32-bit) */
70 1.5.38.1 scw #define PCCREG_DMA_BYTE_COUNT 0x08 /* DMA byte count (32-bit) */
71 1.5.38.1 scw #define PCCREG_DMA_DATA_HOLD 0x0c /* DMA data hold register (32-bit) */
72 1.5.38.1 scw #define PCCREG_TMR1_PRELOAD 0x10 /* Timer1 preload (16-bit) */
73 1.5.38.1 scw #define PCCREG_TMR1_COUNT 0x12 /* Timer1 count (16-bit) */
74 1.5.38.1 scw #define PCCREG_TMR2_PRELOAD 0x14 /* Timer2 preload (16-bit) */
75 1.5.38.1 scw #define PCCREG_TMR2_COUNT 0x16 /* Timer2 count (16-bit) */
76 1.5.38.1 scw #define PCCREG_TMR1_INTR_CTRL 0x18 /* Timer1 interrupt ctrl */
77 1.5.38.1 scw #define PCCREG_TMR1_CONTROL 0x19 /* Timer1 ctrl reg */
78 1.5.38.1 scw #define PCCREG_TMR2_INTR_CTRL 0x1a /* Timer2 interrupt ctrl */
79 1.5.38.1 scw #define PCCREG_TMR2_CONTROL 0x1b /* Timer2 ctrl reg */
80 1.5.38.1 scw #define PCCREG_ACFAIL_INTR_CTRL 0x1c /* ACFAIL intr reg */
81 1.5.38.1 scw #define PCCREG_WDOG_INTR_CTRL 0x1d /* Watchdog intr reg */
82 1.5.38.1 scw #define PCCREG_PRNT_INTR_CTRL 0x1e /* Printer intr reg */
83 1.5.38.1 scw #define PCCREG_PRNT_CONTROL 0x1f /* Printer ctrl */
84 1.5.38.1 scw #define PCCREG_DMA_INTR_CTRL 0x20 /* DMA interrupt control */
85 1.5.38.1 scw #define PCCREG_DMA_CONTROL 0x21 /* DMA csr */
86 1.5.38.1 scw #define PCCREG_BUSERR_INTR_CTRL 0x22 /* Bus error interrupt */
87 1.5.38.1 scw #define PCCREG_DMA_STATUS 0x23 /* DMA status register */
88 1.5.38.1 scw #define PCCREG_ABORT_INTR_CTRL 0x24 /* ABORT interrupt control reg */
89 1.5.38.1 scw #define PCCREG_TABLE_ADDR_FC 0x25 /* Table address function code reg */
90 1.5.38.1 scw #define PCCREG_SERIAL_INTR_CTRL 0x26 /* Serial interrupt reg */
91 1.5.38.1 scw #define PCCREG_GENERAL_CONTROL 0x27 /* General control register */
92 1.5.38.1 scw #define PCCREG_LANCE_INTR_CTRL 0x28 /* Ethernet interrupt */
93 1.5.38.1 scw #define PCCREG_GENERAL_STATUS 0x29 /* General status */
94 1.5.38.1 scw #define PCCREG_SCSI_INTR_CTRL 0x2a /* SCSI interrupt reg */
95 1.5.38.1 scw #define PCCREG_SLAVE_BASE_ADDR 0x2b /* Slave base addr reg */
96 1.5.38.1 scw #define PCCREG_SOFT1_INTR_CTRL 0x2c /* Software interrupt #1 cr */
97 1.5.38.1 scw #define PCCREG_VECTOR_BASE 0x2d /* Interrupt base vector register */
98 1.5.38.1 scw #define PCCREG_SOFT2_INTR_CTRL 0x2e /* Software interrupt #2 cr */
99 1.5.38.1 scw #define PCCREG_REVISION 0x2f /* Revision level */
100 1.5.38.1 scw
101 1.5.38.1 scw #define PCCREG_SIZE 0x30
102 1.5.38.1 scw
103 1.5.38.1 scw /*
104 1.5.38.1 scw * Convenience macros for reading the PCC chip's registers
105 1.5.38.1 scw * through bus_space.
106 1.5.38.1 scw */
107 1.5.38.1 scw #define pcc_reg_read(sc,r) \
108 1.5.38.1 scw bus_space_read_1((sc)->sc_bust, (sc)->sc_bush, (r))
109 1.5.38.1 scw #define pcc_reg_read16(sc,r) \
110 1.5.38.1 scw bus_space_read_2((sc)->sc_bust, (sc)->sc_bush, (r))
111 1.5.38.1 scw #define pcc_reg_read32(sc,r) \
112 1.5.38.1 scw bus_space_read_4((sc)->sc_bust, (sc)->sc_bush, (r))
113 1.5.38.1 scw #define pcc_reg_write(sc,r,v) \
114 1.5.38.1 scw bus_space_write_1((sc)->sc_bust, (sc)->sc_bush, (r), (v))
115 1.5.38.1 scw #define pcc_reg_write16(sc,r,v) \
116 1.5.38.1 scw bus_space_write_2((sc)->sc_bust, (sc)->sc_bush, (r), (v))
117 1.5.38.1 scw #define pcc_reg_write32(sc,r,v) \
118 1.5.38.1 scw bus_space_write_4((sc)->sc_bust, (sc)->sc_bush, (r), (v))
119 1.1 chuck
120 1.1 chuck
121 1.1 chuck /*
122 1.5 thorpej * we lock off our interrupt vector at 0x40.
123 1.1 chuck */
124 1.1 chuck
125 1.5.38.1 scw #define PCC_VECBASE 0x40
126 1.5.38.1 scw #define PCC_NVEC 12
127 1.1 chuck
128 1.1 chuck /*
129 1.1 chuck * vectors we use
130 1.1 chuck */
131 1.1 chuck
132 1.1 chuck #define PCCV_ACFAIL 0
133 1.1 chuck #define PCCV_BERR 1
134 1.1 chuck #define PCCV_ABORT 2
135 1.1 chuck #define PCCV_ZS 3
136 1.1 chuck #define PCCV_LE 4
137 1.5.38.1 scw #define PCCV_SCSI 5
138 1.5.38.1 scw #define PCCV_DMA 6
139 1.1 chuck #define PCCV_PRINTER 7
140 1.1 chuck #define PCCV_TIMER1 8
141 1.1 chuck #define PCCV_TIMER2 9
142 1.1 chuck #define PCCV_SOFT1 10
143 1.1 chuck #define PCCV_SOFT2 11
144 1.1 chuck
145 1.1 chuck /*
146 1.1 chuck * enable interrupt
147 1.1 chuck */
148 1.1 chuck
149 1.2 chuck #define PCC_ICLEAR 0x80
150 1.1 chuck #define PCC_IENABLE 0x08
151 1.1 chuck
152 1.1 chuck /*
153 1.1 chuck * interrupt mask
154 1.1 chuck */
155 1.1 chuck
156 1.1 chuck #define PCC_IMASK 0x7
157 1.1 chuck
158 1.1 chuck /*
159 1.1 chuck * clock/timer
160 1.1 chuck */
161 1.1 chuck
162 1.1 chuck #define PCC_TIMERACK 0x80 /* ack intr */
163 1.1 chuck #define PCC_TIMER100HZ 63936 /* load value for 100Hz */
164 1.1 chuck #define PCC_TIMERCLEAR 0x0 /* reset and clear timer */
165 1.3 chuck #define PCC_TIMERSTOP 0x1 /* stop clock, but don't clear it */
166 1.1 chuck #define PCC_TIMERSTART 0x3 /* start timer */
167 1.5 thorpej
168 1.5 thorpej #define pcc_timer_hz2lim(hz) (65536 - (160000/(hz)))
169 1.5 thorpej #define pcc_timer_us2lim(us) (65536 - (160000/(1000000/(us))))
170 1.1 chuck
171 1.1 chuck /*
172 1.1 chuck * serial control
173 1.1 chuck */
174 1.1 chuck
175 1.1 chuck #define PCC_ZSEXTERN 0x10 /* let PCC supply vector */
176 1.3 chuck
177 1.3 chuck /*
178 1.3 chuck * abort switch
179 1.3 chuck */
180 1.3 chuck
181 1.3 chuck #define PCC_ABORT_IEN 0x08 /* enable interrupt */
182 1.3 chuck #define PCC_ABORT_ABS 0x40 /* current state of switch */
183 1.3 chuck #define PCC_ABORT_ACK 0x80 /* interrupt active; write to ack */
184 1.3 chuck
185 1.3 chuck /*
186 1.3 chuck * general control register
187 1.3 chuck */
188 1.3 chuck
189 1.3 chuck #define PCC_GENCR_IEN 0x10 /* global interrupt enable */
190 1.5.38.1 scw
191 1.5.38.1 scw #endif /* __MVME68K_PCCREG_H */
192