23 static const char *teles3_revision =
"$Revision: 2.19.2.4 $";
25 #define byteout(addr, val) outb(val, addr)
26 #define bytein(addr) inb(addr)
31 return (
bytein(adr + off));
44 insb(adr, data, size);
50 outsb(adr, data, size);
58 return (
readreg(cs->hw.teles3.isac, offset));
64 writereg(cs->hw.teles3.isac, offset, value);
70 read_fifo(cs->hw.teles3.isacfifo, data, size);
76 write_fifo(cs->hw.teles3.isacfifo, data, size);
82 return (
readreg(cs->hw.teles3.hscx[hscx], offset));
88 writereg(cs->hw.teles3.hscx[hscx], offset, value);
95 #define READHSCX(cs, nr, reg) readreg(cs->hw.teles3.hscx[nr], reg)
96 #define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.teles3.hscx[nr], reg, data)
97 #define READHSCXFIFO(cs, nr, ptr, cnt) read_fifo(cs->hw.teles3.hscxfifo[nr], ptr, cnt)
98 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) write_fifo(cs->hw.teles3.hscxfifo[nr], ptr, cnt)
103 teles3_interrupt(
int intno,
void *
dev_id)
106 struct IsdnCardState *cs =
dev_id;
115 hscx_int_main(cs, val);
123 if (cs->debug & L1_DEB_HSCX)
124 debugl1(cs,
"HSCX IntStat after IntRoutine");
129 if (cs->debug & L1_DEB_ISAC)
130 debugl1(cs,
"ISAC IntStat after IntRoutine");
141 spin_unlock_irqrestore(&cs->lock, flags);
146 release_ioregs(
struct IsdnCardState *cs,
int mask)
157 release_io_teles3(
struct IsdnCardState *cs)
162 if (cs->hw.teles3.cfg_reg) {
169 release_ioregs(cs, 0x7);
174 reset_teles3(
struct IsdnCardState *cs)
209 byteout(cs->hw.teles3.cfg_reg + 4, irqcfg);
211 byteout(cs->hw.teles3.cfg_reg + 4, irqcfg | 1);
214 byteout(cs->hw.teles3.cfg_reg, 0xff);
216 byteout(cs->hw.teles3.cfg_reg, 0x00);
220 byteout(cs->hw.teles3.isac + 0x3c, 0);
222 byteout(cs->hw.teles3.isac + 0x3c, 1);
230 Teles_card_msg(
struct IsdnCardState *cs,
int mt,
void *
arg)
238 spin_unlock_irqrestore(&cs->lock, flags);
241 release_io_teles3(cs);
246 spin_unlock_irqrestore(&cs->lock, flags);
259 (
unsigned long)
"Teles 16.3 PnP" },
262 (
unsigned long)
"Creatix 16.3 PnP" },
265 (
unsigned long)
"Compaq ISDN S0" },
277 struct IsdnCardState *cs = card->
cs;
280 strcpy(tmp, teles3_revision);
289 while (ipid->card_vendor) {
291 ipid->card_device, pnp_c))) {
294 ipid->vendor, ipid->function, pnp_d))) {
298 (
char *)ipid->driver_data);
306 card->
para[3] = pnp_port_start(pnp_d, 2);
307 card->
para[2] = pnp_port_start(pnp_d, 1);
308 card->
para[1] = pnp_port_start(pnp_d, 0);
310 if (!card->
para[0] || !card->
para[1] || !card->
para[2]) {
311 printk(
KERN_ERR "Teles PnP:some resources are missing %ld/%lx/%lx\n",
324 if (!ipid->card_vendor) {
331 cs->hw.teles3.cfg_reg = card->
para[1];
332 switch (cs->hw.teles3.cfg_reg) {
336 cs->hw.teles3.cfg_reg |= 0xc00;
339 cs->hw.teles3.isac = cs->hw.teles3.cfg_reg - 0x420;
340 cs->hw.teles3.hscx[0] = cs->hw.teles3.cfg_reg - 0xc20;
341 cs->hw.teles3.hscx[1] = cs->hw.teles3.cfg_reg - 0x820;
343 cs->hw.teles3.cfg_reg = 0;
344 cs->hw.teles3.hscx[0] = card->
para[1] - 0x20;
345 cs->hw.teles3.hscx[1] = card->
para[1];
346 cs->hw.teles3.isac = card->
para[1] + 0x20;
348 cs->hw.teles3.cfg_reg = card->
para[3];
349 cs->hw.teles3.isac = card->
para[2] - 32;
350 cs->hw.teles3.hscx[0] = card->
para[1] - 32;
351 cs->hw.teles3.hscx[1] = card->
para[1];
353 cs->hw.teles3.cfg_reg = 0;
354 cs->hw.teles3.isac = card->
para[1] - 32;
355 cs->hw.teles3.hscx[0] = card->
para[2] - 32;
356 cs->hw.teles3.hscx[1] = card->
para[2];
358 cs->irq = card->
para[0];
359 cs->hw.teles3.isacfifo = cs->hw.teles3.isac + 0x3e;
360 cs->hw.teles3.hscxfifo[0] = cs->hw.teles3.hscx[0] + 0x3e;
361 cs->hw.teles3.hscxfifo[1] = cs->hw.teles3.hscx[1] + 0x3e;
363 if (!
request_region(cs->hw.teles3.hscx[1], 96,
"HiSax Teles PCMCIA")) {
365 "HiSax: %s ports %x-%x already in use\n",
367 cs->hw.teles3.hscx[1],
368 cs->hw.teles3.hscx[1] + 96);
373 if (cs->hw.teles3.cfg_reg) {
377 "HiSax: %s config port %x already in use\n",
379 cs->hw.teles3.cfg_reg);
385 "HiSax: %s config port %x-%x already in use\n",
387 cs->hw.teles3.cfg_reg,
388 cs->hw.teles3.cfg_reg + 8);
395 "HiSax: %s isac ports %x-%x already in use\n",
397 cs->hw.teles3.isac + 32,
398 cs->hw.teles3.isac + 64);
399 if (cs->hw.teles3.cfg_reg) {
408 if (!
request_region(cs->hw.teles3.hscx[0] + 32, 32,
"HiSax hscx A")) {
410 "HiSax: %s hscx A ports %x-%x already in use\n",
412 cs->hw.teles3.hscx[0] + 32,
413 cs->hw.teles3.hscx[0] + 64);
414 if (cs->hw.teles3.cfg_reg) {
421 release_ioregs(cs, 1);
424 if (!
request_region(cs->hw.teles3.hscx[1] + 32, 32,
"HiSax hscx B")) {
426 "HiSax: %s hscx B ports %x-%x already in use\n",
428 cs->hw.teles3.hscx[1] + 32,
429 cs->hw.teles3.hscx[1] + 64);
430 if (cs->hw.teles3.cfg_reg) {
437 release_ioregs(cs, 3);
442 if ((val =
bytein(cs->hw.teles3.cfg_reg + 0)) != 0x51) {
444 cs->hw.teles3.cfg_reg + 0, val);
445 release_io_teles3(cs);
448 if ((val =
bytein(cs->hw.teles3.cfg_reg + 1)) != 0x93) {
450 cs->hw.teles3.cfg_reg + 1, val);
451 release_io_teles3(cs);
454 val =
bytein(cs->hw.teles3.cfg_reg + 2);
461 if (val != 0x46 && val != 0x39 && val != 0x38 && val != 0x1c && val != 0x1e && val != 0x1f) {
463 cs->hw.teles3.cfg_reg + 2, val);
464 release_io_teles3(cs);
469 "HiSax: %s config irq:%d isac:0x%X cfg:0x%X\n",
471 cs->hw.teles3.isac + 32, cs->hw.teles3.cfg_reg);
473 "HiSax: hscx A:0x%X hscx B:0x%X\n",
474 cs->hw.teles3.hscx[0] + 32, cs->hw.teles3.hscx[1] + 32);
477 if (reset_teles3(cs)) {
479 release_io_teles3(cs);
484 cs->readisacfifo = &ReadISACfifo;
485 cs->writeisacfifo = &WriteISACfifo;
488 cs->BC_Send_Data = &hscx_fill_fifo;
489 cs->cardmsg = &Teles_card_msg;
490 cs->irq_func = &teles3_interrupt;
494 "Teles3: wrong HSCX versions check IO address\n");
495 release_io_teles3(cs);