mkclock_pnpbus.c revision 1.4
11.4Stsutsui/* $NetBSD: mkclock_pnpbus.c,v 1.4 2008/03/29 06:16:54 tsutsui Exp $ */ 21.1Sgarbled/*- 31.1Sgarbled * Copyright (c) 2006 The NetBSD Foundation, Inc. 41.1Sgarbled * All rights reserved. 51.1Sgarbled * 61.1Sgarbled * This code is derived from software contributed to The NetBSD Foundation 71.1Sgarbled * by Tim Rightnour 81.1Sgarbled * 91.1Sgarbled * Redistribution and use in source and binary forms, with or without 101.1Sgarbled * modification, are permitted provided that the following conditions 111.1Sgarbled * are met: 121.1Sgarbled * 1. Redistributions of source code must retain the above copyright 131.1Sgarbled * notice, this list of conditions and the following disclaimer. 141.1Sgarbled * 2. Redistributions in binary form must reproduce the above copyright 151.1Sgarbled * notice, this list of conditions and the following disclaimer in the 161.1Sgarbled * documentation and/or other materials provided with the distribution. 171.1Sgarbled * 3. All advertising materials mentioning features or use of this software 181.1Sgarbled * must display the following acknowledgement: 191.1Sgarbled * This product includes software developed by the NetBSD 201.1Sgarbled * Foundation, Inc. and its contributors. 211.1Sgarbled * 4. Neither the name of The NetBSD Foundation nor the names of its 221.1Sgarbled * contributors may be used to endorse or promote products derived 231.1Sgarbled * from this software without specific prior written permission. 241.1Sgarbled * 251.1Sgarbled * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 261.1Sgarbled * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 271.1Sgarbled * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 281.1Sgarbled * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 291.1Sgarbled * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 301.1Sgarbled * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 311.1Sgarbled * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 321.1Sgarbled * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 331.1Sgarbled * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 341.1Sgarbled * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 351.1Sgarbled * POSSIBILITY OF SUCH DAMAGE. 361.1Sgarbled */ 371.1Sgarbled 381.1Sgarbled/* 391.1Sgarbled * Mostek MK48T18 time-of-day chip attachment to pnpbus, using two 401.1Sgarbled * 8-bit ports for address selection and one 8-bit port for data. 411.1Sgarbled * 421.1Sgarbled * Note that this is essentially a stub driver. We cannot attach the clock 431.1Sgarbled * with this driver because the clock and nvram part are one in the same, and 441.1Sgarbled * share the same IO ports. If we attach the clock, the NVRAM driver will 451.1Sgarbled * fail to attach. Instead, we note that we have an mk48txx device, and in 461.1Sgarbled * the nvram driver, we will attach the clock goop there. 471.1Sgarbled * 481.3Smsaitoh * Therefore the probe will always fail. 491.1Sgarbled */ 501.1Sgarbled 511.1Sgarbled#include <sys/cdefs.h> 521.4Stsutsui__KERNEL_RCSID(0, "$NetBSD: mkclock_pnpbus.c,v 1.4 2008/03/29 06:16:54 tsutsui Exp $"); 531.1Sgarbled 541.1Sgarbled#include <sys/param.h> 551.1Sgarbled#include <sys/kernel.h> 561.1Sgarbled#include <sys/systm.h> 571.1Sgarbled#include <sys/device.h> 581.1Sgarbled 591.1Sgarbled#include <machine/bus.h> 601.1Sgarbled#include <machine/residual.h> 611.2Sgarbled#include <machine/chpidpnp.h> 621.1Sgarbled 631.1Sgarbled#include <dev/isa/isavar.h> 641.1Sgarbled#include <prep/pnpbus/pnpbusvar.h> 651.1Sgarbled 661.1Sgarbledextern int prep_clock_mk48txx; 671.1Sgarbled 681.4Stsutsuistatic int mkclock_pnpbus_probe(device_t, cfdata_t, void *); 691.1Sgarbled 701.4StsutsuiCFATTACH_DECL_NEW(mkclock_pnpbus, 0, mkclock_pnpbus_probe, NULL, NULL, NULL); 711.1Sgarbled 721.1Sgarbledstatic int 731.4Stsutsuimkclock_pnpbus_probe(device_t parent, cfdata_t cf, void *aux) 741.1Sgarbled{ 751.1Sgarbled struct pnpbus_dev_attach_args *pna = aux; 761.1Sgarbled 771.1Sgarbled if (strcmp(pna->pna_devid, "PNP0B00") == 0 && 781.2Sgarbled pna->subtype == RealTimeClock && pna->chipid == MOTmk48) 791.1Sgarbled prep_clock_mk48txx = 1; 801.1Sgarbled 811.1Sgarbled return 0; 821.1Sgarbled} 83