Lines Matching +full:cmd +full:- +full:cnt +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
60 char name[MISDN_MAX_IDLEN]; member
78 card->isac.dch.debug = debug; in _set_debug()
79 card->isar.ch[0].bch.debug = debug; in _set_debug()
80 card->isar.ch[1].bch.debug = debug; in _set_debug()
117 int cnt = irqloops; in IOFUNC_IND() local
119 spin_lock(&sf->lock); in IOFUNC_IND()
120 val = inb(sf->cfg + TIGER_AUX_STATUS); in IOFUNC_IND()
122 spin_unlock(&sf->lock); in IOFUNC_IND()
125 sf->irqcnt++; in IOFUNC_IND()
129 mISDNisar_irq(&sf->isar); in IOFUNC_IND()
132 mISDNisac_irq(&sf->isac, val); in IOFUNC_IND()
134 if ((val & ISAR_IRQSTA) && cnt--) in IOFUNC_IND()
136 if (cnt < irqloops) in IOFUNC_IND()
137 pr_debug("%s: %d irqloops cpu%d\n", sf->name, in IOFUNC_IND()
138 irqloops - cnt, smp_processor_id()); in IOFUNC_IND()
139 if (irqloops && !cnt) in IOFUNC_IND()
140 pr_notice("%s: %d IRQ LOOP cpu%d\n", sf->name, in IOFUNC_IND()
142 spin_unlock(&sf->lock); in IOFUNC_IND()
151 outb(SFAX_TIGER_IRQ_BIT, sf->cfg + TIGER_AUX_IRQMASK); in enable_hwirq()
159 outb(0, sf->cfg + TIGER_AUX_IRQMASK); in disable_hwirq()
166 pr_debug("%s: resetting card\n", sf->name); in reset_speedfax()
167 outb(TIGER_EXTERN_RESET_ON, sf->cfg + TIGER_RESET_ADDR); in reset_speedfax()
168 outb(SFAX_PCI_RESET_ON, sf->cfg + TIGER_AUX_DATA); in reset_speedfax()
170 outb(TIGER_EXTERN_RESET_OFF, sf->cfg + TIGER_RESET_ADDR); in reset_speedfax()
171 sf->aux_data = SFAX_PCI_RESET_OFF; in reset_speedfax()
172 outb(sf->aux_data, sf->cfg + TIGER_AUX_DATA); in reset_speedfax()
177 sfax_ctrl(struct sfax_hw *sf, u32 cmd, u_long arg) in sfax_ctrl() argument
181 switch (cmd) { in sfax_ctrl()
187 sf->aux_data &= ~SFAX_LED1_BIT; in sfax_ctrl()
189 sf->aux_data &= ~SFAX_LED2_BIT; in sfax_ctrl()
190 outb(sf->aux_data, sf->cfg + TIGER_AUX_DATA); in sfax_ctrl()
194 sf->aux_data |= SFAX_LED1_BIT; in sfax_ctrl()
196 sf->aux_data |= SFAX_LED2_BIT; in sfax_ctrl()
197 outb(sf->aux_data, sf->cfg + TIGER_AUX_DATA); in sfax_ctrl()
201 sf->name, __func__, cmd, arg); in sfax_ctrl()
202 ret = -EINVAL; in sfax_ctrl()
213 switch (cq->op) { in channel_ctrl()
215 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_L1_TIMER3; in channel_ctrl()
218 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */ in channel_ctrl()
219 if (cq->channel < 0 || cq->channel > 3) { in channel_ctrl()
220 ret = -EINVAL; in channel_ctrl()
223 ret = sf->isac.ctrl(&sf->isac, HW_TESTLOOP, cq->channel); in channel_ctrl()
226 ret = sf->isac.ctrl(&sf->isac, HW_TIMER3_VALUE, cq->p1); in channel_ctrl()
229 pr_info("%s: unknown Op %x\n", sf->name, cq->op); in channel_ctrl()
230 ret = -EINVAL; in channel_ctrl()
237 sfax_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg) in sfax_dctrl() argument
241 struct sfax_hw *sf = dch->hw; in sfax_dctrl()
245 pr_debug("%s: cmd:%x %p\n", sf->name, cmd, arg); in sfax_dctrl()
246 switch (cmd) { in sfax_dctrl()
249 if (rq->protocol == ISDN_P_TE_S0) in sfax_dctrl()
250 err = sf->isac.open(&sf->isac, rq); in sfax_dctrl()
252 err = sf->isar.open(&sf->isar, rq); in sfax_dctrl()
256 pr_info("%s: cannot get module\n", sf->name); in sfax_dctrl()
259 pr_debug("%s: dev(%d) close from %p\n", sf->name, in sfax_dctrl()
260 dch->dev.id, __builtin_return_address(0)); in sfax_dctrl()
267 pr_debug("%s: unknown command %x\n", sf->name, cmd); in sfax_dctrl()
268 return -EINVAL; in sfax_dctrl()
276 int ret, cnt = 3; in init_card() local
279 ret = request_irq(sf->irq, speedfax_irq, IRQF_SHARED, sf->name, sf); in init_card()
281 pr_info("%s: couldn't get interrupt %d\n", sf->name, sf->irq); in init_card()
284 while (cnt--) { in init_card()
285 spin_lock_irqsave(&sf->lock, flags); in init_card()
286 ret = sf->isac.init(&sf->isac); in init_card()
288 spin_unlock_irqrestore(&sf->lock, flags); in init_card()
290 sf->name, ret); in init_card()
296 spin_unlock_irqrestore(&sf->lock, flags); in init_card()
299 pr_notice("%s: IRQ %d count %d\n", sf->name, in init_card()
300 sf->irq, sf->irqcnt); in init_card()
301 if (!sf->irqcnt) { in init_card()
303 sf->name, sf->irq, 3 - cnt); in init_card()
307 free_irq(sf->irq, sf); in init_card()
308 return -EIO; in init_card()
317 if (!request_region(sf->cfg, 256, sf->name)) { in setup_speedfax()
318 pr_info("mISDN: %s config port %x-%x already in use\n", in setup_speedfax()
319 sf->name, sf->cfg, sf->cfg + 255); in setup_speedfax()
320 return -EIO; in setup_speedfax()
322 outb(0xff, sf->cfg); in setup_speedfax()
323 outb(0, sf->cfg); in setup_speedfax()
324 outb(0xdd, sf->cfg + TIGER_AUX_CTRL); in setup_speedfax()
325 outb(0, sf->cfg + TIGER_AUX_IRQMASK); in setup_speedfax()
327 sf->isac.type = IPAC_TYPE_ISAC; in setup_speedfax()
328 sf->p_isac.ale = sf->cfg + SFAX_PCI_ADDR; in setup_speedfax()
329 sf->p_isac.port = sf->cfg + SFAX_PCI_ISAC; in setup_speedfax()
330 sf->p_isar.ale = sf->cfg + SFAX_PCI_ADDR; in setup_speedfax()
331 sf->p_isar.port = sf->cfg + SFAX_PCI_ISAR; in setup_speedfax()
332 ASSIGN_FUNC(IND, ISAC, sf->isac); in setup_speedfax()
333 ASSIGN_FUNC(IND, ISAR, sf->isar); in setup_speedfax()
334 spin_lock_irqsave(&sf->lock, flags); in setup_speedfax()
337 spin_unlock_irqrestore(&sf->lock, flags); in setup_speedfax()
345 spin_lock_irqsave(&card->lock, flags); in release_card()
347 spin_unlock_irqrestore(&card->lock, flags); in release_card()
348 card->isac.release(&card->isac); in release_card()
349 free_irq(card->irq, card); in release_card()
350 card->isar.release(&card->isar); in release_card()
351 mISDN_unregister_device(&card->isac.dch.dev); in release_card()
352 release_region(card->cfg, 256); in release_card()
353 pci_disable_device(card->pdev); in release_card()
354 pci_set_drvdata(card->pdev, NULL); in release_card()
356 list_del(&card->list); in release_card()
359 sfax_cnt--; in release_card()
369 snprintf(card->name, MISDN_MAX_IDLEN - 1, "Speedfax.%d", sfax_cnt + 1); in setup_instance()
371 list_add_tail(&card->list, &Cards); in setup_instance()
374 spin_lock_init(&card->lock); in setup_instance()
375 card->isac.hwlock = &card->lock; in setup_instance()
376 card->isar.hwlock = &card->lock; in setup_instance()
377 card->isar.ctrl = (void *)&sfax_ctrl; in setup_instance()
378 card->isac.name = card->name; in setup_instance()
379 card->isar.name = card->name; in setup_instance()
380 card->isar.owner = THIS_MODULE; in setup_instance()
382 err = request_firmware(&firmware, "isdn/ISAR.BIN", &card->pdev->dev); in setup_instance()
385 card->name, err); in setup_instance()
390 card->name, firmware->size); in setup_instance()
392 mISDNisac_init(&card->isac, card); in setup_instance()
394 card->isac.dch.dev.D.ctrl = sfax_dctrl; in setup_instance()
395 card->isac.dch.dev.Bprotocols = in setup_instance()
396 mISDNisar_init(&card->isar, card); in setup_instance()
398 set_channelmap(i + 1, card->isac.dch.dev.channelmap); in setup_instance()
399 list_add(&card->isar.ch[i].bch.ch.list, in setup_instance()
400 &card->isac.dch.dev.bchannels); in setup_instance()
406 err = card->isar.init(&card->isar); in setup_instance()
409 err = mISDN_register_device(&card->isac.dch.dev, in setup_instance()
410 &card->pdev->dev, card->name); in setup_instance()
416 err = card->isar.firmware(&card->isar, firmware->data, firmware->size); in setup_instance()
424 free_irq(card->irq, card); in setup_instance()
426 mISDN_unregister_device(&card->isac.dch.dev); in setup_instance()
428 release_region(card->cfg, 256); in setup_instance()
430 card->isac.release(&card->isac); in setup_instance()
431 card->isar.release(&card->isar); in setup_instance()
434 pci_disable_device(card->pdev); in setup_instance()
436 list_del(&card->list); in setup_instance()
445 int err = -ENOMEM; in sfaxpci_probe()
452 card->pdev = pdev; in sfaxpci_probe()
460 (char *)ent->driver_data, pci_name(pdev)); in sfaxpci_probe()
462 card->cfg = pci_resource_start(pdev, 0); in sfaxpci_probe()
463 card->irq = pdev->irq; in sfaxpci_probe()
496 .name = "speedfax+ pci",