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