11.6Sdyoung/* $NetBSD: mkclock_pnpbus.c,v 1.6 2011/07/01 16:55:42 dyoung 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 * 181.1Sgarbled * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 191.1Sgarbled * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 201.1Sgarbled * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 211.1Sgarbled * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 221.1Sgarbled * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 231.1Sgarbled * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 241.1Sgarbled * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 251.1Sgarbled * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 261.1Sgarbled * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 271.1Sgarbled * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 281.1Sgarbled * POSSIBILITY OF SUCH DAMAGE. 291.1Sgarbled */ 301.1Sgarbled 311.1Sgarbled/* 321.1Sgarbled * Mostek MK48T18 time-of-day chip attachment to pnpbus, using two 331.1Sgarbled * 8-bit ports for address selection and one 8-bit port for data. 341.1Sgarbled * 351.1Sgarbled * Note that this is essentially a stub driver. We cannot attach the clock 361.1Sgarbled * with this driver because the clock and nvram part are one in the same, and 371.1Sgarbled * share the same IO ports. If we attach the clock, the NVRAM driver will 381.1Sgarbled * fail to attach. Instead, we note that we have an mk48txx device, and in 391.1Sgarbled * the nvram driver, we will attach the clock goop there. 401.1Sgarbled * 411.3Smsaitoh * Therefore the probe will always fail. 421.1Sgarbled */ 431.1Sgarbled 441.1Sgarbled#include <sys/cdefs.h> 451.6Sdyoung__KERNEL_RCSID(0, "$NetBSD: mkclock_pnpbus.c,v 1.6 2011/07/01 16:55:42 dyoung Exp $"); 461.1Sgarbled 471.1Sgarbled#include <sys/param.h> 481.1Sgarbled#include <sys/kernel.h> 491.1Sgarbled#include <sys/systm.h> 501.1Sgarbled#include <sys/device.h> 511.1Sgarbled 521.6Sdyoung#include <sys/bus.h> 531.1Sgarbled#include <machine/residual.h> 541.2Sgarbled#include <machine/chpidpnp.h> 551.1Sgarbled 561.1Sgarbled#include <dev/isa/isavar.h> 571.1Sgarbled#include <prep/pnpbus/pnpbusvar.h> 581.1Sgarbled 591.1Sgarbledextern int prep_clock_mk48txx; 601.1Sgarbled 611.4Stsutsuistatic int mkclock_pnpbus_probe(device_t, cfdata_t, void *); 621.1Sgarbled 631.4StsutsuiCFATTACH_DECL_NEW(mkclock_pnpbus, 0, mkclock_pnpbus_probe, NULL, NULL, NULL); 641.1Sgarbled 651.1Sgarbledstatic int 661.4Stsutsuimkclock_pnpbus_probe(device_t parent, cfdata_t cf, void *aux) 671.1Sgarbled{ 681.1Sgarbled struct pnpbus_dev_attach_args *pna = aux; 691.1Sgarbled 701.1Sgarbled if (strcmp(pna->pna_devid, "PNP0B00") == 0 && 711.2Sgarbled pna->subtype == RealTimeClock && pna->chipid == MOTmk48) 721.1Sgarbled prep_clock_mk48txx = 1; 731.1Sgarbled 741.1Sgarbled return 0; 751.1Sgarbled} 76