zs.c revision 1.1 1 1.1 drochner /* $NetBSD: zs.c,v 1.1 2001/05/14 18:23:07 drochner Exp $ */
2 1.1 drochner
3 1.1 drochner /*-
4 1.1 drochner * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 1.1 drochner * All rights reserved.
6 1.1 drochner *
7 1.1 drochner * This code is derived from software contributed to The NetBSD Foundation
8 1.1 drochner * by Gordon W. Ross.
9 1.1 drochner *
10 1.1 drochner * Redistribution and use in source and binary forms, with or without
11 1.1 drochner * modification, are permitted provided that the following conditions
12 1.1 drochner * are met:
13 1.1 drochner * 1. Redistributions of source code must retain the above copyright
14 1.1 drochner * notice, this list of conditions and the following disclaimer.
15 1.1 drochner * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 drochner * notice, this list of conditions and the following disclaimer in the
17 1.1 drochner * documentation and/or other materials provided with the distribution.
18 1.1 drochner * 3. All advertising materials mentioning features or use of this software
19 1.1 drochner * must display the following acknowledgement:
20 1.1 drochner * This product includes software developed by the NetBSD
21 1.1 drochner * Foundation, Inc. and its contributors.
22 1.1 drochner * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 drochner * contributors may be used to endorse or promote products derived
24 1.1 drochner * from this software without specific prior written permission.
25 1.1 drochner *
26 1.1 drochner * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 drochner * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 drochner * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 drochner * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 drochner * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 drochner * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 drochner * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 drochner * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 drochner * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 drochner * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 drochner * POSSIBILITY OF SUCH DAMAGE.
37 1.1 drochner */
38 1.1 drochner
39 1.1 drochner /*
40 1.1 drochner * Zilog Z8530 Dual UART driver (machine-dependent part)
41 1.1 drochner *
42 1.1 drochner * Runs two serial lines per chip using slave drivers.
43 1.1 drochner * Plain tty/async lines use the zs_async slave.
44 1.1 drochner */
45 1.1 drochner
46 1.1 drochner #include "opt_ddb.h"
47 1.1 drochner
48 1.1 drochner #include <sys/param.h>
49 1.1 drochner #include <sys/systm.h>
50 1.1 drochner #include <sys/conf.h>
51 1.1 drochner #include <sys/device.h>
52 1.1 drochner #include <sys/file.h>
53 1.1 drochner #include <sys/ioctl.h>
54 1.1 drochner #include <sys/kernel.h>
55 1.1 drochner #include <sys/malloc.h>
56 1.1 drochner #include <sys/proc.h>
57 1.1 drochner #include <sys/tty.h>
58 1.1 drochner #include <sys/time.h>
59 1.1 drochner #include <sys/syslog.h>
60 1.1 drochner
61 1.1 drochner #include <dev/cons.h>
62 1.1 drochner #include <dev/ic/z8530reg.h>
63 1.1 drochner
64 1.1 drochner #include <machine/cpu.h>
65 1.1 drochner
66 1.1 drochner #include <machine/z8530var.h>
67 1.1 drochner #include <cesfic/dev/zsvar.h>
68 1.1 drochner
69 1.1 drochner int zs_getc __P((void*));
70 1.1 drochner void zs_putc __P((void*, int));
71 1.1 drochner
72 1.1 drochner static struct zs_chanstate zs_conschan_store;
73 1.1 drochner static int zs_hwflags[2][2];
74 1.1 drochner int zs_major = 10;
75 1.1 drochner int zssoftpending;
76 1.1 drochner
77 1.1 drochner extern struct cfdriver zsc_cd;
78 1.1 drochner
79 1.1 drochner u_char zs_init_reg[16] = {
80 1.1 drochner 0, /* 0: CMD (reset, etc.) */
81 1.1 drochner 0, /* 1: No interrupts yet. */
82 1.1 drochner 0x18 + ZSHARD_PRI, /* IVECT */
83 1.1 drochner ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
84 1.1 drochner ZSWR4_CLK_X16 | ZSWR4_ONESB | ZSWR4_EVENP,
85 1.1 drochner ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
86 1.1 drochner 0, /* 6: TXSYNC/SYNCLO */
87 1.1 drochner 0, /* 7: RXSYNC/SYNCHI */
88 1.1 drochner 0, /* 8: alias for data port */
89 1.1 drochner ZSWR9_MASTER_IE,
90 1.1 drochner 0, /*10: Misc. TX/RX control bits */
91 1.1 drochner ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
92 1.1 drochner 11, /*12: BAUDLO (default=9600) */
93 1.1 drochner 0, /*13: BAUDHI (default=9600) */
94 1.1 drochner ZSWR14_BAUD_ENA | ZSWR14_BAUD_FROM_PCLK,
95 1.1 drochner ZSWR15_BREAK_IE | ZSWR15_DCD_IE,
96 1.1 drochner };
97 1.1 drochner
98 1.1 drochner static int zsc_print __P((void *, const char *));
99 1.1 drochner int zscngetc __P((dev_t));
100 1.1 drochner void zscnputc __P((dev_t, int));
101 1.1 drochner
102 1.1 drochner static struct consdev zscons = { NULL, NULL,
103 1.1 drochner zscngetc, zscnputc, nullcnpollc, 0, NODEV, 1 };
104 1.1 drochner
105 1.1 drochner void
106 1.1 drochner zs_config(zsc, base)
107 1.1 drochner struct zsc_softc *zsc;
108 1.1 drochner char *base;
109 1.1 drochner {
110 1.1 drochner struct zsc_attach_args zsc_args;
111 1.1 drochner struct zs_chanstate *cs;
112 1.1 drochner int zsc_unit, channel, s;
113 1.1 drochner
114 1.1 drochner zsc_unit = zsc->zsc_dev.dv_unit;
115 1.1 drochner printf(": Zilog 8530 SCC\n");
116 1.1 drochner
117 1.1 drochner /*
118 1.1 drochner * Initialize software state for each channel.
119 1.1 drochner */
120 1.1 drochner for (channel = 0; channel < 2; channel++) {
121 1.1 drochner zsc_args.channel = channel;
122 1.1 drochner zsc_args.hwflags = zs_hwflags[zsc_unit][channel];
123 1.1 drochner
124 1.1 drochner /*
125 1.1 drochner * If we're the console, copy the channel state, and
126 1.1 drochner * adjust the console channel pointer.
127 1.1 drochner */
128 1.1 drochner if (zsc_args.hwflags & ZS_HWFLAG_CONSOLE) {
129 1.1 drochner cs = &zs_conschan_store;
130 1.1 drochner } else {
131 1.1 drochner cs = malloc(sizeof(struct zs_chanstate),
132 1.1 drochner M_DEVBUF, M_NOWAIT);
133 1.1 drochner if(channel==0){
134 1.1 drochner cs->cs_reg_csr = base+7;
135 1.1 drochner cs->cs_reg_data = base+15;
136 1.1 drochner } else {
137 1.1 drochner cs->cs_reg_csr = base+3;
138 1.1 drochner cs->cs_reg_data = base+11;
139 1.1 drochner }
140 1.1 drochner bcopy(zs_init_reg, cs->cs_creg, 16);
141 1.1 drochner bcopy(zs_init_reg, cs->cs_preg, 16);
142 1.1 drochner cs->cs_defspeed = 9600;
143 1.1 drochner }
144 1.1 drochner zsc->zsc_cs[channel] = cs;
145 1.1 drochner
146 1.1 drochner cs->cs_defcflag = CREAD | CS8 | HUPCL;
147 1.1 drochner
148 1.1 drochner /* Make these correspond to cs_defcflag (-crtscts) */
149 1.1 drochner cs->cs_rr0_dcd = ZSRR0_DCD;
150 1.1 drochner cs->cs_rr0_cts = 0;
151 1.1 drochner cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
152 1.1 drochner cs->cs_wr5_rts = 0;
153 1.1 drochner
154 1.1 drochner cs->cs_channel = channel;
155 1.1 drochner cs->cs_private = NULL;
156 1.1 drochner cs->cs_ops = &zsops_null;
157 1.1 drochner cs->cs_brg_clk = 4000000 / 16;
158 1.1 drochner
159 1.1 drochner /*
160 1.1 drochner * Clear the master interrupt enable.
161 1.1 drochner * The INTENA is common to both channels,
162 1.1 drochner * so just do it on the A channel.
163 1.1 drochner */
164 1.1 drochner if (channel == 0) {
165 1.1 drochner zs_write_reg(cs, 9, 0);
166 1.1 drochner }
167 1.1 drochner
168 1.1 drochner /*
169 1.1 drochner * Look for a child driver for this channel.
170 1.1 drochner * The child attach will setup the hardware.
171 1.1 drochner */
172 1.1 drochner if (!config_found(&zsc->zsc_dev, (void *)&zsc_args, zsc_print)) {
173 1.1 drochner /* No sub-driver. Just reset it. */
174 1.1 drochner u_char reset = (channel == 0) ?
175 1.1 drochner ZSWR9_A_RESET : ZSWR9_B_RESET;
176 1.1 drochner s = splzs();
177 1.1 drochner zs_write_reg(cs, 9, reset);
178 1.1 drochner splx(s);
179 1.1 drochner }
180 1.1 drochner }
181 1.1 drochner }
182 1.1 drochner
183 1.1 drochner static int
184 1.1 drochner zsc_print(aux, name)
185 1.1 drochner void *aux;
186 1.1 drochner const char *name;
187 1.1 drochner {
188 1.1 drochner struct zsc_attach_args *args = aux;
189 1.1 drochner
190 1.1 drochner if (name != NULL)
191 1.1 drochner printf("%s: ", name);
192 1.1 drochner
193 1.1 drochner if (args->channel != -1)
194 1.1 drochner printf(" channel %d", args->channel);
195 1.1 drochner
196 1.1 drochner return UNCONF;
197 1.1 drochner }
198 1.1 drochner
199 1.1 drochner int
200 1.1 drochner zshard(arg)
201 1.1 drochner void *arg;
202 1.1 drochner {
203 1.1 drochner register struct zsc_softc *zsc;
204 1.1 drochner register int unit, rval;
205 1.1 drochner
206 1.1 drochner rval = 0;
207 1.1 drochner for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
208 1.1 drochner zsc = zsc_cd.cd_devs[unit];
209 1.1 drochner if (zsc == NULL)
210 1.1 drochner continue;
211 1.1 drochner rval |= zsc_intr_hard(zsc);
212 1.1 drochner if ((zsc->zsc_cs[0]->cs_softreq) ||
213 1.1 drochner (zsc->zsc_cs[1]->cs_softreq))
214 1.1 drochner {
215 1.1 drochner /* zsc_req_softint(zsc); */
216 1.1 drochner /* We are at splzs here, so no need to lock. */
217 1.1 drochner if (zssoftpending == 0) {
218 1.1 drochner zssoftpending = 1;
219 1.1 drochner setsoftzs();
220 1.1 drochner }
221 1.1 drochner }
222 1.1 drochner }
223 1.1 drochner return (rval);
224 1.1 drochner }
225 1.1 drochner
226 1.1 drochner void
227 1.1 drochner softzs()
228 1.1 drochner {
229 1.1 drochner register struct zsc_softc *zsc;
230 1.1 drochner register int unit;
231 1.1 drochner
232 1.1 drochner /* This is not the only ISR on this IPL. */
233 1.1 drochner if (zssoftpending == 0)
234 1.1 drochner return;
235 1.1 drochner
236 1.1 drochner /*
237 1.1 drochner * The soft intr. bit will be set by zshard only if
238 1.1 drochner * the variable zssoftpending is zero.
239 1.1 drochner */
240 1.1 drochner zssoftpending = 0;
241 1.1 drochner
242 1.1 drochner for (unit = 0; unit < zsc_cd.cd_ndevs; ++unit) {
243 1.1 drochner zsc = zsc_cd.cd_devs[unit];
244 1.1 drochner if (zsc == NULL)
245 1.1 drochner continue;
246 1.1 drochner (void) zsc_intr_soft(zsc);
247 1.1 drochner }
248 1.1 drochner return;
249 1.1 drochner }
250 1.1 drochner
251 1.1 drochner u_char
252 1.1 drochner zs_read_reg(cs, reg)
253 1.1 drochner struct zs_chanstate *cs;
254 1.1 drochner u_char reg;
255 1.1 drochner {
256 1.1 drochner u_char val;
257 1.1 drochner
258 1.1 drochner *cs->cs_reg_csr = reg;
259 1.1 drochner ZS_DELAY();
260 1.1 drochner val = *cs->cs_reg_csr;
261 1.1 drochner ZS_DELAY();
262 1.1 drochner return val;
263 1.1 drochner }
264 1.1 drochner
265 1.1 drochner void
266 1.1 drochner zs_write_reg(cs, reg, val)
267 1.1 drochner struct zs_chanstate *cs;
268 1.1 drochner u_char reg, val;
269 1.1 drochner {
270 1.1 drochner *cs->cs_reg_csr = reg;
271 1.1 drochner ZS_DELAY();
272 1.1 drochner *cs->cs_reg_csr = val;
273 1.1 drochner ZS_DELAY();
274 1.1 drochner }
275 1.1 drochner
276 1.1 drochner u_char zs_read_csr(cs)
277 1.1 drochner struct zs_chanstate *cs;
278 1.1 drochner {
279 1.1 drochner register u_char val;
280 1.1 drochner
281 1.1 drochner val = *cs->cs_reg_csr;
282 1.1 drochner ZS_DELAY();
283 1.1 drochner return val;
284 1.1 drochner }
285 1.1 drochner
286 1.1 drochner void zs_write_csr(cs, val)
287 1.1 drochner struct zs_chanstate *cs;
288 1.1 drochner u_char val;
289 1.1 drochner {
290 1.1 drochner *cs->cs_reg_csr = val;
291 1.1 drochner ZS_DELAY();
292 1.1 drochner }
293 1.1 drochner
294 1.1 drochner u_char zs_read_data(cs)
295 1.1 drochner struct zs_chanstate *cs;
296 1.1 drochner {
297 1.1 drochner register u_char val;
298 1.1 drochner
299 1.1 drochner val = *cs->cs_reg_data;
300 1.1 drochner ZS_DELAY();
301 1.1 drochner return val;
302 1.1 drochner }
303 1.1 drochner
304 1.1 drochner void zs_write_data(cs, val)
305 1.1 drochner struct zs_chanstate *cs;
306 1.1 drochner u_char val;
307 1.1 drochner {
308 1.1 drochner *cs->cs_reg_data = val;
309 1.1 drochner ZS_DELAY();
310 1.1 drochner }
311 1.1 drochner
312 1.1 drochner int
313 1.1 drochner zs_set_speed(cs, bps)
314 1.1 drochner struct zs_chanstate *cs;
315 1.1 drochner int bps; /* bits per second */
316 1.1 drochner {
317 1.1 drochner int tconst, real_bps;
318 1.1 drochner
319 1.1 drochner tconst = BPS_TO_TCONST(cs->cs_brg_clk, bps);
320 1.1 drochner
321 1.1 drochner if (tconst < 0)
322 1.1 drochner return (EINVAL);
323 1.1 drochner
324 1.1 drochner /* Convert back to make sure we can do it. */
325 1.1 drochner real_bps = TCONST_TO_BPS(cs->cs_brg_clk, tconst);
326 1.1 drochner #if 0
327 1.1 drochner /* XXX - Allow some tolerance here? */
328 1.1 drochner if (real_bps != bps)
329 1.1 drochner return (EINVAL);
330 1.1 drochner #endif
331 1.1 drochner cs->cs_preg[12] = tconst;
332 1.1 drochner cs->cs_preg[13] = tconst >> 8;
333 1.1 drochner
334 1.1 drochner return (0);
335 1.1 drochner }
336 1.1 drochner
337 1.1 drochner int
338 1.1 drochner zs_set_modes(cs, cflag)
339 1.1 drochner struct zs_chanstate *cs;
340 1.1 drochner int cflag; /* bits per second */
341 1.1 drochner {
342 1.1 drochner int s;
343 1.1 drochner
344 1.1 drochner /*
345 1.1 drochner * Output hardware flow control on the chip is horrendous:
346 1.1 drochner * if carrier detect drops, the receiver is disabled, and if
347 1.1 drochner * CTS drops, the transmitter is stoped IN MID CHARACTER!
348 1.1 drochner * Therefore, NEVER set the HFC bit, and instead use the
349 1.1 drochner * status interrupt to detect CTS changes.
350 1.1 drochner */
351 1.1 drochner s = splzs();
352 1.1 drochner #if 0 /* XXX - See below. */
353 1.1 drochner if (cflag & CLOCAL) {
354 1.1 drochner cs->cs_rr0_dcd = 0;
355 1.1 drochner cs->cs_preg[15] &= ~ZSWR15_DCD_IE;
356 1.1 drochner } else {
357 1.1 drochner /* XXX - Need to notice DCD change here... */
358 1.1 drochner cs->cs_rr0_dcd = ZSRR0_DCD;
359 1.1 drochner cs->cs_preg[15] |= ZSWR15_DCD_IE;
360 1.1 drochner }
361 1.1 drochner #endif /* XXX */
362 1.1 drochner if (cflag & CRTSCTS) {
363 1.1 drochner cs->cs_wr5_dtr = ZSWR5_DTR;
364 1.1 drochner cs->cs_wr5_rts = ZSWR5_RTS;
365 1.1 drochner cs->cs_rr0_cts = ZSRR0_CTS;
366 1.1 drochner cs->cs_preg[15] |= ZSWR15_CTS_IE;
367 1.1 drochner } else {
368 1.1 drochner cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
369 1.1 drochner cs->cs_wr5_rts = 0;
370 1.1 drochner cs->cs_rr0_cts = 0;
371 1.1 drochner cs->cs_preg[15] &= ~ZSWR15_CTS_IE;
372 1.1 drochner }
373 1.1 drochner splx(s);
374 1.1 drochner
375 1.1 drochner /* Caller will stuff the pending registers. */
376 1.1 drochner return (0);
377 1.1 drochner }
378 1.1 drochner
379 1.1 drochner /*
380 1.1 drochner * Handle user request to enter kernel debugger.
381 1.1 drochner */
382 1.1 drochner void
383 1.1 drochner zs_abort(cs)
384 1.1 drochner struct zs_chanstate *cs;
385 1.1 drochner {
386 1.1 drochner int rr0;
387 1.1 drochner
388 1.1 drochner /* Wait for end of break to avoid PROM abort. */
389 1.1 drochner /* XXX - Limit the wait? */
390 1.1 drochner do {
391 1.1 drochner rr0 = *cs->cs_reg_csr;
392 1.1 drochner ZS_DELAY();
393 1.1 drochner } while (rr0 & ZSRR0_BREAK);
394 1.1 drochner #ifdef DDB
395 1.1 drochner console_debugger();
396 1.1 drochner #endif
397 1.1 drochner }
398 1.1 drochner
399 1.1 drochner /*
400 1.1 drochner * Polled input char.
401 1.1 drochner */
402 1.1 drochner int
403 1.1 drochner zs_getc(arg)
404 1.1 drochner void *arg;
405 1.1 drochner {
406 1.1 drochner register struct zs_chanstate *cs = arg;
407 1.1 drochner register int s, c, rr0, stat;
408 1.1 drochner
409 1.1 drochner s = splhigh();
410 1.1 drochner top:
411 1.1 drochner /* Wait for a character to arrive. */
412 1.1 drochner do {
413 1.1 drochner rr0 = *cs->cs_reg_csr;
414 1.1 drochner ZS_DELAY();
415 1.1 drochner } while ((rr0 & ZSRR0_RX_READY) == 0);
416 1.1 drochner
417 1.1 drochner /* Read error register. */
418 1.1 drochner stat = zs_read_reg(cs, 1) & (ZSRR1_FE | ZSRR1_DO | ZSRR1_PE);
419 1.1 drochner if (stat) {
420 1.1 drochner zs_write_csr(cs, ZSM_RESET_ERR);
421 1.1 drochner goto top;
422 1.1 drochner }
423 1.1 drochner
424 1.1 drochner /* Read character. */
425 1.1 drochner c = *cs->cs_reg_data;
426 1.1 drochner ZS_DELAY();
427 1.1 drochner splx(s);
428 1.1 drochner
429 1.1 drochner return (c);
430 1.1 drochner }
431 1.1 drochner
432 1.1 drochner /*
433 1.1 drochner * Polled output char.
434 1.1 drochner */
435 1.1 drochner void
436 1.1 drochner zs_putc(arg, c)
437 1.1 drochner void *arg;
438 1.1 drochner int c;
439 1.1 drochner {
440 1.1 drochner register struct zs_chanstate *cs = arg;
441 1.1 drochner register int s, rr0;
442 1.1 drochner
443 1.1 drochner s = splhigh();
444 1.1 drochner /* Wait for transmitter to become ready. */
445 1.1 drochner do {
446 1.1 drochner rr0 = *cs->cs_reg_csr;
447 1.1 drochner ZS_DELAY();
448 1.1 drochner } while ((rr0 & ZSRR0_TX_READY) == 0);
449 1.1 drochner
450 1.1 drochner *cs->cs_reg_data = c;
451 1.1 drochner ZS_DELAY();
452 1.1 drochner splx(s);
453 1.1 drochner }
454 1.1 drochner
455 1.1 drochner int zscngetc(dev)
456 1.1 drochner dev_t dev;
457 1.1 drochner {
458 1.1 drochner register struct zs_chanstate *cs = &zs_conschan_store;
459 1.1 drochner register int c;
460 1.1 drochner
461 1.1 drochner c = zs_getc(cs);
462 1.1 drochner return (c);
463 1.1 drochner }
464 1.1 drochner
465 1.1 drochner void zscnputc(dev, c)
466 1.1 drochner dev_t dev;
467 1.1 drochner int c;
468 1.1 drochner {
469 1.1 drochner register struct zs_chanstate *cs = &zs_conschan_store;
470 1.1 drochner
471 1.1 drochner zs_putc(cs, c);
472 1.1 drochner }
473 1.1 drochner
474 1.1 drochner /*
475 1.1 drochner * Common parts of console init.
476 1.1 drochner */
477 1.1 drochner void
478 1.1 drochner zs_cninit(base)
479 1.1 drochner void *base;
480 1.1 drochner {
481 1.1 drochner struct zs_chanstate *cs;
482 1.1 drochner /*
483 1.1 drochner * Pointer to channel state. Later, the console channel
484 1.1 drochner * state is copied into the softc, and the console channel
485 1.1 drochner * pointer adjusted to point to the new copy.
486 1.1 drochner */
487 1.1 drochner cs = &zs_conschan_store;
488 1.1 drochner zs_hwflags[0][0] = ZS_HWFLAG_CONSOLE;
489 1.1 drochner
490 1.1 drochner /* Setup temporary chanstate. */
491 1.1 drochner cs->cs_reg_csr = base+7;
492 1.1 drochner cs->cs_reg_data = base+15;
493 1.1 drochner
494 1.1 drochner /* Initialize the pending registers. */
495 1.1 drochner bcopy(zs_init_reg, cs->cs_preg, 16);
496 1.1 drochner cs->cs_preg[5] |= (ZSWR5_DTR | ZSWR5_RTS);
497 1.1 drochner
498 1.1 drochner /* XXX: Preserve BAUD rate from boot loader. */
499 1.1 drochner /* XXX: Also, why reset the chip here? -gwr */
500 1.1 drochner /* cs->cs_defspeed = zs_get_speed(cs); */
501 1.1 drochner cs->cs_defspeed = 9600; /* XXX */
502 1.1 drochner
503 1.1 drochner /* Clear the master interrupt enable. */
504 1.1 drochner zs_write_reg(cs, 9, 0);
505 1.1 drochner
506 1.1 drochner /* Reset the whole SCC chip. */
507 1.1 drochner zs_write_reg(cs, 9, ZSWR9_HARD_RESET);
508 1.1 drochner
509 1.1 drochner /* Copy "pending" to "current" and H/W. */
510 1.1 drochner zs_loadchannelregs(cs);
511 1.1 drochner
512 1.1 drochner /* Point the console at the SCC. */
513 1.1 drochner cn_tab = &zscons;
514 1.1 drochner }
515