26 #include <linux/module.h>
27 #include <linux/slab.h>
28 #include <linux/pci.h>
35 #define SPEEDFAX_REV "2.0"
37 #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID 0x51
38 #define PCI_SUBVENDOR_SPEEDFAX_PCI 0x54
39 #define PCI_SUB_ID_SEDLBAUER 0x01
41 #define SFAX_PCI_ADDR 0xc8
42 #define SFAX_PCI_ISAC 0xd0
43 #define SFAX_PCI_ISAR 0xe0
47 #define TIGER_RESET_ADDR 0x00
48 #define TIGER_EXTERN_RESET_ON 0x01
49 #define TIGER_EXTERN_RESET_OFF 0x00
50 #define TIGER_AUX_CTRL 0x02
51 #define TIGER_AUX_DATA 0x03
52 #define TIGER_AUX_IRQMASK 0x05
53 #define TIGER_AUX_STATUS 0x07
56 #define SFAX_AUX_IOMASK 0xdd
57 #define SFAX_ISAR_RESET_BIT_OFF 0x00
58 #define SFAX_ISAR_RESET_BIT_ON 0x01
59 #define SFAX_TIGER_IRQ_BIT 0x02
60 #define SFAX_LED1_BIT 0x08
61 #define SFAX_LED2_BIT 0x10
63 #define SFAX_PCI_RESET_ON (SFAX_ISAR_RESET_BIT_ON)
64 #define SFAX_PCI_RESET_OFF (SFAX_LED1_BIT | SFAX_LED2_BIT)
68 static u32 irqloops = 4;
125 speedfax_irq(
int intno,
void *
dev_id)
131 spin_lock(&sf->
lock);
134 spin_unlock(&sf->
lock);
146 if ((val & ISAR_IRQSTA) && cnt--)
151 if (irqloops && !cnt)
154 spin_unlock(&sf->
lock);
159 enable_hwirq(
struct sfax_hw *sf)
167 disable_hwirq(
struct sfax_hw *sf)
175 reset_speedfax(
struct sfax_hw *sf)
212 pr_info(
"%s: %s unknown command %x %lx\n",
213 sf->
name, __func__, cmd, arg);
249 sfax_dctrl(
struct mISDNchannel *ch,
u32 cmd,
void *arg)
253 struct sfax_hw *sf = dch->
hw;
254 struct channel_req *
rq;
272 dch->
dev.id, __builtin_return_address(0));
276 err = channel_ctrl(sf, arg);
286 init_card(
struct sfax_hw *sf)
300 spin_unlock_irqrestore(&sf->
lock, flags);
301 pr_info(
"%s: ISAC init failed with %d\n",
308 spin_unlock_irqrestore(&sf->
lock, flags);
314 pr_info(
"%s: IRQ(%d) got no requests during init %d\n",
325 setup_speedfax(
struct sfax_hw *sf)
330 pr_info(
"mISDN: %s config port %x-%x already in use\n",
349 spin_unlock_irqrestore(&sf->
lock, flags);
354 release_card(
struct sfax_hw *card) {
359 spin_unlock_irqrestore(&card->
lock, flags);
375 setup_instance(
struct sfax_hw *card)
389 card->
isar.ctrl = (
void *)&sfax_ctrl;
396 pr_info(
"%s: firmware request failed %d\n",
401 pr_notice(
"%s: got firmware %zu bytes\n",
406 card->
isac.dch.dev.D.ctrl = sfax_dctrl;
407 card->
isac.dch.dev.Bprotocols =
409 for (i = 0; i < 2; i++) {
410 set_channelmap(i + 1, card->
isac.dch.dev.channelmap);
411 list_add(&card->
isar.ch[i].bch.ch.list,
412 &card->
isac.dch.dev.bchannels);
415 err = setup_speedfax(card);
425 err = init_card(card);
432 pr_notice(
"SpeedFax %d cards installed\n", sfax_cnt);
458 struct sfax_hw *card = kzalloc(
sizeof(
struct sfax_hw),
GFP_KERNEL);
461 pr_info(
"No memory for Speedfax+ PCI\n");
471 pr_notice(
"mISDN: Speedfax found adapter %s at %s\n",
476 pci_set_drvdata(pdev, card);
477 err = setup_instance(card);
479 pci_set_drvdata(pdev,
NULL);
484 sfax_remove_pci(
struct pci_dev *pdev)
486 struct sfax_hw *card = pci_get_drvdata(pdev);
491 pr_debug(
"%s: drvdata already removed\n", __func__);
497 0, 0, (
unsigned long)
"Pyramid Speedfax + PCI"
501 0, 0, (
unsigned long)
"Sedlbauer Speedfax + PCI"
508 .name =
"speedfax+ pci",
509 .probe = sfaxpci_probe,
511 .id_table = sfaxpci_ids,
519 pr_notice(
"Sedlbauer Speedfax+ Driver Rev. %s\n",
521 err = pci_register_driver(&sfaxpci_driver);
526 Speedfax_cleanup(
void)