static inline u8 readreg(unsigned int adr, u8 off) { return (bytein(adr + off)); }
int __devinit setup_avm_a1(struct IsdnCard *card) { u_char val; struct IsdnCardState *cs = card->cs; char tmp[64]; strcpy(tmp, avm_revision); printk(KERN_INFO "HiSax: AVM driver Rev. %s\n", HiSax_getrev(tmp)); if (cs->typ != ISDN_CTYPE_A1) return (0); cs->hw.avm.cfg_reg = card->para[1] + 0x1800; cs->hw.avm.isac = card->para[1] + 0x1400 - 0x20; cs->hw.avm.hscx[0] = card->para[1] + 0x400 - 0x20; cs->hw.avm.hscx[1] = card->para[1] + 0xc00 - 0x20; cs->hw.avm.isacfifo = card->para[1] + 0x1000; cs->hw.avm.hscxfifo[0] = card->para[1]; cs->hw.avm.hscxfifo[1] = card->para[1] + 0x800; cs->irq = card->para[0]; if (!request_region(cs->hw.avm.cfg_reg, 8, "avm cfg")) { printk(KERN_WARNING "HiSax: AVM A1 config port %x-%x already in use\n", cs->hw.avm.cfg_reg, cs->hw.avm.cfg_reg + 8); return (0); } if (!request_region(cs->hw.avm.isac + 32, 32, "HiSax isac")) { printk(KERN_WARNING "HiSax: AVM A1 isac ports %x-%x already in use\n", cs->hw.avm.isac + 32, cs->hw.avm.isac + 64); release_ioregs(cs, 0); return (0); } if (!request_region(cs->hw.avm.isacfifo, 1, "HiSax isac fifo")) { printk(KERN_WARNING "HiSax: AVM A1 isac fifo port %x already in use\n", cs->hw.avm.isacfifo); release_ioregs(cs, 1); return (0); } if (!request_region(cs->hw.avm.hscx[0] + 32, 32, "HiSax hscx A")) { printk(KERN_WARNING "HiSax: AVM A1 hscx A ports %x-%x already in use\n", cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscx[0] + 64); release_ioregs(cs, 3); return (0); } if (!request_region(cs->hw.avm.hscxfifo[0], 1, "HiSax hscx A fifo")) { printk(KERN_WARNING "HiSax: AVM A1 hscx A fifo port %x already in use\n", cs->hw.avm.hscxfifo[0]); release_ioregs(cs, 7); return (0); } if (!request_region(cs->hw.avm.hscx[1] + 32, 32, "HiSax hscx B")) { printk(KERN_WARNING "HiSax: AVM A1 hscx B ports %x-%x already in use\n", cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscx[1] + 64); release_ioregs(cs, 0xf); return (0); } if (!request_region(cs->hw.avm.hscxfifo[1], 1, "HiSax hscx B fifo")) { printk(KERN_WARNING "HiSax: AVM A1 hscx B fifo port %x already in use\n", cs->hw.avm.hscxfifo[1]); release_ioregs(cs, 0x1f); return (0); } byteout(cs->hw.avm.cfg_reg, 0x0); HZDELAY(HZ / 5 + 1); byteout(cs->hw.avm.cfg_reg, 0x1); HZDELAY(HZ / 5 + 1); byteout(cs->hw.avm.cfg_reg, 0x0); HZDELAY(HZ / 5 + 1); val = cs->irq; if (val == 9) val = 2; byteout(cs->hw.avm.cfg_reg + 1, val); HZDELAY(HZ / 5 + 1); byteout(cs->hw.avm.cfg_reg, 0x0); HZDELAY(HZ / 5 + 1); val = bytein(cs->hw.avm.cfg_reg); printk(KERN_INFO "AVM A1: Byte at %x is %x\n", cs->hw.avm.cfg_reg, val); val = bytein(cs->hw.avm.cfg_reg + 3); printk(KERN_INFO "AVM A1: Byte at %x is %x\n", cs->hw.avm.cfg_reg + 3, val); val = bytein(cs->hw.avm.cfg_reg + 2); printk(KERN_INFO "AVM A1: Byte at %x is %x\n", cs->hw.avm.cfg_reg + 2, val); val = bytein(cs->hw.avm.cfg_reg); printk(KERN_INFO "AVM A1: Byte at %x is %x\n", cs->hw.avm.cfg_reg, val); printk(KERN_INFO "HiSax: AVM A1 config irq:%d cfg:0x%X\n", cs->irq, cs->hw.avm.cfg_reg); printk(KERN_INFO "HiSax: isac:0x%X/0x%X\n", cs->hw.avm.isac + 32, cs->hw.avm.isacfifo); printk(KERN_INFO "HiSax: hscx A:0x%X/0x%X hscx B:0x%X/0x%X\n", cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscxfifo[0], cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscxfifo[1]); 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; setup_isac(cs); cs->cardmsg = &AVM_card_msg; cs->irq_func = &avm_a1_interrupt; ISACVersion(cs, "AVM A1:"); if (HscxVersion(cs, "AVM A1:")) { printk(KERN_WARNING "AVM A1: wrong HSCX versions check IO address\n"); release_ioregs(cs, 0x3f); return (0); } return (1); }
static u_char ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) { return (bytein(calc_off(cs->hw.spt.hscx[hscx], offset))); }
static irqreturn_t netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) { struct IsdnCardState *cs = dev_id; u_char val, s1val, s0val; u_long flags; spin_lock_irqsave(&cs->lock, flags); s1val = bytein(cs->hw.njet.base + NETJET_IRQSTAT1); if (!(s1val & NETJET_ISACIRQ)) { val = NETjet_ReadIC(cs, ISAC_ISTA); if (cs->debug & L1_DEB_ISAC) debugl1(cs, "tiger: i1 %x %x", s1val, val); if (val) { isac_interrupt(cs, val); NETjet_WriteIC(cs, ISAC_MASK, 0xFF); NETjet_WriteIC(cs, ISAC_MASK, 0x0); } s1val = 1; } else s1val = 0; /* * read/write stat0 is better, because lower IRQ rate * Note the IRQ is on for 125 us if a condition match * thats long on modern CPU and so the IRQ is reentered * all the time. */ s0val = bytein(cs->hw.njet.base + NETJET_IRQSTAT0); if ((s0val | s1val)==0) { // shared IRQ spin_unlock_irqrestore(&cs->lock, flags); return IRQ_NONE; } if (s0val) byteout(cs->hw.njet.base + NETJET_IRQSTAT0, s0val); /* start new code 13/07/00 GE */ /* set bits in sval to indicate which page is free */ if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) < inl(cs->hw.njet.base + NETJET_DMA_WRITE_IRQ)) /* the 2nd write page is free */ s0val = 0x08; else /* the 1st write page is free */ s0val = 0x04; if (inl(cs->hw.njet.base + NETJET_DMA_READ_ADR) < inl(cs->hw.njet.base + NETJET_DMA_READ_IRQ)) /* the 2nd read page is free */ s0val |= 0x02; else /* the 1st read page is free */ s0val |= 0x01; if (s0val != cs->hw.njet.last_is0) /* we have a DMA interrupt */ { if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) { printk(KERN_WARNING "nj LOCK_ATOMIC s0val %x->%x\n", cs->hw.njet.last_is0, s0val); spin_unlock_irqrestore(&cs->lock, flags); return IRQ_HANDLED; } cs->hw.njet.irqstat0 = s0val; if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) != (cs->hw.njet.last_is0 & NETJET_IRQM0_READ)) /* we have a read dma int */ read_tiger(cs); if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_WRITE) != (cs->hw.njet.last_is0 & NETJET_IRQM0_WRITE)) /* we have a write dma int */ write_tiger(cs); /* end new code 13/07/00 GE */ test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); } spin_unlock_irqrestore(&cs->lock, flags); return IRQ_HANDLED; }
static int ergo_waitpofready(struct HYSDN_CARD *card) { tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */ int timecnt = 10000 / 50; /* timeout is 10 secs max. */ ulong flags; int msg_size; int i; if (card->debug_flags & LOG_POF_CARD) hysdn_addlog(card, "ERGO: waiting for pof ready"); while (timecnt--) { /* wait until timeout */ if (dpr->ToPcFlag) { /* data has arrived */ if ((dpr->ToPcChannel != CHAN_SYSTEM) || (dpr->ToPcSize < MIN_RDY_MSG_SIZE) || (dpr->ToPcSize > MAX_RDY_MSG_SIZE) || ((*(ulong *) dpr->ToPcBuf) != RDY_MAGIC)) break; /* an error occurred */ /* Check for additional data delivered during SysReady */ msg_size = dpr->ToPcSize - RDY_MAGIC_SIZE; if (msg_size > 0) if (EvalSysrTokData(card, dpr->ToPcBuf + RDY_MAGIC_SIZE, msg_size)) break; if (card->debug_flags & LOG_POF_RECORD) hysdn_addlog(card, "ERGO: pof boot success"); save_flags(flags); cli(); card->state = CARD_STATE_RUN; /* now card is running */ /* enable the cards interrupt */ byteout(card->iobase + PCI9050_INTR_REG, bytein(card->iobase + PCI9050_INTR_REG) | (PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1)); card->irq_enabled = 1; /* we are ready to receive interrupts */ dpr->ToPcFlag = 0; /* reset data indicator */ dpr->ToHyInt = 1; dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ restore_flags(flags); if ((hynet_enable & (1 << card->myid)) && (i = hysdn_net_create(card))) { ergo_stopcard(card); card->state = CARD_STATE_BOOTERR; return (i); } #ifdef CONFIG_HYSDN_CAPI if((i = hycapi_capi_create(card))) { printk(KERN_WARNING "HYSDN: failed to create capi-interface.\n"); } #endif /* CONFIG_HYSDN_CAPI */ return (0); /* success */ } /* data has arrived */ sti(); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout((50 * HZ) / 1000); /* Timeout 50ms */ } /* wait until timeout */ if (card->debug_flags & LOG_POF_CARD) hysdn_addlog(card, "ERGO: pof boot ready timeout"); return (-ERR_POF_TIMEOUT); } /* ergo_waitpofready */
static u_char ReadISAC(struct IsdnCardState *cs, u_char offset) { return (bytein(calc_off(cs->hw.spt.isac, offset))); }
static int Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) { int ret = 0; u_long flags; switch (mt) { case CARD_RESET: spin_lock_irqsave(&cs->lock, flags); reset_elsa(cs); spin_unlock_irqrestore(&cs->lock, flags); return(0); case CARD_RELEASE: release_io_elsa(cs); return(0); case CARD_INIT: spin_lock_irqsave(&cs->lock, flags); cs->debug |= L1_DEB_IPAC; reset_elsa(cs); inithscxisac(cs, 1); if ((cs->subtyp == ELSA_QS1000) || (cs->subtyp == ELSA_QS3000)) { byteout(cs->hw.elsa.timer, 0); } if (cs->hw.elsa.trig) byteout(cs->hw.elsa.trig, 0xff); inithscxisac(cs, 2); spin_unlock_irqrestore(&cs->lock, flags); return(0); case CARD_TEST: if ((cs->subtyp == ELSA_PCMCIA) || (cs->subtyp == ELSA_PCMCIA_IPAC) || (cs->subtyp == ELSA_QS1000PCI)) { return(0); } else if (cs->subtyp == ELSA_QS3000PCI) { ret = 0; } else { spin_lock_irqsave(&cs->lock, flags); cs->hw.elsa.counter = 0; cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT; cs->hw.elsa.status |= ELSA_TIMER_AKTIV; byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); byteout(cs->hw.elsa.timer, 0); spin_unlock_irqrestore(&cs->lock, flags); msleep(110); spin_lock_irqsave(&cs->lock, flags); cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT; byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV; spin_unlock_irqrestore(&cs->lock, flags); printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n", cs->hw.elsa.counter); if ((cs->hw.elsa.counter > 10) && (cs->hw.elsa.counter < 16)) { printk(KERN_INFO "Elsa: timer and irq OK\n"); ret = 0; } else { printk(KERN_WARNING "Elsa: timer tic problem (%d/12) maybe an IRQ(%d) conflict\n", cs->hw.elsa.counter, cs->irq); ret = 1; } } #if ARCOFI_USE if (check_arcofi(cs)) { init_modem(cs); } #endif elsa_led_handler(cs); return(ret); case (MDL_REMOVE | REQUEST): cs->hw.elsa.status &= 0; break; case (MDL_ASSIGN | REQUEST): cs->hw.elsa.status |= ELSA_ASSIGN; break; case MDL_INFO_SETUP: if ((long) arg) cs->hw.elsa.status |= 0x0200; else cs->hw.elsa.status |= 0x0100; break; case MDL_INFO_CONN: if ((long) arg) cs->hw.elsa.status |= 0x2000; else cs->hw.elsa.status |= 0x1000; break; case MDL_INFO_REL: if ((long) arg) { cs->hw.elsa.status &= ~0x2000; cs->hw.elsa.status &= ~0x0200; } else { cs->hw.elsa.status &= ~0x1000; cs->hw.elsa.status &= ~0x0100; } break; #if ARCOFI_USE case CARD_AUX_IND: if (cs->hw.elsa.MFlag) { int len; u_char *msg; if (!arg) return(0); msg = arg; len = *msg; msg++; modem_write_cmd(cs, msg, len); } break; #endif } if (cs->typ == ISDN_CTYPE_ELSA) { int pwr = bytein(cs->hw.elsa.ale); if (pwr & 0x08) cs->hw.elsa.status |= ELSA_BAD_PWR; else cs->hw.elsa.status &= ~ELSA_BAD_PWR; } elsa_led_handler(cs); return(ret); }
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); 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 (check_region((cs->hw.teles3.hscx[1]), 96 )) { 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 request_region(cs->hw.teles3.hscx[1], 96, "HiSax Teles PCMCIA"); } else { if (cs->hw.teles3.cfg_reg) { if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) { if (check_region((cs->hw.teles3.cfg_reg), 1)) { printk(KERN_WARNING "HiSax: %s config port %x already in use\n", CardType[card->typ], cs->hw.teles3.cfg_reg); return (0); } else request_region(cs->hw.teles3.cfg_reg, 1, "teles3 cfg"); } else { if (check_region((cs->hw.teles3.cfg_reg), 8)) { 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); } else request_region(cs->hw.teles3.cfg_reg, 8, "teles3 cfg"); } } if (check_region((cs->hw.teles3.isac + 32), 32)) { 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); } else request_region(cs->hw.teles3.isac + 32, 32, "HiSax isac"); if (check_region((cs->hw.teles3.hscx[0] + 32), 32)) { 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); } else request_region(cs->hw.teles3.hscx[0] + 32, 32, "HiSax hscx A"); if (check_region((cs->hw.teles3.hscx[1] + 32), 32)) { 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); } else request_region(cs->hw.teles3.hscx[1] + 32, 32, "HiSax hscx B"); } 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); 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); }
int __devinit setup_teles0(struct IsdnCard *card) { u_char val; struct IsdnCardState *cs = card->cs; char tmp[64]; strcpy(tmp, teles0_revision); ; if ((cs->typ != ISDN_CTYPE_16_0) && (cs->typ != ISDN_CTYPE_8_0)) return (0); if (cs->typ == ISDN_CTYPE_16_0) cs->hw.teles0.cfg_reg = card->para[2]; else /* 8.0 */ cs->hw.teles0.cfg_reg = 0; if (card->para[1] < 0x10000) { card->para[1] <<= 4; // printk(KERN_INFO // "Teles0: membase configured DOSish, assuming 0x%lx\n", ; } cs->irq = card->para[0]; if (cs->hw.teles0.cfg_reg) { if (!request_region(cs->hw.teles0.cfg_reg, 8, "teles cfg")) { // printk(KERN_WARNING // "HiSax: %s config port %x-%x already in use\n", // CardType[card->typ], // cs->hw.teles0.cfg_reg, ; return (0); } } if (cs->hw.teles0.cfg_reg) { if ((val = bytein(cs->hw.teles0.cfg_reg + 0)) != 0x51) { // printk(KERN_WARNING "Teles0: 16.0 Byte at %x is %x\n", ; release_region(cs->hw.teles0.cfg_reg, 8); return (0); } if ((val = bytein(cs->hw.teles0.cfg_reg + 1)) != 0x93) { // printk(KERN_WARNING "Teles0: 16.0 Byte at %x is %x\n", ; release_region(cs->hw.teles0.cfg_reg, 8); return (0); } val = bytein(cs->hw.teles0.cfg_reg + 2); /* 0x1e=without AB * 0x1f=with AB * 0x1c 16.3 ??? */ if (val != 0x1e && val != 0x1f) { // printk(KERN_WARNING "Teles0: 16.0 Byte at %x is %x\n", ; release_region(cs->hw.teles0.cfg_reg, 8); return (0); } } /* 16.0 and 8.0 designed for IOM1 */ test_and_set_bit(HW_IOM1, &cs->HW_Flags); cs->hw.teles0.phymem = card->para[1]; if (!request_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE, "teles iomem")) { // printk(KERN_WARNING // "HiSax: %s memory region %lx-%lx already in use\n", // CardType[card->typ], // cs->hw.teles0.phymem, ; if (cs->hw.teles0.cfg_reg) release_region(cs->hw.teles0.cfg_reg, 8); return (0); } cs->hw.teles0.membase = ioremap(cs->hw.teles0.phymem, TELES_IOMEM_SIZE); // printk(KERN_INFO // "HiSax: %s config irq:%d mem:%p cfg:0x%X\n", // CardType[cs->typ], cs->irq, ; if (reset_teles0(cs)) { ; release_io_teles0(cs); return (0); } 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 = &Teles_card_msg; cs->irq_func = &teles0_interrupt; ISACVersion(cs, "Teles0:"); if (HscxVersion(cs, "Teles0:")) { // printk(KERN_WARNING ; release_io_teles0(cs); return (0); } return (1); }
static irqreturn_t elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs) { struct IsdnCardState *cs = dev_id; u_long flags; u_char ista,val; int icnt=5; spin_lock_irqsave(&cs->lock, flags); if (cs->subtyp == ELSA_QS1000PCI || cs->subtyp == ELSA_QS3000PCI) { val = bytein(cs->hw.elsa.cfg + 0x4c); /* PCI IRQ */ if (!(val & ELSA_PCI_IRQ_MASK)) { spin_unlock_irqrestore(&cs->lock, flags); return IRQ_NONE; } } #if ARCOFI_USE if (cs->hw.elsa.MFlag) { val = serial_inp(cs, UART_IIR); if (!(val & UART_IIR_NO_INT)) { debugl1(cs,"IIR %02x", val); rs_interrupt_elsa(intno, cs); } } #endif ista = readreg(cs->hw.elsa.ale, cs->hw.elsa.isac, IPAC_ISTA); Start_IPAC: if (cs->debug & L1_DEB_IPAC) debugl1(cs, "IPAC ISTA %02X", ista); if (ista & 0x0f) { val = readreg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_ISTA + 0x40); if (ista & 0x01) val |= 0x01; if (ista & 0x04) val |= 0x02; if (ista & 0x08) val |= 0x04; if (val) hscx_int_main(cs, val); } if (ista & 0x20) { val = 0xfe & readreg(cs->hw.elsa.ale, cs->hw.elsa.isac, ISAC_ISTA + 0x80); if (val) { isac_interrupt(cs, val); } } if (ista & 0x10) { val = 0x01; isac_interrupt(cs, val); } ista = readreg(cs->hw.elsa.ale, cs->hw.elsa.isac, IPAC_ISTA); if ((ista & 0x3f) && icnt) { icnt--; goto Start_IPAC; } if (!icnt) printk(KERN_WARNING "ELSA IRQ LOOP\n"); writereg(cs->hw.elsa.ale, cs->hw.elsa.isac, IPAC_MASK, 0xFF); writereg(cs->hw.elsa.ale, cs->hw.elsa.isac, IPAC_MASK, 0xC0); spin_unlock_irqrestore(&cs->lock, flags); return IRQ_HANDLED; }
__initfunc(int setup_teles0(struct IsdnCard *card)) { u_char val; struct IsdnCardState *cs = card->cs; char tmp[64]; strcpy(tmp, teles0_revision); printk(KERN_INFO "HiSax: Teles 8.0/16.0 driver Rev. %s\n", HiSax_getrev(tmp)); if ((cs->typ != ISDN_CTYPE_16_0) && (cs->typ != ISDN_CTYPE_8_0)) return (0); if (cs->typ == ISDN_CTYPE_16_0) cs->hw.teles0.cfg_reg = card->para[2]; else /* 8.0 */ cs->hw.teles0.cfg_reg = 0; if (card->para[1] < 0x10000) { card->para[1] <<= 4; printk(KERN_INFO "Teles0: membase configured DOSish, assuming 0x%lx\n", (unsigned long) card->para[1]); } cs->hw.teles0.membase = card->para[1]; cs->irq = card->para[0]; if (cs->hw.teles0.cfg_reg) { if (check_region((cs->hw.teles0.cfg_reg), 8)) { printk(KERN_WARNING "HiSax: %s config port %x-%x already in use\n", CardType[card->typ], cs->hw.teles0.cfg_reg, cs->hw.teles0.cfg_reg + 8); return (0); } else { request_region(cs->hw.teles0.cfg_reg, 8, "teles cfg"); } } if (cs->hw.teles0.cfg_reg) { if ((val = bytein(cs->hw.teles0.cfg_reg + 0)) != 0x51) { printk(KERN_WARNING "Teles0: 16.0 Byte at %x is %x\n", cs->hw.teles0.cfg_reg + 0, val); release_region(cs->hw.teles0.cfg_reg, 8); return (0); } if ((val = bytein(cs->hw.teles0.cfg_reg + 1)) != 0x93) { printk(KERN_WARNING "Teles0: 16.0 Byte at %x is %x\n", cs->hw.teles0.cfg_reg + 1, val); release_region(cs->hw.teles0.cfg_reg, 8); return (0); } val = bytein(cs->hw.teles0.cfg_reg + 2); /* 0x1e=without AB * 0x1f=with AB * 0x1c 16.3 ??? */ if (val != 0x1e && val != 0x1f) { printk(KERN_WARNING "Teles0: 16.0 Byte at %x is %x\n", cs->hw.teles0.cfg_reg + 2, val); release_region(cs->hw.teles0.cfg_reg, 8); return (0); } } /* 16.0 and 8.0 designed for IOM1 */ test_and_set_bit(HW_IOM1, &cs->HW_Flags); printk(KERN_INFO "HiSax: %s config irq:%d mem:0x%X cfg:0x%X\n", CardType[cs->typ], cs->irq, cs->hw.teles0.membase, cs->hw.teles0.cfg_reg); if (reset_teles0(cs)) { printk(KERN_WARNING "Teles0: wrong IRQ\n"); release_io_teles0(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; ISACVersion(cs, "Teles0:"); if (HscxVersion(cs, "Teles0:")) { printk(KERN_WARNING "Teles0: wrong HSCX versions check IO/MEM addresses\n"); release_io_teles0(cs); return (0); } return (1); }
static inline u_char HscxReadReg(unsigned int adr, int WhichHscx, u_char off) { byteout(adr + HSCX_COMMAND_OFFSET, HSCX_OFFSET(WhichHscx, off)); return bytein(adr + HSCX_DATA_OFFSET); }
static inline u_char IsacReadReg(unsigned int adr, u_char off) { byteout(adr + ISAC_COMMAND_OFFSET, off + 0x20); return bytein(adr + ISAC_DATA_OFFSET); }
static inline u_char readreg(unsigned int adr, u_char off) { return (bytein(adr + off)); }
static void netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) { struct IsdnCardState *cs = dev_id; u_char val, sval; long flags; if (!cs) { printk(KERN_WARNING "NETjet-S: Spurious interrupt!\n"); return; } if (!((sval = bytein(cs->hw.njet.base + NETJET_IRQSTAT1)) & NETJET_ISACIRQ)) { val = NETjet_ReadIC(cs, ISAC_ISTA); if (cs->debug & L1_DEB_ISAC) debugl1(cs, "tiger: i1 %x %x", sval, val); if (val) { isac_interrupt(cs, val); NETjet_WriteIC(cs, ISAC_MASK, 0xFF); NETjet_WriteIC(cs, ISAC_MASK, 0x0); } } save_flags(flags); cli(); /* start new code 13/07/00 GE */ /* set bits in sval to indicate which page is free */ if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) < inl(cs->hw.njet.base + NETJET_DMA_WRITE_IRQ)) /* the 2nd write page is free */ sval = 0x08; else /* the 1st write page is free */ sval = 0x04; if (inl(cs->hw.njet.base + NETJET_DMA_READ_ADR) < inl(cs->hw.njet.base + NETJET_DMA_READ_IRQ)) /* the 2nd read page is free */ sval = sval | 0x02; else /* the 1st read page is free */ sval = sval | 0x01; if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */ { if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) { restore_flags(flags); return; } cs->hw.njet.irqstat0 = sval; restore_flags(flags); if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) != (cs->hw.njet.last_is0 & NETJET_IRQM0_READ)) /* we have a read dma int */ read_tiger(cs); if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_WRITE) != (cs->hw.njet.last_is0 & NETJET_IRQM0_WRITE)) /* we have a write dma int */ write_tiger(cs); /* end new code 13/07/00 GE */ test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); } else restore_flags(flags); /* if (!testcnt--) { cs->hw.njet.dmactrl = 0; byteout(cs->hw.njet.base + NETJET_DMACTRL, cs->hw.njet.dmactrl); byteout(cs->hw.njet.base + NETJET_IRQMASK0, 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", __func__, 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); } cs->irq_flags |= IRQF_SHARED; /* cardbus can share */ } 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); }
static inline u_char readreg(unsigned int adr, u_short off) { return bytein(adr + off); }