2 * Copyright (c) 1998 Martijn Plak. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the author nor the names of any co-contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 * 4. Altered versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software and/or documentation.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 *---------------------------------------------------------------------------
33 * isdn4bsd layer1 driver for Dynalink IS64PH isdn TA
34 * ==================================================
36 * $FreeBSD: src/sys/i4b/layer1/isic/i4b_dynalink.c,v 1.5.2.1 2001/08/10 14:08:38 obrien Exp $
37 * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_dynalink.c,v 1.3 2003/08/07 21:17:26 dillon Exp $
39 * last edit-date: [Wed Jan 24 09:08:03 2001]
41 *---------------------------------------------------------------------------*/
45 This driver was written for the Dynalink IS64PH ISDN TA, based on two
46 Siemens chips (HSCX 21525 and ISAC 2186). It is sold in the Netherlands.
48 model numbers found on (my) card:
49 IS64PH, TAS100H-N, P/N:89590555, TA200S100045521
52 Siemens PSB 21525N, HSCX TE V2.1
53 Siemens PSB 2186N, ISAC-S TE V1.1
60 i/o port 4 byte alignment, 4 bytes requested,
61 10 bit i/o decoding, 0x100-0x3f8 (?)
62 irq 3,4,5,9,10,11,12,15, high true, edge sensitive
64 At the moment I'm writing this Dynalink is replacing this card with
65 one based on a single Siemens chip (IPAC). It will apparently be sold
66 under the same model name.
68 This driver might also work for Asuscom cards.
74 #if (NISIC > 0) && defined(DYNALINK)
76 #include <sys/param.h>
77 #include <sys/systm.h>
78 #include <sys/socket.h>
81 #include <net/i4b/include/machine/i4b_ioctl.h>
82 #include <net/i4b/include/machine/i4b_trace.h>
84 #include "../i4b_l1.h"
88 /* io address mapping */
97 /* HSCX register offsets */
101 /* LOW-LEVEL DEVICE ACCESS
105 dynalink_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size)
107 bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]);
108 bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]);
112 bus_space_write_1(t, h, ADDR, 0);
113 bus_space_read_multi_1(t, h, ISAC, buf, size);
115 case ISIC_WHAT_HSCXA:
116 bus_space_write_1(t, h, ADDR, HSCXA);
117 bus_space_read_multi_1(t, h, HSCX, buf, size);
119 case ISIC_WHAT_HSCXB:
120 bus_space_write_1(t, h, ADDR, HSCXB);
121 bus_space_read_multi_1(t, h, HSCX, buf, size);
127 dynalink_write_fifo(struct l1_softc *sc, int what, void *buf, size_t size)
129 bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]);
130 bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]);
134 bus_space_write_1(t, h, ADDR, 0);
135 bus_space_write_multi_1(t, h, ISAC, (u_int8_t*)buf, size);
137 case ISIC_WHAT_HSCXA:
138 bus_space_write_1(t, h, ADDR, HSCXA);
139 bus_space_write_multi_1(t, h, HSCX, (u_int8_t*)buf, size);
141 case ISIC_WHAT_HSCXB:
142 bus_space_write_1(t, h, ADDR, HSCXB);
143 bus_space_write_multi_1(t, h, HSCX, (u_int8_t*)buf, size);
149 dynalink_write_reg(struct l1_softc *sc, int what, bus_size_t reg, u_int8_t data)
151 bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]);
152 bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]);
156 bus_space_write_1(t, h, ADDR, reg);
157 bus_space_write_1(t, h, ISAC, data);
159 case ISIC_WHAT_HSCXA:
160 bus_space_write_1(t, h, ADDR, HSCXA+reg);
161 bus_space_write_1(t, h, HSCX, data);
163 case ISIC_WHAT_HSCXB:
164 bus_space_write_1(t, h, ADDR, HSCXB+reg);
165 bus_space_write_1(t, h, HSCX, data);
171 dynalink_read_reg(struct l1_softc *sc, int what, bus_size_t reg)
173 bus_space_tag_t t = rman_get_bustag(sc->sc_resources.io_base[0]);
174 bus_space_handle_t h = rman_get_bushandle(sc->sc_resources.io_base[0]);
178 bus_space_write_1(t, h, ADDR, reg);
179 return bus_space_read_1(t, h, ISAC);
180 case ISIC_WHAT_HSCXA:
181 bus_space_write_1(t, h, ADDR, HSCXA+reg);
182 return bus_space_read_1(t, h, HSCX);
183 case ISIC_WHAT_HSCXB:
184 bus_space_write_1(t, h, ADDR, HSCXB+reg);
185 return bus_space_read_1(t, h, HSCX);
190 /* attach callback routine */
192 isic_attach_Dyn(device_t dev)
194 int unit = device_get_unit(dev); /* get unit */
195 struct l1_softc *sc = &l1_sc[unit]; /* pointer to softc */
197 struct i4b_info * info = &(sc->sc_resources);
198 bus_space_tag_t t = rman_get_bustag(info->io_base[0]);
199 bus_space_handle_t h = rman_get_bushandle(info->io_base[0]);
201 /* fill in l1_softc structure */
202 sc->readreg = dynalink_read_reg;
203 sc->writereg = dynalink_write_reg;
204 sc->readfifo = dynalink_read_fifo;
205 sc->writefifo = dynalink_write_fifo;
207 sc->sc_cardtyp = CARD_TYPEP_DYNALINK;
208 sc->sc_bustyp = BUS_TYPE_IOM2;
210 sc->sc_bfifolen = HSCX_FIFO_LEN;
212 /* Read HSCX A/B VSTR. Expected value is 0x05 (V2.1). */
213 if( ((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) ||
214 ((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) )
216 printf("isic%d: HSCX VSTR test failed for Dynalink\n",
218 printf("isic%d: HSC0: VSTR: %#x\n",
219 sc->sc_unit, HSCX_READ(0, H_VSTR));
220 printf("isic%d: HSC1: VSTR: %#x\n",
221 sc->sc_unit, HSCX_READ(1, H_VSTR));
226 bus_space_write_1(t,h,ADDR,RESET);
227 DELAY(SEC_DELAY / 10);
228 bus_space_write_1(t,h,ADDR,0);
229 DELAY(SEC_DELAY / 10);
234 #endif /* (NISIC > 0) && defined(DYNALINK) */