2012-10-27 21:17:22 +04:00
|
|
|
/* $NetBSD: ixpcom_ixm.c,v 1.11 2012/10/27 17:17:48 chs Exp $ */
|
2002-07-20 07:09:03 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2002
|
|
|
|
* Ichiro FUKUHARA <ichiro@ichiro.org>.
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``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 ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD 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.
|
|
|
|
*/
|
|
|
|
|
2003-03-25 09:53:15 +03:00
|
|
|
#include <sys/cdefs.h>
|
2012-10-27 21:17:22 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: ixpcom_ixm.c,v 1.11 2012/10/27 17:17:48 chs Exp $");
|
2003-03-25 09:53:15 +03:00
|
|
|
|
2002-07-20 07:09:03 +04:00
|
|
|
/* Front-end of ixpcom */
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
|
|
|
|
#include <sys/termios.h>
|
|
|
|
|
|
|
|
#include <machine/intr.h>
|
2011-07-02 00:36:42 +04:00
|
|
|
#include <sys/bus.h>
|
2002-07-20 07:09:03 +04:00
|
|
|
|
|
|
|
#include <arm/ixp12x0/ixp12x0_comreg.h>
|
|
|
|
#include <arm/ixp12x0/ixp12x0_comvar.h>
|
|
|
|
#include <arm/ixp12x0/ixp12x0reg.h>
|
|
|
|
#include <arm/ixp12x0/ixp12x0var.h>
|
|
|
|
#include <arm/ixp12x0/ixpsipvar.h>
|
|
|
|
|
|
|
|
#include <evbarm/ixm1200/ixpcom_ixmvar.h>
|
|
|
|
|
2012-02-12 20:31:01 +04:00
|
|
|
static int ixpcom_ixm_match(device_t, cfdata_t, void *);
|
|
|
|
static void ixpcom_ixm_attach(device_t, device_t, void *);
|
2002-07-20 07:09:03 +04:00
|
|
|
|
2012-10-27 21:17:22 +04:00
|
|
|
CFATTACH_DECL_NEW(ixpcom_ixm, sizeof(struct ixpcom_softc),
|
2002-10-02 08:55:47 +04:00
|
|
|
ixpcom_ixm_match, ixpcom_ixm_attach, NULL, NULL);
|
2002-07-20 07:09:03 +04:00
|
|
|
|
|
|
|
static int
|
2012-02-12 20:31:01 +04:00
|
|
|
ixpcom_ixm_match(device_t parent, cfdata_t match, void *aux)
|
2002-07-20 07:09:03 +04:00
|
|
|
{
|
2002-09-27 06:24:06 +04:00
|
|
|
if (strcmp(match->cf_name, "ixpcom") == 0)
|
2002-07-20 07:09:03 +04:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-02-12 20:31:01 +04:00
|
|
|
ixpcom_ixm_attach(device_t parent, device_t self, void *aux)
|
2002-07-20 07:09:03 +04:00
|
|
|
{
|
2012-02-12 20:31:01 +04:00
|
|
|
struct ixpcom_ixm_softc *isc = device_private(self);
|
2002-07-20 07:09:03 +04:00
|
|
|
struct ixpcom_softc *sc = &isc->sc_ixpcom;
|
|
|
|
struct ixpsip_attach_args *sa = aux;
|
|
|
|
|
2012-10-27 21:17:22 +04:00
|
|
|
sc->sc_dev = self;
|
2002-07-20 07:09:03 +04:00
|
|
|
isc->sc_iot = sa->sa_iot;
|
|
|
|
sc->sc_iot = sa->sa_iot;
|
|
|
|
sc->sc_baseaddr = sa->sa_addr;
|
|
|
|
|
|
|
|
if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0,
|
|
|
|
&sc->sc_ioh)) {
|
2012-02-12 20:31:01 +04:00
|
|
|
aprint_error(": unable to map device\n");
|
2002-07-20 07:09:03 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-02-12 20:31:01 +04:00
|
|
|
aprint_normal(": IXP12x0 UART\n");
|
2002-07-20 07:09:03 +04:00
|
|
|
|
|
|
|
ixpcom_attach_subr(sc);
|
|
|
|
|
|
|
|
#ifdef POLLING_COM
|
|
|
|
{ void* d; d = d = ixpcomintr; }
|
|
|
|
#else
|
|
|
|
ixp12x0_intr_establish(IXP12X0_INTR_UART, IPL_SERIAL, ixpcomintr, sc);
|
|
|
|
#endif
|
|
|
|
}
|