1 /* $OpenBSD: rt_isa.c,v 1.1 2002/08/28 21:20:48 mickey Exp $ */
2
3 /*
4 * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
5 * Vladimir Popov <jumbo@narod.ru>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /* ISA interface for AIMS Lab Radiotrack FM Radio Card device driver */
30
31 /*
32 * Sanyo LM7000 Direct PLL Frequency Synthesizer
33 */
34
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/device.h>
38
39 #include <machine/bus.h>
40
41 #include <dev/ic/lm700x.h>
42 #include <dev/isa/isavar.h>
43 #include <dev/isa/rtreg.h>
44 #include <dev/isa/rtvar.h>
45
46 int rt_isa_probe(struct device *, void *, void *);
47 void rt_isa_attach(struct device *, struct device *, void *);
48
49 struct cfattach rt_isa_ca = {
50 sizeof(struct rt_softc), rt_isa_probe, rt_isa_attach
51 };
52
53 int
54 rt_isa_probe(struct device *parent, void *match, void *aux)
55 {
56 struct isa_attach_args *ia = aux;
57 bus_space_handle_t ioh;
58 int iosize = 1;
59
60 if (!RT_BASE_VALID(ia->ia_iobase)) {
61 printf("rt: wrong iobase 0x%x\n", ia->ia_iobase);
62 return (0);
63 }
64
65 if (bus_space_map(ia->ia_iot, ia->ia_iobase, iosize, 0, &ioh))
66 return (0);
67
68 /* This doesn't work yet */
69 bus_space_unmap(ia->ia_iot, ioh, iosize);
70 return (0);
71 #if 0
72 ia->ia_iosize = iosize;
73 return 1;
74 #endif /* 0 */
75 }
76
77 void
78 rt_isa_attach(struct device *parent, struct device *self, void *aux)
79 {
80 struct rt_softc *sc = (void *) self;
81 struct isa_attach_args *ia = aux;
82 bus_space_handle_t ioh;
83
84 /* remap I/O */
85 if (bus_space_map(ia->ia_iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) {
86 printf(": bus_space_map() failed\n");
87 return;
88 }
89
90 printf(": AIMS Lab Radiotrack or compatible\n");
91
92 sc->sc_ct = CARD_RADIOTRACK;
93 sc->lm.iot = ia->ia_iot;
94 sc->lm.ioh = ioh;
95
96 rtattach(sc);
97 }