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