Release 4.7 drivers/isdn/hisax/teleint.c
/* $Id: teleint.c,v 1.16.2.5 2004/01/19 15:31:50 keil Exp $
*
* low level stuff for TeleInt isdn cards
*
* Author Karsten Keil
* Copyright by Karsten Keil <keil@isdn4linux.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/init.h>
#include "hisax.h"
#include "isac.h"
#include "hfc_2bs0.h"
#include "isdnl1.h"
static const char *TeleInt_revision = "$Revision: 1.16.2.5 $";
#define byteout(addr, val) outb(val, addr)
#define bytein(addr) inb(addr)
static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
int max_delay = 2000;
byteout(ale, off);
ret = HFC_BUSY & bytein(ale);
while (ret && --max_delay)
ret = HFC_BUSY & bytein(ale);
if (!max_delay) {
printk(KERN_WARNING "TeleInt Busy not inactive\n");
return (0);
}
ret = bytein(adr);
return (ret);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 86 | 96.63% | 2 | 66.67% |
andrew morton | andrew morton | 3 | 3.37% | 1 | 33.33% |
| Total | 89 | 100.00% | 3 | 100.00% |
static inline void
readfifo(unsigned int ale, unsigned int adr, u_char off, u_char *data, int size)
{
register u_char ret;
register int max_delay = 20000;
register int i;
byteout(ale, off);
for (i = 0; i < size; i++) {
ret = HFC_BUSY & bytein(ale);
while (ret && --max_delay)
ret = HFC_BUSY & bytein(ale);
if (!max_delay) {
printk(KERN_WARNING "TeleInt Busy not inactive\n");
return;
}
data[i] = bytein(adr);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 107 | 97.27% | 3 | 75.00% |
andrew morton | andrew morton | 3 | 2.73% | 1 | 25.00% |
| Total | 110 | 100.00% | 4 | 100.00% |
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
register u_char ret;
int max_delay = 2000;
byteout(ale, off);
ret = HFC_BUSY & bytein(ale);
while (ret && --max_delay)
ret = HFC_BUSY & bytein(ale);
if (!max_delay) {
printk(KERN_WARNING "TeleInt Busy not inactive\n");
return;
}
byteout(adr, data);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 80 | 96.39% | 2 | 66.67% |
andrew morton | andrew morton | 3 | 3.61% | 1 | 33.33% |
| Total | 83 | 100.00% | 3 | 100.00% |
static inline void
writefifo(unsigned int ale, unsigned int adr, u_char off, u_char *data, int size)
{
register u_char ret;
register int max_delay = 20000;
register int i;
byteout(ale, off);
for (i = 0; i < size; i++) {
ret = HFC_BUSY & bytein(ale);
while (ret && --max_delay)
ret = HFC_BUSY & bytein(ale);
if (!max_delay) {
printk(KERN_WARNING "TeleInt Busy not inactive\n");
return;
}
byteout(adr, data[i]);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 107 | 97.27% | 3 | 75.00% |
andrew morton | andrew morton | 3 | 2.73% | 1 | 25.00% |
| Total | 110 | 100.00% | 4 | 100.00% |
/* Interface functions */
static u_char
ReadISAC(struct IsdnCardState *cs, u_char offset)
{
cs->hw.hfc.cip = offset;
return (readreg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, offset));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 48 | 96.00% | 1 | 50.00% |
andrew morton | andrew morton | 2 | 4.00% | 1 | 50.00% |
| Total | 50 | 100.00% | 2 | 100.00% |
static void
WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
{
cs->hw.hfc.cip = offset;
writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, offset, value);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 50 | 96.15% | 1 | 50.00% |
andrew morton | andrew morton | 2 | 3.85% | 1 | 50.00% |
| Total | 52 | 100.00% | 2 | 100.00% |
static void
ReadISACfifo(struct IsdnCardState *cs, u_char *data, int size)
{
cs->hw.hfc.cip = 0;
readfifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 54 | 98.18% | 1 | 50.00% |
andrew morton | andrew morton | 1 | 1.82% | 1 | 50.00% |
| Total | 55 | 100.00% | 2 | 100.00% |
static void
WriteISACfifo(struct IsdnCardState *cs, u_char *data, int size)
{
cs->hw.hfc.cip = 0;
writefifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 54 | 98.18% | 1 | 50.00% |
andrew morton | andrew morton | 1 | 1.82% | 1 | 50.00% |
| Total | 55 | 100.00% | 2 | 100.00% |
static u_char
ReadHFC(struct IsdnCardState *cs, int data, u_char reg)
{
register u_char ret;
if (data) {
cs->hw.hfc.cip = reg;
byteout(cs->hw.hfc.addr | 1, reg);
ret = bytein(cs->hw.hfc.addr);
if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2))
debugl1(cs, "hfc RD %02x %02x", reg, ret);
} else
ret = bytein(cs->hw.hfc.addr | 1);
return (ret);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 108 | 97.30% | 2 | 66.67% |
andrew morton | andrew morton | 3 | 2.70% | 1 | 33.33% |
| Total | 111 | 100.00% | 3 | 100.00% |
static void
WriteHFC(struct IsdnCardState *cs, int data, u_char reg, u_char value)
{
byteout(cs->hw.hfc.addr | 1, reg);
cs->hw.hfc.cip = reg;
if (data)
byteout(cs->hw.hfc.addr, value);
if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2))
debugl1(cs, "hfc W%c %02x %02x", data ? 'D' : 'C', reg, value);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 91 | 97.85% | 2 | 66.67% |
andrew morton | andrew morton | 2 | 2.15% | 1 | 33.33% |
| Total | 93 | 100.00% | 3 | 100.00% |
static irqreturn_t
TeleInt_interrupt(int intno, void *dev_id)
{
struct IsdnCardState *cs = dev_id;
u_char val;
u_long flags;
spin_lock_irqsave(&cs->lock, flags);
val = readreg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_ISTA);
Start_ISAC:
if (val)
isac_interrupt(cs, val);
val = readreg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_ISTA);
if (val) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "ISAC IntStat after IntRoutine");
goto Start_ISAC;
}
writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_MASK, 0xFF);
writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_MASK, 0x0);
spin_unlock_irqrestore(&cs->lock, flags);
return IRQ_HANDLED;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 160 | 86.02% | 1 | 25.00% |
andrew morton | andrew morton | 15 | 8.06% | 2 | 50.00% |
kai germaschewski | kai germaschewski | 11 | 5.91% | 1 | 25.00% |
| Total | 186 | 100.00% | 4 | 100.00% |
static void
TeleInt_Timer(struct IsdnCardState *cs)
{
int stat = 0;
u_long flags;
spin_lock_irqsave(&cs->lock, flags);
if (cs->bcs[0].mode) {
stat |= 1;
main_irq_hfc(&cs->bcs[0]);
}
if (cs->bcs[1].mode) {
stat |= 2;
main_irq_hfc(&cs->bcs[1]);
}
spin_unlock_irqrestore(&cs->lock, flags);
stat = HZ / 100;
if (!stat)
stat = 1;
cs->hw.hfc.timer.expires = jiffies + stat;
add_timer(&cs->hw.hfc.timer);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 97 | 71.32% | 1 | 50.00% |
andrew morton | andrew morton | 39 | 28.68% | 1 | 50.00% |
| Total | 136 | 100.00% | 2 | 100.00% |
static void
release_io_TeleInt(struct IsdnCardState *cs)
{
del_timer(&cs->hw.hfc.timer);
releasehfc(cs);
if (cs->hw.hfc.addr)
release_region(cs->hw.hfc.addr, 2);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 30 | 58.82% | 1 | 33.33% |
andrew morton | andrew morton | 20 | 39.22% | 1 | 33.33% |
adrian bunk | adrian bunk | 1 | 1.96% | 1 | 33.33% |
| Total | 51 | 100.00% | 3 | 100.00% |
static void
reset_TeleInt(struct IsdnCardState *cs)
{
printk(KERN_INFO "TeleInt: resetting card\n");
cs->hw.hfc.cirm |= HFC_RESET;
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm); /* Reset On */
mdelay(10);
cs->hw.hfc.cirm &= ~HFC_RESET;
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm); /* Reset Off */
mdelay(10);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 87 | 94.57% | 3 | 75.00% |
andrew morton | andrew morton | 5 | 5.43% | 1 | 25.00% |
| Total | 92 | 100.00% | 4 | 100.00% |
static int
TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
u_long flags;
int delay;
switch (mt) {
case CARD_RESET:
spin_lock_irqsave(&cs->lock, flags);
reset_TeleInt(cs);
spin_unlock_irqrestore(&cs->lock, flags);
return (0);
case CARD_RELEASE:
release_io_TeleInt(cs);
return (0);
case CARD_INIT:
spin_lock_irqsave(&cs->lock, flags);
reset_TeleInt(cs);
inithfc(cs);
clear_pending_isac_ints(cs);
initisac(cs);
/* Reenable all IRQ */
cs->writeisac(cs, ISAC_MASK, 0);
cs->writeisac(cs, ISAC_CMDR, 0x41);
spin_unlock_irqrestore(&cs->lock, flags);
delay = HZ / 100;
if (!delay)
delay = 1;
cs->hw.hfc.timer.expires = jiffies + delay;
add_timer(&cs->hw.hfc.timer);
return (0);
case CARD_TEST:
return (0);
}
return (0);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andrew morton | andrew morton | 173 | 86.07% | 1 | 20.00% |
pre-git | pre-git | 18 | 8.96% | 1 | 20.00% |
kai germaschewski | kai germaschewski | 10 | 4.98% | 3 | 60.00% |
| Total | 201 | 100.00% | 5 | 100.00% |
int setup_TeleInt(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, TeleInt_revision);
printk(KERN_INFO "HiSax: TeleInt driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_TELEINT)
return (0);
cs->hw.hfc.addr = card->para[1] & 0x3fe;
cs->irq = card->para[0];
cs->hw.hfc.cirm = HFC_CIRM;
cs->hw.hfc.isac_spcr = 0x00;
cs->hw.hfc.cip = 0;
cs->hw.hfc.ctmt = HFC_CTMT | HFC_CLTIMER;
cs->bcs[0].hw.hfc.send = NULL;
cs->bcs[1].hw.hfc.send = NULL;
cs->hw.hfc.fifosize = 7 * 1024 + 512;
cs->hw.hfc.timer.function = (void *) TeleInt_Timer;
cs->hw.hfc.timer.data = (long) cs;
init_timer(&cs->hw.hfc.timer);
if (!request_region(cs->hw.hfc.addr, 2, "TeleInt isdn")) {
printk(KERN_WARNING
"HiSax: TeleInt config port %x-%x already in use\n",
cs->hw.hfc.addr,
cs->hw.hfc.addr + 2);
return (0);
}
/* HW IO = IO */
byteout(cs->hw.hfc.addr, cs->hw.hfc.addr & 0xff);
byteout(cs->hw.hfc.addr | 1, ((cs->hw.hfc.addr & 0x300) >> 8) | 0x54);
switch (cs->irq) {
case 3:
cs->hw.hfc.cirm |= HFC_INTA;
break;
case 4:
cs->hw.hfc.cirm |= HFC_INTB;
break;
case 5:
cs->hw.hfc.cirm |= HFC_INTC;
break;
case 7:
cs->hw.hfc.cirm |= HFC_INTD;
break;
case 10:
cs->hw.hfc.cirm |= HFC_INTE;
break;
case 11:
cs->hw.hfc.cirm |= HFC_INTF;
break;
default:
printk(KERN_WARNING "TeleInt: wrong IRQ\n");
release_io_TeleInt(cs);
return (0);
}
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm);
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.ctmt);
printk(KERN_INFO "TeleInt: defined at 0x%x IRQ %d\n",
cs->hw.hfc.addr, cs->irq);
setup_isac(cs);
cs->readisac = &ReadISAC;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->BC_Read_Reg = &ReadHFC;
cs->BC_Write_Reg = &WriteHFC;
cs->cardmsg = &TeleInt_card_msg;
cs->irq_func = &TeleInt_interrupt;
ISACVersion(cs, "TeleInt:");
return (1);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 402 | 72.17% | 2 | 22.22% |
andrew morton | andrew morton | 137 | 24.60% | 1 | 11.11% |
kai germaschewski | kai germaschewski | 16 | 2.87% | 4 | 44.44% |
jeff garzik | jeff garzik | 1 | 0.18% | 1 | 11.11% |
greg kroah-hartman | greg kroah-hartman | 1 | 0.18% | 1 | 11.11% |
| Total | 557 | 100.00% | 9 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 1615 | 77.94% | 6 | 30.00% |
andrew morton | andrew morton | 413 | 19.93% | 2 | 10.00% |
kai germaschewski | kai germaschewski | 38 | 1.83% | 8 | 40.00% |
joe perches | joe perches | 2 | 0.10% | 1 | 5.00% |
adrian bunk | adrian bunk | 2 | 0.10% | 1 | 5.00% |
greg kroah-hartman | greg kroah-hartman | 1 | 0.05% | 1 | 5.00% |
jeff garzik | jeff garzik | 1 | 0.05% | 1 | 5.00% |
| Total | 2072 | 100.00% | 20 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.