42 #include <linux/module.h>
43 #include <linux/pci.h>
46 #include <linux/slab.h>
49 #define INFINEON_REV "1.0"
53 static u32 irqloops = 4;
124 #define PCI_SUBVENDOR_HST_SAPHIR3 0x52
125 #define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53
126 #define PCI_SUB_ID_SEDLBAUER 0x01
154 #define DIVA_HSCX_PORT 0x00
155 #define DIVA_HSCX_ALE 0x04
156 #define DIVA_ISAC_PORT 0x08
157 #define DIVA_ISAC_ALE 0x0C
158 #define DIVA_PCI_CTRL 0x10
161 #define DIVA_IRQ_BIT 0x01
162 #define DIVA_RESET_BIT 0x08
163 #define DIVA_EEPROM_CLK 0x40
164 #define DIVA_LED_A 0x10
165 #define DIVA_LED_B 0x20
166 #define DIVA_IRQ_CLR 0x80
170 #define PITA_ICR_REG 0x00
171 #define PITA_INT0_STATUS 0x02
173 #define PITA_MISC_REG 0x1c
174 #define PITA_PARA_SOFTRESET 0x01000000
175 #define PITA_SER_SOFTRESET 0x02000000
176 #define PITA_PARA_MPX_MODE 0x04000000
177 #define PITA_INT0_ENABLE 0x00020000
180 #define TIGER_RESET_ADDR 0x00
181 #define TIGER_EXTERN_RESET 0x01
182 #define TIGER_AUX_CTRL 0x02
183 #define TIGER_AUX_DATA 0x03
184 #define TIGER_AUX_IRQMASK 0x05
185 #define TIGER_AUX_STATUS 0x07
188 #define TIGER_IOMASK 0xdd
189 #define TIGER_IRQ_BIT 0x02
191 #define TIGER_IPAC_ALE 0xC0
192 #define TIGER_IPAC_PORT 0xC8
195 #define ELSA_IRQ_ADDR 0x4c
196 #define ELSA_IRQ_MASK 0x04
197 #define QS1000_IRQ_OFF 0x01
198 #define QS3000_IRQ_OFF 0x03
199 #define QS1000_IRQ_ON 0x41
200 #define QS3000_IRQ_ON 0x43
203 #define NICCY_ISAC_PORT 0x00
204 #define NICCY_HSCX_PORT 0x01
205 #define NICCY_ISAC_ALE 0x02
206 #define NICCY_HSCX_ALE 0x03
208 #define NICCY_IRQ_CTRL_REG 0x38
209 #define NICCY_IRQ_ENABLE 0x001f00
210 #define NICCY_IRQ_DISABLE 0xff0000
211 #define NICCY_IRQ_BIT 0x800000
215 #define SCT_PLX_IRQ_ADDR 0x4c
216 #define SCT_PLX_RESET_ADDR 0x50
217 #define SCT_PLX_IRQ_ENABLE 0x41
218 #define SCT_PLX_RESET_BIT 0x04
221 #define GAZEL_IPAC_DATA_PORT 0x04
223 #define GAZEL_CNTRL 0x50
224 #define GAZEL_RESET 0x04
225 #define GAZEL_RESET_9050 0x40000000
226 #define GAZEL_INCSR 0x4C
227 #define GAZEL_ISAC_EN 0x08
228 #define GAZEL_INT_ISAC 0x20
229 #define GAZEL_HSCX_EN 0x01
230 #define GAZEL_INT_HSCX 0x04
231 #define GAZEL_PCI_EN 0x40
232 #define GAZEL_IPAC_EN 0x03
280 diva_irq(
int intno,
void *
dev_id)
285 spin_lock(&hw->
lock);
288 spin_unlock(&hw->
lock);
293 spin_unlock(&hw->
lock);
298 diva20x_irq(
int intno,
void *dev_id)
300 struct inf_hw *hw =
dev_id;
303 spin_lock(&hw->
lock);
306 spin_unlock(&hw->
lock);
312 spin_unlock(&hw->
lock);
317 tiger_irq(
int intno,
void *dev_id)
319 struct inf_hw *hw =
dev_id;
322 spin_lock(&hw->
lock);
325 spin_unlock(&hw->
lock);
330 spin_unlock(&hw->
lock);
335 elsa_irq(
int intno,
void *dev_id)
337 struct inf_hw *hw =
dev_id;
340 spin_lock(&hw->
lock);
343 spin_unlock(&hw->
lock);
348 spin_unlock(&hw->
lock);
353 niccy_irq(
int intno,
void *dev_id)
355 struct inf_hw *hw =
dev_id;
358 spin_lock(&hw->
lock);
361 spin_unlock(&hw->
lock);
367 spin_unlock(&hw->
lock);
372 gazel_irq(
int intno,
void *dev_id)
374 struct inf_hw *hw =
dev_id;
377 spin_lock(&hw->
lock);
379 spin_unlock(&hw->
lock);
384 ipac_irq(
int intno,
void *dev_id)
386 struct inf_hw *hw =
dev_id;
389 spin_lock(&hw->
lock);
392 spin_unlock(&hw->
lock);
397 spin_unlock(&hw->
lock);
402 enable_hwirq(
struct inf_hw *hw)
407 switch (hw->
ci->typ) {
446 disable_hwirq(
struct inf_hw *hw)
451 switch (hw->
ci->typ) {
486 ipac_chip_reset(
struct inf_hw *hw)
497 reset_inf(
struct inf_hw *hw)
504 switch (hw->
ci->typ) {
512 outb(9, (u32)hw->
cfg.start + 0x69);
565 hw->
ipac.isac.adf2 = 0x87;
566 hw->
ipac.hscx[0].slot = 0x1f;
567 hw->
ipac.hscx[1].slot = 0x23;
580 hw->
ipac.conf = 0x01;
598 pr_info(
"%s: %s unknown command %x %lx\n",
599 hw->
name, __func__, cmd, arg);
612 if (!hw->
ci->irqfunc)
624 spin_unlock_irqrestore(&hw->
lock, flags);
625 pr_info(
"%s: ISAC init failed with %d\n",
629 spin_unlock_irqrestore(&hw->
lock, flags);
631 if (debug & DEBUG_HW)
635 pr_info(
"%s: IRQ(%d) got no requests during init %d\n",
645 release_io(
struct inf_hw *hw)
666 setup_io(
struct inf_hw *hw)
670 if (hw->
ci->cfg_mode) {
683 pr_info(
"mISDN: %s config port %lx (%lu bytes)"
684 "already in use\n", hw->
name,
690 hw->
cfg.mode = hw->
ci->cfg_mode;
691 if (debug & DEBUG_HW)
692 pr_notice(
"%s: IO cfg %lx (%lu bytes) mode%d\n",
697 if (hw->
ci->addr_mode) {
710 pr_info(
"mISDN: %s address port %lx (%lu bytes)"
711 "already in use\n", hw->
name,
717 hw->
addr.mode = hw->
ci->addr_mode;
718 if (debug & DEBUG_HW)
719 pr_notice(
"%s: IO addr %lx (%lu bytes) mode%d\n",
725 switch (hw->
ci->typ) {
738 hw->
ipac.isac.off = 0x80;
754 hw->
ipac.isac.off = 0x80;
770 hw->
ipac.isac.off = 0x80;
772 hw->
isac.a.io.port = (u32)hw->
addr.start + 1;
775 hw->
hscx.a.io.port = (u32)hw->
addr.start + 1;
789 hw->
ipac.isac.off = 0x80;
791 hw->
isac.a.io.port = hw->
isac.a.io.ale + 4;
793 hw->
hscx.a.io.ale = hw->
isac.a.io.ale;
794 hw->
hscx.a.io.port = hw->
isac.a.io.port;
799 hw->
ipac.isac.off = 0x80;
800 hw->
isac.a.io.ale = (u32)hw->
addr.start + 0x08;
801 hw->
isac.a.io.port = hw->
isac.a.io.ale + 4;
803 hw->
hscx.a.io.ale = hw->
isac.a.io.ale;
804 hw->
hscx.a.io.port = hw->
isac.a.io.port;
809 hw->
ipac.isac.off = 0x80;
811 hw->
isac.a.io.port = hw->
isac.a.io.ale + 4;
813 hw->
hscx.a.io.ale = hw->
isac.a.io.ale;
814 hw->
hscx.a.io.port = hw->
isac.a.io.port;
819 hw->
ipac.isac.off = 0x80;
820 hw->
isac.a.io.ale = (u32)hw->
addr.start + 0x20;
821 hw->
isac.a.io.port = hw->
isac.a.io.ale + 4;
823 hw->
hscx.a.io.ale = hw->
isac.a.io.ale;
824 hw->
hscx.a.io.port = hw->
isac.a.io.port;
829 hw->
ipac.isac.off = 0x80;
833 hw->
hscx.a.io.port = hw->
isac.a.io.port;
837 hw->
ipac.isac.off = 0x80;
839 hw->
isac.a.io.ale = (u32)hw->
addr.start;
842 hw->
hscx.a.io.ale = hw->
isac.a.io.ale;
843 hw->
hscx.a.io.port = hw->
isac.a.io.port;
848 switch (hw->
isac.mode) {
865 release_card(
struct inf_hw *card) {
871 spin_unlock_irqrestore(&card->
lock, flags);
872 card->
ipac.isac.release(&card->
ipac.isac);
879 switch (card->
ci->typ) {
885 for (i = 0; i < 3; i++) {
887 release_card(card->
sc[i]);
900 setup_instance(
struct inf_hw *card)
916 card->
ipac.isac.hwlock = &card->
lock;
918 card->
ipac.ctrl = (
void *)&inf_ctrl;
920 err = setup_io(card);
924 card->
ipac.isac.dch.dev.Bprotocols =
927 if (card->
ipac.isac.dch.dev.Bprotocols == 0)
938 pr_notice(
"Infineon %d cards installed\n", inf_cnt);
952 static const struct inf_cinfo inf_card_info[] = {
962 "Dialogic Diva 2.0U",
969 "Dialogic Diva 2.01",
976 "Dialogic Diva 2.02",
983 "Sedlbauer SpeedWin PCI",
997 "Develo Microlink PCI",
1004 "Develo QuickStep 3000",
1066 const struct inf_cinfo *ci = inf_card_info;
1080 struct inf_hw *
card;
1082 card = kzalloc(
sizeof(
struct inf_hw),
GFP_KERNEL);
1084 pr_info(
"No memory for Infineon ISDN card\n");
1095 pr_info(
"mISDN: do not have informations about adapter at %s\n",
1101 pr_notice(
"mISDN: found adapter %s at %s\n",
1102 card->
ci->full, pci_name(pdev));
1105 pci_set_drvdata(pdev, card);
1106 err = setup_instance(card);
1110 pci_set_drvdata(pdev,
NULL);
1115 for (i = 1; i < 4; i++) {
1116 sc = kzalloc(
sizeof(
struct inf_hw),
GFP_KERNEL);
1124 sc->
ci = card->
ci +
i;
1125 err = setup_instance(sc);
1132 card->
sc[i - 1] =
sc;
1139 inf_remove(
struct pci_dev *pdev)
1141 struct inf_hw *card = pci_get_drvdata(pdev);
1146 pr_debug(
"%s: drvdata already removed\n", __func__);
1150 .name =
"ISDN Infineon pci",
1153 .id_table = infineon_ids,
1161 pr_notice(
"Infineon ISDN Driver Rev. %s\n", INFINEON_REV);
1162 err = pci_register_driver(&infineon_driver);
1167 infineon_cleanup(
void)