1998-12-27 21:47:14 +00:00
|
|
|
/*
|
2001-01-24 08:41:52 +00:00
|
|
|
* Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
* 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 THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*
|
1999-12-14 20:48:35 +00:00
|
|
|
* isic - I4B Siemens ISDN Chipset Driver for Creatix/Teles PnP
|
1998-12-27 21:47:14 +00:00
|
|
|
* ============================================================
|
2001-01-24 08:41:52 +00:00
|
|
|
* last edit-date: [Wed Jan 24 09:07:22 2001]
|
1999-12-14 20:48:35 +00:00
|
|
|
*
|
|
|
|
* Note: this driver works for the Creatix ISDN S0-16 P+P and
|
|
|
|
* for the Teles S0/16.3 PnP card. Although they are not
|
|
|
|
* the same hardware and don't share the same PnP config
|
|
|
|
* information, once the base addresses are set, the
|
|
|
|
* offsets are same and therefore they can use the same
|
|
|
|
* driver.
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
2003-06-10 23:48:55 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1998-12-27 21:47:14 +00:00
|
|
|
#include "opt_i4b.h"
|
|
|
|
|
Continue de-counting i4b. Devices i4bctl, i4bcapi, iavc, i4bq921,
i4bq931, i4b, isic, iwic, ifpi, ifpi2, ifpnp, ihfc, and itjc are
no longer count devices. Also remove a few other instances of N<DEVICE>
being used to control compilation of whole files.
Reviewed by: hm
2002-09-02 00:52:11 +00:00
|
|
|
#if (defined(CRTX_S0_P) || defined(TEL_S0_16_3_P) || defined(COMPAQ_M610))
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1999-12-14 20:48:35 +00:00
|
|
|
#include <sys/socket.h>
|
1998-12-27 21:47:14 +00:00
|
|
|
#include <net/if.h>
|
|
|
|
|
|
|
|
#include <machine/i4b_ioctl.h>
|
2001-01-24 08:41:52 +00:00
|
|
|
#include <machine/i4b_trace.h>
|
1998-12-27 21:47:14 +00:00
|
|
|
|
2001-01-24 08:41:52 +00:00
|
|
|
#include <i4b/layer1/i4b_l1.h>
|
2000-10-09 13:29:00 +00:00
|
|
|
#include <i4b/layer1/isic/i4b_isic.h>
|
|
|
|
#include <i4b/layer1/isic/i4b_hscx.h>
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* Creatix / Teles PnP ISAC get fifo routine
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
1999-12-14 20:48:35 +00:00
|
|
|
ctxs0P_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_read_multi_1(t,h,0x3e,buf,size);
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* Creatix / Teles PnP ISAC put fifo routine
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
1999-12-14 20:48:35 +00:00
|
|
|
ctxs0P_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_write_multi_1(t,h,0x3e,buf,size);
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* Creatix / Teles PnP ISAC put register routine
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
1999-12-14 20:48:35 +00:00
|
|
|
ctxs0P_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_write_1(t,h,offs,data);
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* Creatix / Teles PnP ISAC get register routine
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static u_int8_t
|
1999-12-14 20:48:35 +00:00
|
|
|
ctxs0P_read_reg(struct l1_softc *sc, int what, bus_size_t offs)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[what+2]);
|
|
|
|
bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[what+2]);
|
|
|
|
return bus_space_read_1(t,h,offs);
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* isic_attach_Cs0P - attach Creatix / Teles PnP
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
int
|
1999-12-14 20:48:35 +00:00
|
|
|
isic_attach_Cs0P(device_t dev)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
u_int32_t iobase1;
|
|
|
|
u_int32_t iobase2;
|
2002-02-28 03:15:53 +00:00
|
|
|
u_int32_t iocfg = 0; /* quiet bogus gcc warning */
|
1999-12-14 20:48:35 +00:00
|
|
|
int unit = device_get_unit(dev);
|
|
|
|
struct l1_softc *sc = &l1_sc[unit];
|
|
|
|
bus_space_tag_t t;
|
|
|
|
bus_space_handle_t h;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* this card needs a second io_base,
|
|
|
|
* free resources if we don't get it
|
|
|
|
*/
|
|
|
|
|
|
|
|
sc->sc_resources.io_rid[1] = 1;
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(!(sc->sc_resources.io_base[1] =
|
|
|
|
bus_alloc_resource(dev, SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[1],
|
|
|
|
0UL, ~0UL, 1, RF_ACTIVE)))
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: Could not get io area 1 for Creatix / Teles PnP!\n", unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
1998-12-27 21:47:14 +00:00
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
/*
|
|
|
|
* Compaq M610 has a cfg io area,
|
|
|
|
* we need it
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (sc->sc_cardtyp == CARD_TYPEP_COMPAQ_M610)
|
|
|
|
{
|
|
|
|
sc->sc_resources.io_rid[2] = 2;
|
1999-12-14 20:48:35 +00:00
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
if(!(sc->sc_resources.io_base[2] =
|
|
|
|
bus_alloc_resource(dev, SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[2],
|
|
|
|
0UL, ~0UL, 1, RF_ACTIVE)))
|
|
|
|
{
|
|
|
|
printf("isic%d: Could not get cfg io area for Compaq Microcom 610\n", unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
iocfg = rman_get_start(sc->sc_resources.io_base[2]);
|
|
|
|
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[2],
|
|
|
|
sc->sc_resources.io_base[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remember the io base addresses */
|
1999-12-14 20:48:35 +00:00
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
if (sc->sc_cardtyp != CARD_TYPEP_COMPAQ_M610)
|
|
|
|
{
|
|
|
|
iobase1 = rman_get_start(sc->sc_resources.io_base[0]);
|
|
|
|
iobase2 = rman_get_start(sc->sc_resources.io_base[1]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iobase1 = rman_get_start(sc->sc_resources.io_base[1]);
|
|
|
|
iobase2 = rman_get_start(sc->sc_resources.io_base[0]);
|
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/*
|
|
|
|
* because overlapping resources are invalid,
|
2001-10-21 09:20:52 +00:00
|
|
|
* release the first and second io port resource
|
1999-12-14 20:48:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[0],
|
|
|
|
sc->sc_resources.io_base[0]);
|
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_resources.io_rid[1],
|
|
|
|
sc->sc_resources.io_base[1]);
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* set and allocate a base io address for the ISAC chip */
|
|
|
|
|
|
|
|
sc->sc_resources.io_rid[2] = 2;
|
|
|
|
|
|
|
|
bus_set_resource(dev, SYS_RES_IOPORT, 2, iobase1-0x20, 0x40);
|
2001-10-21 09:20:52 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(!(sc->sc_resources.io_base[2] =
|
|
|
|
bus_alloc_resource(dev, SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[2],
|
|
|
|
0ul, ~0ul, 1, RF_ACTIVE)))
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: Could not get io area 2 for Creatix / Teles PnP!\n", unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
|
|
|
|
/* set and allocate a resource for the HSCX channel A */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
sc->sc_resources.io_rid[3] = 3;
|
|
|
|
|
|
|
|
/*XXX*/ /* FIXME !!!!
|
|
|
|
* the width of the resource is too small, there are accesses
|
|
|
|
* to it with an offset of 0x3e into the next resource. anyway,
|
|
|
|
* it seems to work and i have no idea how to do 2 resources
|
|
|
|
* overlapping each other.
|
|
|
|
*/
|
1998-12-27 21:47:14 +00:00
|
|
|
|
2000-10-09 13:29:00 +00:00
|
|
|
#if 0
|
1999-12-14 20:48:35 +00:00
|
|
|
bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x20);
|
2000-10-09 13:29:00 +00:00
|
|
|
#else
|
|
|
|
bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x10);
|
|
|
|
#endif
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(!(sc->sc_resources.io_base[3] =
|
|
|
|
bus_alloc_resource(dev,SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[3],
|
|
|
|
0ul,~0ul, 1, RF_ACTIVE)))
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: Could not get io area 3 for Creatix / Teles PnP!\n", unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* set and allocate a resources for the HSCX channel B */
|
|
|
|
|
|
|
|
sc->sc_resources.io_rid[4] = 4;
|
|
|
|
|
|
|
|
bus_set_resource(dev, SYS_RES_IOPORT, 4, iobase2, 0x40);
|
2001-10-21 09:20:52 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(!(sc->sc_resources.io_base[4] =
|
|
|
|
bus_alloc_resource(dev,SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[4],
|
|
|
|
0ul, ~0ul, 1, RF_ACTIVE)))
|
|
|
|
{
|
|
|
|
printf("isic%d: Could not get io area 4 for Creatix / Teles PnP!\n", unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
2001-10-21 09:20:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* set and allocate a resource for the cfg io
|
|
|
|
* for compaq m610
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (sc->sc_cardtyp == CARD_TYPEP_COMPAQ_M610)
|
|
|
|
{
|
|
|
|
sc->sc_resources.io_rid[5] = 5;
|
|
|
|
|
|
|
|
bus_set_resource(dev, SYS_RES_IOPORT, 5, iocfg, 0x01);
|
|
|
|
|
|
|
|
if(!(sc->sc_resources.io_base[5] =
|
|
|
|
bus_alloc_resource(dev,SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[5],
|
|
|
|
0ul, ~0ul, 1, RF_ACTIVE)))
|
|
|
|
{
|
|
|
|
printf("isic%d: Could not get cfg io area for Compaq Microcom 610!\n", unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-12-27 21:47:14 +00:00
|
|
|
/* setup access routines */
|
|
|
|
|
|
|
|
sc->clearirq = NULL;
|
|
|
|
sc->readreg = ctxs0P_read_reg;
|
|
|
|
sc->writereg = ctxs0P_write_reg;
|
|
|
|
|
|
|
|
sc->readfifo = ctxs0P_read_fifo;
|
|
|
|
sc->writefifo = ctxs0P_write_fifo;
|
|
|
|
|
|
|
|
/* setup card type */
|
2001-10-21 09:20:52 +00:00
|
|
|
|
|
|
|
if (sc->sc_cardtyp != CARD_TYPEP_COMPAQ_M610)
|
|
|
|
sc->sc_cardtyp = CARD_TYPEP_CS0P;
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/* setup IOM bus type */
|
|
|
|
|
|
|
|
sc->sc_bustyp = BUS_TYPE_IOM2;
|
|
|
|
|
|
|
|
sc->sc_ipac = 0;
|
|
|
|
sc->sc_bfifolen = HSCX_FIFO_LEN;
|
1999-12-14 20:48:35 +00:00
|
|
|
|
|
|
|
/* enable the card */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
if (sc->sc_cardtyp != CARD_TYPEP_COMPAQ_M610)
|
|
|
|
{
|
|
|
|
t = rman_get_bustag(sc->sc_resources.io_base[2]);
|
|
|
|
h = rman_get_bushandle(sc->sc_resources.io_base[2]);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
bus_space_write_1(t, h, 0x3c, 0);
|
|
|
|
DELAY(SEC_DELAY / 10);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
2001-10-21 09:20:52 +00:00
|
|
|
bus_space_write_1(t, h, 0x3c, 1);
|
|
|
|
DELAY(SEC_DELAY / 10);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t = rman_get_bustag(sc->sc_resources.io_base[5]);
|
|
|
|
h = rman_get_bushandle(sc->sc_resources.io_base[5]);
|
|
|
|
|
|
|
|
bus_space_write_1(t, h, 0xff, 0);
|
|
|
|
DELAY(SEC_DELAY / 10);
|
|
|
|
|
|
|
|
bus_space_write_1(t, h, 0x00, 1);
|
|
|
|
DELAY(SEC_DELAY / 10);
|
|
|
|
}
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
return 0;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
Continue de-counting i4b. Devices i4bctl, i4bcapi, iavc, i4bq921,
i4bq931, i4b, isic, iwic, ifpi, ifpi2, ifpnp, ihfc, and itjc are
no longer count devices. Also remove a few other instances of N<DEVICE>
being used to control compilation of whole files.
Reviewed by: hm
2002-09-02 00:52:11 +00:00
|
|
|
#endif /* (defined(CRTX_S0_P) || defined(TEL_S0_16_3_P) || defined(COMPAQ_M610)) */
|
1998-12-27 21:47:14 +00:00
|
|
|
|