1 // SPDX-License-Identifier: GPL-2.0-only
4 * Support for cards based on following Infineon ISDN chipsets
11 * - Dialogic Diva 2.0U
12 * - Dialogic Diva 2.01
13 * - Dialogic Diva 2.02
14 * - Sedlbauer Speedwin
16 * - Develo (former ELSA) Microlink PCI (Quickstep 1000)
17 * - Develo (former ELSA) Quickstep 3000
18 * - Berkom Scitel BRIX Quadro
19 * - Dr.Neuhaus (Sagem) Niccy
21 * Author Karsten Keil <keil@isdn4linux.de>
23 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
26 #include <linux/interrupt.h>
27 #include <linux/module.h>
28 #include <linux/pci.h>
29 #include <linux/delay.h>
30 #include <linux/mISDNhw.h>
31 #include <linux/slab.h>
34 #define INFINEON_REV "1.0"
38 static u32 irqloops
= 4;
70 enum addr_mode cfg_mode
;
71 enum addr_mode addr_mode
;
88 resource_size_t start
;
93 struct list_head list
;
95 const struct inf_cinfo
*ci
;
96 char name
[MISDN_MAX_IDLEN
];
100 struct _iohandle addr
;
103 spinlock_t lock
; /* HW access lock */
105 struct inf_hw
*sc
[3]; /* slave cards */
109 #define PCI_SUBVENDOR_HST_SAPHIR3 0x52
110 #define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53
111 #define PCI_SUB_ID_SEDLBAUER 0x01
113 static struct pci_device_id infineon_ids
[] = {
114 { PCI_VDEVICE(EICON
, PCI_DEVICE_ID_EICON_DIVA20
), INF_DIVA20
},
115 { PCI_VDEVICE(EICON
, PCI_DEVICE_ID_EICON_DIVA20_U
), INF_DIVA20U
},
116 { PCI_VDEVICE(EICON
, PCI_DEVICE_ID_EICON_DIVA201
), INF_DIVA201
},
117 { PCI_VDEVICE(EICON
, PCI_DEVICE_ID_EICON_DIVA202
), INF_DIVA202
},
118 { PCI_VENDOR_ID_TIGERJET
, PCI_DEVICE_ID_TIGERJET_100
,
119 PCI_SUBVENDOR_SEDLBAUER_PCI
, PCI_SUB_ID_SEDLBAUER
, 0, 0,
121 { PCI_VENDOR_ID_TIGERJET
, PCI_DEVICE_ID_TIGERJET_100
,
122 PCI_SUBVENDOR_HST_SAPHIR3
, PCI_SUB_ID_SEDLBAUER
, 0, 0, INF_SAPHIR3
},
123 { PCI_VDEVICE(ELSA
, PCI_DEVICE_ID_ELSA_MICROLINK
), INF_QS1000
},
124 { PCI_VDEVICE(ELSA
, PCI_DEVICE_ID_ELSA_QS3000
), INF_QS3000
},
125 { PCI_VDEVICE(SATSAGEM
, PCI_DEVICE_ID_SATSAGEM_NICCY
), INF_NICCY
},
126 { PCI_VENDOR_ID_PLX
, PCI_DEVICE_ID_PLX_9050
,
127 PCI_VENDOR_ID_BERKOM
, PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO
, 0, 0,
129 { PCI_VDEVICE(PLX
, PCI_DEVICE_ID_PLX_R685
), INF_GAZEL_R685
},
130 { PCI_VDEVICE(PLX
, PCI_DEVICE_ID_PLX_R753
), INF_GAZEL_R753
},
131 { PCI_VDEVICE(PLX
, PCI_DEVICE_ID_PLX_DJINN_ITOO
), INF_GAZEL_R753
},
132 { PCI_VDEVICE(PLX
, PCI_DEVICE_ID_PLX_OLITEC
), INF_GAZEL_R753
},
135 MODULE_DEVICE_TABLE(pci
, infineon_ids
);
137 /* PCI interface specific defines */
139 #define DIVA_HSCX_PORT 0x00
140 #define DIVA_HSCX_ALE 0x04
141 #define DIVA_ISAC_PORT 0x08
142 #define DIVA_ISAC_ALE 0x0C
143 #define DIVA_PCI_CTRL 0x10
145 /* DIVA_PCI_CTRL bits */
146 #define DIVA_IRQ_BIT 0x01
147 #define DIVA_RESET_BIT 0x08
148 #define DIVA_EEPROM_CLK 0x40
149 #define DIVA_LED_A 0x10
150 #define DIVA_LED_B 0x20
151 #define DIVA_IRQ_CLR 0x80
155 #define PITA_ICR_REG 0x00
156 #define PITA_INT0_STATUS 0x02
158 #define PITA_MISC_REG 0x1c
159 #define PITA_PARA_SOFTRESET 0x01000000
160 #define PITA_SER_SOFTRESET 0x02000000
161 #define PITA_PARA_MPX_MODE 0x04000000
162 #define PITA_INT0_ENABLE 0x00020000
164 /* TIGER 100 Registers */
165 #define TIGER_RESET_ADDR 0x00
166 #define TIGER_EXTERN_RESET 0x01
167 #define TIGER_AUX_CTRL 0x02
168 #define TIGER_AUX_DATA 0x03
169 #define TIGER_AUX_IRQMASK 0x05
170 #define TIGER_AUX_STATUS 0x07
173 #define TIGER_IOMASK 0xdd /* 1 and 5 are inputs */
174 #define TIGER_IRQ_BIT 0x02
176 #define TIGER_IPAC_ALE 0xC0
177 #define TIGER_IPAC_PORT 0xC8
179 /* ELSA (now Develo) PCI cards */
180 #define ELSA_IRQ_ADDR 0x4c
181 #define ELSA_IRQ_MASK 0x04
182 #define QS1000_IRQ_OFF 0x01
183 #define QS3000_IRQ_OFF 0x03
184 #define QS1000_IRQ_ON 0x41
185 #define QS3000_IRQ_ON 0x43
187 /* Dr Neuhaus/Sagem Niccy */
188 #define NICCY_ISAC_PORT 0x00
189 #define NICCY_HSCX_PORT 0x01
190 #define NICCY_ISAC_ALE 0x02
191 #define NICCY_HSCX_ALE 0x03
193 #define NICCY_IRQ_CTRL_REG 0x38
194 #define NICCY_IRQ_ENABLE 0x001f00
195 #define NICCY_IRQ_DISABLE 0xff0000
196 #define NICCY_IRQ_BIT 0x800000
200 #define SCT_PLX_IRQ_ADDR 0x4c
201 #define SCT_PLX_RESET_ADDR 0x50
202 #define SCT_PLX_IRQ_ENABLE 0x41
203 #define SCT_PLX_RESET_BIT 0x04
206 #define GAZEL_IPAC_DATA_PORT 0x04
208 #define GAZEL_CNTRL 0x50
209 #define GAZEL_RESET 0x04
210 #define GAZEL_RESET_9050 0x40000000
211 #define GAZEL_INCSR 0x4C
212 #define GAZEL_ISAC_EN 0x08
213 #define GAZEL_INT_ISAC 0x20
214 #define GAZEL_HSCX_EN 0x01
215 #define GAZEL_INT_HSCX 0x04
216 #define GAZEL_PCI_EN 0x40
217 #define GAZEL_IPAC_EN 0x03
220 static LIST_HEAD(Cards
);
221 static DEFINE_RWLOCK(card_lock
); /* protect Cards */
224 _set_debug(struct inf_hw
*card
)
226 card
->ipac
.isac
.dch
.debug
= debug
;
227 card
->ipac
.hscx
[0].bch
.debug
= debug
;
228 card
->ipac
.hscx
[1].bch
.debug
= debug
;
232 set_debug(const char *val
, const struct kernel_param
*kp
)
237 ret
= param_set_uint(val
, kp
);
239 read_lock(&card_lock
);
240 list_for_each_entry(card
, &Cards
, list
)
242 read_unlock(&card_lock
);
247 MODULE_AUTHOR("Karsten Keil");
248 MODULE_LICENSE("GPL v2");
249 MODULE_VERSION(INFINEON_REV
);
250 module_param_call(debug
, set_debug
, param_get_uint
, &debug
, S_IRUGO
| S_IWUSR
);
251 MODULE_PARM_DESC(debug
, "infineon debug mask");
252 module_param(irqloops
, uint
, S_IRUGO
| S_IWUSR
);
253 MODULE_PARM_DESC(irqloops
, "infineon maximal irqloops (default 4)");
255 /* Interface functions */
257 IOFUNC_IO(ISAC
, inf_hw
, isac
.a
.io
)
258 IOFUNC_IO(IPAC
, inf_hw
, hscx
.a
.io
)
259 IOFUNC_IND(ISAC
, inf_hw
, isac
.a
.io
)
260 IOFUNC_IND(IPAC
, inf_hw
, hscx
.a
.io
)
261 IOFUNC_MEMIO(ISAC
, inf_hw
, u32
, isac
.a
.p
)
262 IOFUNC_MEMIO(IPAC
, inf_hw
, u32
, hscx
.a
.p
)
265 diva_irq(int intno
, void *dev_id
)
267 struct inf_hw
*hw
= dev_id
;
270 spin_lock(&hw
->lock
);
271 val
= inb((u32
)hw
->cfg
.start
+ DIVA_PCI_CTRL
);
272 if (!(val
& DIVA_IRQ_BIT
)) { /* for us or shared ? */
273 spin_unlock(&hw
->lock
);
274 return IRQ_NONE
; /* shared */
277 mISDNipac_irq(&hw
->ipac
, irqloops
);
278 spin_unlock(&hw
->lock
);
283 diva20x_irq(int intno
, void *dev_id
)
285 struct inf_hw
*hw
= dev_id
;
288 spin_lock(&hw
->lock
);
289 val
= readb(hw
->cfg
.p
);
290 if (!(val
& PITA_INT0_STATUS
)) { /* for us or shared ? */
291 spin_unlock(&hw
->lock
);
292 return IRQ_NONE
; /* shared */
295 mISDNipac_irq(&hw
->ipac
, irqloops
);
296 writeb(PITA_INT0_STATUS
, hw
->cfg
.p
); /* ACK PITA INT0 */
297 spin_unlock(&hw
->lock
);
302 tiger_irq(int intno
, void *dev_id
)
304 struct inf_hw
*hw
= dev_id
;
307 spin_lock(&hw
->lock
);
308 val
= inb((u32
)hw
->cfg
.start
+ TIGER_AUX_STATUS
);
309 if (val
& TIGER_IRQ_BIT
) { /* for us or shared ? */
310 spin_unlock(&hw
->lock
);
311 return IRQ_NONE
; /* shared */
314 mISDNipac_irq(&hw
->ipac
, irqloops
);
315 spin_unlock(&hw
->lock
);
320 elsa_irq(int intno
, void *dev_id
)
322 struct inf_hw
*hw
= dev_id
;
325 spin_lock(&hw
->lock
);
326 val
= inb((u32
)hw
->cfg
.start
+ ELSA_IRQ_ADDR
);
327 if (!(val
& ELSA_IRQ_MASK
)) {
328 spin_unlock(&hw
->lock
);
329 return IRQ_NONE
; /* shared */
332 mISDNipac_irq(&hw
->ipac
, irqloops
);
333 spin_unlock(&hw
->lock
);
338 niccy_irq(int intno
, void *dev_id
)
340 struct inf_hw
*hw
= dev_id
;
343 spin_lock(&hw
->lock
);
344 val
= inl((u32
)hw
->cfg
.start
+ NICCY_IRQ_CTRL_REG
);
345 if (!(val
& NICCY_IRQ_BIT
)) { /* for us or shared ? */
346 spin_unlock(&hw
->lock
);
347 return IRQ_NONE
; /* shared */
349 outl(val
, (u32
)hw
->cfg
.start
+ NICCY_IRQ_CTRL_REG
);
351 mISDNipac_irq(&hw
->ipac
, irqloops
);
352 spin_unlock(&hw
->lock
);
357 gazel_irq(int intno
, void *dev_id
)
359 struct inf_hw
*hw
= dev_id
;
362 spin_lock(&hw
->lock
);
363 ret
= mISDNipac_irq(&hw
->ipac
, irqloops
);
364 spin_unlock(&hw
->lock
);
369 ipac_irq(int intno
, void *dev_id
)
371 struct inf_hw
*hw
= dev_id
;
374 spin_lock(&hw
->lock
);
375 val
= hw
->ipac
.read_reg(hw
, IPAC_ISTA
);
377 spin_unlock(&hw
->lock
);
378 return IRQ_NONE
; /* shared */
381 mISDNipac_irq(&hw
->ipac
, irqloops
);
382 spin_unlock(&hw
->lock
);
387 enable_hwirq(struct inf_hw
*hw
)
392 switch (hw
->ci
->typ
) {
395 writel(PITA_INT0_ENABLE
, hw
->cfg
.p
);
399 outb(TIGER_IRQ_BIT
, (u32
)hw
->cfg
.start
+ TIGER_AUX_IRQMASK
);
402 outb(QS1000_IRQ_ON
, (u32
)hw
->cfg
.start
+ ELSA_IRQ_ADDR
);
405 outb(QS3000_IRQ_ON
, (u32
)hw
->cfg
.start
+ ELSA_IRQ_ADDR
);
408 val
= inl((u32
)hw
->cfg
.start
+ NICCY_IRQ_CTRL_REG
);
409 val
|= NICCY_IRQ_ENABLE
;
410 outl(val
, (u32
)hw
->cfg
.start
+ NICCY_IRQ_CTRL_REG
);
413 w
= inw((u32
)hw
->cfg
.start
+ SCT_PLX_IRQ_ADDR
);
414 w
|= SCT_PLX_IRQ_ENABLE
;
415 outw(w
, (u32
)hw
->cfg
.start
+ SCT_PLX_IRQ_ADDR
);
418 outb(GAZEL_ISAC_EN
+ GAZEL_HSCX_EN
+ GAZEL_PCI_EN
,
419 (u32
)hw
->cfg
.start
+ GAZEL_INCSR
);
422 outb(GAZEL_IPAC_EN
+ GAZEL_PCI_EN
,
423 (u32
)hw
->cfg
.start
+ GAZEL_INCSR
);
431 disable_hwirq(struct inf_hw
*hw
)
436 switch (hw
->ci
->typ
) {
439 writel(0, hw
->cfg
.p
);
443 outb(0, (u32
)hw
->cfg
.start
+ TIGER_AUX_IRQMASK
);
446 outb(QS1000_IRQ_OFF
, (u32
)hw
->cfg
.start
+ ELSA_IRQ_ADDR
);
449 outb(QS3000_IRQ_OFF
, (u32
)hw
->cfg
.start
+ ELSA_IRQ_ADDR
);
452 val
= inl((u32
)hw
->cfg
.start
+ NICCY_IRQ_CTRL_REG
);
453 val
&= NICCY_IRQ_DISABLE
;
454 outl(val
, (u32
)hw
->cfg
.start
+ NICCY_IRQ_CTRL_REG
);
457 w
= inw((u32
)hw
->cfg
.start
+ SCT_PLX_IRQ_ADDR
);
458 w
&= (~SCT_PLX_IRQ_ENABLE
);
459 outw(w
, (u32
)hw
->cfg
.start
+ SCT_PLX_IRQ_ADDR
);
463 outb(0, (u32
)hw
->cfg
.start
+ GAZEL_INCSR
);
471 ipac_chip_reset(struct inf_hw
*hw
)
473 hw
->ipac
.write_reg(hw
, IPAC_POTA2
, 0x20);
475 hw
->ipac
.write_reg(hw
, IPAC_POTA2
, 0x00);
477 hw
->ipac
.write_reg(hw
, IPAC_CONF
, hw
->ipac
.conf
);
478 hw
->ipac
.write_reg(hw
, IPAC_MASK
, 0xc0);
482 reset_inf(struct inf_hw
*hw
)
487 if (debug
& DEBUG_HW
)
488 pr_notice("%s: resetting card\n", hw
->name
);
489 switch (hw
->ci
->typ
) {
492 outb(0, (u32
)hw
->cfg
.start
+ DIVA_PCI_CTRL
);
494 outb(DIVA_RESET_BIT
, (u32
)hw
->cfg
.start
+ DIVA_PCI_CTRL
);
496 /* Workaround PCI9060 */
497 outb(9, (u32
)hw
->cfg
.start
+ 0x69);
498 outb(DIVA_RESET_BIT
| DIVA_LED_A
,
499 (u32
)hw
->cfg
.start
+ DIVA_PCI_CTRL
);
502 writel(PITA_PARA_SOFTRESET
| PITA_PARA_MPX_MODE
,
503 hw
->cfg
.p
+ PITA_MISC_REG
);
505 writel(PITA_PARA_MPX_MODE
, hw
->cfg
.p
+ PITA_MISC_REG
);
509 writel(PITA_PARA_SOFTRESET
| PITA_PARA_MPX_MODE
,
510 hw
->cfg
.p
+ PITA_MISC_REG
);
512 writel(PITA_PARA_MPX_MODE
| PITA_SER_SOFTRESET
,
513 hw
->cfg
.p
+ PITA_MISC_REG
);
519 hw
->ipac
.write_reg(hw
, IPAC_ACFG
, 0xff);
520 hw
->ipac
.write_reg(hw
, IPAC_AOE
, 0x00);
521 hw
->ipac
.write_reg(hw
, IPAC_PCFG
, 0x12);
526 hw
->ipac
.write_reg(hw
, IPAC_ACFG
, 0x00);
527 hw
->ipac
.write_reg(hw
, IPAC_AOE
, 0x3c);
528 hw
->ipac
.write_reg(hw
, IPAC_ATX
, 0xff);
533 w
= inw((u32
)hw
->cfg
.start
+ SCT_PLX_RESET_ADDR
);
534 w
&= (~SCT_PLX_RESET_BIT
);
535 outw(w
, (u32
)hw
->cfg
.start
+ SCT_PLX_RESET_ADDR
);
537 w
= inw((u32
)hw
->cfg
.start
+ SCT_PLX_RESET_ADDR
);
538 w
|= SCT_PLX_RESET_BIT
;
539 outw(w
, (u32
)hw
->cfg
.start
+ SCT_PLX_RESET_ADDR
);
543 val
= inl((u32
)hw
->cfg
.start
+ GAZEL_CNTRL
);
544 val
|= (GAZEL_RESET_9050
+ GAZEL_RESET
);
545 outl(val
, (u32
)hw
->cfg
.start
+ GAZEL_CNTRL
);
546 val
&= ~(GAZEL_RESET_9050
+ GAZEL_RESET
);
548 outl(val
, (u32
)hw
->cfg
.start
+ GAZEL_CNTRL
);
550 hw
->ipac
.isac
.adf2
= 0x87;
551 hw
->ipac
.hscx
[0].slot
= 0x1f;
552 hw
->ipac
.hscx
[1].slot
= 0x23;
555 val
= inl((u32
)hw
->cfg
.start
+ GAZEL_CNTRL
);
556 val
|= (GAZEL_RESET_9050
+ GAZEL_RESET
);
557 outl(val
, (u32
)hw
->cfg
.start
+ GAZEL_CNTRL
);
558 val
&= ~(GAZEL_RESET_9050
+ GAZEL_RESET
);
560 outl(val
, (u32
)hw
->cfg
.start
+ GAZEL_CNTRL
);
563 hw
->ipac
.write_reg(hw
, IPAC_ACFG
, 0xff);
564 hw
->ipac
.write_reg(hw
, IPAC_AOE
, 0x00);
565 hw
->ipac
.conf
= 0x01; /* IOM off */
574 inf_ctrl(struct inf_hw
*hw
, u32 cmd
, u_long arg
)
583 pr_info("%s: %s unknown command %x %lx\n",
584 hw
->name
, __func__
, cmd
, arg
);
592 init_irq(struct inf_hw
*hw
)
597 if (!hw
->ci
->irqfunc
)
599 ret
= request_irq(hw
->irq
, hw
->ci
->irqfunc
, IRQF_SHARED
, hw
->name
, hw
);
601 pr_info("%s: couldn't get interrupt %d\n", hw
->name
, hw
->irq
);
605 spin_lock_irqsave(&hw
->lock
, flags
);
607 ret
= hw
->ipac
.init(&hw
->ipac
);
609 spin_unlock_irqrestore(&hw
->lock
, flags
);
610 pr_info("%s: ISAC init failed with %d\n",
614 spin_unlock_irqrestore(&hw
->lock
, flags
);
615 msleep_interruptible(10);
616 if (debug
& DEBUG_HW
)
617 pr_notice("%s: IRQ %d count %d\n", hw
->name
,
618 hw
->irq
, hw
->irqcnt
);
620 pr_info("%s: IRQ(%d) got no requests during init %d\n",
621 hw
->name
, hw
->irq
, 3 - cnt
);
625 free_irq(hw
->irq
, hw
);
630 release_io(struct inf_hw
*hw
)
634 release_mem_region(hw
->cfg
.start
, hw
->cfg
.size
);
637 release_region(hw
->cfg
.start
, hw
->cfg
.size
);
638 hw
->cfg
.mode
= AM_NONE
;
642 release_mem_region(hw
->addr
.start
, hw
->addr
.size
);
645 release_region(hw
->addr
.start
, hw
->addr
.size
);
646 hw
->addr
.mode
= AM_NONE
;
651 setup_io(struct inf_hw
*hw
)
655 if (hw
->ci
->cfg_mode
) {
656 hw
->cfg
.start
= pci_resource_start(hw
->pdev
, hw
->ci
->cfg_bar
);
657 hw
->cfg
.size
= pci_resource_len(hw
->pdev
, hw
->ci
->cfg_bar
);
658 if (hw
->ci
->cfg_mode
== AM_MEMIO
) {
659 if (!request_mem_region(hw
->cfg
.start
, hw
->cfg
.size
,
663 if (!request_region(hw
->cfg
.start
, hw
->cfg
.size
,
668 pr_info("mISDN: %s config port %lx (%lu bytes)"
669 "already in use\n", hw
->name
,
670 (ulong
)hw
->cfg
.start
, (ulong
)hw
->cfg
.size
);
673 if (hw
->ci
->cfg_mode
== AM_MEMIO
)
674 hw
->cfg
.p
= ioremap(hw
->cfg
.start
, hw
->cfg
.size
);
675 hw
->cfg
.mode
= hw
->ci
->cfg_mode
;
676 if (debug
& DEBUG_HW
)
677 pr_notice("%s: IO cfg %lx (%lu bytes) mode%d\n",
678 hw
->name
, (ulong
)hw
->cfg
.start
,
679 (ulong
)hw
->cfg
.size
, hw
->ci
->cfg_mode
);
682 if (hw
->ci
->addr_mode
) {
683 hw
->addr
.start
= pci_resource_start(hw
->pdev
, hw
->ci
->addr_bar
);
684 hw
->addr
.size
= pci_resource_len(hw
->pdev
, hw
->ci
->addr_bar
);
685 if (hw
->ci
->addr_mode
== AM_MEMIO
) {
686 if (!request_mem_region(hw
->addr
.start
, hw
->addr
.size
,
690 if (!request_region(hw
->addr
.start
, hw
->addr
.size
,
695 pr_info("mISDN: %s address port %lx (%lu bytes)"
696 "already in use\n", hw
->name
,
697 (ulong
)hw
->addr
.start
, (ulong
)hw
->addr
.size
);
700 if (hw
->ci
->addr_mode
== AM_MEMIO
) {
701 hw
->addr
.p
= ioremap(hw
->addr
.start
, hw
->addr
.size
);
702 if (unlikely(!hw
->addr
.p
))
705 hw
->addr
.mode
= hw
->ci
->addr_mode
;
706 if (debug
& DEBUG_HW
)
707 pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n",
708 hw
->name
, (ulong
)hw
->addr
.start
,
709 (ulong
)hw
->addr
.size
, hw
->ci
->addr_mode
);
713 switch (hw
->ci
->typ
) {
716 hw
->ipac
.type
= IPAC_TYPE_ISAC
| IPAC_TYPE_HSCX
;
717 hw
->isac
.mode
= hw
->cfg
.mode
;
718 hw
->isac
.a
.io
.ale
= (u32
)hw
->cfg
.start
+ DIVA_ISAC_ALE
;
719 hw
->isac
.a
.io
.port
= (u32
)hw
->cfg
.start
+ DIVA_ISAC_PORT
;
720 hw
->hscx
.mode
= hw
->cfg
.mode
;
721 hw
->hscx
.a
.io
.ale
= (u32
)hw
->cfg
.start
+ DIVA_HSCX_ALE
;
722 hw
->hscx
.a
.io
.port
= (u32
)hw
->cfg
.start
+ DIVA_HSCX_PORT
;
725 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
726 hw
->ipac
.isac
.off
= 0x80;
727 hw
->isac
.mode
= hw
->addr
.mode
;
728 hw
->isac
.a
.p
= hw
->addr
.p
;
729 hw
->hscx
.mode
= hw
->addr
.mode
;
730 hw
->hscx
.a
.p
= hw
->addr
.p
;
733 hw
->ipac
.type
= IPAC_TYPE_IPACX
;
734 hw
->isac
.mode
= hw
->addr
.mode
;
735 hw
->isac
.a
.p
= hw
->addr
.p
;
736 hw
->hscx
.mode
= hw
->addr
.mode
;
737 hw
->hscx
.a
.p
= hw
->addr
.p
;
741 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
742 hw
->ipac
.isac
.off
= 0x80;
743 hw
->isac
.mode
= hw
->cfg
.mode
;
744 hw
->isac
.a
.io
.ale
= (u32
)hw
->cfg
.start
+ TIGER_IPAC_ALE
;
745 hw
->isac
.a
.io
.port
= (u32
)hw
->cfg
.start
+ TIGER_IPAC_PORT
;
746 hw
->hscx
.mode
= hw
->cfg
.mode
;
747 hw
->hscx
.a
.io
.ale
= (u32
)hw
->cfg
.start
+ TIGER_IPAC_ALE
;
748 hw
->hscx
.a
.io
.port
= (u32
)hw
->cfg
.start
+ TIGER_IPAC_PORT
;
749 outb(0xff, (ulong
)hw
->cfg
.start
);
751 outb(0x00, (ulong
)hw
->cfg
.start
);
753 outb(TIGER_IOMASK
, (ulong
)hw
->cfg
.start
+ TIGER_AUX_CTRL
);
757 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
758 hw
->ipac
.isac
.off
= 0x80;
759 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
;
760 hw
->isac
.a
.io
.port
= (u32
)hw
->addr
.start
+ 1;
761 hw
->isac
.mode
= hw
->addr
.mode
;
762 hw
->hscx
.a
.io
.ale
= (u32
)hw
->addr
.start
;
763 hw
->hscx
.a
.io
.port
= (u32
)hw
->addr
.start
+ 1;
764 hw
->hscx
.mode
= hw
->addr
.mode
;
767 hw
->ipac
.type
= IPAC_TYPE_ISAC
| IPAC_TYPE_HSCX
;
768 hw
->isac
.mode
= hw
->addr
.mode
;
769 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
+ NICCY_ISAC_ALE
;
770 hw
->isac
.a
.io
.port
= (u32
)hw
->addr
.start
+ NICCY_ISAC_PORT
;
771 hw
->hscx
.mode
= hw
->addr
.mode
;
772 hw
->hscx
.a
.io
.ale
= (u32
)hw
->addr
.start
+ NICCY_HSCX_ALE
;
773 hw
->hscx
.a
.io
.port
= (u32
)hw
->addr
.start
+ NICCY_HSCX_PORT
;
776 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
777 hw
->ipac
.isac
.off
= 0x80;
778 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
;
779 hw
->isac
.a
.io
.port
= hw
->isac
.a
.io
.ale
+ 4;
780 hw
->isac
.mode
= hw
->addr
.mode
;
781 hw
->hscx
.a
.io
.ale
= hw
->isac
.a
.io
.ale
;
782 hw
->hscx
.a
.io
.port
= hw
->isac
.a
.io
.port
;
783 hw
->hscx
.mode
= hw
->addr
.mode
;
786 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
787 hw
->ipac
.isac
.off
= 0x80;
788 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
+ 0x08;
789 hw
->isac
.a
.io
.port
= hw
->isac
.a
.io
.ale
+ 4;
790 hw
->isac
.mode
= hw
->addr
.mode
;
791 hw
->hscx
.a
.io
.ale
= hw
->isac
.a
.io
.ale
;
792 hw
->hscx
.a
.io
.port
= hw
->isac
.a
.io
.port
;
793 hw
->hscx
.mode
= hw
->addr
.mode
;
796 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
797 hw
->ipac
.isac
.off
= 0x80;
798 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
+ 0x10;
799 hw
->isac
.a
.io
.port
= hw
->isac
.a
.io
.ale
+ 4;
800 hw
->isac
.mode
= hw
->addr
.mode
;
801 hw
->hscx
.a
.io
.ale
= hw
->isac
.a
.io
.ale
;
802 hw
->hscx
.a
.io
.port
= hw
->isac
.a
.io
.port
;
803 hw
->hscx
.mode
= hw
->addr
.mode
;
806 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
807 hw
->ipac
.isac
.off
= 0x80;
808 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
+ 0x20;
809 hw
->isac
.a
.io
.port
= hw
->isac
.a
.io
.ale
+ 4;
810 hw
->isac
.mode
= hw
->addr
.mode
;
811 hw
->hscx
.a
.io
.ale
= hw
->isac
.a
.io
.ale
;
812 hw
->hscx
.a
.io
.port
= hw
->isac
.a
.io
.port
;
813 hw
->hscx
.mode
= hw
->addr
.mode
;
816 hw
->ipac
.type
= IPAC_TYPE_ISAC
| IPAC_TYPE_HSCX
;
817 hw
->ipac
.isac
.off
= 0x80;
818 hw
->isac
.mode
= hw
->addr
.mode
;
819 hw
->isac
.a
.io
.port
= (u32
)hw
->addr
.start
;
820 hw
->hscx
.mode
= hw
->addr
.mode
;
821 hw
->hscx
.a
.io
.port
= hw
->isac
.a
.io
.port
;
824 hw
->ipac
.type
= IPAC_TYPE_IPAC
;
825 hw
->ipac
.isac
.off
= 0x80;
826 hw
->isac
.mode
= hw
->addr
.mode
;
827 hw
->isac
.a
.io
.ale
= (u32
)hw
->addr
.start
;
828 hw
->isac
.a
.io
.port
= (u32
)hw
->addr
.start
+ GAZEL_IPAC_DATA_PORT
;
829 hw
->hscx
.mode
= hw
->addr
.mode
;
830 hw
->hscx
.a
.io
.ale
= hw
->isac
.a
.io
.ale
;
831 hw
->hscx
.a
.io
.port
= hw
->isac
.a
.io
.port
;
836 switch (hw
->isac
.mode
) {
838 ASSIGN_FUNC_IPAC(MIO
, hw
->ipac
);
841 ASSIGN_FUNC_IPAC(IND
, hw
->ipac
);
844 ASSIGN_FUNC_IPAC(IO
, hw
->ipac
);
853 release_card(struct inf_hw
*card
) {
857 spin_lock_irqsave(&card
->lock
, flags
);
859 spin_unlock_irqrestore(&card
->lock
, flags
);
860 card
->ipac
.isac
.release(&card
->ipac
.isac
);
861 free_irq(card
->irq
, card
);
862 mISDN_unregister_device(&card
->ipac
.isac
.dch
.dev
);
864 write_lock_irqsave(&card_lock
, flags
);
865 list_del(&card
->list
);
866 write_unlock_irqrestore(&card_lock
, flags
);
867 switch (card
->ci
->typ
) {
873 for (i
= 0; i
< 3; i
++) {
875 release_card(card
->sc
[i
]);
880 pci_disable_device(card
->pdev
);
881 pci_set_drvdata(card
->pdev
, NULL
);
889 setup_instance(struct inf_hw
*card
)
894 snprintf(card
->name
, MISDN_MAX_IDLEN
- 1, "%s.%d", card
->ci
->name
,
896 write_lock_irqsave(&card_lock
, flags
);
897 list_add_tail(&card
->list
, &Cards
);
898 write_unlock_irqrestore(&card_lock
, flags
);
901 card
->ipac
.isac
.name
= card
->name
;
902 card
->ipac
.name
= card
->name
;
903 card
->ipac
.owner
= THIS_MODULE
;
904 spin_lock_init(&card
->lock
);
905 card
->ipac
.isac
.hwlock
= &card
->lock
;
906 card
->ipac
.hwlock
= &card
->lock
;
907 card
->ipac
.ctrl
= (void *)&inf_ctrl
;
909 err
= setup_io(card
);
913 card
->ipac
.isac
.dch
.dev
.Bprotocols
=
914 mISDNipac_init(&card
->ipac
, card
);
916 if (card
->ipac
.isac
.dch
.dev
.Bprotocols
== 0)
919 err
= mISDN_register_device(&card
->ipac
.isac
.dch
.dev
,
920 &card
->pdev
->dev
, card
->name
);
924 err
= init_irq(card
);
927 pr_notice("Infineon %d cards installed\n", inf_cnt
);
930 mISDN_unregister_device(&card
->ipac
.isac
.dch
.dev
);
932 card
->ipac
.release(&card
->ipac
);
935 write_lock_irqsave(&card_lock
, flags
);
936 list_del(&card
->list
);
937 write_unlock_irqrestore(&card_lock
, flags
);
941 static const struct inf_cinfo inf_card_info
[] = {
946 AM_IND_IO
, AM_NONE
, 2, 0,
951 "Dialogic Diva 2.0U",
953 AM_IND_IO
, AM_NONE
, 2, 0,
958 "Dialogic Diva 2.01",
960 AM_MEMIO
, AM_MEMIO
, 0, 1,
965 "Dialogic Diva 2.02",
967 AM_MEMIO
, AM_MEMIO
, 0, 1,
972 "Sedlbauer SpeedWin PCI",
974 AM_IND_IO
, AM_NONE
, 0, 0,
981 AM_IND_IO
, AM_NONE
, 0, 0,
986 "Develo Microlink PCI",
988 AM_IO
, AM_IND_IO
, 1, 3,
993 "Develo QuickStep 3000",
995 AM_IO
, AM_IND_IO
, 1, 3,
1002 AM_IO
, AM_IND_IO
, 0, 1,
1009 AM_IO
, AM_IND_IO
, 1, 5,
1016 AM_NONE
, AM_IND_IO
, 0, 4,
1023 AM_NONE
, AM_IND_IO
, 0, 3,
1030 AM_NONE
, AM_IND_IO
, 0, 2,
1044 AM_IO
, AM_IND_IO
, 1, 2,
1052 static const struct inf_cinfo
*
1053 get_card_info(enum inf_types typ
)
1055 const struct inf_cinfo
*ci
= inf_card_info
;
1057 while (ci
->typ
!= INF_NONE
) {
1066 inf_probe(struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
1069 struct inf_hw
*card
;
1071 card
= kzalloc(sizeof(struct inf_hw
), GFP_KERNEL
);
1073 pr_info("No memory for Infineon ISDN card\n");
1077 err
= pci_enable_device(pdev
);
1082 card
->ci
= get_card_info(ent
->driver_data
);
1084 pr_info("mISDN: do not have information about adapter at %s\n",
1087 pci_disable_device(pdev
);
1090 pr_notice("mISDN: found adapter %s at %s\n",
1091 card
->ci
->full
, pci_name(pdev
));
1093 card
->irq
= pdev
->irq
;
1094 pci_set_drvdata(pdev
, card
);
1095 err
= setup_instance(card
);
1097 pci_disable_device(pdev
);
1099 pci_set_drvdata(pdev
, NULL
);
1100 } else if (ent
->driver_data
== INF_SCT_1
) {
1104 for (i
= 1; i
< 4; i
++) {
1105 sc
= kzalloc(sizeof(struct inf_hw
), GFP_KERNEL
);
1108 pci_disable_device(pdev
);
1111 sc
->irq
= card
->irq
;
1112 sc
->pdev
= card
->pdev
;
1113 sc
->ci
= card
->ci
+ i
;
1114 err
= setup_instance(sc
);
1116 pci_disable_device(pdev
);
1121 card
->sc
[i
- 1] = sc
;
1128 inf_remove(struct pci_dev
*pdev
)
1130 struct inf_hw
*card
= pci_get_drvdata(pdev
);
1135 pr_debug("%s: drvdata already removed\n", __func__
);
1138 static struct pci_driver infineon_driver
= {
1139 .name
= "ISDN Infineon pci",
1141 .remove
= inf_remove
,
1142 .id_table
= infineon_ids
,
1150 pr_notice("Infineon ISDN Driver Rev. %s\n", INFINEON_REV
);
1151 err
= pci_register_driver(&infineon_driver
);
1156 infineon_cleanup(void)
1158 pci_unregister_driver(&infineon_driver
);
1161 module_init(infineon_init
);
1162 module_exit(infineon_cleanup
);