1 /* $NetBSD: mkclock_pnpbus.c,v 1.4 2008/03/29 06:16:54 tsutsui Exp $ */
3 * Copyright (c) 2006 The NetBSD Foundation, Inc.
6 * This code is derived from software contributed to The NetBSD Foundation
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
32 * Mostek MK48T18 time-of-day chip attachment to pnpbus, using two
33 * 8-bit ports for address selection and one 8-bit port for data.
35 * Note that this is essentially a stub driver. We cannot attach the clock
36 * with this driver because the clock and nvram part are one in the same, and
37 * share the same IO ports. If we attach the clock, the NVRAM driver will
38 * fail to attach. Instead, we note that we have an mk48txx device, and in
39 * the nvram driver, we will attach the clock goop there.
41 * Therefore the probe will always fail.
44 #include <sys/cdefs.h>
45 __KERNEL_RCSID(0, "$NetBSD: mkclock_pnpbus.c,v 1.4 2008/03/29 06:16:54 tsutsui Exp $");
47 #include <sys/param.h>
48 #include <sys/kernel.h>
49 #include <sys/systm.h>
50 #include <sys/device.h>
52 #include <machine/bus.h>
53 #include <machine/residual.h>
54 #include <machine/chpidpnp.h>
56 #include <dev/isa/isavar.h>
57 #include <prep/pnpbus/pnpbusvar.h>
59 extern int prep_clock_mk48txx
;
61 static int mkclock_pnpbus_probe(device_t
, cfdata_t
, void *);
63 CFATTACH_DECL_NEW(mkclock_pnpbus
, 0, mkclock_pnpbus_probe
, NULL
, NULL
, NULL
);
66 mkclock_pnpbus_probe(device_t parent
, cfdata_t cf
, void *aux
)
68 struct pnpbus_dev_attach_args
*pna
= aux
;
70 if (strcmp(pna
->pna_devid
, "PNP0B00") == 0 &&
71 pna
->subtype
== RealTimeClock
&& pna
->chipid
== MOTmk48
)
72 prep_clock_mk48txx
= 1;