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
.chip
== SEDL_CHIP_ISAC_ISAR
) {
455 spin_lock_irqsave(&cs
->lock
, flags
);
456 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
458 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
461 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
463 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
465 spin_unlock_irqrestore(&cs
->lock
, flags
);
467 release_io_sedlbauer(cs
);
470 spin_lock_irqsave(&cs
->lock
, flags
);
472 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
473 clear_pending_isac_ints(cs
);
474 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
478 /* Reenable all IRQ */
479 cs
->writeisac(cs
, ISAC_MASK
, 0);
480 /* RESET Receiver and Transmitter */
481 cs
->writeisac(cs
, ISAC_CMDR
, 0x41);
485 spin_unlock_irqrestore(&cs
->lock
, flags
);
490 if (cs
->subtyp
!= SEDL_SPEEDFAX_PYRAMID
)
492 spin_lock_irqsave(&cs
->lock
, flags
);
494 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED2
;
496 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED1
;
497 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
498 spin_unlock_irqrestore(&cs
->lock
, flags
);
501 if (cs
->subtyp
!= SEDL_SPEEDFAX_PYRAMID
)
503 spin_lock_irqsave(&cs
->lock
, flags
);
505 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED2
;
507 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED1
;
508 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
509 spin_unlock_irqrestore(&cs
->lock
, flags
);
515 static struct pci_dev
*dev_sedl __devinitdata
= NULL
;
518 static struct isapnp_device_id sedl_ids
[] __devinitdata
= {
519 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
520 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
521 (unsigned long) "Speed win" },
522 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
523 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
524 (unsigned long) "Speed Fax+" },
528 static struct isapnp_device_id
*ipid __devinitdata
= &sedl_ids
[0];
529 static struct pnp_card
*pnp_c __devinitdata
= NULL
;
533 setup_sedlbauer(struct IsdnCard
*card
)
535 int bytecnt
, ver
, val
;
536 struct IsdnCardState
*cs
= card
->cs
;
538 u16 sub_vendor_id
, sub_id
;
540 strcpy(tmp
, Sedlbauer_revision
);
541 printk(KERN_INFO
"HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp
));
543 if (cs
->typ
== ISDN_CTYPE_SEDLBAUER
) {
544 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
545 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
546 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
547 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_PCMCIA
) {
548 cs
->subtyp
= SEDL_SPEED_STAR
;
549 cs
->hw
.sedl
.bus
= SEDL_BUS_PCMCIA
;
550 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
551 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_FAX
) {
552 cs
->subtyp
= SEDL_SPEED_FAX
;
553 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
554 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
560 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
561 cs
->irq
= card
->para
[0];
562 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
567 if (isapnp_present()) {
568 struct pnp_dev
*pnp_d
;
569 while(ipid
->card_vendor
) {
570 if ((pnp_c
= pnp_find_card(ipid
->card_vendor
,
571 ipid
->card_device
, pnp_c
))) {
573 if ((pnp_d
= pnp_find_dev(pnp_c
,
574 ipid
->vendor
, ipid
->function
, pnp_d
))) {
577 printk(KERN_INFO
"HiSax: %s detected\n",
578 (char *)ipid
->driver_data
);
579 pnp_disable_dev(pnp_d
);
580 err
= pnp_activate_dev(pnp_d
);
582 printk(KERN_WARNING
"%s: pnp_activate_dev ret(%d)\n",
586 card
->para
[1] = pnp_port_start(pnp_d
, 0);
587 card
->para
[0] = pnp_irq(pnp_d
, 0);
589 if (!card
->para
[0] || !card
->para
[1]) {
590 printk(KERN_ERR
"Sedlbauer PnP:some resources are missing %ld/%lx\n",
591 card
->para
[0], card
->para
[1]);
592 pnp_disable_dev(pnp_d
);
595 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
596 cs
->irq
= card
->para
[0];
597 if (ipid
->function
== ISAPNP_FUNCTION(0x2)) {
598 cs
->subtyp
= SEDL_SPEED_FAX
;
599 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
602 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
603 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
607 printk(KERN_ERR
"Sedlbauer PnP: PnP error card found, no device\n");
614 if (!ipid
->card_vendor
) {
615 printk(KERN_INFO
"Sedlbauer PnP: no ISAPnP card found\n");
619 /* Probe for Sedlbauer speed pci */
621 if ((dev_sedl
= pci_find_device(PCI_VENDOR_ID_TIGERJET
,
622 PCI_DEVICE_ID_TIGERJET_100
, dev_sedl
))) {
623 if (pci_enable_device(dev_sedl
))
625 cs
->irq
= dev_sedl
->irq
;
627 printk(KERN_WARNING
"Sedlbauer: No IRQ for PCI card found\n");
630 cs
->hw
.sedl
.cfg_reg
= pci_resource_start(dev_sedl
, 0);
632 printk(KERN_WARNING
"Sedlbauer: No PCI card found\n");
635 cs
->irq_flags
|= IRQF_SHARED
;
636 cs
->hw
.sedl
.bus
= SEDL_BUS_PCI
;
637 sub_vendor_id
= dev_sedl
->subsystem_vendor
;
638 sub_id
= dev_sedl
->subsystem_device
;
639 printk(KERN_INFO
"Sedlbauer: PCI subvendor:%x subid %x\n",
640 sub_vendor_id
, sub_id
);
641 printk(KERN_INFO
"Sedlbauer: PCI base adr %#x\n",
642 cs
->hw
.sedl
.cfg_reg
);
643 if (sub_id
!= PCI_SUB_ID_SEDLBAUER
) {
644 printk(KERN_ERR
"Sedlbauer: unknown sub id %#x\n", sub_id
);
647 if (sub_vendor_id
== PCI_SUBVENDOR_SPEEDFAX_PYRAMID
) {
648 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
649 cs
->subtyp
= SEDL_SPEEDFAX_PYRAMID
;
650 } else if (sub_vendor_id
== PCI_SUBVENDOR_SPEEDFAX_PCI
) {
651 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
652 cs
->subtyp
= SEDL_SPEEDFAX_PCI
;
653 } else if (sub_vendor_id
== PCI_SUBVENDOR_HST_SAPHIR3
) {
654 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
655 cs
->subtyp
= HST_SAPHIR3
;
656 } else if (sub_vendor_id
== PCI_SUBVENDOR_SEDLBAUER_PCI
) {
657 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
658 cs
->subtyp
= SEDL_SPEED_PCI
;
660 printk(KERN_ERR
"Sedlbauer: unknown sub vendor id %#x\n",
665 cs
->hw
.sedl
.reset_on
= SEDL_ISAR_PCI_ISAR_RESET_ON
;
666 cs
->hw
.sedl
.reset_off
= SEDL_ISAR_PCI_ISAR_RESET_OFF
;
667 byteout(cs
->hw
.sedl
.cfg_reg
, 0xff);
668 byteout(cs
->hw
.sedl
.cfg_reg
, 0x00);
669 byteout(cs
->hw
.sedl
.cfg_reg
+ 2, 0xdd);
670 byteout(cs
->hw
.sedl
.cfg_reg
+ 5, 0x02);
671 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
673 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
676 printk(KERN_WARNING
"Sedlbauer: NO_PCI_BIOS\n");
678 #endif /* CONFIG_PCI */
685 /* In case of the sedlbauer pcmcia card, this region is in use,
686 * reserved for us by the card manager. So we do not check it
687 * here, it would fail.
689 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCMCIA
&&
690 !request_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
, "sedlbauer isdn")) {
692 "HiSax: %s config port %x-%x already in use\n",
695 cs
->hw
.sedl
.cfg_reg
+ bytecnt
);
700 "Sedlbauer: defined at 0x%x-0x%x IRQ %d\n",
702 cs
->hw
.sedl
.cfg_reg
+ bytecnt
,
705 cs
->BC_Read_Reg
= &ReadHSCX
;
706 cs
->BC_Write_Reg
= &WriteHSCX
;
707 cs
->BC_Send_Data
= &hscx_fill_fifo
;
708 cs
->cardmsg
= &Sedl_card_msg
;
711 * testing ISA and PCMCIA Cards for IPAC, default is ISAC
712 * do not test for PCI card, because ports are different
713 * and PCI card uses only IPAC (for the moment)
715 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCI
) {
716 val
= readreg(cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
,
717 cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
, IPAC_ID
);
718 printk(KERN_DEBUG
"Sedlbauer: testing IPAC version %x\n", val
);
719 if ((val
== 1) || (val
== 2)) {
721 cs
->subtyp
= SEDL_SPEED_WIN2_PC104
;
722 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
723 cs
->subtyp
= SEDL_SPEED_STAR2
;
725 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
727 /* ISAC_HSCX oder ISAC_ISAR */
728 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_TEST
) {
729 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_HSCX
;
735 * hw.sedl.chip is now properly set
737 printk(KERN_INFO
"Sedlbauer: %s detected\n",
738 Sedlbauer_Types
[cs
->subtyp
]);
741 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
742 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
743 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_ADR
;
744 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
745 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
747 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
;
748 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
749 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
751 test_and_set_bit(HW_IPAC
, &cs
->HW_Flags
);
752 cs
->readisac
= &ReadISAC_IPAC
;
753 cs
->writeisac
= &WriteISAC_IPAC
;
754 cs
->readisacfifo
= &ReadISACfifo_IPAC
;
755 cs
->writeisacfifo
= &WriteISACfifo_IPAC
;
756 cs
->irq_func
= &sedlbauer_interrupt_ipac
;
757 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ID
);
758 printk(KERN_INFO
"Sedlbauer: IPAC version %x\n", val
);
760 /* ISAC_HSCX oder ISAC_ISAR */
761 cs
->readisac
= &ReadISAC
;
762 cs
->writeisac
= &WriteISAC
;
763 cs
->readisacfifo
= &ReadISACfifo
;
764 cs
->writeisacfifo
= &WriteISACfifo
;
765 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
766 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
767 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
769 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
771 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
774 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
776 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
778 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
780 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+
781 SEDL_ISAR_ISA_ISAR_RESET_ON
;
782 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+
783 SEDL_ISAR_ISA_ISAR_RESET_OFF
;
785 cs
->bcs
[0].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
786 cs
->bcs
[1].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
787 test_and_set_bit(HW_ISAR
, &cs
->HW_Flags
);
788 cs
->irq_func
= &sedlbauer_interrupt_isar
;
789 cs
->auxcmd
= &isar_auxcmd
;
790 ISACVersion(cs
, "Sedlbauer:");
791 cs
->BC_Read_Reg
= &ReadISAR
;
792 cs
->BC_Write_Reg
= &WriteISAR
;
793 cs
->BC_Send_Data
= &isar_fill_fifo
;
796 ver
= ISARVersion(cs
, "Sedlbauer:");
799 "Sedlbauer: wrong ISAR version (ret = %d)\n", ver
);
806 release_io_sedlbauer(cs
);
810 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
811 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ADR
;
812 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ISAC
;
813 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_HSCX
;
814 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
815 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
816 cs
->irq_flags
|= IRQF_SHARED
;
818 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ADR
;
819 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ISAC
;
820 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_HSCX
;
821 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_ON
;
822 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_OFF
;
824 cs
->irq_func
= &sedlbauer_interrupt
;
825 ISACVersion(cs
, "Sedlbauer:");
827 if (HscxVersion(cs
, "Sedlbauer:")) {
829 "Sedlbauer: wrong HSCX versions check IO address\n");
830 release_io_sedlbauer(cs
);