1 /* $Id: sedlbauer.c,v 1.34.2.6 2004/01/24 20:47:24 keil Exp $
3 * low level stuff for Sedlbauer cards
4 * includes support for the Sedlbauer speed star (speed star II),
5 * support for the Sedlbauer speed fax+,
6 * support for the Sedlbauer ISDN-Controller PC/104 and
7 * support for the Sedlbauer speed pci
8 * derived from the original file asuscom.c from Karsten Keil
10 * Author Marcus Niemann
11 * Copyright by Marcus Niemann <niemann@www-bib.fh-bielefeld.de>
13 * This software may be used and distributed according to the terms
14 * of the GNU General Public License, incorporated herein by reference.
16 * Thanks to Karsten Keil
17 * Sedlbauer AG for informations
23 * Card: Chip: Configuration: Comment:
24 * ---------------------------------------------------------------------
25 * Speed Card ISAC_HSCX DIP-SWITCH
26 * Speed Win ISAC_HSCX ISAPNP
27 * Speed Fax+ ISAC_ISAR ISAPNP Full analog support
28 * Speed Star ISAC_HSCX CARDMGR
29 * Speed Win2 IPAC ISAPNP
30 * ISDN PC/104 IPAC DIP-SWITCH
31 * Speed Star2 IPAC CARDMGR
32 * Speed PCI IPAC PCI PNP
33 * Speed Fax+ ISAC_ISAR PCI PNP Full analog support
36 * For the sedlbauer speed fax+ to work properly you have to download
37 * the firmware onto the card.
38 * For example: hisaxctrl <DriverID> 9 ISAR.BIN
41 #include <linux/init.h>
48 #include <linux/pci.h>
49 #include <linux/isapnp.h>
51 extern const char *CardType
[];
53 static const char *Sedlbauer_revision
= "$Revision: 1.34.2.6 $";
55 static const char *Sedlbauer_Types
[] =
56 {"None", "speed card/win", "speed star", "speed fax+",
57 "speed win II / ISDN PC/104", "speed star II", "speed pci",
58 "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"};
60 #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID 0x51
61 #define PCI_SUBVENDOR_HST_SAPHIR3 0x52
62 #define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53
63 #define PCI_SUBVENDOR_SPEEDFAX_PCI 0x54
64 #define PCI_SUB_ID_SEDLBAUER 0x01
66 #define SEDL_SPEED_CARD_WIN 1
67 #define SEDL_SPEED_STAR 2
68 #define SEDL_SPEED_FAX 3
69 #define SEDL_SPEED_WIN2_PC104 4
70 #define SEDL_SPEED_STAR2 5
71 #define SEDL_SPEED_PCI 6
72 #define SEDL_SPEEDFAX_PYRAMID 7
73 #define SEDL_SPEEDFAX_PCI 8
76 #define SEDL_CHIP_TEST 0
77 #define SEDL_CHIP_ISAC_HSCX 1
78 #define SEDL_CHIP_ISAC_ISAR 2
79 #define SEDL_CHIP_IPAC 3
81 #define SEDL_BUS_ISA 1
82 #define SEDL_BUS_PCI 2
83 #define SEDL_BUS_PCMCIA 3
85 #define byteout(addr,val) outb(val,addr)
86 #define bytein(addr) inb(addr)
88 #define SEDL_HSCX_ISA_RESET_ON 0
89 #define SEDL_HSCX_ISA_RESET_OFF 1
90 #define SEDL_HSCX_ISA_ISAC 2
91 #define SEDL_HSCX_ISA_HSCX 3
92 #define SEDL_HSCX_ISA_ADR 4
94 #define SEDL_HSCX_PCMCIA_RESET 0
95 #define SEDL_HSCX_PCMCIA_ISAC 1
96 #define SEDL_HSCX_PCMCIA_HSCX 2
97 #define SEDL_HSCX_PCMCIA_ADR 4
99 #define SEDL_ISAR_ISA_ISAC 4
100 #define SEDL_ISAR_ISA_ISAR 6
101 #define SEDL_ISAR_ISA_ADR 8
102 #define SEDL_ISAR_ISA_ISAR_RESET_ON 10
103 #define SEDL_ISAR_ISA_ISAR_RESET_OFF 12
105 #define SEDL_IPAC_ANY_ADR 0
106 #define SEDL_IPAC_ANY_IPAC 2
108 #define SEDL_IPAC_PCI_BASE 0
109 #define SEDL_IPAC_PCI_ADR 0xc0
110 #define SEDL_IPAC_PCI_IPAC 0xc8
111 #define SEDL_ISAR_PCI_ADR 0xc8
112 #define SEDL_ISAR_PCI_ISAC 0xd0
113 #define SEDL_ISAR_PCI_ISAR 0xe0
114 #define SEDL_ISAR_PCI_ISAR_RESET_ON 0x01
115 #define SEDL_ISAR_PCI_ISAR_RESET_OFF 0x18
116 #define SEDL_ISAR_PCI_LED1 0x08
117 #define SEDL_ISAR_PCI_LED2 0x10
119 #define SEDL_RESET 0x3 /* same as DOS driver */
122 readreg(unsigned int ale
, unsigned int adr
, u_char off
)
132 readfifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
* data
, int size
)
135 insb(adr
, data
, size
);
140 writereg(unsigned int ale
, unsigned int adr
, u_char off
, u_char data
)
147 writefifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
* data
, int size
)
150 outsb(adr
, data
, size
);
153 /* Interface functions */
156 ReadISAC(struct IsdnCardState
*cs
, u_char offset
)
158 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
));
162 WriteISAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
164 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
, value
);
168 ReadISACfifo(struct IsdnCardState
*cs
, u_char
* data
, int size
)
170 readfifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0, data
, size
);
174 WriteISACfifo(struct IsdnCardState
*cs
, u_char
* data
, int size
)
176 writefifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0, data
, size
);
180 ReadISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
)
182 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
|0x80));
186 WriteISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
188 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
|0x80, value
);
192 ReadISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
* data
, int size
)
194 readfifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0x80, data
, size
);
198 WriteISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
* data
, int size
)
200 writefifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0x80, data
, size
);
204 ReadHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
)
206 return (readreg(cs
->hw
.sedl
.adr
,
207 cs
->hw
.sedl
.hscx
, offset
+ (hscx
? 0x40 : 0)));
211 WriteHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
, u_char value
)
213 writereg(cs
->hw
.sedl
.adr
,
214 cs
->hw
.sedl
.hscx
, offset
+ (hscx
? 0x40 : 0), value
);
217 /* ISAR access routines
218 * mode = 0 access with IRQ on
219 * mode = 1 access with IRQ off
220 * mode = 2 access with IRQ off and using last offset
224 ReadISAR(struct IsdnCardState
*cs
, int mode
, u_char offset
)
227 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, offset
));
229 byteout(cs
->hw
.sedl
.adr
, offset
);
230 return(bytein(cs
->hw
.sedl
.hscx
));
234 WriteISAR(struct IsdnCardState
*cs
, int mode
, u_char offset
, u_char value
)
237 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, offset
, value
);
240 byteout(cs
->hw
.sedl
.adr
, offset
);
241 byteout(cs
->hw
.sedl
.hscx
, value
);
246 * fast interrupt HSCX stuff goes here
249 #define READHSCX(cs, nr, reg) readreg(cs->hw.sedl.adr, \
250 cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0))
251 #define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.sedl.adr, \
252 cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0), data)
254 #define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.sedl.adr, \
255 cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
257 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.sedl.adr, \
258 cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
260 #include "hscx_irq.c"
263 sedlbauer_interrupt(int intno
, void *dev_id
)
265 struct IsdnCardState
*cs
= dev_id
;
269 spin_lock_irqsave(&cs
->lock
, flags
);
270 if ((cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) && (*cs
->busy_flag
== 1)) {
271 /* The card tends to generate interrupts while being removed
272 causing us to just crash the kernel. bad. */
273 spin_unlock_irqrestore(&cs
->lock
, flags
);
274 printk(KERN_WARNING
"Sedlbauer: card not available!\n");
278 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
281 hscx_int_main(cs
, val
);
282 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
285 isac_interrupt(cs
, val
);
286 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
288 if (cs
->debug
& L1_DEB_HSCX
)
289 debugl1(cs
, "HSCX IntStat after IntRoutine");
292 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
294 if (cs
->debug
& L1_DEB_ISAC
)
295 debugl1(cs
, "ISAC IntStat after IntRoutine");
298 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
, 0xFF);
299 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
+ 0x40, 0xFF);
300 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0xFF);
301 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0x0);
302 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
, 0x0);
303 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
+ 0x40, 0x0);
304 spin_unlock_irqrestore(&cs
->lock
, flags
);
309 sedlbauer_interrupt_ipac(int intno
, void *dev_id
)
311 struct IsdnCardState
*cs
= dev_id
;
312 u_char ista
, val
, icnt
= 5;
315 spin_lock_irqsave(&cs
->lock
, flags
);
316 ista
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ISTA
);
318 if (cs
->debug
& L1_DEB_IPAC
)
319 debugl1(cs
, "IPAC ISTA %02X", ista
);
321 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
329 hscx_int_main(cs
, val
);
332 val
= 0xfe & readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
| 0x80);
334 isac_interrupt(cs
, val
);
339 isac_interrupt(cs
, val
);
341 ista
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ISTA
);
342 if ((ista
& 0x3f) && icnt
) {
347 if (cs
->debug
& L1_DEB_ISAC
)
348 debugl1(cs
, "Sedlbauer IRQ LOOP");
349 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xFF);
350 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xC0);
351 spin_unlock_irqrestore(&cs
->lock
, flags
);
356 sedlbauer_interrupt_isar(int intno
, void *dev_id
)
358 struct IsdnCardState
*cs
= dev_id
;
363 spin_lock_irqsave(&cs
->lock
, flags
);
364 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
);
366 if (val
& ISAR_IRQSTA
)
368 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
371 isac_interrupt(cs
, val
);
372 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
);
373 if ((val
& ISAR_IRQSTA
) && --cnt
) {
374 if (cs
->debug
& L1_DEB_HSCX
)
375 debugl1(cs
, "ISAR IntStat after IntRoutine");
378 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
380 if (cs
->debug
& L1_DEB_ISAC
)
381 debugl1(cs
, "ISAC IntStat after IntRoutine");
385 if (cs
->debug
& L1_DEB_ISAC
)
386 debugl1(cs
, "Sedlbauer IRQ LOOP");
388 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
, 0);
389 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0xFF);
390 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0x0);
391 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
, ISAR_IRQMSK
);
392 spin_unlock_irqrestore(&cs
->lock
, flags
);
397 release_io_sedlbauer(struct IsdnCardState
*cs
)
401 if (cs
->subtyp
== SEDL_SPEED_FAX
) {
403 } else if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
406 if (cs
->hw
.sedl
.cfg_reg
)
407 release_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
);
411 reset_sedlbauer(struct IsdnCardState
*cs
)
413 printk(KERN_INFO
"Sedlbauer: resetting card\n");
415 if (!((cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) &&
416 (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_HSCX
))) {
417 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
418 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_POTA2
, 0x20);
420 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_POTA2
, 0x0);
422 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_CONF
, 0x0);
423 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ACFG
, 0xff);
424 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_AOE
, 0x0);
425 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xc0);
426 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_PCFG
, 0x12);
427 } else if ((cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) &&
428 (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
)) {
429 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
431 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
434 byteout(cs
->hw
.sedl
.reset_on
, SEDL_RESET
); /* Reset On */
436 byteout(cs
->hw
.sedl
.reset_off
, 0); /* Reset Off */
443 Sedl_card_msg(struct IsdnCardState
*cs
, int mt
, void *arg
)
449 spin_lock_irqsave(&cs
->lock
, flags
);
451 spin_unlock_irqrestore(&cs
->lock
, flags
);
454 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
)
455 /* disable all IRQ */
456 byteout(cs
->hw
.sedl
.cfg_reg
+ 5, 0);
457 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
458 spin_lock_irqsave(&cs
->lock
, flags
);
459 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
461 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
464 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
466 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
468 spin_unlock_irqrestore(&cs
->lock
, flags
);
470 release_io_sedlbauer(cs
);
473 spin_lock_irqsave(&cs
->lock
, flags
);
474 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
)
476 byteout(cs
->hw
.sedl
.cfg_reg
+ 5, 0x02);
478 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
479 clear_pending_isac_ints(cs
);
480 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
484 /* Reenable all IRQ */
485 cs
->writeisac(cs
, ISAC_MASK
, 0);
486 /* RESET Receiver and Transmitter */
487 cs
->writeisac(cs
, ISAC_CMDR
, 0x41);
491 spin_unlock_irqrestore(&cs
->lock
, flags
);
496 if (cs
->subtyp
!= SEDL_SPEEDFAX_PYRAMID
)
498 spin_lock_irqsave(&cs
->lock
, flags
);
500 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED2
;
502 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED1
;
503 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
504 spin_unlock_irqrestore(&cs
->lock
, flags
);
507 if (cs
->subtyp
!= SEDL_SPEEDFAX_PYRAMID
)
509 spin_lock_irqsave(&cs
->lock
, flags
);
511 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED2
;
513 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED1
;
514 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
515 spin_unlock_irqrestore(&cs
->lock
, flags
);
522 static struct isapnp_device_id sedl_ids
[] __devinitdata
= {
523 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
524 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
525 (unsigned long) "Speed win" },
526 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
527 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
528 (unsigned long) "Speed Fax+" },
532 static struct isapnp_device_id
*ipid __devinitdata
= &sedl_ids
[0];
533 static struct pnp_card
*pnp_c __devinitdata
= NULL
;
536 setup_sedlbauer_isapnp(struct IsdnCard
*card
, int *bytecnt
)
538 struct IsdnCardState
*cs
= card
->cs
;
539 struct pnp_dev
*pnp_d
;
541 if (!isapnp_present())
544 while(ipid
->card_vendor
) {
545 if ((pnp_c
= pnp_find_card(ipid
->card_vendor
,
546 ipid
->card_device
, pnp_c
))) {
548 if ((pnp_d
= pnp_find_dev(pnp_c
,
549 ipid
->vendor
, ipid
->function
, pnp_d
))) {
552 printk(KERN_INFO
"HiSax: %s detected\n",
553 (char *)ipid
->driver_data
);
554 pnp_disable_dev(pnp_d
);
555 err
= pnp_activate_dev(pnp_d
);
557 printk(KERN_WARNING
"%s: pnp_activate_dev ret(%d)\n",
561 card
->para
[1] = pnp_port_start(pnp_d
, 0);
562 card
->para
[0] = pnp_irq(pnp_d
, 0);
564 if (!card
->para
[0] || !card
->para
[1]) {
565 printk(KERN_ERR
"Sedlbauer PnP:some resources are missing %ld/%lx\n",
566 card
->para
[0], card
->para
[1]);
567 pnp_disable_dev(pnp_d
);
570 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
571 cs
->irq
= card
->para
[0];
572 if (ipid
->function
== ISAPNP_FUNCTION(0x2)) {
573 cs
->subtyp
= SEDL_SPEED_FAX
;
574 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
577 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
578 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
583 printk(KERN_ERR
"Sedlbauer PnP: PnP error card found, no device\n");
591 printk(KERN_INFO
"Sedlbauer PnP: no ISAPnP card found\n");
597 setup_sedlbauer_isapnp(struct IsdnCard
*card
, int *bytecnt
)
601 #endif /* __ISAPNP__ */
603 #ifdef CONFIG_PCI_LEGACY
604 static struct pci_dev
*dev_sedl __devinitdata
= NULL
;
607 setup_sedlbauer_pci(struct IsdnCard
*card
)
609 struct IsdnCardState
*cs
= card
->cs
;
610 u16 sub_vendor_id
, sub_id
;
612 if ((dev_sedl
= pci_find_device(PCI_VENDOR_ID_TIGERJET
,
613 PCI_DEVICE_ID_TIGERJET_100
, dev_sedl
))) {
614 if (pci_enable_device(dev_sedl
))
616 cs
->irq
= dev_sedl
->irq
;
618 printk(KERN_WARNING
"Sedlbauer: No IRQ for PCI card found\n");
621 cs
->hw
.sedl
.cfg_reg
= pci_resource_start(dev_sedl
, 0);
623 printk(KERN_WARNING
"Sedlbauer: No PCI card found\n");
626 cs
->irq_flags
|= IRQF_SHARED
;
627 cs
->hw
.sedl
.bus
= SEDL_BUS_PCI
;
628 sub_vendor_id
= dev_sedl
->subsystem_vendor
;
629 sub_id
= dev_sedl
->subsystem_device
;
630 printk(KERN_INFO
"Sedlbauer: PCI subvendor:%x subid %x\n",
631 sub_vendor_id
, sub_id
);
632 printk(KERN_INFO
"Sedlbauer: PCI base adr %#x\n",
633 cs
->hw
.sedl
.cfg_reg
);
634 if (sub_id
!= PCI_SUB_ID_SEDLBAUER
) {
635 printk(KERN_ERR
"Sedlbauer: unknown sub id %#x\n", sub_id
);
638 if (sub_vendor_id
== PCI_SUBVENDOR_SPEEDFAX_PYRAMID
) {
639 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
640 cs
->subtyp
= SEDL_SPEEDFAX_PYRAMID
;
641 } else if (sub_vendor_id
== PCI_SUBVENDOR_SPEEDFAX_PCI
) {
642 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
643 cs
->subtyp
= SEDL_SPEEDFAX_PCI
;
644 } else if (sub_vendor_id
== PCI_SUBVENDOR_HST_SAPHIR3
) {
645 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
646 cs
->subtyp
= HST_SAPHIR3
;
647 } else if (sub_vendor_id
== PCI_SUBVENDOR_SEDLBAUER_PCI
) {
648 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
649 cs
->subtyp
= SEDL_SPEED_PCI
;
651 printk(KERN_ERR
"Sedlbauer: unknown sub vendor id %#x\n",
656 cs
->hw
.sedl
.reset_on
= SEDL_ISAR_PCI_ISAR_RESET_ON
;
657 cs
->hw
.sedl
.reset_off
= SEDL_ISAR_PCI_ISAR_RESET_OFF
;
658 byteout(cs
->hw
.sedl
.cfg_reg
, 0xff);
659 byteout(cs
->hw
.sedl
.cfg_reg
, 0x00);
660 byteout(cs
->hw
.sedl
.cfg_reg
+ 2, 0xdd);
661 byteout(cs
->hw
.sedl
.cfg_reg
+ 5, 0); /* disable all IRQ */
662 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
664 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
673 setup_sedlbauer_pci(struct IsdnCard
*card
)
678 #endif /* CONFIG_PCI_LEGACY */
681 setup_sedlbauer(struct IsdnCard
*card
)
683 int bytecnt
= 8, ver
, val
, rc
;
684 struct IsdnCardState
*cs
= card
->cs
;
687 strcpy(tmp
, Sedlbauer_revision
);
688 printk(KERN_INFO
"HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp
));
690 if (cs
->typ
== ISDN_CTYPE_SEDLBAUER
) {
691 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
692 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
693 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
694 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_PCMCIA
) {
695 cs
->subtyp
= SEDL_SPEED_STAR
;
696 cs
->hw
.sedl
.bus
= SEDL_BUS_PCMCIA
;
697 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
698 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_FAX
) {
699 cs
->subtyp
= SEDL_SPEED_FAX
;
700 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
701 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
707 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
708 cs
->irq
= card
->para
[0];
709 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
713 rc
= setup_sedlbauer_isapnp(card
, &bytecnt
);
719 /* Probe for Sedlbauer speed pci */
720 rc
= setup_sedlbauer_pci(card
);
729 /* In case of the sedlbauer pcmcia card, this region is in use,
730 * reserved for us by the card manager. So we do not check it
731 * here, it would fail.
733 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCMCIA
&&
734 !request_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
, "sedlbauer isdn")) {
736 "HiSax: %s config port %x-%x already in use\n",
739 cs
->hw
.sedl
.cfg_reg
+ bytecnt
);
744 "Sedlbauer: defined at 0x%x-0x%x IRQ %d\n",
746 cs
->hw
.sedl
.cfg_reg
+ bytecnt
,
749 cs
->BC_Read_Reg
= &ReadHSCX
;
750 cs
->BC_Write_Reg
= &WriteHSCX
;
751 cs
->BC_Send_Data
= &hscx_fill_fifo
;
752 cs
->cardmsg
= &Sedl_card_msg
;
755 * testing ISA and PCMCIA Cards for IPAC, default is ISAC
756 * do not test for PCI card, because ports are different
757 * and PCI card uses only IPAC (for the moment)
759 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCI
) {
760 val
= readreg(cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
,
761 cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
, IPAC_ID
);
762 printk(KERN_DEBUG
"Sedlbauer: testing IPAC version %x\n", val
);
763 if ((val
== 1) || (val
== 2)) {
765 cs
->subtyp
= SEDL_SPEED_WIN2_PC104
;
766 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
767 cs
->subtyp
= SEDL_SPEED_STAR2
;
769 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
771 /* ISAC_HSCX oder ISAC_ISAR */
772 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_TEST
) {
773 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_HSCX
;
779 * hw.sedl.chip is now properly set
781 printk(KERN_INFO
"Sedlbauer: %s detected\n",
782 Sedlbauer_Types
[cs
->subtyp
]);
785 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
786 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
787 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_ADR
;
788 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
789 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
791 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
;
792 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
793 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
795 test_and_set_bit(HW_IPAC
, &cs
->HW_Flags
);
796 cs
->readisac
= &ReadISAC_IPAC
;
797 cs
->writeisac
= &WriteISAC_IPAC
;
798 cs
->readisacfifo
= &ReadISACfifo_IPAC
;
799 cs
->writeisacfifo
= &WriteISACfifo_IPAC
;
800 cs
->irq_func
= &sedlbauer_interrupt_ipac
;
801 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ID
);
802 printk(KERN_INFO
"Sedlbauer: IPAC version %x\n", val
);
804 /* ISAC_HSCX oder ISAC_ISAR */
805 cs
->readisac
= &ReadISAC
;
806 cs
->writeisac
= &WriteISAC
;
807 cs
->readisacfifo
= &ReadISACfifo
;
808 cs
->writeisacfifo
= &WriteISACfifo
;
809 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
810 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
811 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
813 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
815 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
818 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
820 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
822 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
824 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+
825 SEDL_ISAR_ISA_ISAR_RESET_ON
;
826 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+
827 SEDL_ISAR_ISA_ISAR_RESET_OFF
;
829 cs
->bcs
[0].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
830 cs
->bcs
[1].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
831 test_and_set_bit(HW_ISAR
, &cs
->HW_Flags
);
832 cs
->irq_func
= &sedlbauer_interrupt_isar
;
833 cs
->auxcmd
= &isar_auxcmd
;
834 ISACVersion(cs
, "Sedlbauer:");
835 cs
->BC_Read_Reg
= &ReadISAR
;
836 cs
->BC_Write_Reg
= &WriteISAR
;
837 cs
->BC_Send_Data
= &isar_fill_fifo
;
840 ver
= ISARVersion(cs
, "Sedlbauer:");
843 "Sedlbauer: wrong ISAR version (ret = %d)\n", ver
);
850 release_io_sedlbauer(cs
);
854 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
855 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ADR
;
856 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ISAC
;
857 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_HSCX
;
858 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
859 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
860 cs
->irq_flags
|= IRQF_SHARED
;
862 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ADR
;
863 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ISAC
;
864 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_HSCX
;
865 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_ON
;
866 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_OFF
;
868 cs
->irq_func
= &sedlbauer_interrupt
;
869 ISACVersion(cs
, "Sedlbauer:");
871 if (HscxVersion(cs
, "Sedlbauer:")) {
873 "Sedlbauer: wrong HSCX versions check IO address\n");
874 release_io_sedlbauer(cs
);