1 /* $Id: sedlbauer.c,v 1.23 2000/06/26 08:59:14 keil Exp $
3 * sedlbauer.c 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 * Copyright (C) 1997,1998 Marcus Niemann (for the modifications to
11 * the original file asuscom.c)
13 * Author Marcus Niemann (niemann@www-bib.fh-bielefeld.de)
15 * Thanks to Karsten Keil
16 * Sedlbauer AG for informations
19 * This file is (c) under GNU PUBLIC LICENSE
24 * Card: Chip: Configuration: Comment:
25 * ---------------------------------------------------------------------
26 * Speed Card ISAC_HSCX DIP-SWITCH
27 * Speed Win ISAC_HSCX ISAPNP
28 * Speed Fax+ ISAC_ISAR ISAPNP Full analog support
29 * Speed Star ISAC_HSCX CARDMGR
30 * Speed Win2 IPAC ISAPNP
31 * ISDN PC/104 IPAC DIP-SWITCH
32 * Speed Star2 IPAC CARDMGR
33 * Speed PCI IPAC PCI PNP
34 * Speed Fax+ ISAC_ISAR PCI PNP Full analog support
37 * For the sedlbauer speed fax+ to work properly you have to download
38 * the firmware onto the card.
39 * For example: hisaxctrl <DriverID> 9 ISAR.BIN
42 #define SEDLBAUER_PCI 1
44 #define __NO_VERSION__
45 #include <linux/config.h>
52 #include <linux/pci.h>
54 extern const char *CardType
[];
56 const char *Sedlbauer_revision
= "$Revision: 1.20 $";
58 const char *Sedlbauer_Types
[] =
59 {"None", "speed card/win", "speed star", "speed fax+",
60 "speed win II / ISDN PC/104", "speed star II", "speed pci",
64 #define PCI_VENDOR_SEDLBAUER 0xe159
65 #define PCI_SPEEDPCI_ID 0x02
66 #define PCI_SUBVENDOR_SEDLBAUER 0x51
67 #define PCI_SUB_ID_SPEEDFAXP 0x01
70 #define SEDL_SPEED_CARD_WIN 1
71 #define SEDL_SPEED_STAR 2
72 #define SEDL_SPEED_FAX 3
73 #define SEDL_SPEED_WIN2_PC104 4
74 #define SEDL_SPEED_STAR2 5
75 #define SEDL_SPEED_PCI 6
76 #define SEDL_SPEEDFAX_PCI 7
78 #define SEDL_CHIP_TEST 0
79 #define SEDL_CHIP_ISAC_HSCX 1
80 #define SEDL_CHIP_ISAC_ISAR 2
81 #define SEDL_CHIP_IPAC 3
83 #define SEDL_BUS_ISA 1
84 #define SEDL_BUS_PCI 2
85 #define SEDL_BUS_PCMCIA 3
87 #define byteout(addr,val) outb(val,addr)
88 #define bytein(addr) inb(addr)
90 #define SEDL_HSCX_ISA_RESET_ON 0
91 #define SEDL_HSCX_ISA_RESET_OFF 1
92 #define SEDL_HSCX_ISA_ISAC 2
93 #define SEDL_HSCX_ISA_HSCX 3
94 #define SEDL_HSCX_ISA_ADR 4
96 #define SEDL_HSCX_PCMCIA_RESET 0
97 #define SEDL_HSCX_PCMCIA_ISAC 1
98 #define SEDL_HSCX_PCMCIA_HSCX 2
99 #define SEDL_HSCX_PCMCIA_ADR 4
101 #define SEDL_ISAR_ISA_ISAC 4
102 #define SEDL_ISAR_ISA_ISAR 6
103 #define SEDL_ISAR_ISA_ADR 8
104 #define SEDL_ISAR_ISA_ISAR_RESET_ON 10
105 #define SEDL_ISAR_ISA_ISAR_RESET_OFF 12
107 #define SEDL_IPAC_ANY_ADR 0
108 #define SEDL_IPAC_ANY_IPAC 2
110 #define SEDL_IPAC_PCI_BASE 0
111 #define SEDL_IPAC_PCI_ADR 0xc0
112 #define SEDL_IPAC_PCI_IPAC 0xc8
113 #define SEDL_ISAR_PCI_ADR 0xc8
114 #define SEDL_ISAR_PCI_ISAC 0xd0
115 #define SEDL_ISAR_PCI_ISAR 0xe0
116 #define SEDL_ISAR_PCI_ISAR_RESET_ON 0x01
117 #define SEDL_ISAR_PCI_ISAR_RESET_OFF 0x18
118 #define SEDL_ISAR_PCI_LED1 0x08
119 #define SEDL_ISAR_PCI_LED2 0x10
121 #define SEDL_RESET 0x3 /* same as DOS driver */
124 readreg(unsigned int ale
, unsigned int adr
, u_char off
)
133 restore_flags(flags
);
138 readfifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
* data
, int size
)
140 /* fifo read without cli because it's allready done */
143 insb(adr
, data
, size
);
148 writereg(unsigned int ale
, unsigned int adr
, u_char off
, u_char data
)
156 restore_flags(flags
);
160 writefifo(unsigned int ale
, unsigned int adr
, u_char off
, u_char
* data
, int size
)
162 /* fifo write without cli because it's allready done */
164 outsb(adr
, data
, size
);
167 /* Interface functions */
170 ReadISAC(struct IsdnCardState
*cs
, u_char offset
)
172 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
));
176 WriteISAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
178 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
, value
);
182 ReadISACfifo(struct IsdnCardState
*cs
, u_char
* data
, int size
)
184 readfifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0, data
, size
);
188 WriteISACfifo(struct IsdnCardState
*cs
, u_char
* data
, int size
)
190 writefifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0, data
, size
);
194 ReadISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
)
196 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
|0x80));
200 WriteISAC_IPAC(struct IsdnCardState
*cs
, u_char offset
, u_char value
)
202 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, offset
|0x80, value
);
206 ReadISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
* data
, int size
)
208 readfifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0x80, data
, size
);
212 WriteISACfifo_IPAC(struct IsdnCardState
*cs
, u_char
* data
, int size
)
214 writefifo(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, 0x80, data
, size
);
218 ReadHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
)
220 return (readreg(cs
->hw
.sedl
.adr
,
221 cs
->hw
.sedl
.hscx
, offset
+ (hscx
? 0x40 : 0)));
225 WriteHSCX(struct IsdnCardState
*cs
, int hscx
, u_char offset
, u_char value
)
227 writereg(cs
->hw
.sedl
.adr
,
228 cs
->hw
.sedl
.hscx
, offset
+ (hscx
? 0x40 : 0), value
);
231 /* ISAR access routines
232 * mode = 0 access with IRQ on
233 * mode = 1 access with IRQ off
234 * mode = 2 access with IRQ off and using last offset
238 ReadISAR(struct IsdnCardState
*cs
, int mode
, u_char offset
)
241 return (readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, offset
));
243 byteout(cs
->hw
.sedl
.adr
, offset
);
244 return(bytein(cs
->hw
.sedl
.hscx
));
248 WriteISAR(struct IsdnCardState
*cs
, int mode
, u_char offset
, u_char value
)
251 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, offset
, value
);
254 byteout(cs
->hw
.sedl
.adr
, offset
);
255 byteout(cs
->hw
.sedl
.hscx
, value
);
260 * fast interrupt HSCX stuff goes here
263 #define READHSCX(cs, nr, reg) readreg(cs->hw.sedl.adr, \
264 cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0))
265 #define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.sedl.adr, \
266 cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0), data)
268 #define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.sedl.adr, \
269 cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
271 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.sedl.adr, \
272 cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
274 #include "hscx_irq.c"
277 sedlbauer_interrupt(int intno
, void *dev_id
, struct pt_regs
*regs
)
279 struct IsdnCardState
*cs
= dev_id
;
283 printk(KERN_WARNING
"Sedlbauer: Spurious interrupt!\n");
287 if ((cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) && (*cs
->busy_flag
== 1)) {
288 /* The card tends to generate interrupts while being removed
289 causing us to just crash the kernel. bad. */
290 printk(KERN_WARNING
"Sedlbauer: card not available!\n");
294 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
297 hscx_int_main(cs
, val
);
298 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
301 isac_interrupt(cs
, val
);
302 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
304 if (cs
->debug
& L1_DEB_HSCX
)
305 debugl1(cs
, "HSCX IntStat after IntRoutine");
308 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
310 if (cs
->debug
& L1_DEB_ISAC
)
311 debugl1(cs
, "ISAC IntStat after IntRoutine");
314 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
, 0xFF);
315 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
+ 0x40, 0xFF);
316 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0xFF);
317 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0x0);
318 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
, 0x0);
319 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_MASK
+ 0x40, 0x0);
323 sedlbauer_interrupt_ipac(int intno
, void *dev_id
, struct pt_regs
*regs
)
325 struct IsdnCardState
*cs
= dev_id
;
326 u_char ista
, val
, icnt
= 5;
329 printk(KERN_WARNING
"Sedlbauer: Spurious interrupt!\n");
332 ista
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ISTA
);
334 if (cs
->debug
& L1_DEB_IPAC
)
335 debugl1(cs
, "IPAC ISTA %02X", ista
);
337 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, HSCX_ISTA
+ 0x40);
345 hscx_int_main(cs
, val
);
348 val
= 0xfe & readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
| 0x80);
350 isac_interrupt(cs
, val
);
355 isac_interrupt(cs
, val
);
357 ista
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ISTA
);
358 if ((ista
& 0x3f) && icnt
) {
363 printk(KERN_WARNING
"Sedlbauer IRQ LOOP\n");
364 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xFF);
365 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xC0);
369 sedlbauer_interrupt_isar(int intno
, void *dev_id
, struct pt_regs
*regs
)
371 struct IsdnCardState
*cs
= dev_id
;
376 printk(KERN_WARNING
"Sedlbauer: Spurious interrupt!\n");
380 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
);
382 if (val
& ISAR_IRQSTA
)
384 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
387 isac_interrupt(cs
, val
);
388 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
);
389 if ((val
& ISAR_IRQSTA
) && --cnt
) {
390 if (cs
->debug
& L1_DEB_HSCX
)
391 debugl1(cs
, "ISAR IntStat after IntRoutine");
394 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_ISTA
);
396 if (cs
->debug
& L1_DEB_ISAC
)
397 debugl1(cs
, "ISAC IntStat after IntRoutine");
401 printk(KERN_WARNING
"Sedlbauer IRQ LOOP\n");
403 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
, 0);
404 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0xFF);
405 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, ISAC_MASK
, 0x0);
406 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
, ISAR_IRQBIT
, ISAR_IRQMSK
);
410 release_io_sedlbauer(struct IsdnCardState
*cs
)
414 if (cs
->subtyp
== SEDL_SPEED_FAX
) {
416 } else if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
419 if (cs
->hw
.sedl
.cfg_reg
)
420 release_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
);
424 reset_sedlbauer(struct IsdnCardState
*cs
)
428 printk(KERN_INFO
"Sedlbauer: resetting card\n");
430 if (!((cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) &&
431 (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_HSCX
))) {
432 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
433 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_POTA2
, 0x20);
436 set_current_state(TASK_UNINTERRUPTIBLE
);
437 schedule_timeout((10*HZ
)/1000);
438 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_POTA2
, 0x0);
439 set_current_state(TASK_UNINTERRUPTIBLE
);
440 schedule_timeout((10*HZ
)/1000);
441 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_CONF
, 0x0);
442 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ACFG
, 0xff);
443 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_AOE
, 0x0);
444 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_MASK
, 0xc0);
445 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_PCFG
, 0x12);
446 restore_flags(flags
);
447 } else if ((cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) &&
448 (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
)) {
449 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
452 current
->state
= TASK_UNINTERRUPTIBLE
;
453 schedule_timeout((20*HZ
)/1000);
454 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
455 current
->state
= TASK_UNINTERRUPTIBLE
;
456 schedule_timeout((20*HZ
)/1000);
457 restore_flags(flags
);
459 byteout(cs
->hw
.sedl
.reset_on
, SEDL_RESET
); /* Reset On */
462 set_current_state(TASK_UNINTERRUPTIBLE
);
463 schedule_timeout((10*HZ
)/1000);
464 byteout(cs
->hw
.sedl
.reset_off
, 0); /* Reset Off */
465 set_current_state(TASK_UNINTERRUPTIBLE
);
466 schedule_timeout((10*HZ
)/1000);
467 restore_flags(flags
);
473 Sedl_card_msg(struct IsdnCardState
*cs
, int mt
, void *arg
)
480 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
481 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
483 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
486 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
488 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
,
491 release_io_sedlbauer(cs
);
494 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
495 clear_pending_isac_ints(cs
);
496 writereg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.hscx
,
500 /* Reenable all IRQ */
501 cs
->writeisac(cs
, ISAC_MASK
, 0);
502 /* RESET Receiver and Transmitter */
503 cs
->writeisac(cs
, ISAC_CMDR
, 0x41);
511 if (cs
->subtyp
!= SEDL_SPEEDFAX_PCI
)
514 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED2
;
516 cs
->hw
.sedl
.reset_off
&= ~SEDL_ISAR_PCI_LED1
;
517 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
520 if (cs
->subtyp
!= SEDL_SPEEDFAX_PCI
)
523 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED2
;
525 cs
->hw
.sedl
.reset_off
|= SEDL_ISAR_PCI_LED1
;
526 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
533 static struct pci_dev
*dev_sedl __initdata
= NULL
;
537 setup_sedlbauer(struct IsdnCard
*card
))
539 int bytecnt
, ver
, val
;
540 struct IsdnCardState
*cs
= card
->cs
;
542 u16 sub_vendor_id
, sub_id
;
545 strcpy(tmp
, Sedlbauer_revision
);
546 printk(KERN_INFO
"HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp
));
548 if (cs
->typ
== ISDN_CTYPE_SEDLBAUER
) {
549 cs
->subtyp
= SEDL_SPEED_CARD_WIN
;
550 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
551 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
552 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_PCMCIA
) {
553 cs
->subtyp
= SEDL_SPEED_STAR
;
554 cs
->hw
.sedl
.bus
= SEDL_BUS_PCMCIA
;
555 cs
->hw
.sedl
.chip
= SEDL_CHIP_TEST
;
556 } else if (cs
->typ
== ISDN_CTYPE_SEDLBAUER_FAX
) {
557 cs
->subtyp
= SEDL_SPEED_FAX
;
558 cs
->hw
.sedl
.bus
= SEDL_BUS_ISA
;
559 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
565 cs
->hw
.sedl
.cfg_reg
= card
->para
[1];
566 cs
->irq
= card
->para
[0];
567 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
571 /* Probe for Sedlbauer speed pci */
574 if (!pci_present()) {
575 printk(KERN_ERR
"Sedlbauer: no PCI bus present\n");
578 if ((dev_sedl
= pci_find_device(PCI_VENDOR_SEDLBAUER
,
579 PCI_SPEEDPCI_ID
, dev_sedl
))) {
580 if (pci_enable_device(dev_sedl
))
582 cs
->irq
= dev_sedl
->irq
;
584 printk(KERN_WARNING
"Sedlbauer: No IRQ for PCI card found\n");
587 cs
->hw
.sedl
.cfg_reg
= pci_resource_start(dev_sedl
, 0);
589 printk(KERN_WARNING
"Sedlbauer: No PCI card found\n");
592 cs
->irq_flags
|= SA_SHIRQ
;
593 cs
->hw
.sedl
.bus
= SEDL_BUS_PCI
;
594 sub_vendor_id
= dev_sedl
->subsystem_vendor
;
595 sub_id
= dev_sedl
->subsystem_device
;
596 printk(KERN_INFO
"Sedlbauer: PCI subvendor:%x subid %x\n",
597 sub_vendor_id
, sub_id
);
598 printk(KERN_INFO
"Sedlbauer: PCI base adr %#x\n",
599 cs
->hw
.sedl
.cfg_reg
);
600 if ((sub_vendor_id
== PCI_SUBVENDOR_SEDLBAUER
) &&
601 (sub_id
== PCI_SUB_ID_SPEEDFAXP
)) {
602 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_ISAR
;
603 cs
->subtyp
= SEDL_SPEEDFAX_PCI
;
605 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
606 cs
->subtyp
= SEDL_SPEED_PCI
;
609 cs
->hw
.sedl
.reset_on
= SEDL_ISAR_PCI_ISAR_RESET_ON
;
610 cs
->hw
.sedl
.reset_off
= SEDL_ISAR_PCI_ISAR_RESET_OFF
;
611 byteout(cs
->hw
.sedl
.cfg_reg
, 0xff);
612 byteout(cs
->hw
.sedl
.cfg_reg
, 0x00);
613 byteout(cs
->hw
.sedl
.cfg_reg
+ 2, 0xdd);
614 byteout(cs
->hw
.sedl
.cfg_reg
+ 5, 0x02);
615 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_on
);
618 current
->state
= TASK_UNINTERRUPTIBLE
;
619 schedule_timeout((10*HZ
)/1000);
620 byteout(cs
->hw
.sedl
.cfg_reg
+3, cs
->hw
.sedl
.reset_off
);
621 restore_flags(flags
);
623 printk(KERN_WARNING
"Sedlbauer: NO_PCI_BIOS\n");
625 #endif /* CONFIG_PCI */
626 #endif /* SEDLBAUER_PCI */
629 /* In case of the sedlbauer pcmcia card, this region is in use,
630 reserved for us by the card manager. So we do not check it
631 here, it would fail. */
632 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCMCIA
&&
633 check_region((cs
->hw
.sedl
.cfg_reg
), bytecnt
)) {
635 "HiSax: %s config port %x-%x already in use\n",
638 cs
->hw
.sedl
.cfg_reg
+ bytecnt
);
641 request_region(cs
->hw
.sedl
.cfg_reg
, bytecnt
, "sedlbauer isdn");
645 "Sedlbauer: defined at 0x%x-0x%x IRQ %d\n",
647 cs
->hw
.sedl
.cfg_reg
+ bytecnt
,
650 cs
->BC_Read_Reg
= &ReadHSCX
;
651 cs
->BC_Write_Reg
= &WriteHSCX
;
652 cs
->BC_Send_Data
= &hscx_fill_fifo
;
653 cs
->cardmsg
= &Sedl_card_msg
;
656 * testing ISA and PCMCIA Cards for IPAC, default is ISAC
657 * do not test for PCI card, because ports are different
658 * and PCI card uses only IPAC (for the moment)
660 if (cs
->hw
.sedl
.bus
!= SEDL_BUS_PCI
) {
661 val
= readreg(cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
,
662 cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
, IPAC_ID
);
665 cs
->subtyp
= SEDL_SPEED_WIN2_PC104
;
666 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
667 cs
->subtyp
= SEDL_SPEED_STAR2
;
669 cs
->hw
.sedl
.chip
= SEDL_CHIP_IPAC
;
671 /* ISAC_HSCX oder ISAC_ISAR */
672 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_TEST
) {
673 cs
->hw
.sedl
.chip
= SEDL_CHIP_ISAC_HSCX
;
679 * hw.sedl.chip is now properly set
681 printk(KERN_INFO
"Sedlbauer: %s detected\n",
682 Sedlbauer_Types
[cs
->subtyp
]);
685 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_IPAC
) {
687 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
688 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_ADR
;
689 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
690 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_PCI_IPAC
;
692 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_ADR
;
693 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
694 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_IPAC_ANY_IPAC
;
696 test_and_set_bit(HW_IPAC
, &cs
->HW_Flags
);
697 cs
->readisac
= &ReadISAC_IPAC
;
698 cs
->writeisac
= &WriteISAC_IPAC
;
699 cs
->readisacfifo
= &ReadISACfifo_IPAC
;
700 cs
->writeisacfifo
= &WriteISACfifo_IPAC
;
701 cs
->irq_func
= &sedlbauer_interrupt_ipac
;
703 val
= readreg(cs
->hw
.sedl
.adr
, cs
->hw
.sedl
.isac
, IPAC_ID
);
704 printk(KERN_INFO
"Sedlbauer: IPAC version %x\n", val
);
707 /* ISAC_HSCX oder ISAC_ISAR */
708 cs
->readisac
= &ReadISAC
;
709 cs
->writeisac
= &WriteISAC
;
710 cs
->readisacfifo
= &ReadISACfifo
;
711 cs
->writeisacfifo
= &WriteISACfifo
;
712 if (cs
->hw
.sedl
.chip
== SEDL_CHIP_ISAC_ISAR
) {
713 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCI
) {
714 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
716 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
718 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
721 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+
723 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+
725 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+
727 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+
728 SEDL_ISAR_ISA_ISAR_RESET_ON
;
729 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+
730 SEDL_ISAR_ISA_ISAR_RESET_OFF
;
732 cs
->bcs
[0].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
733 cs
->bcs
[1].hw
.isar
.reg
= &cs
->hw
.sedl
.isar
;
734 test_and_set_bit(HW_ISAR
, &cs
->HW_Flags
);
735 cs
->irq_func
= &sedlbauer_interrupt_isar
;
736 cs
->auxcmd
= &isar_auxcmd
;
737 ISACVersion(cs
, "Sedlbauer:");
738 cs
->BC_Read_Reg
= &ReadISAR
;
739 cs
->BC_Write_Reg
= &WriteISAR
;
740 cs
->BC_Send_Data
= &isar_fill_fifo
;
741 ver
= ISARVersion(cs
, "Sedlbauer:");
744 "Sedlbauer: wrong ISAR version (ret = %d)\n", ver
);
745 release_io_sedlbauer(cs
);
749 if (cs
->hw
.sedl
.bus
== SEDL_BUS_PCMCIA
) {
750 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ADR
;
751 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_ISAC
;
752 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_HSCX
;
753 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
754 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_PCMCIA_RESET
;
756 cs
->hw
.sedl
.adr
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ADR
;
757 cs
->hw
.sedl
.isac
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_ISAC
;
758 cs
->hw
.sedl
.hscx
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_HSCX
;
759 cs
->hw
.sedl
.reset_on
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_ON
;
760 cs
->hw
.sedl
.reset_off
= cs
->hw
.sedl
.cfg_reg
+ SEDL_HSCX_ISA_RESET_OFF
;
762 cs
->irq_func
= &sedlbauer_interrupt
;
763 ISACVersion(cs
, "Sedlbauer:");
765 if (HscxVersion(cs
, "Sedlbauer:")) {
767 "Sedlbauer: wrong HSCX versions check IO address\n");
768 release_io_sedlbauer(cs
);