1996-10-13 20:04:59 +00:00
|
|
|
/* $Id$
|
1997-01-27 15:52:55 +00:00
|
|
|
|
1996-10-13 20:04:59 +00:00
|
|
|
* teles3.c low level stuff for Teles 16.3 & PNP isdn cards
|
|
|
|
*
|
|
|
|
* based on the teles driver from Jan den Ouden
|
1997-01-21 22:28:32 +00:00
|
|
|
*
|
1997-01-27 15:52:55 +00:00
|
|
|
* Author Karsten Keil (keil@temic-ech.spacenet.de)
|
1996-10-13 20:04:59 +00:00
|
|
|
*
|
1997-01-27 15:52:55 +00:00
|
|
|
* Thanks to Jan den Ouden
|
|
|
|
* Fritz Elfert
|
|
|
|
* Beat Doebeli
|
1997-01-21 22:28:32 +00:00
|
|
|
*
|
1996-10-13 20:04:59 +00:00
|
|
|
* $Log$
|
1999-08-30 12:01:28 +00:00
|
|
|
* Revision 2.12 1999/07/12 21:05:32 keil
|
|
|
|
* fix race in IRQ handling
|
|
|
|
* added watchdog for lost IRQs
|
|
|
|
*
|
1999-07-12 21:05:34 +00:00
|
|
|
* Revision 2.11 1999/07/01 08:12:14 keil
|
|
|
|
* Common HiSax version for 2.0, 2.1, 2.2 and 2.3 kernel
|
|
|
|
*
|
1999-07-01 08:12:15 +00:00
|
|
|
* Revision 2.10 1999/02/15 14:37:15 cpetig
|
|
|
|
* oops, missed something in last commit
|
|
|
|
*
|
1999-02-15 14:37:15 +00:00
|
|
|
* Revision 2.9 1999/02/15 14:11:02 cpetig
|
|
|
|
* fixed a bug with Teles PCMCIA, it doesn't have a config register
|
|
|
|
*
|
1999-02-15 14:11:02 +00:00
|
|
|
* Revision 2.8 1998/04/15 16:44:30 keil
|
|
|
|
* new init code
|
|
|
|
*
|
1998-04-15 16:46:53 +00:00
|
|
|
* Revision 2.7 1998/02/02 13:29:48 keil
|
|
|
|
* fast io
|
|
|
|
*
|
1998-02-02 13:29:48 +00:00
|
|
|
* Revision 2.6 1997/11/13 16:22:44 keil
|
|
|
|
* COMPAQ_ISA reset
|
|
|
|
*
|
1997-11-13 16:22:44 +00:00
|
|
|
* Revision 2.5 1997/11/12 15:01:25 keil
|
|
|
|
* COMPAQ_ISA changes
|
|
|
|
*
|
1997-11-12 15:01:25 +00:00
|
|
|
* Revision 2.4 1997/11/08 21:35:56 keil
|
|
|
|
* new l1 init
|
|
|
|
*
|
1997-11-08 21:35:56 +00:00
|
|
|
* Revision 2.3 1997/11/06 17:09:33 keil
|
|
|
|
* New 2.1 init code
|
|
|
|
*
|
1997-11-06 17:13:35 +00:00
|
|
|
* Revision 2.2 1997/10/29 18:55:59 keil
|
|
|
|
* changes for 2.1.60 (irq2dev_map)
|
|
|
|
*
|
1997-10-29 18:55:59 +00:00
|
|
|
* Revision 2.1 1997/07/27 21:47:12 keil
|
|
|
|
* new interface structures
|
|
|
|
*
|
1997-07-27 21:47:59 +00:00
|
|
|
* Revision 2.0 1997/06/26 11:02:46 keil
|
|
|
|
* New Layer and card interface
|
|
|
|
*
|
1997-06-26 11:02:55 +00:00
|
|
|
* Revision 1.11 1997/04/13 19:54:05 keil
|
|
|
|
* Change in IRQ check delay for SMP
|
|
|
|
*
|
1997-04-13 19:54:07 +00:00
|
|
|
* Revision 1.10 1997/04/06 22:54:05 keil
|
|
|
|
* Using SKB's
|
|
|
|
*
|
1997-04-06 22:55:52 +00:00
|
|
|
* Revision 1.9 1997/03/22 02:01:07 fritz
|
|
|
|
* -Reworked toplevel Makefile. From now on, no different Makefiles
|
|
|
|
* for standalone- and in-kernel-compilation are needed any more.
|
|
|
|
* -Added local Rules.make for above reason.
|
|
|
|
* -Experimental changes in teles3.c for enhanced IRQ-checking with
|
|
|
|
* 2.1.X and SMP kernels.
|
|
|
|
* -Removed diffstd-script, same functionality is in stddiff -r.
|
|
|
|
* -Enhanced scripts std2kern and stddiff.
|
|
|
|
*
|
1997-03-22 02:01:28 +00:00
|
|
|
* Revision 1.8 1997/02/23 18:43:55 fritz
|
|
|
|
* Added support for Teles-Vision.
|
|
|
|
*
|
1997-02-23 18:43:55 +00:00
|
|
|
* Revision 1.7 1997/01/28 22:48:33 keil
|
|
|
|
* fixes for Teles PCMCIA (Christof Petig)
|
|
|
|
*
|
1997-01-28 22:48:33 +00:00
|
|
|
* Revision 1.6 1997/01/27 15:52:55 keil
|
|
|
|
* SMP proof,cosmetics, PCMCIA added
|
|
|
|
*
|
1997-06-26 11:02:55 +00:00
|
|
|
* removed old log info /KKe
|
1996-10-13 20:04:59 +00:00
|
|
|
*
|
1997-01-27 15:52:55 +00:00
|
|
|
*/
|
1996-10-13 20:04:59 +00:00
|
|
|
#define __NO_VERSION__
|
|
|
|
#include "hisax.h"
|
1997-06-26 11:02:55 +00:00
|
|
|
#include "isac.h"
|
|
|
|
#include "hscx.h"
|
1996-10-13 20:04:59 +00:00
|
|
|
#include "isdnl1.h"
|
|
|
|
|
1997-01-27 15:52:55 +00:00
|
|
|
extern const char *CardType[];
|
|
|
|
const char *teles3_revision = "$Revision$";
|
1996-10-13 20:04:59 +00:00
|
|
|
|
1998-02-02 13:29:48 +00:00
|
|
|
#define byteout(addr,val) outb(val,addr)
|
|
|
|
#define bytein(addr) inb(addr)
|
1996-10-13 20:04:59 +00:00
|
|
|
|
1997-04-06 22:55:52 +00:00
|
|
|
static inline u_char
|
|
|
|
readreg(unsigned int adr, u_char off)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-01-27 15:52:55 +00:00
|
|
|
return (bytein(adr + off));
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
1997-04-06 22:55:52 +00:00
|
|
|
writereg(unsigned int adr, u_char off, u_char data)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-01-27 15:52:55 +00:00
|
|
|
byteout(adr + off, data);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
1997-04-06 22:55:52 +00:00
|
|
|
read_fifo(unsigned int adr, u_char * data, int size)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
insb(adr, data, size);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
1997-01-21 22:28:32 +00:00
|
|
|
|
1996-10-13 20:04:59 +00:00
|
|
|
static void
|
1997-04-06 22:55:52 +00:00
|
|
|
write_fifo(unsigned int adr, u_char * data, int size)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
outsb(adr, data, size);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
/* Interface functions */
|
1996-10-13 20:04:59 +00:00
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
static u_char
|
|
|
|
ReadISAC(struct IsdnCardState *cs, u_char offset)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
return (readreg(cs->hw.teles3.isac, offset));
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-06-26 11:02:55 +00:00
|
|
|
WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
writereg(cs->hw.teles3.isac, offset, value);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-06-26 11:02:55 +00:00
|
|
|
ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
read_fifo(cs->hw.teles3.isacfifo, data, size);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-06-26 11:02:55 +00:00
|
|
|
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
write_fifo(cs->hw.teles3.isacfifo, data, size);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
static u_char
|
|
|
|
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
return (readreg(cs->hw.teles3.hscx[hscx], offset));
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-06-26 11:02:55 +00:00
|
|
|
WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
writereg(cs->hw.teles3.hscx[hscx], offset, value);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
/*
|
|
|
|
* fast interrupt HSCX stuff goes here
|
|
|
|
*/
|
1997-01-21 22:28:32 +00:00
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
#define READHSCX(cs, nr, reg) readreg(cs->hw.teles3.hscx[nr], reg)
|
|
|
|
#define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.teles3.hscx[nr], reg, data)
|
|
|
|
#define READHSCXFIFO(cs, nr, ptr, cnt) read_fifo(cs->hw.teles3.hscxfifo[nr], ptr, cnt)
|
|
|
|
#define WRITEHSCXFIFO(cs, nr, ptr, cnt) write_fifo(cs->hw.teles3.hscxfifo[nr], ptr, cnt)
|
1997-01-21 22:28:32 +00:00
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
#include "hscx_irq.c"
|
1996-10-13 20:04:59 +00:00
|
|
|
|
|
|
|
static void
|
1997-11-06 17:13:35 +00:00
|
|
|
teles3_interrupt(int intno, void *dev_id, struct pt_regs *regs)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1999-07-12 21:05:34 +00:00
|
|
|
#define MAXCOUNT 5
|
1997-11-06 17:13:35 +00:00
|
|
|
struct IsdnCardState *cs = dev_id;
|
1999-07-12 21:05:34 +00:00
|
|
|
u_char val;
|
1997-04-13 19:54:07 +00:00
|
|
|
int count = 0;
|
1996-10-13 20:04:59 +00:00
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
if (!cs) {
|
1996-10-13 20:04:59 +00:00
|
|
|
printk(KERN_WARNING "Teles: Spurious interrupt!\n");
|
|
|
|
return;
|
|
|
|
}
|
1997-06-26 11:02:55 +00:00
|
|
|
val = readreg(cs->hw.teles3.hscx[1], HSCX_ISTA);
|
1997-01-27 15:52:55 +00:00
|
|
|
Start_HSCX:
|
1999-07-12 21:05:34 +00:00
|
|
|
if (val)
|
1997-06-26 11:02:55 +00:00
|
|
|
hscx_int_main(cs, val);
|
|
|
|
val = readreg(cs->hw.teles3.isac, ISAC_ISTA);
|
1997-01-27 15:52:55 +00:00
|
|
|
Start_ISAC:
|
1999-07-12 21:05:34 +00:00
|
|
|
if (val)
|
1997-06-26 11:02:55 +00:00
|
|
|
isac_interrupt(cs, val);
|
1997-04-13 19:54:07 +00:00
|
|
|
count++;
|
1997-06-26 11:02:55 +00:00
|
|
|
val = readreg(cs->hw.teles3.hscx[1], HSCX_ISTA);
|
1997-04-13 19:54:07 +00:00
|
|
|
if (val && count < MAXCOUNT) {
|
1997-06-26 11:02:55 +00:00
|
|
|
if (cs->debug & L1_DEB_HSCX)
|
|
|
|
debugl1(cs, "HSCX IntStat after IntRoutine");
|
1996-10-13 20:04:59 +00:00
|
|
|
goto Start_HSCX;
|
|
|
|
}
|
1997-06-26 11:02:55 +00:00
|
|
|
val = readreg(cs->hw.teles3.isac, ISAC_ISTA);
|
1997-04-13 19:54:07 +00:00
|
|
|
if (val && count < MAXCOUNT) {
|
1997-06-26 11:02:55 +00:00
|
|
|
if (cs->debug & L1_DEB_ISAC)
|
|
|
|
debugl1(cs, "ISAC IntStat after IntRoutine");
|
1996-10-13 20:04:59 +00:00
|
|
|
goto Start_ISAC;
|
|
|
|
}
|
1997-04-13 19:54:07 +00:00
|
|
|
if (count >= MAXCOUNT)
|
|
|
|
printk(KERN_WARNING "Teles3: more than %d loops in teles3_interrupt\n", count);
|
1999-07-12 21:05:34 +00:00
|
|
|
writereg(cs->hw.teles3.hscx[0], HSCX_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.teles3.hscx[1], HSCX_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.teles3.isac, ISAC_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.teles3.isac, ISAC_MASK, 0x0);
|
|
|
|
writereg(cs->hw.teles3.hscx[0], HSCX_MASK, 0x0);
|
|
|
|
writereg(cs->hw.teles3.hscx[1], HSCX_MASK, 0x0);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline static void
|
1997-11-08 21:35:56 +00:00
|
|
|
release_ioregs(struct IsdnCardState *cs, int mask)
|
1997-01-27 15:52:55 +00:00
|
|
|
{
|
|
|
|
if (mask & 1)
|
1997-11-08 21:35:56 +00:00
|
|
|
release_region(cs->hw.teles3.isac + 32, 32);
|
1997-01-27 15:52:55 +00:00
|
|
|
if (mask & 2)
|
1997-11-08 21:35:56 +00:00
|
|
|
release_region(cs->hw.teles3.hscx[0] + 32, 32);
|
1997-01-27 15:52:55 +00:00
|
|
|
if (mask & 4)
|
1997-11-08 21:35:56 +00:00
|
|
|
release_region(cs->hw.teles3.hscx[1] + 32, 32);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
1997-01-27 15:52:55 +00:00
|
|
|
void
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_teles3(struct IsdnCardState *cs)
|
1997-01-27 15:52:55 +00:00
|
|
|
{
|
1999-07-01 08:12:15 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
|
1999-02-15 14:37:15 +00:00
|
|
|
release_region(cs->hw.teles3.hscx[0], 97);
|
1999-07-01 08:12:15 +00:00
|
|
|
} else {
|
|
|
|
if (cs->hw.teles3.cfg_reg) {
|
1997-11-08 21:35:56 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 1);
|
|
|
|
} else {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 8);
|
|
|
|
}
|
1999-07-01 08:12:15 +00:00
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
release_ioregs(cs, 0x7);
|
1997-01-27 15:52:55 +00:00
|
|
|
}
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
1997-11-08 21:35:56 +00:00
|
|
|
static int
|
|
|
|
reset_teles3(struct IsdnCardState *cs)
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
long flags;
|
|
|
|
u_char irqcfg;
|
|
|
|
|
|
|
|
if (cs->typ != ISDN_CTYPE_TELESPCMCIA) {
|
1997-11-08 21:35:56 +00:00
|
|
|
if ((cs->hw.teles3.cfg_reg) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA)) {
|
1997-06-26 11:02:55 +00:00
|
|
|
switch (cs->irq) {
|
|
|
|
case 2:
|
1998-02-02 13:29:48 +00:00
|
|
|
case 9:
|
1997-06-26 11:02:55 +00:00
|
|
|
irqcfg = 0x00;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
irqcfg = 0x02;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
irqcfg = 0x04;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
irqcfg = 0x06;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
irqcfg = 0x08;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
irqcfg = 0x0A;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
irqcfg = 0x0C;
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
irqcfg = 0x0E;
|
|
|
|
break;
|
|
|
|
default:
|
1997-11-08 21:35:56 +00:00
|
|
|
return(1);
|
1997-06-26 11:02:55 +00:00
|
|
|
}
|
|
|
|
save_flags(flags);
|
|
|
|
byteout(cs->hw.teles3.cfg_reg + 4, irqcfg);
|
|
|
|
sti();
|
|
|
|
HZDELAY(HZ / 10 + 1);
|
|
|
|
byteout(cs->hw.teles3.cfg_reg + 4, irqcfg | 1);
|
|
|
|
HZDELAY(HZ / 10 + 1);
|
|
|
|
restore_flags(flags);
|
1997-11-08 21:35:56 +00:00
|
|
|
} else if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
save_flags(flags);
|
|
|
|
byteout(cs->hw.teles3.cfg_reg, 0xff);
|
|
|
|
HZDELAY(2);
|
1997-11-13 16:22:44 +00:00
|
|
|
byteout(cs->hw.teles3.cfg_reg, 0x00);
|
|
|
|
HZDELAY(2);
|
1997-11-08 21:35:56 +00:00
|
|
|
restore_flags(flags);
|
1997-06-26 11:02:55 +00:00
|
|
|
} else {
|
|
|
|
/* Reset off for 16.3 PnP , thanks to Georg Acher */
|
|
|
|
save_flags(flags);
|
1997-11-08 21:35:56 +00:00
|
|
|
byteout(cs->hw.teles3.isac + 0x3c, 0);
|
|
|
|
HZDELAY(2);
|
1997-06-26 11:02:55 +00:00
|
|
|
byteout(cs->hw.teles3.isac + 0x3c, 1);
|
|
|
|
HZDELAY(2);
|
|
|
|
restore_flags(flags);
|
|
|
|
}
|
1997-01-27 15:52:55 +00:00
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
return(0);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
|
1997-11-08 21:35:56 +00:00
|
|
|
static int
|
1997-06-26 11:02:55 +00:00
|
|
|
Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
|
|
|
|
{
|
1997-11-08 21:35:56 +00:00
|
|
|
switch (mt) {
|
|
|
|
case CARD_RESET:
|
|
|
|
reset_teles3(cs);
|
|
|
|
return(0);
|
|
|
|
case CARD_RELEASE:
|
|
|
|
release_io_teles3(cs);
|
|
|
|
return(0);
|
|
|
|
case CARD_INIT:
|
1998-04-15 16:46:53 +00:00
|
|
|
inithscxisac(cs, 3);
|
1997-11-08 21:35:56 +00:00
|
|
|
return(0);
|
|
|
|
case CARD_TEST:
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return(0);
|
1997-06-26 11:02:55 +00:00
|
|
|
}
|
|
|
|
|
1997-11-06 17:13:35 +00:00
|
|
|
__initfunc(int
|
|
|
|
setup_teles3(struct IsdnCard *card))
|
1996-10-13 20:04:59 +00:00
|
|
|
{
|
1997-06-26 11:02:55 +00:00
|
|
|
u_char val;
|
1997-07-27 21:47:59 +00:00
|
|
|
struct IsdnCardState *cs = card->cs;
|
1997-01-27 15:52:55 +00:00
|
|
|
char tmp[64];
|
1997-01-21 22:28:32 +00:00
|
|
|
|
1997-01-27 15:52:55 +00:00
|
|
|
strcpy(tmp, teles3_revision);
|
1997-11-06 17:13:35 +00:00
|
|
|
printk(KERN_INFO "HiSax: Teles IO driver Rev. %s\n", HiSax_getrev(tmp));
|
1997-06-26 11:02:55 +00:00
|
|
|
if ((cs->typ != ISDN_CTYPE_16_3) && (cs->typ != ISDN_CTYPE_PNP)
|
1997-11-12 15:01:25 +00:00
|
|
|
&& (cs->typ != ISDN_CTYPE_TELESPCMCIA) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA))
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
|
|
|
|
1997-06-26 11:02:55 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_16_3) {
|
|
|
|
cs->hw.teles3.cfg_reg = card->para[1];
|
|
|
|
switch (cs->hw.teles3.cfg_reg) {
|
1997-04-06 22:55:52 +00:00
|
|
|
case 0x180:
|
|
|
|
case 0x280:
|
|
|
|
case 0x380:
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.cfg_reg |= 0xc00;
|
1997-04-06 22:55:52 +00:00
|
|
|
break;
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.isac = cs->hw.teles3.cfg_reg - 0x420;
|
|
|
|
cs->hw.teles3.hscx[0] = cs->hw.teles3.cfg_reg - 0xc20;
|
|
|
|
cs->hw.teles3.hscx[1] = cs->hw.teles3.cfg_reg - 0x820;
|
|
|
|
} else if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
|
1999-02-15 14:11:02 +00:00
|
|
|
cs->hw.teles3.cfg_reg = 0;
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.hscx[0] = card->para[1] - 0x20;
|
|
|
|
cs->hw.teles3.hscx[1] = card->para[1];
|
|
|
|
cs->hw.teles3.isac = card->para[1] + 0x20;
|
1997-11-08 21:35:56 +00:00
|
|
|
} else if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
cs->hw.teles3.cfg_reg = card->para[3];
|
|
|
|
cs->hw.teles3.isac = card->para[2] - 32;
|
|
|
|
cs->hw.teles3.hscx[0] = card->para[1] - 32;
|
|
|
|
cs->hw.teles3.hscx[1] = card->para[1];
|
|
|
|
} else { /* PNP */
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.cfg_reg = 0;
|
|
|
|
cs->hw.teles3.isac = card->para[1] - 32;
|
|
|
|
cs->hw.teles3.hscx[0] = card->para[2] - 32;
|
|
|
|
cs->hw.teles3.hscx[1] = card->para[2];
|
|
|
|
}
|
|
|
|
cs->irq = card->para[0];
|
|
|
|
cs->hw.teles3.isacfifo = cs->hw.teles3.isac + 0x3e;
|
|
|
|
cs->hw.teles3.hscxfifo[0] = cs->hw.teles3.hscx[0] + 0x3e;
|
|
|
|
cs->hw.teles3.hscxfifo[1] = cs->hw.teles3.hscx[1] + 0x3e;
|
|
|
|
if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
|
1999-02-15 14:37:15 +00:00
|
|
|
if (check_region((cs->hw.teles3.hscx[0]), 97)) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"HiSax: %s ports %x-%x already in use\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
CardType[cs->typ],
|
1999-02-15 14:37:15 +00:00
|
|
|
cs->hw.teles3.hscx[0],
|
|
|
|
cs->hw.teles3.hscx[0] + 96);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
|
|
|
} else
|
1997-06-26 11:02:55 +00:00
|
|
|
request_region(cs->hw.teles3.hscx[0], 97, "HiSax Teles PCMCIA");
|
1997-01-27 15:52:55 +00:00
|
|
|
} else {
|
1997-06-26 11:02:55 +00:00
|
|
|
if (cs->hw.teles3.cfg_reg) {
|
1997-11-08 21:35:56 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
if (check_region((cs->hw.teles3.cfg_reg), 1)) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"HiSax: %s config port %x already in use\n",
|
|
|
|
CardType[card->typ],
|
|
|
|
cs->hw.teles3.cfg_reg);
|
|
|
|
return (0);
|
|
|
|
} else
|
|
|
|
request_region(cs->hw.teles3.cfg_reg, 1, "teles3 cfg");
|
1997-01-27 15:52:55 +00:00
|
|
|
} else {
|
1997-11-08 21:35:56 +00:00
|
|
|
if (check_region((cs->hw.teles3.cfg_reg), 8)) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"HiSax: %s config port %x-%x already in use\n",
|
|
|
|
CardType[card->typ],
|
|
|
|
cs->hw.teles3.cfg_reg,
|
|
|
|
cs->hw.teles3.cfg_reg + 8);
|
|
|
|
return (0);
|
|
|
|
} else
|
|
|
|
request_region(cs->hw.teles3.cfg_reg, 8, "teles3 cfg");
|
1997-01-27 15:52:55 +00:00
|
|
|
}
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
1997-06-26 11:02:55 +00:00
|
|
|
if (check_region((cs->hw.teles3.isac + 32), 32)) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"HiSax: %s isac ports %x-%x already in use\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
CardType[cs->typ],
|
|
|
|
cs->hw.teles3.isac + 32,
|
|
|
|
cs->hw.teles3.isac + 64);
|
1999-07-01 08:12:15 +00:00
|
|
|
if (cs->hw.teles3.cfg_reg) {
|
1997-11-08 21:35:56 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 1);
|
|
|
|
} else {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 8);
|
|
|
|
}
|
1999-07-01 08:12:15 +00:00
|
|
|
}
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
1997-11-08 21:35:56 +00:00
|
|
|
} else
|
1997-06-26 11:02:55 +00:00
|
|
|
request_region(cs->hw.teles3.isac + 32, 32, "HiSax isac");
|
|
|
|
if (check_region((cs->hw.teles3.hscx[0] + 32), 32)) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"HiSax: %s hscx A ports %x-%x already in use\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
CardType[cs->typ],
|
|
|
|
cs->hw.teles3.hscx[0] + 32,
|
|
|
|
cs->hw.teles3.hscx[0] + 64);
|
1999-07-01 08:12:15 +00:00
|
|
|
if (cs->hw.teles3.cfg_reg) {
|
1997-11-08 21:35:56 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 1);
|
|
|
|
} else {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 8);
|
|
|
|
}
|
1999-07-01 08:12:15 +00:00
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
release_ioregs(cs, 1);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
1997-11-08 21:35:56 +00:00
|
|
|
} else
|
1997-06-26 11:02:55 +00:00
|
|
|
request_region(cs->hw.teles3.hscx[0] + 32, 32, "HiSax hscx A");
|
|
|
|
if (check_region((cs->hw.teles3.hscx[1] + 32), 32)) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"HiSax: %s hscx B ports %x-%x already in use\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
CardType[cs->typ],
|
|
|
|
cs->hw.teles3.hscx[1] + 32,
|
|
|
|
cs->hw.teles3.hscx[1] + 64);
|
1999-07-01 08:12:15 +00:00
|
|
|
if (cs->hw.teles3.cfg_reg) {
|
1997-11-08 21:35:56 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 1);
|
|
|
|
} else {
|
|
|
|
release_region(cs->hw.teles3.cfg_reg, 8);
|
|
|
|
}
|
1999-07-01 08:12:15 +00:00
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
release_ioregs(cs, 3);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
1997-11-08 21:35:56 +00:00
|
|
|
} else
|
1997-06-26 11:02:55 +00:00
|
|
|
request_region(cs->hw.teles3.hscx[1] + 32, 32, "HiSax hscx B");
|
1997-01-27 15:52:55 +00:00
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
if ((cs->hw.teles3.cfg_reg) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA)) {
|
1997-06-26 11:02:55 +00:00
|
|
|
if ((val = bytein(cs->hw.teles3.cfg_reg + 0)) != 0x51) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.cfg_reg + 0, val);
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_teles3(cs);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
|
|
|
}
|
1997-06-26 11:02:55 +00:00
|
|
|
if ((val = bytein(cs->hw.teles3.cfg_reg + 1)) != 0x93) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.cfg_reg + 1, val);
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_teles3(cs);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
|
|
|
}
|
1998-02-02 13:29:48 +00:00
|
|
|
val = bytein(cs->hw.teles3.cfg_reg + 2);/* 0x1e=without AB
|
|
|
|
* 0x1f=with AB
|
|
|
|
* 0x1c 16.3 ???
|
|
|
|
* 0x39 16.3 1.1
|
1999-08-30 12:01:28 +00:00
|
|
|
* 0x38 16.3 1.3
|
1998-02-02 13:29:48 +00:00
|
|
|
* 0x46 16.3 with AB + Video (Teles-Vision)
|
|
|
|
*/
|
1999-08-30 12:01:28 +00:00
|
|
|
if (val != 0x46 && val != 0x39 && val != 0x38 && val != 0x1c && val != 0x1e && val != 0x1f) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.cfg_reg + 2, val);
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_teles3(cs);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
1997-11-06 17:13:35 +00:00
|
|
|
printk(KERN_INFO
|
|
|
|
"HiSax: %s config irq:%d isac:0x%X cfg:0x%X\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
CardType[cs->typ], cs->irq,
|
|
|
|
cs->hw.teles3.isac + 32, cs->hw.teles3.cfg_reg);
|
1997-11-06 17:13:35 +00:00
|
|
|
printk(KERN_INFO
|
|
|
|
"HiSax: hscx A:0x%X hscx B:0x%X\n",
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->hw.teles3.hscx[0] + 32, cs->hw.teles3.hscx[1] + 32);
|
|
|
|
|
1997-11-08 21:35:56 +00:00
|
|
|
if (reset_teles3(cs)) {
|
|
|
|
printk(KERN_WARNING "Teles3: wrong IRQ\n");
|
|
|
|
release_io_teles3(cs);
|
|
|
|
return (0);
|
|
|
|
}
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->readisac = &ReadISAC;
|
|
|
|
cs->writeisac = &WriteISAC;
|
|
|
|
cs->readisacfifo = &ReadISACfifo;
|
|
|
|
cs->writeisacfifo = &WriteISACfifo;
|
1997-07-27 21:47:59 +00:00
|
|
|
cs->BC_Read_Reg = &ReadHSCX;
|
|
|
|
cs->BC_Write_Reg = &WriteHSCX;
|
|
|
|
cs->BC_Send_Data = &hscx_fill_fifo;
|
1997-06-26 11:02:55 +00:00
|
|
|
cs->cardmsg = &Teles_card_msg;
|
1999-07-12 21:05:34 +00:00
|
|
|
cs->irq_func = &teles3_interrupt;
|
1997-06-26 11:02:55 +00:00
|
|
|
ISACVersion(cs, "Teles3:");
|
|
|
|
if (HscxVersion(cs, "Teles3:")) {
|
1997-01-27 15:52:55 +00:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"Teles3: wrong HSCX versions check IO address\n");
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_teles3(cs);
|
1997-01-27 15:52:55 +00:00
|
|
|
return (0);
|
1996-10-13 20:04:59 +00:00
|
|
|
}
|
|
|
|
return (1);
|
|
|
|
}
|