Annotation of sys/arch/sparc/dev/bt445.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: bt445.c,v 1.1 2003/06/17 21:21:31 miod Exp $ */
2: /*
3: * Copyright (c) 2003, Miodrag Vallat.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
18: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
23: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24: * POSSIBILITY OF SUCH DAMAGE.
25: */
26:
27: /*
28: * A skeleton driver for the Brooktree BT445 ``Chameleon'' RAMDAC found
29: * on the early Tadpole SPARCbook 3 machines.
30: *
31: * It will not perform anything by itself, but frame buffer drivers can use
32: * its softc structure to be able to access the RAMDAC themselves - creating
33: * a ramdac API for just this specific case of separate attachments is not
34: * worth doing.
35: */
36:
37: #include <sys/param.h>
38: #include <sys/systm.h>
39: #include <sys/device.h>
40: #include <sys/conf.h>
41:
42: #include <machine/autoconf.h>
43:
44: #include <sparc/dev/bt445reg.h>
45: #include <sparc/dev/bt445var.h>
46:
47: void btcham_attach(struct device *, struct device *, void *);
48: int btcham_match(struct device *, void *, void *);
49:
50: struct cfattach btcham_ca = {
51: sizeof(struct bt445_softc), btcham_match, btcham_attach
52: };
53:
54: struct cfdriver btcham_cd = {
55: NULL, "btcham", DV_DULL
56: };
57:
58: /*
59: * Match a chameleon
60: */
61: int
62: btcham_match(struct device *parent, void *vcf, void *aux)
63: {
64: struct confargs *ca = aux;
65: struct romaux *ra = &ca->ca_ra;
66:
67: if (strcmp("bt445", ra->ra_name) != 0)
68: return (0);
69:
70: return (1);
71: }
72:
73: /*
74: * Attach a chameleon
75: */
76: void
77: btcham_attach(struct device *parent, struct device *self, void *args)
78: {
79: struct confargs *ca = args;
80: struct bt445_softc *sc = (struct bt445_softc *)self;
81: int id, rev;
82:
83: /*
84: * Map the registers
85: */
86: sc->sc_regs = mapiodev(ca->ca_ra.ra_reg, 0, ca->ca_ra.ra_len);
87:
88: /*
89: * Report a few values to please the user.
90: */
91: sc->sc_regs[BT445_ADDRESS] = BT445_REGISTER_OFFSET(BT445_ID);
92: id = sc->sc_regs[BT445_REGISTER_INDEX(BT445_ID)];
93:
94: sc->sc_regs[BT445_ADDRESS] = BT445_REGISTER_OFFSET(BT445_ID);
95: rev = sc->sc_regs[BT445_REGISTER_INDEX(BT445_ID)];
96:
97: printf(": id 0x%x, revision 0x%x\n", id, rev);
98: }
CVSweb