Exemplo n.º 1
0
static int __devinit
setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
{
	struct IsdnCardState *cs = card->cs;
	struct pnp_dev *pnp_d;

	if (!isapnp_present())
		return -1;

	while(ipid->card_vendor) {
		if ((pnp_c = pnp_find_card(ipid->card_vendor,
			ipid->card_device, pnp_c))) {
			pnp_d = NULL;
			if ((pnp_d = pnp_find_dev(pnp_c,
				ipid->vendor, ipid->function, pnp_d))) {
				int err;

				printk(KERN_INFO "HiSax: %s detected\n",
					(char *)ipid->driver_data);
				pnp_disable_dev(pnp_d);
				err = pnp_activate_dev(pnp_d);
				if (err<0) {
					printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
						__func__, err);
					return(0);
				}
				card->para[1] = pnp_port_start(pnp_d, 0);
				card->para[0] = pnp_irq(pnp_d, 0);

				if (!card->para[0] || !card->para[1]) {
					printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
						card->para[0], card->para[1]);
					pnp_disable_dev(pnp_d);
					return(0);
				}
				cs->hw.sedl.cfg_reg = card->para[1];
				cs->irq = card->para[0];
				if (ipid->function == ISAPNP_FUNCTION(0x2)) {
					cs->subtyp = SEDL_SPEED_FAX;
					cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
					*bytecnt = 16;
				} else {
					cs->subtyp = SEDL_SPEED_CARD_WIN;
					cs->hw.sedl.chip = SEDL_CHIP_TEST;
				}

				return (1);
			} else {
				printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
				return(0);
			}
		}
		ipid++;
		pnp_c = NULL;
	} 

	printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
	return -1;
}
Exemplo n.º 2
0
int __init
setup_asuscom(struct IsdnCard *card)
{
	char tmp[64];

	strcpy(tmp, Asuscom_revision);
	printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_card *pb;
		struct pnp_dev *pd;

		while(adev->card_vendor) {
			if ((pb = pnp_find_card(adev->card_vendor,
						adev->card_device,
						pnp_c))) {
				pnp_c = pb;
				pd = NULL;
				if ((pd = pnp_find_dev(pnp_c,
						       adev->vendor,
						       adev->function,
						       pd))) {
					printk(KERN_INFO "HiSax: %s detected\n",
						(char *)adev->driver_data);
					if (pnp_device_attach(pd) < 0) {
						printk(KERN_ERR "AsusPnP: attach failed\n");
						return 0;
					}
					if (pnp_activate_dev(pd) < 0) {
						printk(KERN_ERR "AsusPnP: activate failed\n");
						pnp_device_detach(pd);
						return 0;
					}
					if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) {
						printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n",
							pnp_irq(pd, 0), pnp_port_start(pd, 0));
						pnp_device_detach(pd);
						return(0);
					}
					card->para[1] = pnp_port_start(pd, 0);
					card->para[0] = pnp_irq(pd, 0);
					break;
				} else {
					printk(KERN_ERR "AsusPnP: PnP error card found, no device\n");
				}
			}
			adev++;
			pnp_c=NULL;
		} 
		if (!adev->card_vendor) {
			printk(KERN_INFO "AsusPnP: no ISAPnP card found\n");
			return(0);
		}
	}
#endif
	if (asuscom_probe(card->cs, card) < 0)
		return 0;
	return 1;
}
Exemplo n.º 3
0
static void pnpide_init(int enable)
{
	struct pci_dev *dev = NULL;
	struct pnp_dev_t *dev_type;

	if (!isapnp_present())
		return;

	/* Module unload, deactivate all registered devices. */
	if (!enable) {
		int i;
		for (i = 0; i < pnp_ide_dev_idx; i++) {
			dev = devices[i].dev;
			devices[i].dev_type->init_fn(dev, 0);
			if (dev->deactivate)
				dev->deactivate(dev);
		}
		return;
	}

	for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) {
		while ((dev = isapnp_find_dev(NULL, dev_type->vendor,
			dev_type->device, dev))) {

			if (dev->active)
				continue;

       			if (dev->prepare && dev->prepare(dev) < 0) {
				printk(KERN_ERR"ide-pnp: %s prepare failed\n", DEV_NAME(dev));
				continue;
			}

			if (dev->activate && dev->activate(dev) < 0) {
				printk(KERN_ERR"ide: %s activate failed\n", DEV_NAME(dev));
				continue;
			}

			/* Call device initialization function */
			if (dev_type->init_fn(dev, 1)) {
				if (dev->deactivate(dev))
					dev->deactivate(dev);
			} else {
#ifdef MODULE
				/*
				 * Register device in the array to
				 * deactivate it on a module unload.
				 */
				if (pnp_ide_dev_idx >= NR_PNP_DEVICES)
					return;
				devices[pnp_ide_dev_idx].dev = dev;
				devices[pnp_ide_dev_idx].dev_type = dev_type;
				pnp_ide_dev_idx++;
#endif
			}
		}
	}
}
Exemplo n.º 4
0
static int __init serial8250_pnp_init(void)
{
	if (!isapnp_present()) {
#ifdef SERIAL_DEBUG_PNP
		printk("Leaving probe_serial_pnp() (no isapnp)\n");
#endif
		return -ENODEV;
	}
	pnp_init();
	return 0;
}
Exemplo n.º 5
0
static int setup_diva_isapnp(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	struct pnp_dev *pnp_d;

	if (!isapnp_present())
		return (-1);	/* card not found; continue search */

	while (ipid->card_vendor) {
		if ((pnp_c = pnp_find_card(ipid->card_vendor,
					   ipid->card_device, pnp_c))) {
			pnp_d = NULL;
			if ((pnp_d = pnp_find_dev(pnp_c,
						  ipid->vendor, ipid->function, pnp_d))) {
				int err;

				printk(KERN_INFO "HiSax: %s detected\n",
				       (char *)ipid->driver_data);
				pnp_disable_dev(pnp_d);
				err = pnp_activate_dev(pnp_d);
				if (err < 0) {
					printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
					       __func__, err);
					return (0);
				}
				card->para[1] = pnp_port_start(pnp_d, 0);
				card->para[0] = pnp_irq(pnp_d, 0);
				if (!card->para[0] || !card->para[1]) {
					printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
					       card->para[0], card->para[1]);
					pnp_disable_dev(pnp_d);
					return (0);
				}
				cs->hw.diva.cfg_reg  = card->para[1];
				cs->irq = card->para[0];
				if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
					cs->subtyp = DIVA_IPAC_ISA;
					cs->hw.diva.ctrl = 0;
					cs->hw.diva.isac =
						card->para[1] + DIVA_IPAC_DATA;
					cs->hw.diva.hscx =
						card->para[1] + DIVA_IPAC_DATA;
					cs->hw.diva.isac_adr =
						card->para[1] + DIVA_IPAC_ADR;
					cs->hw.diva.hscx_adr =
						card->para[1] + DIVA_IPAC_ADR;
					test_and_set_bit(HW_IPAC, &cs->HW_Flags);
				} else {
					cs->subtyp = DIVA_ISA;
					cs->hw.diva.ctrl =
						card->para[1] + DIVA_ISA_CTRL;
					cs->hw.diva.isac =
						card->para[1] + DIVA_ISA_ISAC_DATA;
					cs->hw.diva.hscx =
						card->para[1] + DIVA_HSCX_DATA;
					cs->hw.diva.isac_adr =
						card->para[1] + DIVA_ISA_ISAC_ADR;
					cs->hw.diva.hscx_adr =
						card->para[1] + DIVA_HSCX_ADR;
				}
				return (1);		/* card found */
			} else {
				printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
				return (0);
			}
		}
		ipid++;
		pnp_c = NULL;
	}

	return (-1);	/* card not found; continue search */
}
Exemplo n.º 6
0
int __devinit
setup_isurf(struct IsdnCard *card)
{
	int ver;
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, ISurf_revision);
	printk(KERN_INFO "HiSax: ISurf driver Rev. %s\n", HiSax_getrev(tmp));
	
 	if (cs->typ != ISDN_CTYPE_ISURF)
 		return(0);
	if (card->para[1] && card->para[2]) {
		cs->hw.isurf.reset = card->para[1];
		cs->hw.isurf.phymem = card->para[2];
		cs->irq = card->para[0];
	} else {
#ifdef __ISAPNP__
		if (isapnp_present()) {
			struct pnp_dev *pnp_d = NULL;
			int err;

			cs->subtyp = 0;
			if ((pnp_c = pnp_find_card(
				ISAPNP_VENDOR('S', 'I', 'E'),
				ISAPNP_FUNCTION(0x0010), pnp_c))) {
				if (!(pnp_d = pnp_find_dev(pnp_c,
					ISAPNP_VENDOR('S', 'I', 'E'),
					ISAPNP_FUNCTION(0x0010), pnp_d))) {
					printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n");
					return (0);
				}
				pnp_disable_dev(pnp_d);
				err = pnp_activate_dev(pnp_d);
				cs->hw.isurf.reset = pnp_port_start(pnp_d, 0);
				cs->hw.isurf.phymem = pnp_mem_start(pnp_d, 1);
				cs->irq = pnp_irq(pnp_d, 0);
				if (!cs->irq || !cs->hw.isurf.reset || !cs->hw.isurf.phymem) {
					printk(KERN_ERR "ISurfPnP:some resources are missing %d/%x/%lx\n",
						cs->irq, cs->hw.isurf.reset, cs->hw.isurf.phymem);
					pnp_disable_dev(pnp_d);
					return(0);
				}
			} else {
				printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n");
				return(0);
			}
		} else {
			printk(KERN_INFO "ISurfPnP: no ISAPnP bus found\n");
			return(0);
		}
#else
		printk(KERN_WARNING "HiSax: Siemens I-Surf port/mem not set\n");
		return (0);
#endif
	}
	if (!request_region(cs->hw.isurf.reset, 1, "isurf isdn")) {
		printk(KERN_WARNING
			"HiSax: Siemens I-Surf config port %x already in use\n",
			cs->hw.isurf.reset);
			return (0);
	}
	if (!request_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE, "isurf iomem")) {
		printk(KERN_WARNING "HiSax: Siemens I-Surf memory region "
			"%lx-%lx already in use\n",
			cs->hw.isurf.phymem,
			cs->hw.isurf.phymem + ISURF_IOMEM_SIZE);
		release_region(cs->hw.isurf.reset, 1);
		return (0);
	}
	cs->hw.isurf.isar = ioremap(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
	cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET;
	printk(KERN_INFO
	       "ISurf: defined at 0x%x 0x%lx IRQ %d\n",
	       cs->hw.isurf.reset,
	       cs->hw.isurf.phymem,
	       cs->irq);

	setup_isac(cs);
	cs->cardmsg = &ISurf_card_msg;
	cs->irq_func = &isurf_interrupt;
	cs->auxcmd = &isurf_auxcmd;
	cs->readisac = &ReadISAC;
	cs->writeisac = &WriteISAC;
	cs->readisacfifo = &ReadISACfifo;
	cs->writeisacfifo = &WriteISACfifo;
	cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r;
	cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r;
	test_and_set_bit(HW_ISAR, &cs->HW_Flags);
	ISACVersion(cs, "ISurf:");
	cs->BC_Read_Reg = &ReadISAR;
	cs->BC_Write_Reg = &WriteISAR;
	cs->BC_Send_Data = &isar_fill_fifo;
	ver = ISARVersion(cs, "ISurf:");
	if (ver < 0) {
		printk(KERN_WARNING
			"ISurf: wrong ISAR version (ret = %d)\n", ver);
		release_io_isurf(cs);
		return (0);
	}
	return (1);
}
Exemplo n.º 7
0
int __init
setup_niccy(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, niccy_revision);
	printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_NICCY)
		return (0);
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pci_bus *pb;
		struct pci_dev *pd;

		if ((pb = isapnp_find_card(
			ISAPNP_VENDOR('S', 'D', 'A'),
			ISAPNP_FUNCTION(0x0150), pnp_c))) {
			pnp_c = pb;
			pd = NULL;
			if (!(pd = isapnp_find_dev(pnp_c,
				ISAPNP_VENDOR('S', 'D', 'A'),
				ISAPNP_FUNCTION(0x0150), pd))) {
				printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n");
				return (0);
			}
			pd->prepare(pd);
			pd->deactivate(pd);
			pd->activate(pd);
			card->para[1] = pd->resource[0].start;
			card->para[2] = pd->resource[1].start;
			card->para[0] = pd->irq_resource[0].start;
			if (!card->para[0] || !card->para[1] || !card->para[2]) {
				printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n",
					card->para[0], card->para[1], card->para[2]);
				pd->deactivate(pd);
				return(0);
			}
		} else {
			printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
		}
	}
#endif
	if (card->para[1]) {
		cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
		cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
		cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP;
		cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP;
		cs->hw.niccy.cfg_reg = 0;
		cs->subtyp = NICCY_PNP;
		cs->irq = card->para[0];
		if (check_region((cs->hw.niccy.isac), 2)) {
			printk(KERN_WARNING
				"HiSax: %s data port %x-%x already in use\n",
				CardType[card->typ],
				cs->hw.niccy.isac,
				cs->hw.niccy.isac + 1);
			return (0);
		} else
			request_region(cs->hw.niccy.isac, 2, "niccy data");
		if (check_region((cs->hw.niccy.isac_ale), 2)) {
			printk(KERN_WARNING
				"HiSax: %s address port %x-%x already in use\n",
				CardType[card->typ],
				cs->hw.niccy.isac_ale,
				cs->hw.niccy.isac_ale + 1);
			release_region(cs->hw.niccy.isac, 2);
			return (0);
		} else
			request_region(cs->hw.niccy.isac_ale, 2, "niccy addr");
	} else {
#if CONFIG_PCI
		u_int pci_ioaddr;
		if (!pci_present()) {
			printk(KERN_ERR "Niccy: no PCI bus present\n");
			return(0);
		}
		cs->subtyp = 0;
		if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
			PCI_DEVICE_ID_SATSAGEM_NICCY, niccy_dev))) {
			if (pci_enable_device(niccy_dev))
				return(0);
			/* get IRQ */
			if (!niccy_dev->irq) {
				printk(KERN_WARNING "Niccy: No IRQ for PCI card found\n");
				return(0);
			}
			cs->irq = niccy_dev->irq;
			cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
			if (!cs->hw.niccy.cfg_reg) {
				printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n");
				return(0);
			}
			pci_ioaddr = pci_resource_start(niccy_dev, 1);
			if (!pci_ioaddr) {
				printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n");
				return(0);
			}
			cs->subtyp = NICCY_PCI;
		} else {
			printk(KERN_WARNING "Niccy: No PCI card found\n");
			return(0);
		}
		cs->irq_flags |= SA_SHIRQ;
		cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA;
		cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
		cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
		cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
		if (check_region((cs->hw.niccy.isac), 4)) {
			printk(KERN_WARNING
				"HiSax: %s data port %x-%x already in use\n",
				CardType[card->typ],
				cs->hw.niccy.isac,
				cs->hw.niccy.isac + 4);
			return (0);
		} else
			request_region(cs->hw.niccy.isac, 4, "niccy");
		if (check_region(cs->hw.niccy.cfg_reg, 0x40)) {
			printk(KERN_WARNING
			       "HiSax: %s pci port %x-%x already in use\n",
				CardType[card->typ],
				cs->hw.niccy.cfg_reg,
				cs->hw.niccy.cfg_reg + 0x40);
			release_region(cs->hw.niccy.isac, 4);
			return (0);
		} else {
			request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci");
		}
#else
		printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
		printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
		return (0);
#endif /* CONFIG_PCI */
	}
	printk(KERN_INFO
		"HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
		CardType[cs->typ], (cs->subtyp==1) ? "PnP":"PCI",
		cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
	cs->readisac = &ReadISAC;
	cs->writeisac = &WriteISAC;
	cs->readisacfifo = &ReadISACfifo;
	cs->writeisacfifo = &WriteISACfifo;
	cs->BC_Read_Reg = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &niccy_card_msg;
	cs->irq_func = &niccy_interrupt;
	ISACVersion(cs, "Niccy:");
	if (HscxVersion(cs, "Niccy:")) {
		printk(KERN_WARNING
		    "Niccy: wrong HSCX versions check IO address\n");
		release_io_niccy(cs);
		return (0);
	}
	return (1);
}
Exemplo n.º 8
0
int __init
setup_hfcs(struct IsdnCard *card)
{
    struct IsdnCardState *cs = card->cs;
    char tmp[64];

    strcpy(tmp, hfcs_revision);
    printk(KERN_INFO "HiSax: HFC-S driver Rev. %s\n", HiSax_getrev(tmp));

#ifdef __ISAPNP__
    if (!card->para[1] && isapnp_present()) {
        struct pci_bus *pb;
        struct pci_dev *pd;

        while(hdev->card_vendor) {
            if ((pb = isapnp_find_card(hdev->card_vendor,
                                       hdev->card_device, pnp_c))) {
                pnp_c = pb;
                pd = NULL;
                if ((pd = isapnp_find_dev(pnp_c,
                                          hdev->vendor, hdev->function, pd))) {
                    printk(KERN_INFO "HiSax: %s detected\n",
                           (char *)hdev->driver_data);
                    pd->prepare(pd);
                    pd->deactivate(pd);
                    pd->activate(pd);
                    card->para[1] = pd->resource[0].start;
                    card->para[0] = pd->irq_resource[0].start;
                    if (!card->para[0] || !card->para[1]) {
                        printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
                               card->para[0], card->para[1]);
                        pd->deactivate(pd);
                        return(0);
                    }
                    break;
                } else {
                    printk(KERN_ERR "HFC PnP: PnP error card found, no device\n");
                }
            }
            hdev++;
            pnp_c=NULL;
        }
        if (!hdev->card_vendor) {
            printk(KERN_INFO "HFC PnP: no ISAPnP card found\n");
            return(0);
        }
    }
#endif
    cs->hw.hfcD.addr = card->para[1] & 0xfffe;
    cs->irq = card->para[0];
    cs->hw.hfcD.cip = 0;
    cs->hw.hfcD.int_s1 = 0;
    cs->hw.hfcD.send = NULL;
    cs->bcs[0].hw.hfc.send = NULL;
    cs->bcs[1].hw.hfc.send = NULL;
    cs->hw.hfcD.dfifosize = 512;
    cs->dc.hfcd.ph_state = 0;
    cs->hw.hfcD.fifo = 255;
    if (cs->typ == ISDN_CTYPE_TELES3C) {
        cs->hw.hfcD.bfifosize = 1024 + 512;
    } else if (cs->typ == ISDN_CTYPE_ACERP10) {
        cs->hw.hfcD.bfifosize = 7*1024 + 512;
    } else
        return (0);
    if (check_region((cs->hw.hfcD.addr), 2)) {
        printk(KERN_WARNING
               "HiSax: %s config port %x-%x already in use\n",
               CardType[card->typ],
               cs->hw.hfcD.addr,
               cs->hw.hfcD.addr + 2);
        return (0);
    } else {
        request_region(cs->hw.hfcD.addr, 2, "HFCS isdn");
    }
    printk(KERN_INFO
           "HFCS: defined at 0x%x IRQ %d HZ %d\n",
           cs->hw.hfcD.addr,
           cs->irq, HZ);
    if (cs->typ == ISDN_CTYPE_TELES3C) {
        /* Teles 16.3c IO ADR is 0x200 | YY0U (YY Bit 15/14 address) */
        outb(0x00, cs->hw.hfcD.addr);
        outb(0x56, cs->hw.hfcD.addr | 1);
    } else if (cs->typ == ISDN_CTYPE_ACERP10) {
        /* Acer P10 IO ADR is 0x300 */
        outb(0x00, cs->hw.hfcD.addr);
        outb(0x57, cs->hw.hfcD.addr | 1);
    }
    set_cs_func(cs);
    cs->hw.hfcD.timer.function = (void *) hfcs_Timer;
    cs->hw.hfcD.timer.data = (long) cs;
    init_timer(&cs->hw.hfcD.timer);
    reset_hfcs(cs);
    cs->cardmsg = &hfcs_card_msg;
    cs->irq_func = &hfcs_interrupt;
    return (1);
}
Exemplo n.º 9
0
int __devinit
setup_sedlbauer(struct IsdnCard *card)
{
	int bytecnt, ver, val;
	struct IsdnCardState *cs = card->cs;
	char tmp[64];
	u16 sub_vendor_id, sub_id;

	strcpy(tmp, Sedlbauer_revision);
	printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp));
	
 	if (cs->typ == ISDN_CTYPE_SEDLBAUER) {
 		cs->subtyp = SEDL_SPEED_CARD_WIN;
		cs->hw.sedl.bus = SEDL_BUS_ISA;
		cs->hw.sedl.chip = SEDL_CHIP_TEST;
 	} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_PCMCIA) {	
 		cs->subtyp = SEDL_SPEED_STAR;
		cs->hw.sedl.bus = SEDL_BUS_PCMCIA;
		cs->hw.sedl.chip = SEDL_CHIP_TEST;
 	} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_FAX) {	
 		cs->subtyp = SEDL_SPEED_FAX;
		cs->hw.sedl.bus = SEDL_BUS_ISA;
		cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
 	} else
		return (0);

	bytecnt = 8;
	if (card->para[1]) {
		cs->hw.sedl.cfg_reg = card->para[1];
		cs->irq = card->para[0];
		if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
			bytecnt = 16;
		}
	} else {
#ifdef __ISAPNP__
		if (isapnp_present()) {
			struct pnp_dev *pnp_d;
			while(ipid->card_vendor) {
				if ((pnp_c = pnp_find_card(ipid->card_vendor,
					ipid->card_device, pnp_c))) {
					pnp_d = NULL;
					if ((pnp_d = pnp_find_dev(pnp_c,
						ipid->vendor, ipid->function, pnp_d))) {
						int err;

						printk(KERN_INFO "HiSax: %s detected\n",
							(char *)ipid->driver_data);
						pnp_disable_dev(pnp_d);
						err = pnp_activate_dev(pnp_d);
						if (err<0) {
							printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
								__FUNCTION__, err);
							return(0);
						}
						card->para[1] = pnp_port_start(pnp_d, 0);
						card->para[0] = pnp_irq(pnp_d, 0);

						if (!card->para[0] || !card->para[1]) {
							printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
								card->para[0], card->para[1]);
							pnp_disable_dev(pnp_d);
							return(0);
						}
						cs->hw.sedl.cfg_reg = card->para[1];
						cs->irq = card->para[0];
						if (ipid->function == ISAPNP_FUNCTION(0x2)) {
							cs->subtyp = SEDL_SPEED_FAX;
							cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
							bytecnt = 16;
						} else {
							cs->subtyp = SEDL_SPEED_CARD_WIN;
							cs->hw.sedl.chip = SEDL_CHIP_TEST;
						}
						goto ready;
					} else {
						printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
						return(0);
					}
				}
				ipid++;
				pnp_c = NULL;
			} 
			if (!ipid->card_vendor) {
				printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
			}
		}
#endif
/* Probe for Sedlbauer speed pci */
#ifdef CONFIG_PCI
		if ((dev_sedl = pci_find_device(PCI_VENDOR_ID_TIGERJET,
				PCI_DEVICE_ID_TIGERJET_100, dev_sedl))) {
			if (pci_enable_device(dev_sedl))
				return(0);
			cs->irq = dev_sedl->irq;
			if (!cs->irq) {
				printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n");
				return(0);
			}
			cs->hw.sedl.cfg_reg = pci_resource_start(dev_sedl, 0);
		} else {
			printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
			return(0);
		}
		cs->irq_flags |= IRQF_SHARED;
		cs->hw.sedl.bus = SEDL_BUS_PCI;
		sub_vendor_id = dev_sedl->subsystem_vendor;
		sub_id = dev_sedl->subsystem_device;
		printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n",
			sub_vendor_id, sub_id);
		printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n",
			cs->hw.sedl.cfg_reg);
		if (sub_id != PCI_SUB_ID_SEDLBAUER) {
			printk(KERN_ERR "Sedlbauer: unknown sub id %#x\n", sub_id);
			return(0);
		}
		if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PYRAMID) {
			cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
			cs->subtyp = SEDL_SPEEDFAX_PYRAMID;
		} else if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PCI) {
			cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
			cs->subtyp = SEDL_SPEEDFAX_PCI;
		} else if (sub_vendor_id == PCI_SUBVENDOR_HST_SAPHIR3) {
			cs->hw.sedl.chip = SEDL_CHIP_IPAC;
			cs->subtyp = HST_SAPHIR3;
		} else if (sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER_PCI) {
			cs->hw.sedl.chip = SEDL_CHIP_IPAC;
			cs->subtyp = SEDL_SPEED_PCI;
		} else {
			printk(KERN_ERR "Sedlbauer: unknown sub vendor id %#x\n",
				sub_vendor_id);
			return(0);
		}
		bytecnt = 256;
		cs->hw.sedl.reset_on = SEDL_ISAR_PCI_ISAR_RESET_ON;
		cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF;
		byteout(cs->hw.sedl.cfg_reg, 0xff);
		byteout(cs->hw.sedl.cfg_reg, 0x00);
		byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd);
		byteout(cs->hw.sedl.cfg_reg+ 5, 0x02);
		byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
		mdelay(2);
		byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
		mdelay(10);
#else
		printk(KERN_WARNING "Sedlbauer: NO_PCI_BIOS\n");
		return (0);
#endif /* CONFIG_PCI */
	}	

#ifdef __ISAPNP__
ready:	
#endif

	/* In case of the sedlbauer pcmcia card, this region is in use,
	 * reserved for us by the card manager. So we do not check it
	 * here, it would fail.
	 */
	if (cs->hw.sedl.bus != SEDL_BUS_PCMCIA &&
		!request_region(cs->hw.sedl.cfg_reg, bytecnt, "sedlbauer isdn")) {
		printk(KERN_WARNING
			"HiSax: %s config port %x-%x already in use\n",
			CardType[card->typ],
			cs->hw.sedl.cfg_reg,
			cs->hw.sedl.cfg_reg + bytecnt);
			return (0);
	}

	printk(KERN_INFO
	       "Sedlbauer: defined at 0x%x-0x%x IRQ %d\n",
	       cs->hw.sedl.cfg_reg,
	       cs->hw.sedl.cfg_reg + bytecnt,
	       cs->irq);

	cs->BC_Read_Reg = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &Sedl_card_msg;

/*
 * testing ISA and PCMCIA Cards for IPAC, default is ISAC
 * do not test for PCI card, because ports are different
 * and PCI card uses only IPAC (for the moment)
 */	
	if (cs->hw.sedl.bus != SEDL_BUS_PCI) {
		val = readreg(cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_ADR,
			cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC, IPAC_ID);
		printk(KERN_DEBUG "Sedlbauer: testing IPAC version %x\n", val);
	        if ((val == 1) || (val == 2)) {
			/* IPAC */
			cs->subtyp = SEDL_SPEED_WIN2_PC104;
			if (cs->hw.sedl.bus == SEDL_BUS_PCMCIA) {
				cs->subtyp = SEDL_SPEED_STAR2;
			}
			cs->hw.sedl.chip = SEDL_CHIP_IPAC;
		} else {
			/* ISAC_HSCX oder ISAC_ISAR */
			if (cs->hw.sedl.chip == SEDL_CHIP_TEST) {
				cs->hw.sedl.chip = SEDL_CHIP_ISAC_HSCX;
			}
		}
	}

/*
 * hw.sedl.chip is now properly set
 */
	printk(KERN_INFO "Sedlbauer: %s detected\n",
		Sedlbauer_Types[cs->subtyp]);

	setup_isac(cs);
	if (cs->hw.sedl.chip == SEDL_CHIP_IPAC) {
		if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
	                cs->hw.sedl.adr  = cs->hw.sedl.cfg_reg + SEDL_IPAC_PCI_ADR;
			cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_IPAC_PCI_IPAC;
			cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_PCI_IPAC;
		} else {
	                cs->hw.sedl.adr  = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_ADR;
			cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
			cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
		}
		test_and_set_bit(HW_IPAC, &cs->HW_Flags);
		cs->readisac = &ReadISAC_IPAC;
		cs->writeisac = &WriteISAC_IPAC;
		cs->readisacfifo = &ReadISACfifo_IPAC;
		cs->writeisacfifo = &WriteISACfifo_IPAC;
		cs->irq_func = &sedlbauer_interrupt_ipac;
		val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ID);
		printk(KERN_INFO "Sedlbauer: IPAC version %x\n", val);
	} else {
		/* ISAC_HSCX oder ISAC_ISAR */
		cs->readisac = &ReadISAC;
		cs->writeisac = &WriteISAC;
		cs->readisacfifo = &ReadISACfifo;
		cs->writeisacfifo = &WriteISACfifo;
		if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
			if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
				cs->hw.sedl.adr = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_PCI_ADR;
				cs->hw.sedl.isac = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_PCI_ISAC;
				cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_PCI_ISAR;
			} else {
				cs->hw.sedl.adr = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_ISA_ADR;
				cs->hw.sedl.isac = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_ISA_ISAC;
				cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_ISA_ISAR;
				cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_ISA_ISAR_RESET_ON;
				cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg +
							SEDL_ISAR_ISA_ISAR_RESET_OFF;
			}
			cs->bcs[0].hw.isar.reg = &cs->hw.sedl.isar;
			cs->bcs[1].hw.isar.reg = &cs->hw.sedl.isar;
			test_and_set_bit(HW_ISAR, &cs->HW_Flags);
			cs->irq_func = &sedlbauer_interrupt_isar;
			cs->auxcmd = &isar_auxcmd;
			ISACVersion(cs, "Sedlbauer:");
			cs->BC_Read_Reg = &ReadISAR;
			cs->BC_Write_Reg = &WriteISAR;
			cs->BC_Send_Data = &isar_fill_fifo;
			bytecnt = 3;
			while (bytecnt) {
				ver = ISARVersion(cs, "Sedlbauer:");
				if (ver < 0)
					printk(KERN_WARNING
						"Sedlbauer: wrong ISAR version (ret = %d)\n", ver);
				else
					break;
				reset_sedlbauer(cs);
				bytecnt--;
			}
			if (!bytecnt) {
				release_io_sedlbauer(cs);
				return (0);
			}
		} else {
			if (cs->hw.sedl.bus == SEDL_BUS_PCMCIA) {
				cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_ADR;
				cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_ISAC;
				cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_HSCX;
				cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET;
				cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET;
				cs->irq_flags |= IRQF_SHARED;
			} else {
				cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ADR;
				cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ISAC;
				cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_HSCX;
				cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_RESET_ON;
				cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_RESET_OFF;
			}
			cs->irq_func = &sedlbauer_interrupt;
			ISACVersion(cs, "Sedlbauer:");
		
			if (HscxVersion(cs, "Sedlbauer:")) {
				printk(KERN_WARNING
					"Sedlbauer: wrong HSCX versions check IO address\n");
				release_io_sedlbauer(cs);
				return (0);
			}
		}
	}
	return (1);
}
Exemplo n.º 10
0
int __devinit
setup_ix1micro(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, ix1_revision);
;
	if (cs->typ != ISDN_CTYPE_IX1MICROR2)
		return (0);

#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_dev *pnp_d;
		while(ipid->card_vendor) {
			if ((pnp_c = pnp_find_card(ipid->card_vendor,
				ipid->card_device, pnp_c))) {
				pnp_d = NULL;
				if ((pnp_d = pnp_find_dev(pnp_c,
					ipid->vendor, ipid->function, pnp_d))) {
					int err;

//					printk(KERN_INFO "HiSax: %s detected\n",
;
					pnp_disable_dev(pnp_d);
					err = pnp_activate_dev(pnp_d);
					if (err<0) {
//						printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
;
						return(0);
					}
					card->para[1] = pnp_port_start(pnp_d, 0);
					card->para[0] = pnp_irq(pnp_d, 0);
					if (!card->para[0] || !card->para[1]) {
//						printk(KERN_ERR "ITK PnP:some resources are missing %ld/%lx\n",
;
						pnp_disable_dev(pnp_d);
						return(0);
					}
					break;
				} else {
;
				}
			}
			ipid++;
			pnp_c = NULL;
		} 
		if (!ipid->card_vendor) {
;
			return(0);
		}
	}
#endif
	/* IO-Ports */
	cs->hw.ix1.isac_ale = card->para[1] + ISAC_COMMAND_OFFSET;
	cs->hw.ix1.hscx_ale = card->para[1] + HSCX_COMMAND_OFFSET;
	cs->hw.ix1.isac = card->para[1] + ISAC_DATA_OFFSET;
	cs->hw.ix1.hscx = card->para[1] + HSCX_DATA_OFFSET;
	cs->hw.ix1.cfg_reg = card->para[1];
	cs->irq = card->para[0];
	if (cs->hw.ix1.cfg_reg) {
		if (!request_region(cs->hw.ix1.cfg_reg, 4, "ix1micro cfg")) {
//			printk(KERN_WARNING
//			  "HiSax: ITK ix1-micro Rev.2 config port "
//			  "%x-%x already in use\n",
//			       cs->hw.ix1.cfg_reg,
;
			return (0);
		}
	}
//	printk(KERN_INFO "HiSax: ITK ix1-micro Rev.2 config irq:%d io:0x%X\n",
;
	setup_isac(cs);
	cs->readisac = &ReadISAC;
	cs->writeisac = &WriteISAC;
	cs->readisacfifo = &ReadISACfifo;
	cs->writeisacfifo = &WriteISACfifo;
	cs->BC_Read_Reg = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &ix1_card_msg;
	cs->irq_func = &ix1micro_interrupt;
	ISACVersion(cs, "ix1-Micro:");
	if (HscxVersion(cs, "ix1-Micro:")) {
//		printk(KERN_WARNING
;
		release_io_ix1micro(cs);
		return (0);
	}
	return (1);
}
Exemplo n.º 11
0
int __init
setup_asuscom(struct IsdnCard *card)
{
    int bytecnt;
    struct IsdnCardState *cs = card->cs;
    u_char val;
    char tmp[64];

    strcpy(tmp, Asuscom_revision);
    printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp));
    if (cs->typ != ISDN_CTYPE_ASUSCOM)
        return (0);
#ifdef __ISAPNP__
    if (!card->para[1] && isapnp_present()) {
        struct pnp_dev *pnp_d;
        while(ipid->card_vendor) {
            if ((pnp_c = pnp_find_card(ipid->card_vendor,
                                       ipid->card_device, pnp_c))) {
                pnp_d = NULL;
                if ((pnp_d = pnp_find_dev(pnp_c,
                                          ipid->vendor, ipid->function, pnp_d))) {
                    int err;

                    printk(KERN_INFO "HiSax: %s detected\n",
                           (char *)ipid->driver_data);
                    pnp_disable_dev(pnp_d);
                    err = pnp_activate_dev(pnp_d);
                    if (err<0) {
                        printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
                               __FUNCTION__, err);
                        return(0);
                    }
                    card->para[1] = pnp_port_start(pnp_d, 0);
                    card->para[0] = pnp_irq(pnp_d, 0);
                    if (!card->para[0] || !card->para[1]) {
                        printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n",
                               card->para[0], card->para[1]);
                        pnp_disable_dev(pnp_d);
                        return(0);
                    }
                    break;
                } else {
                    printk(KERN_ERR "AsusPnP: PnP error card found, no device\n");
                }
            }
            ipid++;
            pnp_c = NULL;
        }
        if (!ipid->card_vendor) {
            printk(KERN_INFO "AsusPnP: no ISAPnP card found\n");
            return(0);
        }
    }
#endif
    bytecnt = 8;
    cs->hw.asus.cfg_reg = card->para[1];
    cs->irq = card->para[0];
    if (!request_region(cs->hw.asus.cfg_reg, bytecnt, "asuscom isdn")) {
        printk(KERN_WARNING
               "HiSax: %s config port %x-%x already in use\n",
               CardType[card->typ],
               cs->hw.asus.cfg_reg,
               cs->hw.asus.cfg_reg + bytecnt);
        return (0);
    }
    printk(KERN_INFO "ISDNLink: defined at 0x%x IRQ %d\n",
           cs->hw.asus.cfg_reg, cs->irq);
    setup_isac(cs);
    cs->BC_Read_Reg = &ReadHSCX;
    cs->BC_Write_Reg = &WriteHSCX;
    cs->BC_Send_Data = &hscx_fill_fifo;
    cs->cardmsg = &Asus_card_msg;
    val = readreg(cs->hw.asus.cfg_reg + ASUS_IPAC_ALE,
                  cs->hw.asus.cfg_reg + ASUS_IPAC_DATA, IPAC_ID);
    if ((val == 1) || (val == 2)) {
        cs->subtyp = ASUS_IPAC;
        cs->hw.asus.adr  = cs->hw.asus.cfg_reg + ASUS_IPAC_ALE;
        cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA;
        cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA;
        test_and_set_bit(HW_IPAC, &cs->HW_Flags);
        cs->readisac = &ReadISAC_IPAC;
        cs->writeisac = &WriteISAC_IPAC;
        cs->readisacfifo = &ReadISACfifo_IPAC;
        cs->writeisacfifo = &WriteISACfifo_IPAC;
        cs->irq_func = &asuscom_interrupt_ipac;
        printk(KERN_INFO "Asus: IPAC version %x\n", val);
    } else {
        cs->subtyp = ASUS_ISACHSCX;
        cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_ADR;
        cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_ISAC;
        cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_HSCX;
        cs->hw.asus.u7 = cs->hw.asus.cfg_reg + ASUS_CTRL_U7;
        cs->hw.asus.pots = cs->hw.asus.cfg_reg + ASUS_CTRL_POTS;
        cs->readisac = &ReadISAC;
        cs->writeisac = &WriteISAC;
        cs->readisacfifo = &ReadISACfifo;
        cs->writeisacfifo = &WriteISACfifo;
        cs->irq_func = &asuscom_interrupt;
        ISACVersion(cs, "ISDNLink:");
        if (HscxVersion(cs, "ISDNLink:")) {
            printk(KERN_WARNING
                   "ISDNLink: wrong HSCX versions check IO address\n");
            release_io_asuscom(cs);
            return (0);
        }
    }
    return (1);
}
Exemplo n.º 12
0
int __devinit
setup_teles3(struct IsdnCard *card)
{
	char tmp[64];

	strcpy(tmp, teles3_revision);
	printk(KERN_INFO "HiSax: Teles IO driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_card *pnp_card;
		struct pnp_dev *pnp_dev;

		while(tdev->card_vendor) {
			if ((pnp_card = pnp_find_card(tdev->card_vendor,
						      tdev->card_device, pnp_c))) {
				pnp_c = pnp_card;
				pnp_dev = NULL;
				if ((pnp_dev = pnp_find_dev(pnp_card,
							    tdev->vendor,
							    tdev->function,
							    pnp_dev))) {
					printk(KERN_INFO "HiSax: %s detected\n",
						(char *)tdev->driver_data);
					if (pnp_device_attach(pnp_dev) < 0) {
						printk(KERN_ERR "Teles PnP: attach failed\n");
						return 0;
					}
					if (pnp_activate_dev(pnp_dev) < 0) {
						printk(KERN_ERR "Teles PnP: activate failed\n");
						pnp_device_detach(pnp_dev);
						return 0;
					}
					if (!pnp_irq_valid(pnp_dev, 0) ||
					    !pnp_port_valid(pnp_dev, 0) ||
					    !pnp_port_valid(pnp_dev, 1)) {
						printk(KERN_ERR "Teles PnP: some resources are missing %ld/%lx/%lx\n",
							pnp_irq(pnp_dev, 0), pnp_port_start(pnp_dev, 0), pnp_port_start(pnp_dev, 1));
						pnp_device_detach(pnp_dev);
						return 0;
					}
					card->para[3] = pnp_port_start(pnp_dev, 2);
					card->para[2] = pnp_port_start(pnp_dev, 1);
					card->para[1] = pnp_port_start(pnp_dev, 0);
					card->para[0] = pnp_irq(pnp_dev, 0);
					break;
				} else {
					printk(KERN_ERR "Teles PnP: PnP error card found, no device\n");
				}
			}
			tdev++;
			pnp_c=NULL;
		} 
		if (!tdev->card_vendor) {
			printk(KERN_INFO "Teles PnP: no ISAPnP card found\n");
			return(0);
		}
	}
#endif
	if (card->cs->typ == ISDN_CTYPE_16_3) {
		if (teles16_3_probe(card->cs, card) < 0)
			return 0;
	} else if (card->cs->typ == ISDN_CTYPE_TELESPCMCIA) {
		if (telespcmcia_probe(card->cs, card) < 0)
			return 0;
	} else if (card->cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
		if (compaq_probe(card->cs, card) < 0)
			return 0;
	} else {	/* PNP */
		if (telespnp_probe(card->cs, card) < 0)
			return 0;
	}
	return 1;
}
int __init
setup_diva(struct IsdnCard *card)
{
	int bytecnt = 8;
	u_char val;
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, Diva_revision);
	printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
		return(0);
	cs->hw.diva.status = 0;
	if (card->para[1]) {
		cs->hw.diva.ctrl_reg = 0;
		cs->hw.diva.cfg_reg = card->para[1];
		val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR,
			cs->hw.diva.cfg_reg + DIVA_IPAC_DATA, IPAC_ID);
		printk(KERN_INFO "Diva: IPAC version %x\n", val);
		if ((val == 1) || (val==2)) {
			cs->subtyp = DIVA_IPAC_ISA;
			cs->hw.diva.ctrl = 0;
			cs->hw.diva.isac = card->para[1] + DIVA_IPAC_DATA;
			cs->hw.diva.hscx = card->para[1] + DIVA_IPAC_DATA;
			cs->hw.diva.isac_adr = card->para[1] + DIVA_IPAC_ADR;
			cs->hw.diva.hscx_adr = card->para[1] + DIVA_IPAC_ADR;
			test_and_set_bit(HW_IPAC, &cs->HW_Flags);
		} else {
			cs->subtyp = DIVA_ISA;
			cs->hw.diva.ctrl = card->para[1] + DIVA_ISA_CTRL;
			cs->hw.diva.isac = card->para[1] + DIVA_ISA_ISAC_DATA;
			cs->hw.diva.hscx = card->para[1] + DIVA_HSCX_DATA;
			cs->hw.diva.isac_adr = card->para[1] + DIVA_ISA_ISAC_ADR;
			cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
		}
		cs->irq = card->para[0];
	} else {
#ifdef __ISAPNP__
		if (isapnp_present()) {
			struct pnp_dev *pnp_d;
			while(ipid->card_vendor) {
				if ((pnp_c = pnp_find_card(ipid->card_vendor,
					ipid->card_device, pnp_c))) {
					pnp_d = NULL;
					if ((pnp_d = pnp_find_dev(pnp_c,
						ipid->vendor, ipid->function, pnp_d))) {
						int err;

						printk(KERN_INFO "HiSax: %s detected\n",
							(char *)ipid->driver_data);
						pnp_disable_dev(pnp_d);
						err = pnp_activate_dev(pnp_d);
						if (err<0) {
							printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
								__FUNCTION__, err);
							return(0);
						}
						card->para[1] = pnp_port_start(pnp_d, 0);
						card->para[0] = pnp_irq(pnp_d, 0);
						if (!card->para[0] || !card->para[1]) {
							printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
								card->para[0], card->para[1]);
							pnp_disable_dev(pnp_d); 
							return(0);
						}
						cs->hw.diva.cfg_reg  = card->para[1];
						cs->irq = card->para[0];
						if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
							cs->subtyp = DIVA_IPAC_ISA;
							cs->hw.diva.ctrl = 0;
							cs->hw.diva.isac =
								card->para[1] + DIVA_IPAC_DATA;
							cs->hw.diva.hscx =
								card->para[1] + DIVA_IPAC_DATA;
							cs->hw.diva.isac_adr =
								card->para[1] + DIVA_IPAC_ADR;
							cs->hw.diva.hscx_adr =
								card->para[1] + DIVA_IPAC_ADR;
							test_and_set_bit(HW_IPAC, &cs->HW_Flags);
						} else {
							cs->subtyp = DIVA_ISA;
							cs->hw.diva.ctrl =
								card->para[1] + DIVA_ISA_CTRL;
							cs->hw.diva.isac =
								card->para[1] + DIVA_ISA_ISAC_DATA;
							cs->hw.diva.hscx =
								card->para[1] + DIVA_HSCX_DATA;
							cs->hw.diva.isac_adr =
								card->para[1] + DIVA_ISA_ISAC_ADR;
							cs->hw.diva.hscx_adr =
								card->para[1] + DIVA_HSCX_ADR;
						}
						goto ready;
					} else {
						printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
						return(0);
					}
				}
				ipid++;
				pnp_c=NULL;
			} 
			if (!ipid->card_vendor) {
				printk(KERN_INFO "Diva PnP: no ISAPnP card found\n");
			}
		}
#endif
#ifdef CONFIG_PCI
		cs->subtyp = 0;
		if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON,
			PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) {
			if (pci_enable_device(dev_diva))
				return(0);
			cs->subtyp = DIVA_PCI;
			cs->irq = dev_diva->irq;
			cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
		} else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
			PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
			if (pci_enable_device(dev_diva_u))
				return(0);
			cs->subtyp = DIVA_PCI;
			cs->irq = dev_diva_u->irq;
			cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
		} else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
			PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
			if (pci_enable_device(dev_diva201))
				return(0);
			cs->subtyp = DIVA_IPAC_PCI;
			cs->irq = dev_diva201->irq;
			cs->hw.diva.pci_cfg =
				(ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
			cs->hw.diva.cfg_reg =
				(ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
		} else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
			PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
			if (pci_enable_device(dev_diva202))
				return(0);
			cs->subtyp = DIVA_IPACX_PCI;
			cs->irq = dev_diva202->irq;
			cs->hw.diva.pci_cfg =
				(ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096);
			cs->hw.diva.cfg_reg =
				(ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
		} else {
			printk(KERN_WARNING "Diva: No PCI card found\n");
			return(0);
		}

		if (!cs->irq) {
			printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
			return(0);
		}

		if (!cs->hw.diva.cfg_reg) {
			printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
			return(0);
		}
		cs->irq_flags |= SA_SHIRQ;
#else
		printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n");
		printk(KERN_WARNING "Diva: unable to config DIVA PCI\n");
		return (0);
#endif /* CONFIG_PCI */
		if ((cs->subtyp == DIVA_IPAC_PCI) ||
		    (cs->subtyp == DIVA_IPACX_PCI)   ) {
			cs->hw.diva.ctrl = 0;
			cs->hw.diva.isac = 0;
			cs->hw.diva.hscx = 0;
			cs->hw.diva.isac_adr = 0;
			cs->hw.diva.hscx_adr = 0;
			test_and_set_bit(HW_IPAC, &cs->HW_Flags);
			bytecnt = 0;
		} else {
			cs->hw.diva.ctrl = cs->hw.diva.cfg_reg + DIVA_PCI_CTRL;
			cs->hw.diva.isac = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_DATA;
			cs->hw.diva.hscx = cs->hw.diva.cfg_reg + DIVA_HSCX_DATA;
			cs->hw.diva.isac_adr = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_ADR;
			cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg + DIVA_HSCX_ADR;
			bytecnt = 32;
		}
	}
ready:
	printk(KERN_INFO
		"Diva: %s card configured at %#lx IRQ %d\n",
		(cs->subtyp == DIVA_PCI) ? "PCI" :
		(cs->subtyp == DIVA_ISA) ? "ISA" : 
		(cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" :
		(cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
		cs->hw.diva.cfg_reg, cs->irq);
	if ((cs->subtyp == DIVA_IPAC_PCI)  || 
	    (cs->subtyp == DIVA_IPACX_PCI) || 
	    (cs->subtyp == DIVA_PCI)         )
		printk(KERN_INFO "Diva: %s space at %#lx\n",
			(cs->subtyp == DIVA_PCI) ? "PCI" :
			(cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
			cs->hw.diva.pci_cfg);
	if ((cs->subtyp != DIVA_IPAC_PCI) &&
	    (cs->subtyp != DIVA_IPACX_PCI)   ) {
		if (!request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn")) {
			printk(KERN_WARNING
			       "HiSax: %s config port %lx-%lx already in use\n",
			       CardType[card->typ],
			       cs->hw.diva.cfg_reg,
			       cs->hw.diva.cfg_reg + bytecnt);
			return (0);
		}
	}
	cs->BC_Read_Reg  = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &Diva_card_msg;
	setup_isac(cs);
	if (cs->subtyp == DIVA_IPAC_ISA) {
		cs->readisac  = &ReadISAC_IPAC;
		cs->writeisac = &WriteISAC_IPAC;
		cs->readisacfifo  = &ReadISACfifo_IPAC;
		cs->writeisacfifo = &WriteISACfifo_IPAC;
		cs->irq_func = &diva_irq_ipac_isa;
		val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID);
		printk(KERN_INFO "Diva: IPAC version %x\n", val);
	} else if (cs->subtyp == DIVA_IPAC_PCI) {
		cs->readisac  = &MemReadISAC_IPAC;
		cs->writeisac = &MemWriteISAC_IPAC;
		cs->readisacfifo  = &MemReadISACfifo_IPAC;
		cs->writeisacfifo = &MemWriteISACfifo_IPAC;
		cs->BC_Read_Reg  = &MemReadHSCX;
		cs->BC_Write_Reg = &MemWriteHSCX;
		cs->BC_Send_Data = &Memhscx_fill_fifo;
		cs->irq_func = &diva_irq_ipac_pci;
		val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
		printk(KERN_INFO "Diva: IPAC version %x\n", val);
	} else if (cs->subtyp == DIVA_IPACX_PCI) {
		cs->readisac  = &MemReadISAC_IPACX;
		cs->writeisac = &MemWriteISAC_IPACX;
		cs->readisacfifo  = &MemReadISACfifo_IPACX;
		cs->writeisacfifo = &MemWriteISACfifo_IPACX;
		cs->BC_Read_Reg  = &MemReadHSCX_IPACX;
		cs->BC_Write_Reg = &MemWriteHSCX_IPACX;
		cs->BC_Send_Data = NULL; // function located in ipacx module
		cs->irq_func = &diva_irq_ipacx_pci;
		printk(KERN_INFO "Diva: IPACX Design Id: %x\n", 
			MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
	} else { /* DIVA 2.0 */
		cs->hw.diva.tl.function = (void *) diva_led_handler;
		cs->hw.diva.tl.data = (long) cs;
		init_timer(&cs->hw.diva.tl);
		cs->readisac  = &ReadISAC;
		cs->writeisac = &WriteISAC;
		cs->readisacfifo  = &ReadISACfifo;
		cs->writeisacfifo = &WriteISACfifo;
		cs->irq_func = &diva_interrupt;
		ISACVersion(cs, "Diva:");
		if (HscxVersion(cs, "Diva:")) {
			printk(KERN_WARNING
		       "Diva: wrong HSCX versions check IO address\n");
			release_io_diva(cs);
			return (0);
		}
	}
	return (1);
}
Exemplo n.º 14
0
int __devinit setup_niccy(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, niccy_revision);
	printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_NICCY)
		return 0;
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_dev *pnp_d = NULL;
		int err;

		pnp_c = pnp_find_card(ISAPNP_VENDOR('S', 'D', 'A'),
				ISAPNP_FUNCTION(0x0150), pnp_c);
		if (pnp_c) {
			pnp_d = pnp_find_dev(pnp_c,
					ISAPNP_VENDOR('S', 'D', 'A'),
					ISAPNP_FUNCTION(0x0150), pnp_d);
			if (!pnp_d) {
				printk(KERN_ERR "NiccyPnP: PnP error card "
					"found, no device\n");
				return 0;
			}
			pnp_disable_dev(pnp_d);
			err = pnp_activate_dev(pnp_d);
			if (err < 0) {
				printk(KERN_WARNING "%s: pnp_activate_dev "
					"ret(%d)\n", __func__, err);
				return 0;
			}
			card->para[1] = pnp_port_start(pnp_d, 0);
			card->para[2] = pnp_port_start(pnp_d, 1);
			card->para[0] = pnp_irq(pnp_d, 0);
			if (!card->para[0] || !card->para[1] ||
					!card->para[2]) {
				printk(KERN_ERR "NiccyPnP:some resources are "
					"missing %ld/%lx/%lx\n",
					card->para[0], card->para[1],
					card->para[2]);
				pnp_disable_dev(pnp_d);
				return 0;
			}
		} else
			printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
	}
#endif
	if (card->para[1]) {
		cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
		cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
		cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP;
		cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP;
		cs->hw.niccy.cfg_reg = 0;
		cs->subtyp = NICCY_PNP;
		cs->irq = card->para[0];
		if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
			printk(KERN_WARNING "HiSax: NICCY data port %x-%x "
				"already in use\n",
				cs->hw.niccy.isac, cs->hw.niccy.isac + 1);
			return 0;
		}
		if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
			printk(KERN_WARNING "HiSax: NICCY address port %x-%x "
				"already in use\n",
				cs->hw.niccy.isac_ale,
				cs->hw.niccy.isac_ale + 1);
			release_region(cs->hw.niccy.isac, 2);
			return 0;
		}
	} else {
#ifdef CONFIG_PCI
		static struct pci_dev *niccy_dev __devinitdata;

		u_int pci_ioaddr;
		cs->subtyp = 0;
		if ((niccy_dev = hisax_find_pci_device(PCI_VENDOR_ID_SATSAGEM,
						 PCI_DEVICE_ID_SATSAGEM_NICCY,
						 niccy_dev))) {
			if (pci_enable_device(niccy_dev))
				return 0;
			/* get IRQ */
			if (!niccy_dev->irq) {
				printk(KERN_WARNING
				       "Niccy: No IRQ for PCI card found\n");
				return 0;
			}
			cs->irq = niccy_dev->irq;
			cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
			if (!cs->hw.niccy.cfg_reg) {
				printk(KERN_WARNING
				       "Niccy: No IO-Adr for PCI cfg found\n");
				return 0;
			}
			pci_ioaddr = pci_resource_start(niccy_dev, 1);
			if (!pci_ioaddr) {
				printk(KERN_WARNING
				       "Niccy: No IO-Adr for PCI card found\n");
				return 0;
			}
			cs->subtyp = NICCY_PCI;
		} else {
			printk(KERN_WARNING "Niccy: No PCI card found\n");
			return 0;
		}
		cs->irq_flags |= IRQF_SHARED;
		cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA;
		cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
		cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
		cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
		if (!request_region(cs->hw.niccy.isac, 4, "niccy")) {
			printk(KERN_WARNING
			       "HiSax: NICCY data port %x-%x already in use\n",
			       cs->hw.niccy.isac, cs->hw.niccy.isac + 4);
			return 0;
		}
		if (!request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci")) {
			printk(KERN_WARNING
			       "HiSax: NICCY pci port %x-%x already in use\n",
			       cs->hw.niccy.cfg_reg,
			       cs->hw.niccy.cfg_reg + 0x40);
			release_region(cs->hw.niccy.isac, 4);
			return 0;
		}
#else
		printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
		printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
		return 0;
#endif				/* CONFIG_PCI */
	}
	printk(KERN_INFO "HiSax: NICCY %s config irq:%d data:0x%X ale:0x%X\n",
		(cs->subtyp == 1) ? "PnP" : "PCI",
		cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
	setup_isac(cs);
	cs->readisac = &ReadISAC;
	cs->writeisac = &WriteISAC;
	cs->readisacfifo = &ReadISACfifo;
	cs->writeisacfifo = &WriteISACfifo;
	cs->BC_Read_Reg = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &niccy_card_msg;
	cs->irq_func = &niccy_interrupt;
	ISACVersion(cs, "Niccy:");
	if (HscxVersion(cs, "Niccy:")) {
		printk(KERN_WARNING "Niccy: wrong HSCX versions check IO "
			"address\n");
		release_io_niccy(cs);
		return 0;
	}
	return 1;
}
Exemplo n.º 15
0
int __devinit
setup_ix1micro(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, ix1_revision);
	printk(KERN_INFO "HiSax: ITK IX1 driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_IX1MICROR2)
		return (0);

#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_dev *pnp_d;
		while(ipid->card_vendor) {
			if ((pnp_c = pnp_find_card(ipid->card_vendor,
				ipid->card_device, pnp_c))) {
				pnp_d = NULL;
				if ((pnp_d = pnp_find_dev(pnp_c,
					ipid->vendor, ipid->function, pnp_d))) {
					int err;

					printk(KERN_INFO "HiSax: %s detected\n",
						(char *)ipid->driver_data);
					pnp_disable_dev(pnp_d);
					err = pnp_activate_dev(pnp_d);
					if (err<0) {
						printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
							__FUNCTION__, err);
						return(0);
					}
					card->para[1] = pnp_port_start(pnp_d, 0);
					card->para[0] = pnp_irq(pnp_d, 0);
					if (!card->para[0] || !card->para[1]) {
						printk(KERN_ERR "ITK PnP:some resources are missing %ld/%lx\n",
							card->para[0], card->para[1]);
						pnp_disable_dev(pnp_d);
						return(0);
					}
					break;
				} else {
					printk(KERN_ERR "ITK PnP: PnP error card found, no device\n");
				}
			}
			ipid++;
			pnp_c = NULL;
		} 
		if (!ipid->card_vendor) {
			printk(KERN_INFO "ITK PnP: no ISAPnP card found\n");
			return(0);
		}
	}
#endif
	/* IO-Ports */
	cs->hw.ix1.isac_ale = card->para[1] + ISAC_COMMAND_OFFSET;
	cs->hw.ix1.hscx_ale = card->para[1] + HSCX_COMMAND_OFFSET;
	cs->hw.ix1.isac = card->para[1] + ISAC_DATA_OFFSET;
	cs->hw.ix1.hscx = card->para[1] + HSCX_DATA_OFFSET;
	cs->hw.ix1.cfg_reg = card->para[1];
	cs->irq = card->para[0];
	if (cs->hw.ix1.cfg_reg) {
		if (!request_region(cs->hw.ix1.cfg_reg, 4, "ix1micro cfg")) {
			printk(KERN_WARNING
			  "HiSax: %s config port %x-%x already in use\n",
			       CardType[card->typ],
			       cs->hw.ix1.cfg_reg,
			       cs->hw.ix1.cfg_reg + 4);
			return (0);
		}
	}
	printk(KERN_INFO "HiSax: %s config irq:%d io:0x%X\n",
		CardType[cs->typ], cs->irq, cs->hw.ix1.cfg_reg);
	setup_isac(cs);
	cs->readisac = &ReadISAC;
	cs->writeisac = &WriteISAC;
	cs->readisacfifo = &ReadISACfifo;
	cs->writeisacfifo = &WriteISACfifo;
	cs->BC_Read_Reg = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &ix1_card_msg;
	cs->irq_func = &ix1micro_interrupt;
	ISACVersion(cs, "ix1-Micro:");
	if (HscxVersion(cs, "ix1-Micro:")) {
		printk(KERN_WARNING
		    "ix1-Micro: wrong HSCX versions check IO address\n");
		release_io_ix1micro(cs);
		return (0);
	}
	return (1);
}
Exemplo n.º 16
0
int __devinit
setup_teles3(struct IsdnCard *card)
{
	u_char val;
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, teles3_revision);
	printk(KERN_INFO "HiSax: Teles IO driver Rev. %s\n", HiSax_getrev(tmp));
	if ((cs->typ != ISDN_CTYPE_16_3) && (cs->typ != ISDN_CTYPE_PNP)
	    && (cs->typ != ISDN_CTYPE_TELESPCMCIA) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA))
		return (0);

#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_dev *pnp_d;
		while(ipid->card_vendor) {
			if ((pnp_c = pnp_find_card(ipid->card_vendor,
				ipid->card_device, pnp_c))) {
				pnp_d = NULL;
				if ((pnp_d = pnp_find_dev(pnp_c,
					ipid->vendor, ipid->function, pnp_d))) {
					int err;

					printk(KERN_INFO "HiSax: %s detected\n",
						(char *)ipid->driver_data);
					pnp_disable_dev(pnp_d);
					err = pnp_activate_dev(pnp_d);
					if (err<0) {
						printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
							__FUNCTION__, err);
						return(0);
					}
					card->para[3] = pnp_port_start(pnp_d, 2);
					card->para[2] = pnp_port_start(pnp_d, 1);
					card->para[1] = pnp_port_start(pnp_d, 0);
					card->para[0] = pnp_irq(pnp_d, 0);
					if (!card->para[0] || !card->para[1] || !card->para[2]) {
						printk(KERN_ERR "Teles PnP:some resources are missing %ld/%lx/%lx\n",
							card->para[0], card->para[1], card->para[2]);
						pnp_disable_dev(pnp_d);
						return(0);
					}
					break;
				} else {
					printk(KERN_ERR "Teles PnP: PnP error card found, no device\n");
				}
			}
			ipid++;
			pnp_c = NULL;
		} 
		if (!ipid->card_vendor) {
			printk(KERN_INFO "Teles PnP: no ISAPnP card found\n");
			return(0);
		}
	}
#endif
	if (cs->typ == ISDN_CTYPE_16_3) {
		cs->hw.teles3.cfg_reg = card->para[1];
		switch (cs->hw.teles3.cfg_reg) {
			case 0x180:
			case 0x280:
			case 0x380:
				cs->hw.teles3.cfg_reg |= 0xc00;
				break;
		}
		cs->hw.teles3.isac = cs->hw.teles3.cfg_reg - 0x420;
		cs->hw.teles3.hscx[0] = cs->hw.teles3.cfg_reg - 0xc20;
		cs->hw.teles3.hscx[1] = cs->hw.teles3.cfg_reg - 0x820;
	} else if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
		cs->hw.teles3.cfg_reg = 0;
		cs->hw.teles3.hscx[0] = card->para[1] - 0x20;
		cs->hw.teles3.hscx[1] = card->para[1];
		cs->hw.teles3.isac = card->para[1] + 0x20;
	} else if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
		cs->hw.teles3.cfg_reg = card->para[3];
		cs->hw.teles3.isac = card->para[2] - 32;
		cs->hw.teles3.hscx[0] = card->para[1] - 32;
		cs->hw.teles3.hscx[1] = card->para[1];
	} else {	/* PNP */
		cs->hw.teles3.cfg_reg = 0;
		cs->hw.teles3.isac = card->para[1] - 32;
		cs->hw.teles3.hscx[0] = card->para[2] - 32;
		cs->hw.teles3.hscx[1] = card->para[2];
	}
	cs->irq = card->para[0];
	cs->hw.teles3.isacfifo = cs->hw.teles3.isac + 0x3e;
	cs->hw.teles3.hscxfifo[0] = cs->hw.teles3.hscx[0] + 0x3e;
	cs->hw.teles3.hscxfifo[1] = cs->hw.teles3.hscx[1] + 0x3e;
	if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
		if (!request_region(cs->hw.teles3.hscx[1], 96, "HiSax Teles PCMCIA")) {
			printk(KERN_WARNING
			       "HiSax: %s ports %x-%x already in use\n",
			       CardType[cs->typ],
			       cs->hw.teles3.hscx[1],
			       cs->hw.teles3.hscx[1] + 96);
			return (0);
		}
	} else {
		if (cs->hw.teles3.cfg_reg) {
			if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
				if (!request_region(cs->hw.teles3.cfg_reg, 1, "teles3 cfg")) {
					printk(KERN_WARNING
						"HiSax: %s config port %x already in use\n",
						CardType[card->typ],
						cs->hw.teles3.cfg_reg);
					return (0);
				}
			} else {
				if (!request_region(cs->hw.teles3.cfg_reg, 8, "teles3 cfg")) {
					printk(KERN_WARNING
					       "HiSax: %s config port %x-%x already in use\n",
					       CardType[card->typ],
					       cs->hw.teles3.cfg_reg,
						cs->hw.teles3.cfg_reg + 8);
					return (0);
				}
			}
		}
		if (!request_region(cs->hw.teles3.isac + 32, 32, "HiSax isac")) {
			printk(KERN_WARNING
			   "HiSax: %s isac ports %x-%x already in use\n",
			       CardType[cs->typ],
			       cs->hw.teles3.isac + 32,
			       cs->hw.teles3.isac + 64);
			if (cs->hw.teles3.cfg_reg) {
				if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
					release_region(cs->hw.teles3.cfg_reg, 1);
				} else {
					release_region(cs->hw.teles3.cfg_reg, 8);
				}
			}
			return (0);
		}
		if (!request_region(cs->hw.teles3.hscx[0] + 32, 32, "HiSax hscx A")) {
			printk(KERN_WARNING
			 "HiSax: %s hscx A ports %x-%x already in use\n",
			       CardType[cs->typ],
			       cs->hw.teles3.hscx[0] + 32,
			       cs->hw.teles3.hscx[0] + 64);
			if (cs->hw.teles3.cfg_reg) {
				if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
					release_region(cs->hw.teles3.cfg_reg, 1);
				} else {
					release_region(cs->hw.teles3.cfg_reg, 8);
				}
			}
			release_ioregs(cs, 1);
			return (0);
		}
		if (!request_region(cs->hw.teles3.hscx[1] + 32, 32, "HiSax hscx B")) {
			printk(KERN_WARNING
			 "HiSax: %s hscx B ports %x-%x already in use\n",
			       CardType[cs->typ],
			       cs->hw.teles3.hscx[1] + 32,
			       cs->hw.teles3.hscx[1] + 64);
			if (cs->hw.teles3.cfg_reg) {
				if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
					release_region(cs->hw.teles3.cfg_reg, 1);
				} else {
					release_region(cs->hw.teles3.cfg_reg, 8);
				}
			}
			release_ioregs(cs, 3);
			return (0);
		}
	}
	if ((cs->hw.teles3.cfg_reg) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA)) {
		if ((val = bytein(cs->hw.teles3.cfg_reg + 0)) != 0x51) {
			printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
			       cs->hw.teles3.cfg_reg + 0, val);
			release_io_teles3(cs);
			return (0);
		}
		if ((val = bytein(cs->hw.teles3.cfg_reg + 1)) != 0x93) {
			printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
			       cs->hw.teles3.cfg_reg + 1, val);
			release_io_teles3(cs);
			return (0);
		}
		val = bytein(cs->hw.teles3.cfg_reg + 2);/* 0x1e=without AB
							 * 0x1f=with AB
							 * 0x1c 16.3 ???
							 * 0x39 16.3 1.1
							 * 0x38 16.3 1.3
							 * 0x46 16.3 with AB + Video (Teles-Vision)
							 */
		if (val != 0x46 && val != 0x39 && val != 0x38 && val != 0x1c && val != 0x1e && val != 0x1f) {
			printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
			       cs->hw.teles3.cfg_reg + 2, val);
			release_io_teles3(cs);
			return (0);
		}
	}
	printk(KERN_INFO
	       "HiSax: %s config irq:%d isac:0x%X  cfg:0x%X\n",
	       CardType[cs->typ], cs->irq,
	       cs->hw.teles3.isac + 32, cs->hw.teles3.cfg_reg);
	printk(KERN_INFO
	       "HiSax: hscx A:0x%X  hscx B:0x%X\n",
	       cs->hw.teles3.hscx[0] + 32, cs->hw.teles3.hscx[1] + 32);

	setup_isac(cs);
	if (reset_teles3(cs)) {
		printk(KERN_WARNING "Teles3: wrong IRQ\n");
		release_io_teles3(cs);
		return (0);
	}
	cs->readisac = &ReadISAC;
	cs->writeisac = &WriteISAC;
	cs->readisacfifo = &ReadISACfifo;
	cs->writeisacfifo = &WriteISACfifo;
	cs->BC_Read_Reg = &ReadHSCX;
	cs->BC_Write_Reg = &WriteHSCX;
	cs->BC_Send_Data = &hscx_fill_fifo;
	cs->cardmsg = &Teles_card_msg;
	cs->irq_func = &teles3_interrupt;
	ISACVersion(cs, "Teles3:");
	if (HscxVersion(cs, "Teles3:")) {
		printk(KERN_WARNING
		       "Teles3: wrong HSCX versions check IO address\n");
		release_io_teles3(cs);
		return (0);
	}
	return (1);
}
Exemplo n.º 17
0
int __init
setup_niccy(struct IsdnCard *card)
{
	char tmp[64];

	strcpy(tmp, niccy_revision);
	printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_card *pb;
		struct pnp_dev  *pd;

		if ((pb = pnp_find_card(
			ISAPNP_VENDOR('S', 'D', 'A'),
			ISAPNP_FUNCTION(0x0150), pnp_c))) {
			pnp_c = pb;
			pd = NULL;
			if (!(pd = pnp_find_dev(pnp_c,
				ISAPNP_VENDOR('S', 'D', 'A'),
				ISAPNP_FUNCTION(0x0150), pd))) {
				printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n");
				return (0);
			}
			if (pnp_device_attach(pd) < 0) {
				printk(KERN_ERR "NiccyPnP: attach failed\n");
				return 0;
			}
			if (pnp_activate_dev(pd) < 0) {
				printk(KERN_ERR "NiccyPnP: activate failed\n");
				pnp_device_detach(pd);
				return 0;
			}
			if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0) || !pnp_port_valid(pd, 1)) {
				printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n",
					pnp_irq(pd, 0), pnp_port_start(pd, 0), pnp_port_start(pd, 1));
				pnp_device_detach(pd);
				return(0);
			}
			card->para[1] = pnp_port_start(pd, 0);
			card->para[2] = pnp_port_start(pd, 1);
			card->para[0] = pnp_irq(pd, 0);
		} else {
			printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
		}
	}
#endif
	if (card->para[1]) {
		if (niccy_pnp_probe(card->cs, card) < 0)
			return 0;
		return 1;
	} else {
#ifdef CONFIG_PCI
		if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
			PCI_DEVICE_ID_SATSAGEM_NICCY, niccy_dev))) {
			if (niccy_pci_probe(card->cs, niccy_dev) < 0)
				return 0;
			return 1;
		}
#endif /* CONFIG_PCI */
	}
	return 0;
}