1 /* $Id: elsa.c,v 2.32.2.4 2004/01/24 20:47:21 keil Exp $
3 * low level stuff for Elsa isdn cards
6 * Copyright by Karsten Keil <keil@isdn4linux.de>
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
11 * For changes and modifications please read
12 * Documentation/isdn/HiSax.cert
14 * Thanks to Elsa GmbH for documents and information
16 * Klaus Lichtenwalder (Klaus.Lichtenwalder@WebForum.DE)
17 * for ELSA PCMCIA support
21 #include <linux/init.h>
22 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/isapnp.h>
31 #include <linux/serial.h>
32 #include <linux/serial_reg.h>
34 static const char *Elsa_revision
= "$Revision: 2.32.2.4 $";
35 static const char *Elsa_Types
[] =
36 {"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
37 "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI",
40 static const char *ITACVer
[] =
41 {"?0?", "?1?", "?2?", "?3?", "?4?", "V2.2",
44 #define byteout(addr, val) outb(val, addr)
45 #define bytein(addr) inb(addr)
48 #define ELSA_ISAC_PCM 1
52 #define ELSA_ALE_PCM 4
53 #define ELSA_CONTROL 4
55 #define ELSA_START_TIMER 6
56 #define ELSA_TRIG_IRQ 7
66 #define ELSA_QS1000PCI 9
67 #define ELSA_QS3000PCI 10
68 #define ELSA_PCMCIA_IPAC 11
71 #define ELSA_PCI_IRQ_MASK 0x04
73 /* ITAC Registeradressen (only Microlink PC) */
75 #define ITAC_ISEN 0x48
76 #define ITAC_RFIE 0x4A
77 #define ITAC_XFIE 0x4C
78 #define ITAC_SCIE 0x4E
79 #define ITAC_STIE 0x46
82 *** Makros als Befehle fuer die Kartenregister ***
83 *** (mehrere Befehle werden durch Bit-Oderung kombiniert) ***
86 /* Config-Register (Read) */
87 #define ELIRQF_TIMER_RUN 0x02 /* Bit 1 des Config-Reg */
88 #define ELIRQF_TIMER_RUN_PCC8 0x01 /* Bit 0 des Config-Reg bei PCC */
89 #define ELSA_IRQ_IDX 0x38 /* Bit 3,4,5 des Config-Reg */
90 #define ELSA_IRQ_IDX_PCC8 0x30 /* Bit 4,5 des Config-Reg */
91 #define ELSA_IRQ_IDX_PC 0x0c /* Bit 2,3 des Config-Reg */
93 /* Control-Register (Write) */
94 #define ELSA_LINE_LED 0x02 /* Bit 1 Gelbe LED */
95 #define ELSA_STAT_LED 0x08 /* Bit 3 Gruene LED */
96 #define ELSA_ISDN_RESET 0x20 /* Bit 5 Reset-Leitung */
97 #define ELSA_ENA_TIMER_INT 0x80 /* Bit 7 Freigabe Timer Interrupt */
99 /* ALE-Register (Read) */
100 #define ELSA_HW_RELEASE 0x07 /* Bit 0-2 Hardwarerkennung */
101 #define ELSA_S0_POWER_BAD 0x08 /* Bit 3 S0-Bus Spannung fehlt */
104 #define ELIRQF_TIMER_AKTIV 1
105 #define ELSA_BAD_PWR 2
106 #define ELSA_ASSIGN 4
108 #define RS_ISR_PASS_LIMIT 256
109 #define FLG_MODEM_ACTIVE 1
111 #define ELSA_IPAC_LINE_LED 0x40 /* Bit 6 Gelbe LED */
112 #define ELSA_IPAC_STAT_LED 0x80 /* Bit 7 Gruene LED */
115 static struct arcofi_msg ARCOFI_XOP_F
=
116 {NULL
,0,2,{0xa1,0x3f,0,0,0,0,0,0,0,0}}; /* Normal OP */
117 static struct arcofi_msg ARCOFI_XOP_1
=
118 {&ARCOFI_XOP_F
,0,2,{0xa1,0x31,0,0,0,0,0,0,0,0}}; /* PWR UP */
119 static struct arcofi_msg ARCOFI_SOP_F
=
120 {&ARCOFI_XOP_1
,0,10,{0xa1,0x1f,0x00,0x50,0x10,0x00,0x00,0x80,0x02,0x12}};
121 static struct arcofi_msg ARCOFI_COP_9
=
122 {&ARCOFI_SOP_F
,0,10,{0xa1,0x29,0x80,0xcb,0xe9,0x88,0x00,0xc8,0xd8,0x80}}; /* RX */
123 static struct arcofi_msg ARCOFI_COP_8
=
124 {&ARCOFI_COP_9
,0,10,{0xa1,0x28,0x49,0x31,0x8,0x13,0x6e,0x88,0x2a,0x61}}; /* TX */
125 static struct arcofi_msg ARCOFI_COP_7
=
126 {&ARCOFI_COP_8
,0,4,{0xa1,0x27,0x80,0x80,0,0,0,0,0,0}}; /* GZ */
127 static struct arcofi_msg ARCOFI_COP_6
=
128 {&ARCOFI_COP_7
,0,6,{0xa1,0x26,0,0,0x82,0x7c,0,0,0,0}}; /* GRL GRH */
129 static struct arcofi_msg ARCOFI_COP_5
=
130 {&ARCOFI_COP_6
,0,4,{0xa1,0x25,0xbb,0x4a,0,0,0,0,0,0}}; /* GTX */
131 static struct arcofi_msg ARCOFI_VERSION
=
132 {NULL
,1,2,{0xa0,0,0,0,0,0,0,0,0,0}};
133 static struct arcofi_msg ARCOFI_XOP_0
=
134 {NULL
,0,2,{0xa1,0x30,0,0,0,0,0,0,0,0}}; /* PWR Down */
136 static void set_arcofi(struct IsdnCardState
*cs
, int bc
);
138 #include "elsa_ser.c"
139 #endif /* ARCOFI_USE */
142 readreg(unsigned int ale
, unsigned int adr
, u_char off
)
152 readfifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
*data
, int size
)
155 insb(adr
, data
, size
);
160 writereg(unsigned int ale
, unsigned int adr
, u_char off
, u_char data
)
167 writefifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
*data
, int size
)
170 outsb(adr
, data
, size
);
173 /* Interface functions */
176 ReadISAC(struct IsdnCardState
*cs
, u_char offset
)
178 return (readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, offset
));
182 WriteISAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
184 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, offset
, value
);
188 ReadISACfifo(struct IsdnCardState
*cs
, u_char
*data
, int size
)
190 readfifo(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, 0, data
, size
);
194 WriteISACfifo(struct IsdnCardState
*cs
, u_char
*data
, int size
)
196 writefifo(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, 0, data
, size
);
200 ReadISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
)
202 return (readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, offset
+ 0x80));
206 WriteISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
208 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, offset
| 0x80, value
);
212 ReadISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
*data
, int size
)
214 readfifo(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, 0x80, data
, size
);
218 WriteISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
*data
, int size
)
220 writefifo(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, 0x80, data
, size
);
224 ReadHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
)
226 return (readreg(cs
->hw
.elsa
.ale
,
227 cs
->hw
.elsa
.hscx
, offset
+ (hscx
? 0x40 : 0)));
231 WriteHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
, u_char value
)
233 writereg(cs
->hw
.elsa
.ale
,
234 cs
->hw
.elsa
.hscx
, offset
+ (hscx
? 0x40 : 0), value
);
238 readitac(struct IsdnCardState
*cs
, u_char off
)
242 byteout(cs
->hw
.elsa
.ale
, off
);
243 ret
= bytein(cs
->hw
.elsa
.itac
);
248 writeitac(struct IsdnCardState
*cs
, u_char off
, u_char data
)
250 byteout(cs
->hw
.elsa
.ale
, off
);
251 byteout(cs
->hw
.elsa
.itac
, data
);
255 TimerRun(struct IsdnCardState
*cs
)
259 v
= bytein(cs
->hw
.elsa
.cfg
);
260 if ((cs
->subtyp
== ELSA_QS1000
) || (cs
->subtyp
== ELSA_QS3000
))
261 return (0 == (v
& ELIRQF_TIMER_RUN
));
262 else if (cs
->subtyp
== ELSA_PCC8
)
263 return (v
& ELIRQF_TIMER_RUN_PCC8
);
264 return (v
& ELIRQF_TIMER_RUN
);
267 * fast interrupt HSCX stuff goes here
270 #define READHSCX(cs, nr, reg) readreg(cs->hw.elsa.ale, \
271 cs->hw.elsa.hscx, reg + (nr ? 0x40 : 0))
272 #define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.elsa.ale, \
273 cs->hw.elsa.hscx, reg + (nr ? 0x40 : 0), data)
275 #define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.elsa.ale, \
276 cs->hw.elsa.hscx, (nr ? 0x40 : 0), ptr, cnt)
278 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.elsa.ale, \
279 cs->hw.elsa.hscx, (nr ? 0x40 : 0), ptr, cnt)
281 #include "hscx_irq.c"
284 elsa_interrupt(int intno
, void *dev_id
)
286 struct IsdnCardState
*cs
= dev_id
;
291 if ((cs
->typ
== ISDN_CTYPE_ELSA_PCMCIA
) && (*cs
->busy_flag
== 1)) {
292 /* The card tends to generate interrupts while being removed
293 causing us to just crash the kernel. bad. */
294 printk(KERN_WARNING
"Elsa: card not available!\n");
297 spin_lock_irqsave(&cs
->lock
, flags
);
299 if (cs
->hw
.elsa
.MFlag
) {
300 val
= serial_inp(cs
, UART_IIR
);
301 if (!(val
& UART_IIR_NO_INT
)) {
302 debugl1(cs
, "IIR %02x", val
);
303 rs_interrupt_elsa(cs
);
307 val
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_ISTA
+ 0x40);
310 hscx_int_main(cs
, val
);
312 val
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, ISAC_ISTA
);
315 isac_interrupt(cs
, val
);
317 val
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_ISTA
+ 0x40);
319 if (cs
->debug
& L1_DEB_HSCX
)
320 debugl1(cs
, "HSCX IntStat after IntRoutine");
324 val
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, ISAC_ISTA
);
326 if (cs
->debug
& L1_DEB_ISAC
)
327 debugl1(cs
, "ISAC IntStat after IntRoutine");
332 printk(KERN_WARNING
"ELSA IRQ LOOP\n");
333 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_MASK
, 0xFF);
334 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_MASK
+ 0x40, 0xFF);
335 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, ISAC_MASK
, 0xFF);
336 if (cs
->hw
.elsa
.status
& ELIRQF_TIMER_AKTIV
) {
339 byteout(cs
->hw
.elsa
.timer
, 0);
340 cs
->hw
.elsa
.counter
++;
344 if (cs
->hw
.elsa
.MFlag
) {
345 val
= serial_inp(cs
, UART_MCR
);
347 serial_outp(cs
, UART_MCR
, val
);
348 val
= serial_inp(cs
, UART_MCR
);
350 serial_outp(cs
, UART_MCR
, val
);
353 if (cs
->hw
.elsa
.trig
)
354 byteout(cs
->hw
.elsa
.trig
, 0x00);
355 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_MASK
, 0x0);
356 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_MASK
+ 0x40, 0x0);
357 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, ISAC_MASK
, 0x0);
358 spin_unlock_irqrestore(&cs
->lock
, flags
);
363 elsa_interrupt_ipac(int intno
, void *dev_id
)
365 struct IsdnCardState
*cs
= dev_id
;
370 spin_lock_irqsave(&cs
->lock
, flags
);
371 if (cs
->subtyp
== ELSA_QS1000PCI
|| cs
->subtyp
== ELSA_QS3000PCI
) {
372 val
= bytein(cs
->hw
.elsa
.cfg
+ 0x4c); /* PCI IRQ */
373 if (!(val
& ELSA_PCI_IRQ_MASK
)) {
374 spin_unlock_irqrestore(&cs
->lock
, flags
);
379 if (cs
->hw
.elsa
.MFlag
) {
380 val
= serial_inp(cs
, UART_IIR
);
381 if (!(val
& UART_IIR_NO_INT
)) {
382 debugl1(cs
, "IIR %02x", val
);
383 rs_interrupt_elsa(cs
);
387 ista
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ISTA
);
389 if (cs
->debug
& L1_DEB_IPAC
)
390 debugl1(cs
, "IPAC ISTA %02X", ista
);
392 val
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.hscx
, HSCX_ISTA
+ 0x40);
400 hscx_int_main(cs
, val
);
403 val
= 0xfe & readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, ISAC_ISTA
+ 0x80);
405 isac_interrupt(cs
, val
);
410 isac_interrupt(cs
, val
);
412 ista
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ISTA
);
413 if ((ista
& 0x3f) && icnt
) {
418 printk(KERN_WARNING
"ELSA IRQ LOOP\n");
419 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_MASK
, 0xFF);
420 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_MASK
, 0xC0);
421 spin_unlock_irqrestore(&cs
->lock
, flags
);
426 release_io_elsa(struct IsdnCardState
*cs
)
430 del_timer(&cs
->hw
.elsa
.tl
);
434 if (cs
->hw
.elsa
.ctrl
)
435 byteout(cs
->hw
.elsa
.ctrl
, 0); /* LEDs Out */
436 if (cs
->subtyp
== ELSA_QS1000PCI
) {
437 byteout(cs
->hw
.elsa
.cfg
+ 0x4c, 0x01); /* disable IRQ */
438 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ATX
, 0xff);
440 release_region(cs
->hw
.elsa
.cfg
, 0x80);
442 if (cs
->subtyp
== ELSA_QS3000PCI
) {
443 byteout(cs
->hw
.elsa
.cfg
+ 0x4c, 0x03); /* disable ELSA PCI IRQ */
444 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ATX
, 0xff);
445 release_region(cs
->hw
.elsa
.cfg
, 0x80);
447 if (cs
->subtyp
== ELSA_PCMCIA_IPAC
) {
448 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ATX
, 0xff);
450 if ((cs
->subtyp
== ELSA_PCFPRO
) ||
451 (cs
->subtyp
== ELSA_QS3000
) ||
452 (cs
->subtyp
== ELSA_PCF
) ||
453 (cs
->subtyp
== ELSA_QS3000PCI
)) {
459 if (cs
->hw
.elsa
.base
)
460 release_region(cs
->hw
.elsa
.base
, bytecnt
);
464 reset_elsa(struct IsdnCardState
*cs
)
466 if (cs
->hw
.elsa
.timer
) {
468 byteout(cs
->hw
.elsa
.timer
, 0);
469 while (TimerRun(cs
));
470 cs
->hw
.elsa
.ctrl_reg
|= 0x50;
471 cs
->hw
.elsa
.ctrl_reg
&= ~ELSA_ISDN_RESET
; /* Reset On */
472 byteout(cs
->hw
.elsa
.ctrl
, cs
->hw
.elsa
.ctrl_reg
);
474 byteout(cs
->hw
.elsa
.timer
, 0);
475 while (TimerRun(cs
));
476 cs
->hw
.elsa
.ctrl_reg
|= ELSA_ISDN_RESET
; /* Reset Off */
477 byteout(cs
->hw
.elsa
.ctrl
, cs
->hw
.elsa
.ctrl_reg
);
479 byteout(cs
->hw
.elsa
.timer
, 0);
480 while (TimerRun(cs
));
481 if (cs
->hw
.elsa
.trig
)
482 byteout(cs
->hw
.elsa
.trig
, 0xff);
484 if ((cs
->subtyp
== ELSA_QS1000PCI
) || (cs
->subtyp
== ELSA_QS3000PCI
) || (cs
->subtyp
== ELSA_PCMCIA_IPAC
)) {
485 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_POTA2
, 0x20);
487 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_POTA2
, 0x00);
488 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_MASK
, 0xc0);
490 if (cs
->subtyp
!= ELSA_PCMCIA_IPAC
) {
491 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ACFG
, 0x0);
492 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_AOE
, 0x3c);
494 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_PCFG
, 0x10);
495 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ACFG
, 0x4);
496 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_AOE
, 0xf8);
498 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ATX
, 0xff);
499 if (cs
->subtyp
== ELSA_QS1000PCI
)
500 byteout(cs
->hw
.elsa
.cfg
+ 0x4c, 0x41); /* enable ELSA PCI IRQ */
501 else if (cs
->subtyp
== ELSA_QS3000PCI
)
502 byteout(cs
->hw
.elsa
.cfg
+ 0x4c, 0x43); /* enable ELSA PCI IRQ */
509 set_arcofi(struct IsdnCardState
*cs
, int bc
) {
510 cs
->dc
.isac
.arcofi_bc
= bc
;
511 arcofi_fsm(cs
, ARCOFI_START
, &ARCOFI_COP_5
);
512 wait_event_interruptible(cs
->dc
.isac
.arcofi_wait
,
513 cs
->dc
.isac
.arcofi_state
== ARCOFI_NOP
);
517 check_arcofi(struct IsdnCardState
*cs
)
519 int arcofi_present
= 0;
524 if (!cs
->dc
.isac
.mon_tx
)
525 if (!(cs
->dc
.isac
.mon_tx
= kmalloc(MAX_MON_FRAME
, GFP_ATOMIC
))) {
526 if (cs
->debug
& L1_DEB_WARN
)
527 debugl1(cs
, "ISAC MON TX out of buffers!");
530 cs
->dc
.isac
.arcofi_bc
= 0;
531 arcofi_fsm(cs
, ARCOFI_START
, &ARCOFI_VERSION
);
532 wait_event_interruptible(cs
->dc
.isac
.arcofi_wait
,
533 cs
->dc
.isac
.arcofi_state
== ARCOFI_NOP
);
534 if (!test_and_clear_bit(FLG_ARCOFI_ERROR
, &cs
->HW_Flags
)) {
535 debugl1(cs
, "Arcofi response received %d bytes", cs
->dc
.isac
.mon_rxp
);
536 p
= cs
->dc
.isac
.mon_rx
;
538 t
+= sprintf(tmp
, "Arcofi data");
539 QuickHex(t
, p
, cs
->dc
.isac
.mon_rxp
);
540 debugl1(cs
, "%s", tmp
);
541 if ((cs
->dc
.isac
.mon_rxp
== 2) && (cs
->dc
.isac
.mon_rx
[0] == 0xa0)) {
542 switch (cs
->dc
.isac
.mon_rx
[1]) {
544 debugl1(cs
, "Arcofi 2160 detected");
548 debugl1(cs
, "Arcofi 2165 detected");
552 debugl1(cs
, "Arcofi 2163 detected");
556 debugl1(cs
, "unknown Arcofi response");
560 debugl1(cs
, "undefined Monitor response");
561 cs
->dc
.isac
.mon_rxp
= 0;
562 } else if (cs
->dc
.isac
.mon_tx
) {
563 debugl1(cs
, "Arcofi not detected");
565 if (arcofi_present
) {
566 if (cs
->subtyp
== ELSA_QS1000
) {
567 cs
->subtyp
= ELSA_QS3000
;
569 "Elsa: %s detected modem at 0x%lx\n",
570 Elsa_Types
[cs
->subtyp
],
571 cs
->hw
.elsa
.base
+ 8);
572 release_region(cs
->hw
.elsa
.base
, 8);
573 if (!request_region(cs
->hw
.elsa
.base
, 16, "elsa isdn modem")) {
575 "HiSax: %s config port %lx-%lx already in use\n",
576 Elsa_Types
[cs
->subtyp
],
577 cs
->hw
.elsa
.base
+ 8,
578 cs
->hw
.elsa
.base
+ 16);
580 } else if (cs
->subtyp
== ELSA_PCC16
) {
581 cs
->subtyp
= ELSA_PCF
;
583 "Elsa: %s detected modem at 0x%lx\n",
584 Elsa_Types
[cs
->subtyp
],
585 cs
->hw
.elsa
.base
+ 8);
586 release_region(cs
->hw
.elsa
.base
, 8);
587 if (!request_region(cs
->hw
.elsa
.base
, 16, "elsa isdn modem")) {
589 "HiSax: %s config port %lx-%lx already in use\n",
590 Elsa_Types
[cs
->subtyp
],
591 cs
->hw
.elsa
.base
+ 8,
592 cs
->hw
.elsa
.base
+ 16);
596 "Elsa: %s detected modem at 0x%lx\n",
597 Elsa_Types
[cs
->subtyp
],
598 cs
->hw
.elsa
.base
+ 8);
599 arcofi_fsm(cs
, ARCOFI_START
, &ARCOFI_XOP_0
);
600 wait_event_interruptible(cs
->dc
.isac
.arcofi_wait
,
601 cs
->dc
.isac
.arcofi_state
== ARCOFI_NOP
);
606 #endif /* ARCOFI_USE */
609 elsa_led_handler(struct timer_list
*t
)
611 struct IsdnCardState
*cs
= from_timer(cs
, t
, hw
.elsa
.tl
);
614 if (cs
->subtyp
== ELSA_PCMCIA
|| cs
->subtyp
== ELSA_PCMCIA_IPAC
)
616 del_timer(&cs
->hw
.elsa
.tl
);
617 if (cs
->hw
.elsa
.status
& ELSA_ASSIGN
)
618 cs
->hw
.elsa
.ctrl_reg
|= ELSA_STAT_LED
;
619 else if (cs
->hw
.elsa
.status
& ELSA_BAD_PWR
)
620 cs
->hw
.elsa
.ctrl_reg
&= ~ELSA_STAT_LED
;
622 cs
->hw
.elsa
.ctrl_reg
^= ELSA_STAT_LED
;
625 if (cs
->hw
.elsa
.status
& 0xf000)
626 cs
->hw
.elsa
.ctrl_reg
|= ELSA_LINE_LED
;
627 else if (cs
->hw
.elsa
.status
& 0x0f00) {
628 cs
->hw
.elsa
.ctrl_reg
^= ELSA_LINE_LED
;
631 cs
->hw
.elsa
.ctrl_reg
&= ~ELSA_LINE_LED
;
633 if ((cs
->subtyp
== ELSA_QS1000PCI
) ||
634 (cs
->subtyp
== ELSA_QS3000PCI
)) {
636 if (cs
->hw
.elsa
.ctrl_reg
& ELSA_LINE_LED
)
637 led
^= ELSA_IPAC_LINE_LED
;
638 if (cs
->hw
.elsa
.ctrl_reg
& ELSA_STAT_LED
)
639 led
^= ELSA_IPAC_STAT_LED
;
640 writereg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ATX
, led
);
642 byteout(cs
->hw
.elsa
.ctrl
, cs
->hw
.elsa
.ctrl_reg
);
644 cs
->hw
.elsa
.tl
.expires
= jiffies
+ ((blink
* HZ
) / 1000);
645 add_timer(&cs
->hw
.elsa
.tl
);
650 Elsa_card_msg(struct IsdnCardState
*cs
, int mt
, void *arg
)
657 spin_lock_irqsave(&cs
->lock
, flags
);
659 spin_unlock_irqrestore(&cs
->lock
, flags
);
665 spin_lock_irqsave(&cs
->lock
, flags
);
666 cs
->debug
|= L1_DEB_IPAC
;
669 if ((cs
->subtyp
== ELSA_QS1000
) ||
670 (cs
->subtyp
== ELSA_QS3000
))
672 byteout(cs
->hw
.elsa
.timer
, 0);
674 if (cs
->hw
.elsa
.trig
)
675 byteout(cs
->hw
.elsa
.trig
, 0xff);
677 spin_unlock_irqrestore(&cs
->lock
, flags
);
680 if ((cs
->subtyp
== ELSA_PCMCIA
) ||
681 (cs
->subtyp
== ELSA_PCMCIA_IPAC
) ||
682 (cs
->subtyp
== ELSA_QS1000PCI
)) {
684 } else if (cs
->subtyp
== ELSA_QS3000PCI
) {
687 spin_lock_irqsave(&cs
->lock
, flags
);
688 cs
->hw
.elsa
.counter
= 0;
689 cs
->hw
.elsa
.ctrl_reg
|= ELSA_ENA_TIMER_INT
;
690 cs
->hw
.elsa
.status
|= ELIRQF_TIMER_AKTIV
;
691 byteout(cs
->hw
.elsa
.ctrl
, cs
->hw
.elsa
.ctrl_reg
);
692 byteout(cs
->hw
.elsa
.timer
, 0);
693 spin_unlock_irqrestore(&cs
->lock
, flags
);
695 spin_lock_irqsave(&cs
->lock
, flags
);
696 cs
->hw
.elsa
.ctrl_reg
&= ~ELSA_ENA_TIMER_INT
;
697 byteout(cs
->hw
.elsa
.ctrl
, cs
->hw
.elsa
.ctrl_reg
);
698 cs
->hw
.elsa
.status
&= ~ELIRQF_TIMER_AKTIV
;
699 spin_unlock_irqrestore(&cs
->lock
, flags
);
700 printk(KERN_INFO
"Elsa: %d timer tics in 110 msek\n",
701 cs
->hw
.elsa
.counter
);
702 if ((cs
->hw
.elsa
.counter
> 10) &&
703 (cs
->hw
.elsa
.counter
< 16)) {
704 printk(KERN_INFO
"Elsa: timer and irq OK\n");
708 "Elsa: timer tic problem (%d/12) maybe an IRQ(%d) conflict\n",
709 cs
->hw
.elsa
.counter
, cs
->irq
);
714 if (check_arcofi(cs
)) {
718 elsa_led_handler(&cs
->hw
.elsa
.tl
);
720 case (MDL_REMOVE
| REQUEST
):
721 cs
->hw
.elsa
.status
&= 0;
723 case (MDL_ASSIGN
| REQUEST
):
724 cs
->hw
.elsa
.status
|= ELSA_ASSIGN
;
728 cs
->hw
.elsa
.status
|= 0x0200;
730 cs
->hw
.elsa
.status
|= 0x0100;
734 cs
->hw
.elsa
.status
|= 0x2000;
736 cs
->hw
.elsa
.status
|= 0x1000;
740 cs
->hw
.elsa
.status
&= ~0x2000;
741 cs
->hw
.elsa
.status
&= ~0x0200;
743 cs
->hw
.elsa
.status
&= ~0x1000;
744 cs
->hw
.elsa
.status
&= ~0x0100;
749 if (cs
->hw
.elsa
.MFlag
) {
758 modem_write_cmd(cs
, msg
, len
);
763 if (cs
->typ
== ISDN_CTYPE_ELSA
) {
764 int pwr
= bytein(cs
->hw
.elsa
.ale
);
766 cs
->hw
.elsa
.status
|= ELSA_BAD_PWR
;
768 cs
->hw
.elsa
.status
&= ~ELSA_BAD_PWR
;
770 elsa_led_handler(&cs
->hw
.elsa
.tl
);
775 probe_elsa_adr(unsigned int adr
, int typ
)
777 int i
, in1
, in2
, p16_1
= 0, p16_2
= 0, p8_1
= 0, p8_2
= 0, pc_1
= 0,
778 pc_2
= 0, pfp_1
= 0, pfp_2
= 0;
780 /* In case of the elsa pcmcia card, this region is in use,
781 reserved for us by the card manager. So we do not check it
782 here, it would fail. */
783 if (typ
!= ISDN_CTYPE_ELSA_PCMCIA
) {
784 if (request_region(adr
, 8, "elsa card")) {
785 release_region(adr
, 8);
788 "Elsa: Probing Port 0x%x: already in use\n", adr
);
792 for (i
= 0; i
< 16; i
++) {
793 in1
= inb(adr
+ ELSA_CONFIG
); /* 'toggelt' bei */
794 in2
= inb(adr
+ ELSA_CONFIG
); /* jedem Zugriff */
804 printk(KERN_INFO
"Elsa: Probing IO 0x%x", adr
);
805 if (65 == ++p16_1
* ++p16_2
) {
806 printk(" PCC-16/PCF found\n");
808 } else if (1025 == ++pfp_1
* ++pfp_2
) {
809 printk(" PCF-Pro found\n");
810 return (ELSA_PCFPRO
);
811 } else if (33 == ++p8_1
* ++p8_2
) {
812 printk(" PCC8 found\n");
814 } else if (17 == ++pc_1
* ++pc_2
) {
815 printk(" PC found\n");
824 probe_elsa(struct IsdnCardState
*cs
)
827 unsigned int CARD_portlist
[] =
828 {0x160, 0x170, 0x260, 0x360, 0};
830 for (i
= 0; CARD_portlist
[i
]; i
++) {
831 if ((cs
->subtyp
= probe_elsa_adr(CARD_portlist
[i
], cs
->typ
)))
834 return (CARD_portlist
[i
]);
837 static int setup_elsa_isa(struct IsdnCard
*card
)
839 struct IsdnCardState
*cs
= card
->cs
;
842 cs
->hw
.elsa
.base
= card
->para
[0];
843 printk(KERN_INFO
"Elsa: Microlink IO probing\n");
844 if (cs
->hw
.elsa
.base
) {
845 if (!(cs
->subtyp
= probe_elsa_adr(cs
->hw
.elsa
.base
,
848 "Elsa: no Elsa Microlink at %#lx\n",
853 cs
->hw
.elsa
.base
= probe_elsa(cs
);
855 if (!cs
->hw
.elsa
.base
) {
857 "No Elsa Microlink found\n");
861 cs
->hw
.elsa
.cfg
= cs
->hw
.elsa
.base
+ ELSA_CONFIG
;
862 cs
->hw
.elsa
.ctrl
= cs
->hw
.elsa
.base
+ ELSA_CONTROL
;
863 cs
->hw
.elsa
.ale
= cs
->hw
.elsa
.base
+ ELSA_ALE
;
864 cs
->hw
.elsa
.isac
= cs
->hw
.elsa
.base
+ ELSA_ISAC
;
865 cs
->hw
.elsa
.itac
= cs
->hw
.elsa
.base
+ ELSA_ITAC
;
866 cs
->hw
.elsa
.hscx
= cs
->hw
.elsa
.base
+ ELSA_HSCX
;
867 cs
->hw
.elsa
.trig
= cs
->hw
.elsa
.base
+ ELSA_TRIG_IRQ
;
868 cs
->hw
.elsa
.timer
= cs
->hw
.elsa
.base
+ ELSA_START_TIMER
;
869 val
= bytein(cs
->hw
.elsa
.cfg
);
870 if (cs
->subtyp
== ELSA_PC
) {
871 const u_char CARD_IrqTab
[8] =
872 {7, 3, 5, 9, 0, 0, 0, 0};
873 cs
->irq
= CARD_IrqTab
[(val
& ELSA_IRQ_IDX_PC
) >> 2];
874 } else if (cs
->subtyp
== ELSA_PCC8
) {
875 const u_char CARD_IrqTab
[8] =
876 {7, 3, 5, 9, 0, 0, 0, 0};
877 cs
->irq
= CARD_IrqTab
[(val
& ELSA_IRQ_IDX_PCC8
) >> 4];
879 const u_char CARD_IrqTab
[8] =
880 {15, 10, 15, 3, 11, 5, 11, 9};
881 cs
->irq
= CARD_IrqTab
[(val
& ELSA_IRQ_IDX
) >> 3];
883 val
= bytein(cs
->hw
.elsa
.ale
) & ELSA_HW_RELEASE
;
887 if (val
== 'B' || val
== 'C')
889 if ((cs
->subtyp
== ELSA_PCFPRO
) && (val
== 'G'))
892 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n",
893 Elsa_Types
[cs
->subtyp
],
896 val
= bytein(cs
->hw
.elsa
.ale
) & ELSA_S0_POWER_BAD
;
899 "Elsa: Microlink S0 bus power bad\n");
900 cs
->hw
.elsa
.status
|= ELSA_BAD_PWR
;
907 static struct isapnp_device_id elsa_ids
[] = {
908 { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
909 ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
910 (unsigned long) "Elsa QS1000" },
911 { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
912 ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
913 (unsigned long) "Elsa QS3000" },
917 static struct isapnp_device_id
*ipid
= &elsa_ids
[0];
918 static struct pnp_card
*pnp_c
= NULL
;
919 #endif /* __ISAPNP__ */
921 static int setup_elsa_isapnp(struct IsdnCard
*card
)
923 struct IsdnCardState
*cs
= card
->cs
;
926 if (!card
->para
[1] && isapnp_present()) {
927 struct pnp_dev
*pnp_d
;
928 while (ipid
->card_vendor
) {
929 if ((pnp_c
= pnp_find_card(ipid
->card_vendor
,
930 ipid
->card_device
, pnp_c
))) {
932 if ((pnp_d
= pnp_find_dev(pnp_c
,
933 ipid
->vendor
, ipid
->function
, pnp_d
))) {
936 printk(KERN_INFO
"HiSax: %s detected\n",
937 (char *)ipid
->driver_data
);
938 pnp_disable_dev(pnp_d
);
939 err
= pnp_activate_dev(pnp_d
);
941 printk(KERN_WARNING
"%s: pnp_activate_dev ret(%d)\n",
945 card
->para
[1] = pnp_port_start(pnp_d
, 0);
946 card
->para
[0] = pnp_irq(pnp_d
, 0);
948 if (card
->para
[0] == -1 || !card
->para
[1]) {
949 printk(KERN_ERR
"Elsa PnP:some resources are missing %ld/%lx\n",
950 card
->para
[0], card
->para
[1]);
951 pnp_disable_dev(pnp_d
);
954 if (ipid
->function
== ISAPNP_FUNCTION(0x133))
955 cs
->subtyp
= ELSA_QS1000
;
957 cs
->subtyp
= ELSA_QS3000
;
960 printk(KERN_ERR
"Elsa PnP: PnP error card found, no device\n");
967 if (!ipid
->card_vendor
) {
968 printk(KERN_INFO
"Elsa PnP: no ISAPnP card found\n");
972 #endif /* __ISAPNP__ */
974 if (card
->para
[1] && card
->para
[0]) {
975 cs
->hw
.elsa
.base
= card
->para
[1];
976 cs
->irq
= card
->para
[0];
978 cs
->subtyp
= ELSA_QS1000
;
980 printk(KERN_ERR
"Elsa PnP: no parameter\n");
982 cs
->hw
.elsa
.cfg
= cs
->hw
.elsa
.base
+ ELSA_CONFIG
;
983 cs
->hw
.elsa
.ale
= cs
->hw
.elsa
.base
+ ELSA_ALE
;
984 cs
->hw
.elsa
.isac
= cs
->hw
.elsa
.base
+ ELSA_ISAC
;
985 cs
->hw
.elsa
.hscx
= cs
->hw
.elsa
.base
+ ELSA_HSCX
;
986 cs
->hw
.elsa
.trig
= cs
->hw
.elsa
.base
+ ELSA_TRIG_IRQ
;
987 cs
->hw
.elsa
.timer
= cs
->hw
.elsa
.base
+ ELSA_START_TIMER
;
988 cs
->hw
.elsa
.ctrl
= cs
->hw
.elsa
.base
+ ELSA_CONTROL
;
990 "Elsa: %s defined at %#lx IRQ %d\n",
991 Elsa_Types
[cs
->subtyp
],
998 static void setup_elsa_pcmcia(struct IsdnCard
*card
)
1000 struct IsdnCardState
*cs
= card
->cs
;
1003 cs
->hw
.elsa
.base
= card
->para
[1];
1004 cs
->irq
= card
->para
[0];
1005 val
= readreg(cs
->hw
.elsa
.base
+ 0, cs
->hw
.elsa
.base
+ 2, IPAC_ID
);
1006 if ((val
== 1) || (val
== 2)) { /* IPAC version 1.1/1.2 */
1007 cs
->subtyp
= ELSA_PCMCIA_IPAC
;
1008 cs
->hw
.elsa
.ale
= cs
->hw
.elsa
.base
+ 0;
1009 cs
->hw
.elsa
.isac
= cs
->hw
.elsa
.base
+ 2;
1010 cs
->hw
.elsa
.hscx
= cs
->hw
.elsa
.base
+ 2;
1011 test_and_set_bit(HW_IPAC
, &cs
->HW_Flags
);
1013 cs
->subtyp
= ELSA_PCMCIA
;
1014 cs
->hw
.elsa
.ale
= cs
->hw
.elsa
.base
+ ELSA_ALE_PCM
;
1015 cs
->hw
.elsa
.isac
= cs
->hw
.elsa
.base
+ ELSA_ISAC_PCM
;
1016 cs
->hw
.elsa
.hscx
= cs
->hw
.elsa
.base
+ ELSA_HSCX
;
1018 cs
->hw
.elsa
.timer
= 0;
1019 cs
->hw
.elsa
.trig
= 0;
1020 cs
->hw
.elsa
.ctrl
= 0;
1021 cs
->irq_flags
|= IRQF_SHARED
;
1023 "Elsa: %s defined at %#lx IRQ %d\n",
1024 Elsa_Types
[cs
->subtyp
],
1030 static struct pci_dev
*dev_qs1000
= NULL
;
1031 static struct pci_dev
*dev_qs3000
= NULL
;
1033 static int setup_elsa_pci(struct IsdnCard
*card
)
1035 struct IsdnCardState
*cs
= card
->cs
;
1038 if ((dev_qs1000
= hisax_find_pci_device(PCI_VENDOR_ID_ELSA
,
1039 PCI_DEVICE_ID_ELSA_MICROLINK
, dev_qs1000
))) {
1040 if (pci_enable_device(dev_qs1000
))
1042 cs
->subtyp
= ELSA_QS1000PCI
;
1043 cs
->irq
= dev_qs1000
->irq
;
1044 cs
->hw
.elsa
.cfg
= pci_resource_start(dev_qs1000
, 1);
1045 cs
->hw
.elsa
.base
= pci_resource_start(dev_qs1000
, 3);
1046 } else if ((dev_qs3000
= hisax_find_pci_device(PCI_VENDOR_ID_ELSA
,
1047 PCI_DEVICE_ID_ELSA_QS3000
, dev_qs3000
))) {
1048 if (pci_enable_device(dev_qs3000
))
1050 cs
->subtyp
= ELSA_QS3000PCI
;
1051 cs
->irq
= dev_qs3000
->irq
;
1052 cs
->hw
.elsa
.cfg
= pci_resource_start(dev_qs3000
, 1);
1053 cs
->hw
.elsa
.base
= pci_resource_start(dev_qs3000
, 3);
1055 printk(KERN_WARNING
"Elsa: No PCI card found\n");
1059 printk(KERN_WARNING
"Elsa: No IRQ for PCI card found\n");
1063 if (!(cs
->hw
.elsa
.base
&& cs
->hw
.elsa
.cfg
)) {
1064 printk(KERN_WARNING
"Elsa: No IO-Adr for PCI card found\n");
1067 if ((cs
->hw
.elsa
.cfg
& 0xff) || (cs
->hw
.elsa
.base
& 0xf)) {
1068 printk(KERN_WARNING
"Elsa: You may have a wrong PCI bios\n");
1069 printk(KERN_WARNING
"Elsa: If your system hangs now, read\n");
1070 printk(KERN_WARNING
"Elsa: Documentation/isdn/README.HiSax\n");
1072 cs
->hw
.elsa
.ale
= cs
->hw
.elsa
.base
;
1073 cs
->hw
.elsa
.isac
= cs
->hw
.elsa
.base
+ 1;
1074 cs
->hw
.elsa
.hscx
= cs
->hw
.elsa
.base
+ 1;
1075 test_and_set_bit(HW_IPAC
, &cs
->HW_Flags
);
1076 cs
->hw
.elsa
.timer
= 0;
1077 cs
->hw
.elsa
.trig
= 0;
1078 cs
->irq_flags
|= IRQF_SHARED
;
1080 "Elsa: %s defined at %#lx/0x%x IRQ %d\n",
1081 Elsa_Types
[cs
->subtyp
],
1091 static int setup_elsa_pci(struct IsdnCard
*card
)
1095 #endif /* CONFIG_PCI */
1097 static int setup_elsa_common(struct IsdnCard
*card
)
1099 struct IsdnCardState
*cs
= card
->cs
;
1103 switch (cs
->subtyp
) {
1109 case ELSA_PCMCIA_IPAC
:
1115 case ELSA_QS3000PCI
:
1118 case ELSA_QS1000PCI
:
1123 "Unknown ELSA subtype %d\n", cs
->subtyp
);
1126 /* In case of the elsa pcmcia card, this region is in use,
1127 reserved for us by the card manager. So we do not check it
1128 here, it would fail. */
1129 if (cs
->typ
!= ISDN_CTYPE_ELSA_PCMCIA
&& !request_region(cs
->hw
.elsa
.base
, bytecnt
, "elsa isdn")) {
1131 "HiSax: ELSA config port %#lx-%#lx already in use\n",
1133 cs
->hw
.elsa
.base
+ bytecnt
);
1136 if ((cs
->subtyp
== ELSA_QS1000PCI
) || (cs
->subtyp
== ELSA_QS3000PCI
)) {
1137 if (!request_region(cs
->hw
.elsa
.cfg
, 0x80, "elsa isdn pci")) {
1139 "HiSax: ELSA pci port %x-%x already in use\n",
1141 cs
->hw
.elsa
.cfg
+ 0x80);
1142 release_region(cs
->hw
.elsa
.base
, bytecnt
);
1150 timer_setup(&cs
->hw
.elsa
.tl
, elsa_led_handler
, 0);
1152 if (cs
->hw
.elsa
.timer
) {
1153 byteout(cs
->hw
.elsa
.trig
, 0xff);
1154 byteout(cs
->hw
.elsa
.timer
, 0);
1155 if (!TimerRun(cs
)) {
1156 byteout(cs
->hw
.elsa
.timer
, 0); /* 2. Versuch */
1157 if (!TimerRun(cs
)) {
1159 "Elsa: timer do not start\n");
1160 release_io_elsa(cs
);
1164 HZDELAY((HZ
/ 100) + 1); /* wait >=10 ms */
1166 printk(KERN_WARNING
"Elsa: timer do not run down\n");
1167 release_io_elsa(cs
);
1170 printk(KERN_INFO
"Elsa: timer OK; resetting card\n");
1172 cs
->BC_Read_Reg
= &ReadHSCX
;
1173 cs
->BC_Write_Reg
= &WriteHSCX
;
1174 cs
->BC_Send_Data
= &hscx_fill_fifo
;
1175 cs
->cardmsg
= &Elsa_card_msg
;
1176 if ((cs
->subtyp
== ELSA_QS1000PCI
) || (cs
->subtyp
== ELSA_QS3000PCI
) || (cs
->subtyp
== ELSA_PCMCIA_IPAC
)) {
1177 cs
->readisac
= &ReadISAC_IPAC
;
1178 cs
->writeisac
= &WriteISAC_IPAC
;
1179 cs
->readisacfifo
= &ReadISACfifo_IPAC
;
1180 cs
->writeisacfifo
= &WriteISACfifo_IPAC
;
1181 cs
->irq_func
= &elsa_interrupt_ipac
;
1182 val
= readreg(cs
->hw
.elsa
.ale
, cs
->hw
.elsa
.isac
, IPAC_ID
);
1183 printk(KERN_INFO
"Elsa: IPAC version %x\n", val
);
1185 cs
->readisac
= &ReadISAC
;
1186 cs
->writeisac
= &WriteISAC
;
1187 cs
->readisacfifo
= &ReadISACfifo
;
1188 cs
->writeisacfifo
= &WriteISACfifo
;
1189 cs
->irq_func
= &elsa_interrupt
;
1190 ISACVersion(cs
, "Elsa:");
1191 if (HscxVersion(cs
, "Elsa:")) {
1193 "Elsa: wrong HSCX versions check IO address\n");
1194 release_io_elsa(cs
);
1198 if (cs
->subtyp
== ELSA_PC
) {
1199 val
= readitac(cs
, ITAC_SYS
);
1200 printk(KERN_INFO
"Elsa: ITAC version %s\n", ITACVer
[val
& 7]);
1201 writeitac(cs
, ITAC_ISEN
, 0);
1202 writeitac(cs
, ITAC_RFIE
, 0);
1203 writeitac(cs
, ITAC_XFIE
, 0);
1204 writeitac(cs
, ITAC_SCIE
, 0);
1205 writeitac(cs
, ITAC_STIE
, 0);
1210 int setup_elsa(struct IsdnCard
*card
)
1213 struct IsdnCardState
*cs
= card
->cs
;
1216 strcpy(tmp
, Elsa_revision
);
1217 printk(KERN_INFO
"HiSax: Elsa driver Rev. %s\n", HiSax_getrev(tmp
));
1218 cs
->hw
.elsa
.ctrl_reg
= 0;
1219 cs
->hw
.elsa
.status
= 0;
1220 cs
->hw
.elsa
.MFlag
= 0;
1223 if (cs
->typ
== ISDN_CTYPE_ELSA
) {
1224 rc
= setup_elsa_isa(card
);
1228 } else if (cs
->typ
== ISDN_CTYPE_ELSA_PNP
) {
1229 rc
= setup_elsa_isapnp(card
);
1233 } else if (cs
->typ
== ISDN_CTYPE_ELSA_PCMCIA
)
1234 setup_elsa_pcmcia(card
);
1236 else if (cs
->typ
== ISDN_CTYPE_ELSA_PCI
) {
1237 rc
= setup_elsa_pci(card
);
1244 return setup_elsa_common(card
);