zs_pcc.c revision 1.1.8.2 1 1.1.8.2 nathanw /* $NetBSD: zs_pcc.c,v 1.1.8.2 2002/10/18 02:36:13 nathanw Exp $ */
2 1.1.8.2 nathanw
3 1.1.8.2 nathanw /*
4 1.1.8.2 nathanw * Copyright (c) 1997, 1999
5 1.1.8.2 nathanw * Matthias Drochner. All rights reserved.
6 1.1.8.2 nathanw *
7 1.1.8.2 nathanw * Redistribution and use in source and binary forms, with or without
8 1.1.8.2 nathanw * modification, are permitted provided that the following conditions
9 1.1.8.2 nathanw * are met:
10 1.1.8.2 nathanw * 1. Redistributions of source code must retain the above copyright
11 1.1.8.2 nathanw * notice, this list of conditions and the following disclaimer.
12 1.1.8.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.8.2 nathanw * notice, this list of conditions and the following disclaimer in the
14 1.1.8.2 nathanw * documentation and/or other materials provided with the distribution.
15 1.1.8.2 nathanw *
16 1.1.8.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1.8.2 nathanw * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1.8.2 nathanw * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1.8.2 nathanw * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1.8.2 nathanw * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 1.1.8.2 nathanw * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 1.1.8.2 nathanw * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 1.1.8.2 nathanw * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 1.1.8.2 nathanw * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 1.1.8.2 nathanw * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 1.1.8.2 nathanw *
27 1.1.8.2 nathanw */
28 1.1.8.2 nathanw
29 1.1.8.2 nathanw #include <sys/param.h>
30 1.1.8.2 nathanw #include <sys/systm.h>
31 1.1.8.2 nathanw #include <sys/proc.h>
32 1.1.8.2 nathanw #include <sys/device.h>
33 1.1.8.2 nathanw #include <sys/conf.h>
34 1.1.8.2 nathanw #include <sys/file.h>
35 1.1.8.2 nathanw #include <sys/ioctl.h>
36 1.1.8.2 nathanw #include <sys/tty.h>
37 1.1.8.2 nathanw #include <sys/time.h>
38 1.1.8.2 nathanw #include <sys/kernel.h>
39 1.1.8.2 nathanw #include <sys/syslog.h>
40 1.1.8.2 nathanw
41 1.1.8.2 nathanw #include <dev/cons.h>
42 1.1.8.2 nathanw #include <dev/ic/z8530reg.h>
43 1.1.8.2 nathanw #include <machine/z8530var.h>
44 1.1.8.2 nathanw
45 1.1.8.2 nathanw #include <machine/cpu.h>
46 1.1.8.2 nathanw #include <machine/autoconf.h>
47 1.1.8.2 nathanw
48 1.1.8.2 nathanw #include <cesfic/cesfic/isr.h>
49 1.1.8.2 nathanw
50 1.1.8.2 nathanw #include <cesfic/dev/zsvar.h>
51 1.1.8.2 nathanw
52 1.1.8.2 nathanw extern void sic_enable_int __P((int, int, int, int, int));
53 1.1.8.2 nathanw
54 1.1.8.2 nathanw static int zsc_pcc_match __P((struct device *, struct cfdata *, void *));
55 1.1.8.2 nathanw static void zsc_pcc_attach __P((struct device *, struct device *, void *));
56 1.1.8.2 nathanw
57 1.1.8.2 nathanw static char *zsbase;
58 1.1.8.2 nathanw
59 1.1.8.2 nathanw CFATTACH_DECL(zsc_pcc, sizeof(struct zsc_softc),
60 1.1.8.2 nathanw zsc_pcc_match, zsc_pcc_attach, NULL, NULL);
61 1.1.8.2 nathanw
62 1.1.8.2 nathanw static int
63 1.1.8.2 nathanw zsc_pcc_match(parent, cf, aux)
64 1.1.8.2 nathanw struct device *parent;
65 1.1.8.2 nathanw struct cfdata *cf;
66 1.1.8.2 nathanw void *aux;
67 1.1.8.2 nathanw {
68 1.1.8.2 nathanw return (1);
69 1.1.8.2 nathanw }
70 1.1.8.2 nathanw
71 1.1.8.2 nathanw static void
72 1.1.8.2 nathanw zsc_pcc_attach(parent, self, aux)
73 1.1.8.2 nathanw struct device *parent;
74 1.1.8.2 nathanw struct device *self;
75 1.1.8.2 nathanw void *aux;
76 1.1.8.2 nathanw {
77 1.1.8.2 nathanw struct zsc_softc *zsc = (void *) self;
78 1.1.8.2 nathanw static int didintr;
79 1.1.8.2 nathanw
80 1.1.8.2 nathanw if (!zsbase)
81 1.1.8.2 nathanw mainbus_map(0x58000000, 0x10000, 0, (void **)&zsbase);
82 1.1.8.2 nathanw
83 1.1.8.2 nathanw /* Do common parts of SCC configuration. */
84 1.1.8.2 nathanw zs_config(zsc, zsbase);
85 1.1.8.2 nathanw
86 1.1.8.2 nathanw /*
87 1.1.8.2 nathanw * Now safe to install interrupt handlers. Note the arguments
88 1.1.8.2 nathanw * to the interrupt handlers aren't used. Note, we only do this
89 1.1.8.2 nathanw * once since both SCCs interrupt at the same level and vector.
90 1.1.8.2 nathanw */
91 1.1.8.2 nathanw if (didintr == 0) {
92 1.1.8.2 nathanw didintr = 1;
93 1.1.8.2 nathanw (void) isrlink(zshard, zsc, 4, ISRPRI_TTY);
94 1.1.8.2 nathanw sic_enable_int(19, 0, 4, 4, 0);
95 1.1.8.2 nathanw }
96 1.1.8.2 nathanw
97 1.1.8.2 nathanw zs_write_reg(zsc->zsc_cs[0], 2, 0x18 + ZSHARD_PRI);
98 1.1.8.2 nathanw zs_write_reg(zsc->zsc_cs[0], 9, ZSWR9_MASTER_IE);
99 1.1.8.2 nathanw }
100 1.1.8.2 nathanw
101 1.1.8.2 nathanw void
102 1.1.8.2 nathanw zs_cnattach(base)
103 1.1.8.2 nathanw void *base;
104 1.1.8.2 nathanw {
105 1.1.8.2 nathanw zsbase = base;
106 1.1.8.2 nathanw
107 1.1.8.2 nathanw zs_cninit(zsbase);
108 1.1.8.2 nathanw }
109