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>
42 #include <linux/config.h>
49 #include <linux/pci.h>
50 #include <linux/isapnp.h>
52 extern const char *CardType
[];
54 const char *Sedlbauer_revision
= "$Revision: 1.34.2.6 $";
56 const char *Sedlbauer_Types
[] =
57 {"None", "speed card/win", "speed star", "speed fax+",
58 "speed win II / ISDN PC/104", "speed star II", "speed pci",
59 "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"};
61 #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID 0x51
62 #define PCI_SUBVENDOR_HST_SAPHIR3 0x52
63 #define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53
64 #define PCI_SUBVENDOR_SPEEDFAX_PCI 0x54
65 #define PCI_SUB_ID_SEDLBAUER 0x01
67 #define SEDL_SPEED_CARD_WIN 1
68 #define SEDL_SPEED_STAR 2
69 #define SEDL_SPEED_FAX 3
70 #define SEDL_SPEED_WIN2_PC104 4
71 #define SEDL_SPEED_STAR2 5
72 #define SEDL_SPEED_PCI 6
73 #define SEDL_SPEEDFAX_PYRAMID 7
74 #define SEDL_SPEEDFAX_PCI 8
77 #define SEDL_CHIP_TEST 0
78 #define SEDL_CHIP_ISAC_HSCX 1
79 #define SEDL_CHIP_ISAC_ISAR 2
80 #define SEDL_CHIP_IPAC 3
82 #define SEDL_BUS_ISA 1
83 #define SEDL_BUS_PCI 2
84 #define SEDL_BUS_PCMCIA 3
86 #define byteout(addr,val) outb(val,addr)
87 #define bytein(addr) inb(addr)
89 #define SEDL_HSCX_ISA_RESET_ON 0
90 #define SEDL_HSCX_ISA_RESET_OFF 1
91 #define SEDL_HSCX_ISA_ISAC 2
92 #define SEDL_HSCX_ISA_HSCX 3
93 #define SEDL_HSCX_ISA_ADR 4
95 #define SEDL_HSCX_PCMCIA_RESET 0
96 #define SEDL_HSCX_PCMCIA_ISAC 1
97 #define SEDL_HSCX_PCMCIA_HSCX 2
98 #define SEDL_HSCX_PCMCIA_ADR 4
100 #define SEDL_ISAR_ISA_ISAC 4
101 #define SEDL_ISAR_ISA_ISAR 6
102 #define SEDL_ISAR_ISA_ADR 8
103 #define SEDL_ISAR_ISA_ISAR_RESET_ON 10
104 #define SEDL_ISAR_ISA_ISAR_RESET_OFF 12
106 #define SEDL_IPAC_ANY_ADR 0
107 #define SEDL_IPAC_ANY_IPAC 2
109 #define SEDL_IPAC_PCI_BASE 0
110 #define SEDL_IPAC_PCI_ADR 0xc0
111 #define SEDL_IPAC_PCI_IPAC 0xc8
112 #define SEDL_ISAR_PCI_ADR 0xc8
113 #define SEDL_ISAR_PCI_ISAC 0xd0
114 #define SEDL_ISAR_PCI_ISAR 0xe0
115 #define SEDL_ISAR_PCI_ISAR_RESET_ON 0x01
116 #define SEDL_ISAR_PCI_ISAR_RESET_OFF 0x18
117 #define SEDL_ISAR_PCI_LED1 0x08
118 #define SEDL_ISAR_PCI_LED2 0x10
120 #define SEDL_RESET 0x3 /* same as DOS driver */
123 readreg(unsigned int ale
, unsigned int adr
, u_char off
)
133 readfifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
* data
, int size
)
136 insb(adr
, data
, size
);
141 writereg(unsigned int ale
, unsigned int adr
, u_char off
, u_char data
)
148 writefifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
* data
, int size
)
151 outsb(adr
, data
, size
);
154 /* Interface functions */
157 ReadISAC(struct IsdnCardState
*cs
, u_char offset
)
159 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
));
163 WriteISAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
165 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
, value
);
169 ReadISACfifo(struct IsdnCardState
*cs
, u_char
* data
, int size
)
171 readfifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0, data
, size
);
175 WriteISACfifo(struct IsdnCardState
*cs
, u_char
* data
, int size
)
177 writefifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0, data
, size
);
181 ReadISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
)
183 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
|0x80));
187 WriteISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
189 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
|0x80, value
);
193 ReadISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
* data
, int size
)
195 readfifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0x80, data
, size
);
199 WriteISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
* data
, int size
)
201 writefifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0x80, data
, size
);
205 ReadHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
)
207 return (readreg(cs
->hw
.sedl
.adr
,
208 cs
->hw
.sedl
.hscx
, offset
+ (hscx
? 0x40 : 0)));
212 WriteHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
, u_char value
)
214 writereg(cs
->hw
.sedl
.adr
,
215 cs
->hw
.sedl
.hscx
, offset
+ (hscx
? 0x40 : 0), value
);
218 /* ISAR access routines
219 * mode = 0 access with IRQ on
220 * mode = 1 access with IRQ off
221 * mode = 2 access with IRQ off and using last offset
225 ReadISAR(struct IsdnCardState
*cs
, int mode
, u_char offset
)
228 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, offset
));
230 byteout(cs
->hw
.sedl
.adr
, offset
);
231 return(bytein(cs
->hw
.sedl
.hscx
));
235 WriteISAR(struct IsdnCardState
*cs
, int mode
, u_char offset
, u_char value
)
238 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, offset
, value
);
241 byteout(cs
->hw
.sedl
.adr
, offset
);
242 byteout(cs
->hw
.sedl
.hscx
, value
);
247 * fast interrupt HSCX stuff goes here
250 #define READHSCX(cs, nr, reg) readreg(cs->hw.sedl.adr, \
251 cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0))
252 #define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.sedl.adr, \
253 cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0), data)
255 #define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.sedl.adr, \
256 cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
258 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.sedl.adr, \
259 cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
261 #include "hscx_irq.c"
264 sedlbauer_interrupt(int intno
, void *dev_id
, struct pt_regs
*regs
)
266 struct IsdnCardState
*cs
= dev_id
;
270 spin_lock_irqsave(&cs
->lock
, flags
);
271 if ((cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) && (*cs
->busy_flag
== 1)) {
272 /* The card tends to generate interrupts while being removed
273 causing us to just crash the kernel. bad. */
274 spin_unlock_irqrestore(&cs
->lock
, flags
);
275 printk(KERN_WARNING
"Sedlbauer: card not available!\n");
279 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
282 hscx_int_main(cs
, val
);
283 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
286 isac_interrupt(cs
, val
);
287 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
289 if (cs
->debug
& L1_DEB_HSCX
)
290 debugl1(cs
, "HSCX IntStat after IntRoutine");
293 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
295 if (cs
->debug
& L1_DEB_ISAC
)
296 debugl1(cs
, "ISAC IntStat after IntRoutine");
299 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
, 0xFF);
300 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
+ 0x40, 0xFF);
301 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0xFF);
302 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0x0);
303 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
, 0x0);
304 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
+ 0x40, 0x0);
305 spin_unlock_irqrestore(&cs
->lock
, flags
);
310 sedlbauer_interrupt_ipac(int intno
, void *dev_id
, struct pt_regs
*regs
)
312 struct IsdnCardState
*cs
= dev_id
;
313 u_char ista
, val
, icnt
= 5;
316 spin_lock_irqsave(&cs
->lock
, flags
);
317 ista
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ISTA
);
319 if (cs
->debug
& L1_DEB_IPAC
)
320 debugl1(cs
, "IPAC ISTA %02X", ista
);
322 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
330 hscx_int_main(cs
, val
);
333 val
= 0xfe & readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
| 0x80);
335 isac_interrupt(cs
, val
);
340 isac_interrupt(cs
, val
);
342 ista
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ISTA
);
343 if ((ista
& 0x3f) && icnt
) {
348 if (cs
->debug
& L1_DEB_ISAC
)
349 debugl1(cs
, "Sedlbauer IRQ LOOP");
350 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xFF);
351 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xC0);
352 spin_unlock_irqrestore(&cs
->lock
, flags
);
357 sedlbauer_interrupt_isar(int intno
, void *dev_id
, struct pt_regs
*regs
)
359 struct IsdnCardState
*cs
= dev_id
;
364 spin_lock_irqsave(&cs
->lock
, flags
);
365 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
);
367 if (val
& ISAR_IRQSTA
)
369 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
372 isac_interrupt(cs
, val
);
373 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
);
374 if ((val
& ISAR_IRQSTA
) && --cnt
) {
375 if (cs
->debug
& L1_DEB_HSCX
)
376 debugl1(cs
, "ISAR IntStat after IntRoutine");
379 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
381 if (cs
->debug
& L1_DEB_ISAC
)
382 debugl1(cs
, "ISAC IntStat after IntRoutine");
386 if (cs
->debug
& L1_DEB_ISAC
)
387 debugl1(cs
, "Sedlbauer IRQ LOOP");
389 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
, 0);
390 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0xFF);
391 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0x0);
392 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
, ISAR_IRQMSK
);
393 spin_unlock_irqrestore(&cs
->lock
, flags
);
398 release_io_sedlbauer(struct IsdnCardState
*cs
)
402 if (cs
->subtyp
== SEDL_SPEED_FAX
) {
404 } else if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
407 if (cs
->hw
.sedl
.cfg_reg
)
408 release_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
);
412 reset_sedlbauer(struct IsdnCardState
*cs
)
414 printk(KERN_INFO
"Sedlbauer: resetting card\n");
416 if (!((cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) &&
417 (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_HSCX
))) {
418 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
419 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_POTA2
, 0x20);
421 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_POTA2
, 0x0);
423 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_CONF
, 0x0);
424 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ACFG
, 0xff);
425 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_AOE
, 0x0);
426 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xc0);
427 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_PCFG
, 0x12);
428 } else if ((cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) &&
429 (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
)) {
430 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
432 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
435 byteout(cs
->hw
.sedl
.reset_on
, SEDL_RESET
); /* Reset On */
437 byteout(cs
->hw
.sedl
.reset_off
, 0); /* Reset Off */
444 Sedl_card_msg(struct IsdnCardState
*cs
, int mt
, void *arg
)
450 spin_lock_irqsave(&cs
->lock
, flags
);
452 spin_unlock_irqrestore(&cs
->lock
, flags
);
455 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
456 spin_lock_irqsave(&cs
->lock
, flags
);
457 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
459 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
462 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
464 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
466 spin_unlock_irqrestore(&cs
->lock
, flags
);
468 release_io_sedlbauer(cs
);
471 spin_lock_irqsave(&cs
->lock
, flags
);
473 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
474 clear_pending_isac_ints(cs
);
475 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
479 /* Reenable all IRQ */
480 cs
->writeisac(cs
, ISAC_MASK
, 0);
481 /* RESET Receiver and Transmitter */
482 cs
->writeisac(cs
, ISAC_CMDR
, 0x41);
486 spin_unlock_irqrestore(&cs
->lock
, flags
);
491 if (cs
->subtyp
!= SEDL_SPEEDFAX_PYRAMID
)
493 spin_lock_irqsave(&cs
->lock
, flags
);
495 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED2
;
497 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED1
;
498 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
499 spin_unlock_irqrestore(&cs
->lock
, flags
);
502 if (cs
->subtyp
!= SEDL_SPEEDFAX_PYRAMID
)
504 spin_lock_irqsave(&cs
->lock
, flags
);
506 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED2
;
508 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED1
;
509 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
510 spin_unlock_irqrestore(&cs
->lock
, flags
);
516 static struct pci_dev
*dev_sedl __devinitdata
= NULL
;
519 static struct isapnp_device_id sedl_ids
[] __devinitdata
= {
520 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
521 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
522 (unsigned long) "Speed win" },
523 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
524 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
525 (unsigned long) "Speed Fax+" },
529 static struct isapnp_device_id
*ipid __devinitdata
= &sedl_ids
[0];
530 static struct pnp_card
*pnp_c __devinitdata
= NULL
;
534 setup_sedlbauer(struct IsdnCard
*card
)
536 int bytecnt
, ver
, val
;
537 struct IsdnCardState
*cs
= card
->cs
;
539 u16 sub_vendor_id
, sub_id
;
541 strcpy(tmp
, Sedlbauer_revision
);
542 printk(KERN_INFO
"HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp
));
544 if (cs
->typ
== ISDN_CTYPE_SEDLBAUER
) {
545 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
546 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
547 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
548 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_PCMCIA
) {
549 cs
->subtyp
= SEDL_SPEED_STAR
;
550 cs
->hw
.sedl
.bus
= SEDL_BUS_PCMCIA
;
551 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
552 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_FAX
) {
553 cs
->subtyp
= SEDL_SPEED_FAX
;
554 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
555 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
561 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
562 cs
->irq
= card
->para
[0];
563 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
568 if (isapnp_present()) {
569 struct pnp_dev
*pnp_d
;
570 while(ipid
->card_vendor
) {
571 if ((pnp_c
= pnp_find_card(ipid
->card_vendor
,
572 ipid
->card_device
, pnp_c
))) {
574 if ((pnp_d
= pnp_find_dev(pnp_c
,
575 ipid
->vendor
, ipid
->function
, pnp_d
))) {
578 printk(KERN_INFO
"HiSax: %s detected\n",
579 (char *)ipid
->driver_data
);
580 pnp_disable_dev(pnp_d
);
581 err
= pnp_activate_dev(pnp_d
);
583 printk(KERN_WARNING
"%s: pnp_activate_dev ret(%d)\n",
587 card
->para
[1] = pnp_port_start(pnp_d
, 0);
588 card
->para
[0] = pnp_irq(pnp_d
, 0);
590 if (!card
->para
[0] || !card
->para
[1]) {
591 printk(KERN_ERR
"Sedlbauer PnP:some resources are missing %ld/%lx\n",
592 card
->para
[0], card
->para
[1]);
593 pnp_disable_dev(pnp_d
);
596 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
597 cs
->irq
= card
->para
[0];
598 if (ipid
->function
== ISAPNP_FUNCTION(0x2)) {
599 cs
->subtyp
= SEDL_SPEED_FAX
;
600 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
603 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
604 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
608 printk(KERN_ERR
"Sedlbauer PnP: PnP error card found, no device\n");
615 if (!ipid
->card_vendor
) {
616 printk(KERN_INFO
"Sedlbauer PnP: no ISAPnP card found\n");
620 /* Probe for Sedlbauer speed pci */
622 if ((dev_sedl
= pci_find_device(PCI_VENDOR_ID_TIGERJET
,
623 PCI_DEVICE_ID_TIGERJET_100
, dev_sedl
))) {
624 if (pci_enable_device(dev_sedl
))
626 cs
->irq
= dev_sedl
->irq
;
628 printk(KERN_WARNING
"Sedlbauer: No IRQ for PCI card found\n");
631 cs
->hw
.sedl
.cfg_reg
= pci_resource_start(dev_sedl
, 0);
633 printk(KERN_WARNING
"Sedlbauer: No PCI card found\n");
636 cs
->irq_flags
|= SA_SHIRQ
;
637 cs
->hw
.sedl
.bus
= SEDL_BUS_PCI
;
638 sub_vendor_id
= dev_sedl
->subsystem_vendor
;
639 sub_id
= dev_sedl
->subsystem_device
;
640 printk(KERN_INFO
"Sedlbauer: PCI subvendor:%x subid %x\n",
641 sub_vendor_id
, sub_id
);
642 printk(KERN_INFO
"Sedlbauer: PCI base adr %#x\n",
643 cs
->hw
.sedl
.cfg_reg
);
644 if (sub_id
!= PCI_SUB_ID_SEDLBAUER
) {
645 printk(KERN_ERR
"Sedlbauer: unknown sub id %#x\n", sub_id
);
648 if (sub_vendor_id
== PCI_SUBVENDOR_SPEEDFAX_PYRAMID
) {
649 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
650 cs
->subtyp
= SEDL_SPEEDFAX_PYRAMID
;
651 } else if (sub_vendor_id
== PCI_SUBVENDOR_SPEEDFAX_PCI
) {
652 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
653 cs
->subtyp
= SEDL_SPEEDFAX_PCI
;
654 } else if (sub_vendor_id
== PCI_SUBVENDOR_HST_SAPHIR3
) {
655 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
656 cs
->subtyp
= HST_SAPHIR3
;
657 } else if (sub_vendor_id
== PCI_SUBVENDOR_SEDLBAUER_PCI
) {
658 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
659 cs
->subtyp
= SEDL_SPEED_PCI
;
661 printk(KERN_ERR
"Sedlbauer: unknown sub vendor id %#x\n",
666 cs
->hw
.sedl
.reset_on
= SEDL_ISAR_PCI_ISAR_RESET_ON
;
667 cs
->hw
.sedl
.reset_off
= SEDL_ISAR_PCI_ISAR_RESET_OFF
;
668 byteout(cs
->hw
.sedl
.cfg_reg
, 0xff);
669 byteout(cs
->hw
.sedl
.cfg_reg
, 0x00);
670 byteout(cs
->hw
.sedl
.cfg_reg
+ 2, 0xdd);
671 byteout(cs
->hw
.sedl
.cfg_reg
+ 5, 0x02);
672 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
674 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
677 printk(KERN_WARNING
"Sedlbauer: NO_PCI_BIOS\n");
679 #endif /* CONFIG_PCI */
682 /* In case of the sedlbauer pcmcia card, this region is in use,
683 * reserved for us by the card manager. So we do not check it
684 * here, it would fail.
686 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCMCIA
&&
687 !request_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
, "sedlbauer isdn")) {
689 "HiSax: %s config port %x-%x already in use\n",
692 cs
->hw
.sedl
.cfg_reg
+ bytecnt
);
697 "Sedlbauer: defined at 0x%x-0x%x IRQ %d\n",
699 cs
->hw
.sedl
.cfg_reg
+ bytecnt
,
702 cs
->BC_Read_Reg
= &ReadHSCX
;
703 cs
->BC_Write_Reg
= &WriteHSCX
;
704 cs
->BC_Send_Data
= &hscx_fill_fifo
;
705 cs
->cardmsg
= &Sedl_card_msg
;
708 * testing ISA and PCMCIA Cards for IPAC, default is ISAC
709 * do not test for PCI card, because ports are different
710 * and PCI card uses only IPAC (for the moment)
712 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCI
) {
713 val
= readreg(cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
,
714 cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
, IPAC_ID
);
715 printk(KERN_DEBUG
"Sedlbauer: testing IPAC version %x\n", val
);
716 if ((val
== 1) || (val
== 2)) {
718 cs
->subtyp
= SEDL_SPEED_WIN2_PC104
;
719 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
720 cs
->subtyp
= SEDL_SPEED_STAR2
;
722 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
724 /* ISAC_HSCX oder ISAC_ISAR */
725 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_TEST
) {
726 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_HSCX
;
732 * hw.sedl.chip is now properly set
734 printk(KERN_INFO
"Sedlbauer: %s detected\n",
735 Sedlbauer_Types
[cs
->subtyp
]);
738 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
739 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
740 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_ADR
;
741 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
742 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
744 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
;
745 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
746 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
748 test_and_set_bit(HW_IPAC
, &cs
->HW_Flags
);
749 cs
->readisac
= &ReadISAC_IPAC
;
750 cs
->writeisac
= &WriteISAC_IPAC
;
751 cs
->readisacfifo
= &ReadISACfifo_IPAC
;
752 cs
->writeisacfifo
= &WriteISACfifo_IPAC
;
753 cs
->irq_func
= &sedlbauer_interrupt_ipac
;
754 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ID
);
755 printk(KERN_INFO
"Sedlbauer: IPAC version %x\n", val
);
757 /* ISAC_HSCX oder ISAC_ISAR */
758 cs
->readisac
= &ReadISAC
;
759 cs
->writeisac
= &WriteISAC
;
760 cs
->readisacfifo
= &ReadISACfifo
;
761 cs
->writeisacfifo
= &WriteISACfifo
;
762 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
763 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
764 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
766 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
768 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
771 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
773 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
775 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
777 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+
778 SEDL_ISAR_ISA_ISAR_RESET_ON
;
779 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+
780 SEDL_ISAR_ISA_ISAR_RESET_OFF
;
782 cs
->bcs
[0].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
783 cs
->bcs
[1].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
784 test_and_set_bit(HW_ISAR
, &cs
->HW_Flags
);
785 cs
->irq_func
= &sedlbauer_interrupt_isar
;
786 cs
->auxcmd
= &isar_auxcmd
;
787 ISACVersion(cs
, "Sedlbauer:");
788 cs
->BC_Read_Reg
= &ReadISAR
;
789 cs
->BC_Write_Reg
= &WriteISAR
;
790 cs
->BC_Send_Data
= &isar_fill_fifo
;
793 ver
= ISARVersion(cs
, "Sedlbauer:");
796 "Sedlbauer: wrong ISAR version (ret = %d)\n", ver
);
803 release_io_sedlbauer(cs
);
807 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
808 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ADR
;
809 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ISAC
;
810 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_HSCX
;
811 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
812 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
813 cs
->irq_flags
|= SA_SHIRQ
;
815 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ADR
;
816 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ISAC
;
817 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_HSCX
;
818 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_ON
;
819 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_OFF
;
821 cs
->irq_func
= &sedlbauer_interrupt
;
822 ISACVersion(cs
, "Sedlbauer:");
824 if (HscxVersion(cs
, "Sedlbauer:")) {
826 "Sedlbauer: wrong HSCX versions check IO address\n");
827 release_io_sedlbauer(cs
);