2002-03-24 18:45:29 +03:00
|
|
|
/* $NetBSD: upc_iobus.c,v 1.1 2002/03/24 15:47:14 bjh21 Exp $ */
|
2000-08-17 03:56:08 +04:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2000 Ben Harris
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
|
|
|
/*
|
|
|
|
* upc_iobus.c - attachment of the 82C7xx to the Archimedes I/O bus
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
2002-03-24 18:45:29 +03:00
|
|
|
__RCSID("$NetBSD: upc_iobus.c,v 1.1 2002/03/24 15:47:14 bjh21 Exp $");
|
2000-08-17 03:56:08 +04:00
|
|
|
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
2002-03-24 18:45:29 +03:00
|
|
|
#include <arch/acorn26/iobus/iobusvar.h>
|
2000-08-17 03:56:08 +04:00
|
|
|
|
2002-03-24 18:45:29 +03:00
|
|
|
#include <arch/acorn26/iobus/iocreg.h>
|
2000-08-17 03:56:08 +04:00
|
|
|
#include <machine/irq.h>
|
|
|
|
|
|
|
|
#include <dev/ic/upcreg.h>
|
|
|
|
#include <dev/ic/upcvar.h>
|
|
|
|
|
|
|
|
#include "ioeb.h"
|
|
|
|
|
2001-01-24 02:58:31 +03:00
|
|
|
#if NIOEB > 0
|
2002-03-24 18:45:29 +03:00
|
|
|
#include <arch/acorn26/ioc/ioebvar.h>
|
2001-01-24 02:58:31 +03:00
|
|
|
#endif
|
|
|
|
|
2000-08-17 03:56:08 +04:00
|
|
|
static int upc_iobus_match(struct device *, struct cfdata *, void *);
|
|
|
|
static void upc_iobus_attach(struct device *, struct device *, void *);
|
|
|
|
|
|
|
|
struct upc_iobus_softc {
|
|
|
|
struct upc_softc sc_upc;
|
2001-01-24 01:07:59 +03:00
|
|
|
struct evcnt sc_intrcnt4;
|
|
|
|
struct evcnt sc_intrcntw;
|
|
|
|
struct evcnt sc_intrcntf;
|
|
|
|
struct evcnt sc_intrcntp;
|
2000-08-17 03:56:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cfattach upc_iobus_ca = {
|
|
|
|
sizeof(struct upc_iobus_softc), upc_iobus_match, upc_iobus_attach
|
|
|
|
};
|
|
|
|
|
2001-01-24 02:58:31 +03:00
|
|
|
static struct device *the_upc_iobus;
|
2000-08-17 03:56:08 +04:00
|
|
|
|
|
|
|
static int
|
|
|
|
upc_iobus_match(struct device *parent, struct cfdata *cf, void *aux)
|
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
* As is traditional, probing for iobus devices is impossible
|
|
|
|
* (The machine hangs if there's nothing there). In this case,
|
2001-01-24 02:58:31 +03:00
|
|
|
* assume that if there's an IOEB, we've got a UPC too.
|
2000-08-17 03:56:08 +04:00
|
|
|
*/
|
|
|
|
#if NIOEB > 0
|
2001-01-24 02:58:31 +03:00
|
|
|
if (the_ioeb != NULL && the_upc_iobus == NULL)
|
2000-08-17 03:56:08 +04:00
|
|
|
return 1;
|
|
|
|
#endif
|
2001-01-24 02:58:31 +03:00
|
|
|
return 0;
|
2000-08-17 03:56:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
upc_iobus_attach(struct device *parent, struct device *self, void *aux)
|
|
|
|
{
|
|
|
|
struct iobus_attach_args *ioa = aux;
|
|
|
|
struct upc_iobus_softc *sc = (struct upc_iobus_softc *)self;
|
|
|
|
struct upc_softc *upc = &sc->sc_upc;
|
|
|
|
|
|
|
|
upc->sc_iot = ioa->ioa_tag;
|
2001-03-20 03:04:28 +03:00
|
|
|
bus_space_map(ioa->ioa_tag, ioa->ioa_base, UPC_BUS_SIZE, 0,
|
|
|
|
&upc->sc_ioh);
|
2000-08-17 03:56:08 +04:00
|
|
|
upc_attach(upc);
|
|
|
|
|
2001-01-24 01:07:59 +03:00
|
|
|
if (upc->sc_irq4.uih_func != NULL) {
|
|
|
|
evcnt_attach_dynamic(&sc->sc_intrcnt4, EVCNT_TYPE_INTR, NULL,
|
|
|
|
self->dv_xname, "irq4");
|
|
|
|
irq_establish(IOC_IRQ_IL2, upc->sc_irq4.uih_level,
|
|
|
|
upc->sc_irq4.uih_func, upc->sc_irq4.uih_arg,
|
|
|
|
&sc->sc_intrcnt4);
|
|
|
|
}
|
|
|
|
if (upc->sc_wintr.uih_func != NULL) {
|
|
|
|
evcnt_attach_dynamic(&sc->sc_intrcntw, EVCNT_TYPE_INTR, NULL,
|
|
|
|
self->dv_xname, "wdc intr");
|
|
|
|
irq_establish(IOC_IRQ_IL3, upc->sc_wintr.uih_level,
|
|
|
|
upc->sc_wintr.uih_func, upc->sc_wintr.uih_arg,
|
|
|
|
&sc->sc_intrcntw);
|
|
|
|
}
|
|
|
|
if (upc->sc_fintr.uih_func != NULL) {
|
|
|
|
evcnt_attach_dynamic(&sc->sc_intrcntf, EVCNT_TYPE_INTR, NULL,
|
|
|
|
self->dv_xname, "fdc intr");
|
|
|
|
irq_establish(IOC_IRQ_IL4, upc->sc_fintr.uih_level,
|
|
|
|
upc->sc_fintr.uih_func, upc->sc_fintr.uih_arg,
|
|
|
|
&sc->sc_intrcntf);
|
|
|
|
}
|
|
|
|
if (upc->sc_pintr.uih_func != NULL) {
|
|
|
|
evcnt_attach_dynamic(&sc->sc_intrcntp, EVCNT_TYPE_INTR, NULL,
|
|
|
|
self->dv_xname, "lpt intr");
|
|
|
|
irq_establish(IOC_IRQ_IL6, upc->sc_pintr.uih_level,
|
|
|
|
upc->sc_pintr.uih_func, upc->sc_pintr.uih_arg,
|
|
|
|
&sc->sc_intrcntp);
|
|
|
|
}
|
2000-08-17 03:56:08 +04:00
|
|
|
/* IRQ3 on the 82C71x is not connected */
|
|
|
|
}
|