1 /* $NetBSD: ioblix_zbus.c,v 1.13 2005/12/11 12:16:28 christos Exp $ */
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ignatios Souvatzis.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: ioblix_zbus.c,v 1.13 2005/12/11 12:16:28 christos Exp $");
35 /* IOBlix Zorro driver */
36 /* XXX to be done: we need to probe the com clock speed! */
38 #include <sys/types.h>
41 #include <sys/device.h>
42 #include <sys/systm.h>
43 #include <sys/param.h>
45 #include <machine/bus.h>
47 #include <amiga/include/cpu.h>
49 #include <amiga/amiga/device.h>
50 #include <amiga/amiga/drcustom.h>
52 #include <amiga/dev/supio.h>
53 #include <amiga/dev/zbusvar.h>
58 struct bus_space_tag sc_bst
;
61 int iobzmatch(struct device
*, struct cfdata
*, void *);
62 void iobzattach(struct device
*, struct device
*, void *);
63 int iobzprint(void *auxp
, const char *);
64 void iobz_shutdown(void *);
66 CFATTACH_DECL(iobl_zbus
, sizeof(struct iobz_softc
),
67 iobzmatch
, iobzattach
, NULL
, NULL
);
70 iobzmatch(struct device
*parent
, struct cfdata
*cfp
, void *auxp
)
73 struct zbus_args
*zap
;
77 if (zap
->manid
!= 4711)
91 { "com", 0x100, 24000000 }, /* XXX see below */
92 { "com", 0x108, 24000000 },
93 { "com", 0x110, 24000000 },
94 { "com", 0x118, 24000000 },
101 #define IOBZCLOCK 22118400;
103 int iobzclock
= IOBZCLOCK
; /* patchable! */
106 iobzattach(struct device
*parent
, struct device
*self
, void *auxp
)
108 struct iobz_softc
*iobzsc
;
109 struct iobz_devs
*iobzd
;
110 struct zbus_args
*zap
;
111 struct supio_attach_args supa
;
112 extern const struct amiga_bus_space_methods amiga_bus_stride_16
;
113 volatile u_int8_t
*p
;
116 iobzsc
= (struct iobz_softc
*)self
;
122 iobzsc
->sc_bst
.base
= (u_long
)zap
->va
;
123 iobzsc
->sc_bst
.absm
= &amiga_bus_stride_16
;
125 supa
.supio_iot
= &iobzsc
->sc_bst
;
130 while (iobzd
->name
) {
131 supa
.supio_name
= iobzd
->name
;
132 supa
.supio_iobase
= iobzd
->off
;
133 supa
.supio_arg
= iobzclock
/* XXX iobzd->arg */;
134 config_found(self
, &supa
, iobzprint
); /* XXX */
138 p
= (volatile u_int8_t
*)zap
->va
+ 2;
139 (void)shutdownhook_establish(iobz_shutdown
, __UNVOLATILE(p
));
140 *p
= ((*p
) & 0x1F) | 0x80;
144 iobzprint(void *auxp
, const char *pnp
)
146 struct supio_attach_args
*supa
;
152 aprint_normal("%s at %s port 0x%02x",
153 supa
->supio_name
, pnp
, supa
->supio_iobase
);
159 * Disable board interrupts at shutdown time.
163 iobz_shutdown(void *p
) {