Commit 55953e4c authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Shared xmit_data_req() for B-channel

Again, lots of drivers duplicated code to start transmitting a
B-channel frame. Now we do this from one place, and the converted
drivers are obviously serialized w.r.t. calling ->BC_Send_Data()
parent 183fdaad
...@@ -375,22 +375,15 @@ hdlc_fill_fifo(struct BCState *bcs) ...@@ -375,22 +375,15 @@ hdlc_fill_fifo(struct BCState *bcs)
} }
} }
static void
fill_hdlc(struct BCState *bcs)
{
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
hdlc_fill_fifo(bcs);
spin_unlock_irqrestore(&avm_pci_lock, flags);
}
static inline void static inline void
HDLC_irq(struct BCState *bcs, u_int stat) { HDLC_irq(struct BCState *bcs, u_int stat)
{
int len; int len;
struct sk_buff *skb; struct sk_buff *skb;
if (bcs->cs->debug & L1_DEB_HSCX) if (bcs->cs->debug & L1_DEB_HSCX)
debugl1(bcs->cs, "ch%d stat %#x", bcs->channel, stat); debugl1(bcs->cs, "ch%d stat %#x", bcs->channel, stat);
if (stat & HDLC_INT_RPR) { if (stat & HDLC_INT_RPR) {
if (stat & HDLC_STAT_RDO) { if (stat & HDLC_STAT_RDO) {
if (bcs->cs->debug & L1_DEB_HSCX) if (bcs->cs->debug & L1_DEB_HSCX)
...@@ -464,10 +457,9 @@ inline void ...@@ -464,10 +457,9 @@ inline void
HDLC_irq_main(struct IsdnCardState *cs) HDLC_irq_main(struct IsdnCardState *cs)
{ {
u_int stat; u_int stat;
long flags;
struct BCState *bcs; struct BCState *bcs;
spin_lock_irqsave(&avm_pci_lock, flags); spin_lock(&cs->lock);
if (cs->subtyp == AVM_FRITZ_PCI) { if (cs->subtyp == AVM_FRITZ_PCI) {
stat = ReadHDLCPCI(cs, 0, HDLC_STATUS); stat = ReadHDLCPCI(cs, 0, HDLC_STATUS);
} else { } else {
...@@ -496,28 +488,17 @@ HDLC_irq_main(struct IsdnCardState *cs) ...@@ -496,28 +488,17 @@ HDLC_irq_main(struct IsdnCardState *cs)
} else } else
HDLC_irq(bcs, stat); HDLC_irq(bcs, stat);
} }
spin_unlock_irqrestore(&avm_pci_lock, flags); spin_unlock(&cs->lock);
} }
void void
hdlc_l2l1(struct PStack *st, int pr, void *arg) hdlc_l2l1(struct PStack *st, int pr, void *arg)
{ {
struct sk_buff *skb = arg; struct sk_buff *skb = arg;
unsigned long flags;
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&avm_pci_lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
spin_unlock_irqrestore(&avm_pci_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->count = 0;
spin_unlock_irqrestore(&avm_pci_lock, flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
...@@ -851,7 +832,7 @@ setup_avm_pcipnp(struct IsdnCard *card) ...@@ -851,7 +832,7 @@ setup_avm_pcipnp(struct IsdnCard *card)
cs->writeisac = &WriteISAC; cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo; cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo; cs->writeisacfifo = &WriteISACfifo;
cs->BC_Send_Data = &fill_hdlc; cs->BC_Send_Data = &hdlc_fill_fifo;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
cs->irq_func = &avm_pcipnp_interrupt; cs->irq_func = &avm_pcipnp_interrupt;
ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:"); ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:");
......
...@@ -505,17 +505,7 @@ hfc_l2l1(struct PStack *st, int pr, void *arg) ...@@ -505,17 +505,7 @@ hfc_l2l1(struct PStack *st, int pr, void *arg)
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
save_flags(flags); xmit_data_req(st->l1.bcs, skb);
cli();
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
} else {
st->l1.bcs->tx_skb = skb;
/* test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
*/ st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
restore_flags(flags);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
...@@ -469,17 +469,7 @@ hfc_l2l1(struct PStack *st, int pr, void *arg) ...@@ -469,17 +469,7 @@ hfc_l2l1(struct PStack *st, int pr, void *arg)
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
save_flags(flags); xmit_data_req_b(st->l1.bcs, skb);
cli();
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
restore_flags(flags);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
...@@ -1401,17 +1401,7 @@ hfcpci_l2l1(struct PStack *st, int pr, void *arg) ...@@ -1401,17 +1401,7 @@ hfcpci_l2l1(struct PStack *st, int pr, void *arg)
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
save_flags(flags); xmit_data_req(st->l1.bcs, skb);
cli();
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
} else {
st->l1.bcs->tx_skb = skb;
/* test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
*/ st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
restore_flags(flags);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
...@@ -1189,17 +1189,7 @@ hfcsx_l2l1(struct PStack *st, int pr, void *arg) ...@@ -1189,17 +1189,7 @@ hfcsx_l2l1(struct PStack *st, int pr, void *arg)
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
save_flags(flags); xmit_data_req(st->l1.bcs, skb);
cli();
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
} else {
st->l1.bcs->tx_skb = skb;
/* test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
*/ st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
restore_flags(flags);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
...@@ -374,7 +374,6 @@ struct isar_reg { ...@@ -374,7 +374,6 @@ struct isar_reg {
struct isar_hw { struct isar_hw {
int dpath; int dpath;
int rcvidx; int rcvidx;
int txcnt;
int mml; int mml;
u_char state; u_char state;
u_char cmd; u_char cmd;
......
...@@ -100,16 +100,7 @@ hscx_l2l1(struct PStack *st, int pr, void *arg) ...@@ -100,16 +100,7 @@ hscx_l2l1(struct PStack *st, int pr, void *arg)
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&cs->lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->count = 0;
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
spin_unlock_irqrestore(&cs->lock, flags);
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
spin_lock_irqsave(&cs->lock, flags); spin_lock_irqsave(&cs->lock, flags);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#define MAX_DFRAME_LEN_L1 300 #define MAX_DFRAME_LEN_L1 300
#define B_FIFO_SIZE 64 #define B_FIFO_SIZE 64
#define D_FIFO_SIZE 32 #define D_FIFO_SIZE 32
static spinlock_t ipacx_lock = SPIN_LOCK_UNLOCKED;
// ipacx interrupt mask values // ipacx interrupt mask values
#define _MASK_IMASK 0x2E // global mask #define _MASK_IMASK 0x2E // global mask
...@@ -313,7 +312,6 @@ dch_sched_event(struct IsdnCardState *cs, int event) ...@@ -313,7 +312,6 @@ dch_sched_event(struct IsdnCardState *cs, int event)
static void static void
dch_empty_fifo(struct IsdnCardState *cs, int count) dch_empty_fifo(struct IsdnCardState *cs, int count)
{ {
unsigned long flags;
u_char *ptr; u_char *ptr;
if ((cs->debug &L1_DEB_ISAC) && !(cs->debug &L1_DEB_ISAC_FIFO)) if ((cs->debug &L1_DEB_ISAC) && !(cs->debug &L1_DEB_ISAC_FIFO))
...@@ -331,10 +329,8 @@ dch_empty_fifo(struct IsdnCardState *cs, int count) ...@@ -331,10 +329,8 @@ dch_empty_fifo(struct IsdnCardState *cs, int count)
ptr = cs->rcvbuf + cs->rcvidx; ptr = cs->rcvbuf + cs->rcvidx;
cs->rcvidx += count; cs->rcvidx += count;
spin_lock_irqsave(&ipacx_lock, flags);
cs->readisacfifo(cs, ptr, count); cs->readisacfifo(cs, ptr, count);
cs->writeisac(cs, IPACX_CMDRD, 0x80); // RMC cs->writeisac(cs, IPACX_CMDRD, 0x80); // RMC
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_ISAC_FIFO) { if (cs->debug &L1_DEB_ISAC_FIFO) {
char *t = cs->dlog; char *t = cs->dlog;
...@@ -351,7 +347,6 @@ dch_empty_fifo(struct IsdnCardState *cs, int count) ...@@ -351,7 +347,6 @@ dch_empty_fifo(struct IsdnCardState *cs, int count)
static void static void
dch_fill_fifo(struct IsdnCardState *cs) dch_fill_fifo(struct IsdnCardState *cs)
{ {
unsigned long flags;
int count; int count;
u_char cmd, *ptr; u_char cmd, *ptr;
...@@ -369,7 +364,6 @@ dch_fill_fifo(struct IsdnCardState *cs) ...@@ -369,7 +364,6 @@ dch_fill_fifo(struct IsdnCardState *cs)
cmd = 0x0A; // XTF | XME cmd = 0x0A; // XTF | XME
} }
spin_lock_irqsave(&ipacx_lock, flags);
ptr = cs->tx_skb->data; ptr = cs->tx_skb->data;
skb_pull(cs->tx_skb, count); skb_pull(cs->tx_skb, count);
cs->tx_cnt += count; cs->tx_cnt += count;
...@@ -384,7 +378,6 @@ dch_fill_fifo(struct IsdnCardState *cs) ...@@ -384,7 +378,6 @@ dch_fill_fifo(struct IsdnCardState *cs)
init_timer(&cs->dbusytimer); init_timer(&cs->dbusytimer);
cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000); cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
add_timer(&cs->dbusytimer); add_timer(&cs->dbusytimer);
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_ISAC_FIFO) { if (cs->debug &L1_DEB_ISAC_FIFO) {
char *t = cs->dlog; char *t = cs->dlog;
...@@ -403,7 +396,6 @@ dch_int(struct IsdnCardState *cs) ...@@ -403,7 +396,6 @@ dch_int(struct IsdnCardState *cs)
{ {
struct sk_buff *skb; struct sk_buff *skb;
u_char istad, rstad; u_char istad, rstad;
unsigned long flags;
int count; int count;
istad = cs->readisac(cs, IPACX_ISTAD); istad = cs->readisac(cs, IPACX_ISTAD);
...@@ -427,7 +419,6 @@ dch_int(struct IsdnCardState *cs) ...@@ -427,7 +419,6 @@ dch_int(struct IsdnCardState *cs)
count &= D_FIFO_SIZE-1; count &= D_FIFO_SIZE-1;
if (count == 0) count = D_FIFO_SIZE; if (count == 0) count = D_FIFO_SIZE;
dch_empty_fifo(cs, count); dch_empty_fifo(cs, count);
spin_lock_irqsave(&ipacx_lock, flags);
if ((count = cs->rcvidx) > 0) { if ((count = cs->rcvidx) > 0) {
cs->rcvidx = 0; cs->rcvidx = 0;
if (!(skb = dev_alloc_skb(count))) if (!(skb = dev_alloc_skb(count)))
...@@ -437,7 +428,6 @@ dch_int(struct IsdnCardState *cs) ...@@ -437,7 +428,6 @@ dch_int(struct IsdnCardState *cs)
skb_queue_tail(&cs->rq, skb); skb_queue_tail(&cs->rq, skb);
} }
} }
spin_unlock_irqrestore(&ipacx_lock, flags);
} }
cs->rcvidx = 0; cs->rcvidx = 0;
dch_sched_event(cs, D_RCVBUFREADY); dch_sched_event(cs, D_RCVBUFREADY);
...@@ -531,21 +521,10 @@ static void ...@@ -531,21 +521,10 @@ static void
bch_l2l1(struct PStack *st, int pr, void *arg) bch_l2l1(struct PStack *st, int pr, void *arg)
{ {
struct sk_buff *skb = arg; struct sk_buff *skb = arg;
unsigned long flags;
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&ipacx_lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
spin_unlock_irqrestore(&ipacx_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->count = 0;
spin_unlock_irqrestore(&ipacx_lock, flags);
ipacx_fill_fifo(st->l1.bcs);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
...@@ -589,7 +568,6 @@ bch_empty_fifo(struct BCState *bcs, int count) ...@@ -589,7 +568,6 @@ bch_empty_fifo(struct BCState *bcs, int count)
{ {
u_char *ptr, hscx; u_char *ptr, hscx;
struct IsdnCardState *cs; struct IsdnCardState *cs;
unsigned long flags;
int cnt; int cnt;
cs = bcs->cs; cs = bcs->cs;
...@@ -607,7 +585,6 @@ bch_empty_fifo(struct BCState *bcs, int count) ...@@ -607,7 +585,6 @@ bch_empty_fifo(struct BCState *bcs, int count)
} }
// Read data uninterruptible // Read data uninterruptible
spin_lock_irqsave(&ipacx_lock, flags);
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx; ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
cnt = count; cnt = count;
while (cnt--) *ptr++ = cs->BC_Read_Reg(cs, hscx, IPACX_RFIFOB); while (cnt--) *ptr++ = cs->BC_Read_Reg(cs, hscx, IPACX_RFIFOB);
...@@ -615,7 +592,6 @@ bch_empty_fifo(struct BCState *bcs, int count) ...@@ -615,7 +592,6 @@ bch_empty_fifo(struct BCState *bcs, int count)
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx; ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
bcs->hw.hscx.rcvidx += count; bcs->hw.hscx.rcvidx += count;
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_HSCX_FIFO) { if (cs->debug &L1_DEB_HSCX_FIFO) {
char *t = bcs->blog; char *t = bcs->blog;
...@@ -635,7 +611,6 @@ ipacx_fill_fifo(struct BCState *bcs) ...@@ -635,7 +611,6 @@ ipacx_fill_fifo(struct BCState *bcs)
struct IsdnCardState *cs; struct IsdnCardState *cs;
int more, count, cnt; int more, count, cnt;
u_char *ptr, *p, hscx; u_char *ptr, *p, hscx;
unsigned long flags;
cs = bcs->cs; cs = bcs->cs;
if ((cs->debug &L1_DEB_HSCX) && !(cs->debug &L1_DEB_HSCX_FIFO)) if ((cs->debug &L1_DEB_HSCX) && !(cs->debug &L1_DEB_HSCX_FIFO))
...@@ -654,14 +629,12 @@ ipacx_fill_fifo(struct BCState *bcs) ...@@ -654,14 +629,12 @@ ipacx_fill_fifo(struct BCState *bcs)
} }
cnt = count; cnt = count;
spin_lock_irqsave(&ipacx_lock, flags);
p = ptr = bcs->tx_skb->data; p = ptr = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count); skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count; bcs->tx_cnt -= count;
bcs->count += count; bcs->count += count;
while (cnt--) cs->BC_Write_Reg(cs, hscx, IPACX_XFIFOB, *p++); while (cnt--) cs->BC_Write_Reg(cs, hscx, IPACX_XFIFOB, *p++);
cs->BC_Write_Reg(cs, hscx, IPACX_CMDRB, (more ? 0x08 : 0x0a)); cs->BC_Write_Reg(cs, hscx, IPACX_CMDRB, (more ? 0x08 : 0x0a));
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_HSCX_FIFO) { if (cs->debug &L1_DEB_HSCX_FIFO) {
char *t = bcs->blog; char *t = bcs->blog;
...@@ -917,12 +890,14 @@ interrupt_ipacx(struct IsdnCardState *cs) ...@@ -917,12 +890,14 @@ interrupt_ipacx(struct IsdnCardState *cs)
{ {
u_char ista; u_char ista;
spin_lock(&cs->lock);
while ((ista = cs->readisac(cs, IPACX_ISTA))) { while ((ista = cs->readisac(cs, IPACX_ISTA))) {
if (ista &0x80) bch_int(cs, 0); // B channel interrupts if (ista &0x80) bch_int(cs, 0); // B channel interrupts
if (ista &0x40) bch_int(cs, 1); if (ista &0x40) bch_int(cs, 1);
if (ista &0x01) dch_int(cs); // D channel if (ista &0x01) dch_int(cs); // D channel
if (ista &0x10) cic_int(cs); // Layer 1 state if (ista &0x10) cic_int(cs); // Layer 1 state
} }
spin_unlock(&cs->lock);
} }
//---------------------------------------------------------- //----------------------------------------------------------
......
...@@ -190,7 +190,6 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -190,7 +190,6 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
u_short sadr, left, *sp; u_short sadr, left, *sp;
u_char *p = buf; u_char *p = buf;
u_char *msg, *tmpmsg, *mp, tmp[64]; u_char *msg, *tmpmsg, *mp, tmp[64];
unsigned long flags;
struct isar_reg *ireg = cs->bcs[0].hw.isar.reg; struct isar_reg *ireg = cs->bcs[0].hw.isar.reg;
struct {u_short sadr; struct {u_short sadr;
...@@ -344,7 +343,6 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -344,7 +343,6 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
/* NORMAL mode entered */ /* NORMAL mode entered */
/* Enable IRQs of ISAR */ /* Enable IRQs of ISAR */
cs->BC_Write_Reg(cs, 0, ISAR_IRQBIT, ISAR_IRQSTA); cs->BC_Write_Reg(cs, 0, ISAR_IRQBIT, ISAR_IRQSTA);
spin_lock_irqsave(&isar_lock, flags);
cnt = 1000; /* max 1s */ cnt = 1000; /* max 1s */
while ((!ireg->bstat) && cnt) { while ((!ireg->bstat) && cnt) {
udelay(1000); udelay(1000);
...@@ -352,7 +350,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -352,7 +350,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
} }
if (!cnt) { if (!cnt) {
printk(KERN_ERR"isar no general status event received\n"); printk(KERN_ERR"isar no general status event received\n");
ret = 1;goto reterrflg; ret = 1;goto reterror;
} else { } else {
printk(KERN_DEBUG"isar general status event %x\n", printk(KERN_DEBUG"isar general status event %x\n",
ireg->bstat); ireg->bstat);
...@@ -364,7 +362,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -364,7 +362,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
ireg->iis = 0; ireg->iis = 0;
if (!sendmsg(cs, ISAR_HIS_DIAG, ISAR_CTRL_STST, 0, NULL)) { if (!sendmsg(cs, ISAR_HIS_DIAG, ISAR_CTRL_STST, 0, NULL)) {
printk(KERN_ERR"isar sendmsg self tst failed\n"); printk(KERN_ERR"isar sendmsg self tst failed\n");
ret = 1;goto reterrflg; ret = 1;goto reterror;
} }
cnt = 10000; /* max 100 ms */ cnt = 10000; /* max 100 ms */
while ((ireg->iis != ISAR_IIS_DIAG) && cnt) { while ((ireg->iis != ISAR_IIS_DIAG) && cnt) {
...@@ -374,7 +372,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -374,7 +372,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
udelay(1000); udelay(1000);
if (!cnt) { if (!cnt) {
printk(KERN_ERR"isar no self tst response\n"); printk(KERN_ERR"isar no self tst response\n");
ret = 1;goto reterrflg; ret = 1;goto reterror;
} }
if ((ireg->cmsb == ISAR_CTRL_STST) && (ireg->clsb == 1) if ((ireg->cmsb == ISAR_CTRL_STST) && (ireg->clsb == 1)
&& (ireg->par[0] == 0)) { && (ireg->par[0] == 0)) {
...@@ -382,12 +380,12 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -382,12 +380,12 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
} else { } else {
printk(KERN_DEBUG"isar selftest not OK %x/%x/%x\n", printk(KERN_DEBUG"isar selftest not OK %x/%x/%x\n",
ireg->cmsb, ireg->clsb, ireg->par[0]); ireg->cmsb, ireg->clsb, ireg->par[0]);
ret = 1;goto reterrflg; ret = 1;goto reterror;
} }
ireg->iis = 0; ireg->iis = 0;
if (!sendmsg(cs, ISAR_HIS_DIAG, ISAR_CTRL_SWVER, 0, NULL)) { if (!sendmsg(cs, ISAR_HIS_DIAG, ISAR_CTRL_SWVER, 0, NULL)) {
printk(KERN_ERR"isar RQST SVN failed\n"); printk(KERN_ERR"isar RQST SVN failed\n");
ret = 1;goto reterrflg; ret = 1;goto reterror;
} }
cnt = 30000; /* max 300 ms */ cnt = 30000; /* max 300 ms */
while ((ireg->iis != ISAR_IIS_DIAG) && cnt) { while ((ireg->iis != ISAR_IIS_DIAG) && cnt) {
...@@ -397,7 +395,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -397,7 +395,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
udelay(1000); udelay(1000);
if (!cnt) { if (!cnt) {
printk(KERN_ERR"isar no SVN response\n"); printk(KERN_ERR"isar no SVN response\n");
ret = 1;goto reterrflg; ret = 1;goto reterror;
} else { } else {
if ((ireg->cmsb == ISAR_CTRL_SWVER) && (ireg->clsb == 1)) if ((ireg->cmsb == ISAR_CTRL_SWVER) && (ireg->clsb == 1))
printk(KERN_DEBUG"isar software version %#x\n", printk(KERN_DEBUG"isar software version %#x\n",
...@@ -405,14 +403,12 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf) ...@@ -405,14 +403,12 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
else { else {
printk(KERN_ERR"isar wrong swver response (%x,%x) cnt(%d)\n", printk(KERN_ERR"isar wrong swver response (%x,%x) cnt(%d)\n",
ireg->cmsb, ireg->clsb, cnt); ireg->cmsb, ireg->clsb, cnt);
ret = 1;goto reterrflg; ret = 1;goto reterror;
} }
} }
cs->debug = debug; cs->debug = debug;
isar_setup(cs); isar_setup(cs);
ret = 0; ret = 0;
reterrflg:
spin_unlock_irqrestore(&isar_lock, flags);
reterror: reterror:
cs->debug = debug; cs->debug = debug;
if (ret) if (ret)
...@@ -658,7 +654,6 @@ isar_fill_fifo(struct BCState *bcs) ...@@ -658,7 +654,6 @@ isar_fill_fifo(struct BCState *bcs)
int count; int count;
u_char msb; u_char msb;
u_char *ptr; u_char *ptr;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "isar_fill_fifo"); debugl1(cs, "isar_fill_fifo");
...@@ -676,9 +671,8 @@ isar_fill_fifo(struct BCState *bcs) ...@@ -676,9 +671,8 @@ isar_fill_fifo(struct BCState *bcs)
count = bcs->tx_skb->len; count = bcs->tx_skb->len;
msb = HDLC_FED; msb = HDLC_FED;
} }
spin_lock_irqsave(&isar_lock, flags);
ptr = bcs->tx_skb->data; ptr = bcs->tx_skb->data;
if (!bcs->hw.isar.txcnt) { if (!bcs->count) {
msb |= HDLC_FST; msb |= HDLC_FST;
if ((bcs->mode == L1_MODE_FAX) && if ((bcs->mode == L1_MODE_FAX) &&
(bcs->hw.isar.cmd == PCTRL_CMD_FTH)) { (bcs->hw.isar.cmd == PCTRL_CMD_FTH)) {
...@@ -692,7 +686,7 @@ isar_fill_fifo(struct BCState *bcs) ...@@ -692,7 +686,7 @@ isar_fill_fifo(struct BCState *bcs)
} }
skb_pull(bcs->tx_skb, count); skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count; bcs->tx_cnt -= count;
bcs->hw.isar.txcnt += count; bcs->count += count;
switch (bcs->mode) { switch (bcs->mode) {
case L1_MODE_NULL: case L1_MODE_NULL:
printk(KERN_ERR"isar_fill_fifo wrong mode 0\n"); printk(KERN_ERR"isar_fill_fifo wrong mode 0\n");
...@@ -727,7 +721,6 @@ isar_fill_fifo(struct BCState *bcs) ...@@ -727,7 +721,6 @@ isar_fill_fifo(struct BCState *bcs)
printk(KERN_ERR"isar_fill_fifo mode(%x) error\n", bcs->mode); printk(KERN_ERR"isar_fill_fifo mode(%x) error\n", bcs->mode);
break; break;
} }
spin_unlock_irqrestore(&isar_lock, flags);
} }
inline inline
...@@ -763,11 +756,11 @@ send_frames(struct BCState *bcs) ...@@ -763,11 +756,11 @@ send_frames(struct BCState *bcs)
} }
} }
} }
bcs->hw.isar.txcnt = 0; bcs->count = 0;
} }
} }
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) { if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
bcs->hw.isar.txcnt = 0; bcs->count = 0;
test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); test_and_set_bit(BC_FLG_BUSY, &bcs->Flag);
isar_fill_fifo(bcs); isar_fill_fifo(bcs);
} else { } else {
...@@ -1147,11 +1140,10 @@ static char debbuf[128]; ...@@ -1147,11 +1140,10 @@ static char debbuf[128];
void void
isar_int_main(struct IsdnCardState *cs) isar_int_main(struct IsdnCardState *cs)
{ {
unsigned long flags;
struct isar_reg *ireg = cs->bcs[0].hw.isar.reg; struct isar_reg *ireg = cs->bcs[0].hw.isar.reg;
struct BCState *bcs; struct BCState *bcs;
spin_lock_irqsave(&isar_lock, flags); spin_lock(&cs->lock);
get_irq_infos(cs, ireg); get_irq_infos(cs, ireg);
switch (ireg->iis & ISAR_IIS_MSCMSD) { switch (ireg->iis & ISAR_IIS_MSCMSD) {
case ISAR_IIS_RDATA: case ISAR_IIS_RDATA:
...@@ -1237,7 +1229,7 @@ isar_int_main(struct IsdnCardState *cs) ...@@ -1237,7 +1229,7 @@ isar_int_main(struct IsdnCardState *cs)
ireg->iis, ireg->cmsb, ireg->clsb); ireg->iis, ireg->cmsb, ireg->clsb);
break; break;
} }
spin_unlock_irqrestore(&isar_lock, flags); spin_unlock(&cs->lock);
} }
static void static void
...@@ -1551,23 +1543,10 @@ void ...@@ -1551,23 +1543,10 @@ void
isar_l2l1(struct PStack *st, int pr, void *arg) isar_l2l1(struct PStack *st, int pr, void *arg)
{ {
struct sk_buff *skb = arg; struct sk_buff *skb = arg;
unsigned long flags;
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&isar_lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
spin_unlock_irqrestore(&isar_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
if (st->l1.bcs->cs->debug & L1_DEB_HSCX)
debugl1(st->l1.bcs->cs, "DRQ set BC_FLG_BUSY");
st->l1.bcs->hw.isar.txcnt = 0;
spin_unlock_irqrestore(&isar_lock, flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
...@@ -1578,7 +1557,7 @@ isar_l2l1(struct PStack *st, int pr, void *arg) ...@@ -1578,7 +1557,7 @@ isar_l2l1(struct PStack *st, int pr, void *arg)
if (st->l1.bcs->cs->debug & L1_DEB_HSCX) if (st->l1.bcs->cs->debug & L1_DEB_HSCX)
debugl1(st->l1.bcs->cs, "PUI set BC_FLG_BUSY"); debugl1(st->l1.bcs->cs, "PUI set BC_FLG_BUSY");
st->l1.bcs->tx_skb = skb; st->l1.bcs->tx_skb = skb;
st->l1.bcs->hw.isar.txcnt = 0; st->l1.bcs->count = 0;
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
break; break;
case (PH_PULL | REQUEST): case (PH_PULL | REQUEST):
......
...@@ -42,6 +42,7 @@ sched_b_event(struct BCState *bcs, int event) ...@@ -42,6 +42,7 @@ sched_b_event(struct BCState *bcs, int event)
schedule_work(&bcs->work); schedule_work(&bcs->work);
} }
/* called with the card lock held */
static inline void static inline void
xmit_complete_b(struct BCState *bcs) xmit_complete_b(struct BCState *bcs)
{ {
...@@ -50,6 +51,7 @@ xmit_complete_b(struct BCState *bcs) ...@@ -50,6 +51,7 @@ xmit_complete_b(struct BCState *bcs)
bcs->tx_skb = NULL; bcs->tx_skb = NULL;
} }
/* called with the card lock held */
static inline void static inline void
xmit_ready_b(struct BCState *bcs) xmit_ready_b(struct BCState *bcs)
{ {
...@@ -64,3 +66,20 @@ xmit_ready_b(struct BCState *bcs) ...@@ -64,3 +66,20 @@ xmit_ready_b(struct BCState *bcs)
} }
} }
static inline void
xmit_data_req_b(struct BCState *bcs, struct sk_buff *skb)
{
struct IsdnCardState *cs = bcs->cs;
unsigned long flags;
spin_lock_irqsave(&cs->lock, flags);
if (bcs->tx_skb) {
skb_queue_tail(&bcs->squeue, skb);
} else {
bcs->tx_skb = skb;
set_bit(BC_FLG_BUSY, &bcs->Flag);
bcs->count = 0;
bcs->cs->BC_Send_Data(bcs);
}
spin_unlock_irqrestore(&cs->lock, flags);
}
...@@ -145,21 +145,10 @@ static void ...@@ -145,21 +145,10 @@ static void
jade_l2l1(struct PStack *st, int pr, void *arg) jade_l2l1(struct PStack *st, int pr, void *arg)
{ {
struct sk_buff *skb = arg; struct sk_buff *skb = arg;
unsigned long flags;
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&jade_lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
spin_unlock_irqrestore(&jade_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->count = 0;
spin_unlock_irqrestore(&jade_lock, flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
...@@ -199,6 +199,7 @@ jade_int_main(struct IsdnCardState *cs, u_char val, int jade) ...@@ -199,6 +199,7 @@ jade_int_main(struct IsdnCardState *cs, u_char val, int jade)
struct BCState *bcs; struct BCState *bcs;
bcs = cs->bcs + jade; bcs = cs->bcs + jade;
spin_lock(&cs->lock);
if (val & jadeISR_RFO) { if (val & jadeISR_RFO) {
/* handled with RDO */ /* handled with RDO */
val &= ~jadeISR_RFO; val &= ~jadeISR_RFO;
...@@ -227,4 +228,5 @@ jade_int_main(struct IsdnCardState *cs, u_char val, int jade) ...@@ -227,4 +228,5 @@ jade_int_main(struct IsdnCardState *cs, u_char val, int jade)
debugl1(cs, "JADE %c interrupt %x", 'A'+jade, val); debugl1(cs, "JADE %c interrupt %x", 'A'+jade, val);
jade_interrupt(cs, val, jade); jade_interrupt(cs, val, jade);
} }
spin_unlock(&cs->lock);
} }
...@@ -836,15 +836,7 @@ tiger_l2l1(struct PStack *st, int pr, void *arg) ...@@ -836,15 +836,7 @@ tiger_l2l1(struct PStack *st, int pr, void *arg)
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&netjet_lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
spin_unlock_irqrestore(&netjet_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
spin_unlock_irqrestore(&netjet_lock, flags);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "netjet.h" #include "netjet.h"
const char *NETjet_S_revision = "$Revision: 2.7.6.6 $"; const char *NETjet_S_revision = "$Revision: 2.7.6.6 $";
static spinlock_t nj_s_lock = SPIN_LOCK_UNLOCKED;
static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off) static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
{ {
...@@ -32,12 +31,8 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -32,12 +31,8 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u_char val, sval; u_char val, sval;
unsigned long flags;
if (!cs) { spin_lock(&cs->lock);
printk(KERN_WARNING "NETjet-S: Spurious interrupt!\n");
return;
}
if (!((sval = bytein(cs->hw.njet.base + NETJET_IRQSTAT1)) & if (!((sval = bytein(cs->hw.njet.base + NETJET_IRQSTAT1)) &
NETJET_ISACIRQ)) { NETJET_ISACIRQ)) {
val = NETjet_ReadIC(cs, ISAC_ISTA); val = NETjet_ReadIC(cs, ISAC_ISTA);
...@@ -49,7 +44,6 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -49,7 +44,6 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
NETjet_WriteIC(cs, ISAC_MASK, 0x0); NETjet_WriteIC(cs, ISAC_MASK, 0x0);
} }
} }
spin_lock_irqsave(&nj_s_lock, flags);
/* start new code 13/07/00 GE */ /* start new code 13/07/00 GE */
/* set bits in sval to indicate which page is free */ /* set bits in sval to indicate which page is free */
if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) < if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) <
...@@ -67,11 +61,10 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -67,11 +61,10 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */ if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */
{ {
if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) { if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
spin_unlock_irqrestore(&nj_s_lock, flags); goto unlock;
return;
} }
cs->hw.njet.irqstat0 = sval; cs->hw.njet.irqstat0 = sval;
spin_unlock_irqrestore(&nj_s_lock, flags);
if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) != if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) !=
(cs->hw.njet.last_is0 & NETJET_IRQM0_READ)) (cs->hw.njet.last_is0 & NETJET_IRQM0_READ))
/* we have a read dma int */ /* we have a read dma int */
...@@ -82,9 +75,7 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -82,9 +75,7 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
write_tiger(cs); write_tiger(cs);
/* end new code 13/07/00 GE */ /* end new code 13/07/00 GE */
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else }
spin_unlock_irqrestore(&nj_s_lock, flags);
/* if (!testcnt--) { /* if (!testcnt--) {
cs->hw.njet.dmactrl = 0; cs->hw.njet.dmactrl = 0;
byteout(cs->hw.njet.base + NETJET_DMACTRL, byteout(cs->hw.njet.base + NETJET_DMACTRL,
...@@ -92,15 +83,13 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -92,15 +83,13 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0); byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0);
} }
*/ */
unlock:
spin_unlock(&cs->lock);
} }
static void static void
reset_netjet_s(struct IsdnCardState *cs) reset_netjet_s(struct IsdnCardState *cs)
{ {
long flags;
save_flags(flags);
sti();
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
...@@ -110,7 +99,6 @@ reset_netjet_s(struct IsdnCardState *cs) ...@@ -110,7 +99,6 @@ reset_netjet_s(struct IsdnCardState *cs)
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
restore_flags(flags);
cs->hw.njet.auxd = 0; cs->hw.njet.auxd = 0;
cs->hw.njet.dmactrl = 0; cs->hw.njet.dmactrl = 0;
byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ);
...@@ -146,7 +134,6 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -146,7 +134,6 @@ setup_netjet_s(struct IsdnCard *card)
int bytecnt; int bytecnt;
struct IsdnCardState *cs = card->cs; struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
unsigned long flags;
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
#error "not running on big endian machines now" #error "not running on big endian machines now"
...@@ -197,9 +184,6 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -197,9 +184,6 @@ setup_netjet_s(struct IsdnCard *card)
cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF;
save_flags(flags);
sti();
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
...@@ -212,8 +196,6 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -212,8 +196,6 @@ setup_netjet_s(struct IsdnCard *card)
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
restore_flags(flags);
cs->hw.njet.auxd = 0xC0; cs->hw.njet.auxd = 0xC0;
cs->hw.njet.dmactrl = 0; cs->hw.njet.dmactrl = 0;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "netjet.h" #include "netjet.h"
const char *NETjet_U_revision = "$Revision: 2.8.6.6 $"; const char *NETjet_U_revision = "$Revision: 2.8.6.6 $";
static spinlock_t nj_u_lock = SPIN_LOCK_UNLOCKED;
static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off) static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
{ {
...@@ -32,12 +31,8 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -32,12 +31,8 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u_char val, sval; u_char val, sval;
unsigned long flags;
if (!cs) { spin_lock(&cs->lock);
printk(KERN_WARNING "NETspider-U: Spurious interrupt!\n");
return;
}
if (!((sval = bytein(cs->hw.njet.base + NETJET_IRQSTAT1)) & if (!((sval = bytein(cs->hw.njet.base + NETJET_IRQSTAT1)) &
NETJET_ISACIRQ)) { NETJET_ISACIRQ)) {
val = NETjet_ReadIC(cs, ICC_ISTA); val = NETjet_ReadIC(cs, ICC_ISTA);
...@@ -49,7 +44,6 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -49,7 +44,6 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
NETjet_WriteIC(cs, ICC_MASK, 0x0); NETjet_WriteIC(cs, ICC_MASK, 0x0);
} }
} }
spin_lock_irqsave(&nj_u_lock, flags);
/* start new code 13/07/00 GE */ /* start new code 13/07/00 GE */
/* set bits in sval to indicate which page is free */ /* set bits in sval to indicate which page is free */
if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) < if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) <
...@@ -67,11 +61,9 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -67,11 +61,9 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */ if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */
{ {
if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) { if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
spin_unlock_irqrestore(&nj_u_lock, flags); goto unlock;
return;
} }
cs->hw.njet.irqstat0 = sval; cs->hw.njet.irqstat0 = sval;
spin_unlock_irqrestore(&nj_u_lock, flags);
if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) != if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) !=
(cs->hw.njet.last_is0 & NETJET_IRQM0_READ)) (cs->hw.njet.last_is0 & NETJET_IRQM0_READ))
/* we have a read dma int */ /* we have a read dma int */
...@@ -82,9 +74,7 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -82,9 +74,7 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
write_tiger(cs); write_tiger(cs);
/* end new code 13/07/00 GE */ /* end new code 13/07/00 GE */
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags); test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else }
spin_unlock_irqrestore(&nj_u_lock, flags);
/* if (!testcnt--) { /* if (!testcnt--) {
cs->hw.njet.dmactrl = 0; cs->hw.njet.dmactrl = 0;
byteout(cs->hw.njet.base + NETJET_DMACTRL, byteout(cs->hw.njet.base + NETJET_DMACTRL,
...@@ -92,15 +82,13 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -92,15 +82,13 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0); byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0);
} }
*/ */
unlock:
spin_unlock(&cs->lock);
} }
static void static void
reset_netjet_u(struct IsdnCardState *cs) reset_netjet_u(struct IsdnCardState *cs)
{ {
long flags;
save_flags(flags);
sti();
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
...@@ -110,7 +98,7 @@ reset_netjet_u(struct IsdnCardState *cs) ...@@ -110,7 +98,7 @@ reset_netjet_u(struct IsdnCardState *cs)
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
restore_flags(flags);
cs->hw.njet.auxd = 0xC0; cs->hw.njet.auxd = 0xC0;
cs->hw.njet.dmactrl = 0; cs->hw.njet.dmactrl = 0;
byteout(cs->hw.njet.auxa, 0); byteout(cs->hw.njet.auxa, 0);
...@@ -149,7 +137,6 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -149,7 +137,6 @@ setup_netjet_u(struct IsdnCard *card)
int bytecnt; int bytecnt;
struct IsdnCardState *cs = card->cs; struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
long flags;
#if CONFIG_PCI #if CONFIG_PCI
#endif #endif
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
...@@ -193,8 +180,6 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -193,8 +180,6 @@ setup_netjet_u(struct IsdnCard *card)
cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF;
save_flags(flags);
sti();
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
...@@ -207,8 +192,6 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -207,8 +192,6 @@ setup_netjet_u(struct IsdnCard *card)
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
restore_flags(flags);
cs->hw.njet.auxd = 0xC0; cs->hw.njet.auxd = 0xC0;
cs->hw.njet.dmactrl = 0; cs->hw.njet.dmactrl = 0;
......
...@@ -43,8 +43,6 @@ extern const char *CardType[]; ...@@ -43,8 +43,6 @@ extern const char *CardType[];
const char *w6692_revision = "$Revision: 1.12.6.6 $"; const char *w6692_revision = "$Revision: 1.12.6.6 $";
static spinlock_t w6692_lock = SPIN_LOCK_UNLOCKED;
#define DBUSY_TIMER_VALUE 80 #define DBUSY_TIMER_VALUE 80
static char *W6692Ver[] __initdata = static char *W6692Ver[] __initdata =
...@@ -145,7 +143,6 @@ static void ...@@ -145,7 +143,6 @@ static void
W6692_empty_fifo(struct IsdnCardState *cs, int count) W6692_empty_fifo(struct IsdnCardState *cs, int count)
{ {
u_char *ptr; u_char *ptr;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "W6692_empty_fifo"); debugl1(cs, "W6692_empty_fifo");
...@@ -160,10 +157,8 @@ W6692_empty_fifo(struct IsdnCardState *cs, int count) ...@@ -160,10 +157,8 @@ W6692_empty_fifo(struct IsdnCardState *cs, int count)
} }
ptr = cs->rcvbuf + cs->rcvidx; ptr = cs->rcvbuf + cs->rcvidx;
cs->rcvidx += count; cs->rcvidx += count;
spin_lock_irqsave(&w6692_lock, flags);
cs->readW6692fifo(cs, ptr, count); cs->readW6692fifo(cs, ptr, count);
cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RACK); cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RACK);
spin_unlock_irqrestore(&w6692_lock, flags);
if (cs->debug & L1_DEB_ISAC_FIFO) { if (cs->debug & L1_DEB_ISAC_FIFO) {
char *t = cs->dlog; char *t = cs->dlog;
...@@ -178,7 +173,6 @@ W6692_fill_fifo(struct IsdnCardState *cs) ...@@ -178,7 +173,6 @@ W6692_fill_fifo(struct IsdnCardState *cs)
{ {
int count, more; int count, more;
u_char *ptr; u_char *ptr;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "W6692_fill_fifo"); debugl1(cs, "W6692_fill_fifo");
...@@ -195,13 +189,11 @@ W6692_fill_fifo(struct IsdnCardState *cs) ...@@ -195,13 +189,11 @@ W6692_fill_fifo(struct IsdnCardState *cs)
more = !0; more = !0;
count = W_D_FIFO_THRESH; count = W_D_FIFO_THRESH;
} }
spin_lock_irqsave(&w6692_lock, flags);
ptr = cs->tx_skb->data; ptr = cs->tx_skb->data;
skb_pull(cs->tx_skb, count); skb_pull(cs->tx_skb, count);
cs->tx_cnt += count; cs->tx_cnt += count;
cs->writeW6692fifo(cs, ptr, count); cs->writeW6692fifo(cs, ptr, count);
cs->writeW6692(cs, W_D_CMDR, more ? W_D_CMDR_XMS : (W_D_CMDR_XMS | W_D_CMDR_XME)); cs->writeW6692(cs, W_D_CMDR, more ? W_D_CMDR_XMS : (W_D_CMDR_XMS | W_D_CMDR_XME));
spin_unlock_irqrestore(&w6692_lock , flags);
if (test_and_set_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { if (test_and_set_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
debugl1(cs, "W6692_fill_fifo dbusytimer running"); debugl1(cs, "W6692_fill_fifo dbusytimer running");
del_timer(&cs->dbusytimer); del_timer(&cs->dbusytimer);
...@@ -223,7 +215,6 @@ W6692B_empty_fifo(struct BCState *bcs, int count) ...@@ -223,7 +215,6 @@ W6692B_empty_fifo(struct BCState *bcs, int count)
{ {
u_char *ptr; u_char *ptr;
struct IsdnCardState *cs = bcs->cs; struct IsdnCardState *cs = bcs->cs;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "W6692B_empty_fifo"); debugl1(cs, "W6692B_empty_fifo");
...@@ -237,10 +228,8 @@ W6692B_empty_fifo(struct BCState *bcs, int count) ...@@ -237,10 +228,8 @@ W6692B_empty_fifo(struct BCState *bcs, int count)
} }
ptr = bcs->hw.w6692.rcvbuf + bcs->hw.w6692.rcvidx; ptr = bcs->hw.w6692.rcvbuf + bcs->hw.w6692.rcvidx;
bcs->hw.w6692.rcvidx += count; bcs->hw.w6692.rcvidx += count;
spin_lock_irqsave(&w6692_lock, flags);
READW6692BFIFO(cs, bcs->channel, ptr, count); READW6692BFIFO(cs, bcs->channel, ptr, count);
cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT);
spin_unlock_irqrestore(&w6692_lock , flags);
if (cs->debug & L1_DEB_HSCX_FIFO) { if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog; char *t = bcs->blog;
...@@ -257,8 +246,6 @@ W6692B_fill_fifo(struct BCState *bcs) ...@@ -257,8 +246,6 @@ W6692B_fill_fifo(struct BCState *bcs)
struct IsdnCardState *cs = bcs->cs; struct IsdnCardState *cs = bcs->cs;
int more, count; int more, count;
u_char *ptr; u_char *ptr;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "W6692B_fill_fifo"); debugl1(cs, "W6692B_fill_fifo");
...@@ -275,14 +262,12 @@ W6692B_fill_fifo(struct BCState *bcs) ...@@ -275,14 +262,12 @@ W6692B_fill_fifo(struct BCState *bcs)
} else } else
count = bcs->tx_skb->len; count = bcs->tx_skb->len;
spin_lock_irqsave(&w6692_lock, flags);
ptr = bcs->tx_skb->data; ptr = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count); skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count; bcs->tx_cnt -= count;
bcs->count += count; bcs->count += count;
WRITEW6692BFIFO(cs, bcs->channel, ptr, count); WRITEW6692BFIFO(cs, bcs->channel, ptr, count);
cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACT | W_B_CMDR_XMS | (more ? 0 : W_B_CMDR_XME)); cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACT | W_B_CMDR_XMS | (more ? 0 : W_B_CMDR_XME));
spin_unlock_irqrestore(&w6692_lock , flags);
if (cs->debug & L1_DEB_HSCX_FIFO) { if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog; char *t = bcs->blog;
...@@ -391,13 +376,10 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -391,13 +376,10 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
u_char val, exval, v1; u_char val, exval, v1;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int count; unsigned int count;
unsigned long flags;
int icnt = 5; int icnt = 5;
if (!cs) { spin_lock(&cs->lock);
printk(KERN_WARNING "W6692: Spurious interrupt!\n");
return;
}
val = cs->readW6692(cs, W_ISTA); val = cs->readW6692(cs, W_ISTA);
StartW6692: StartW6692:
...@@ -422,7 +404,6 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -422,7 +404,6 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (count == 0) if (count == 0)
count = W_D_FIFO_THRESH; count = W_D_FIFO_THRESH;
W6692_empty_fifo(cs, count); W6692_empty_fifo(cs, count);
spin_lock_irqsave(&w6692_lock, flags);
if ((count = cs->rcvidx) > 0) { if ((count = cs->rcvidx) > 0) {
cs->rcvidx = 0; cs->rcvidx = 0;
if (!(skb = alloc_skb(count, GFP_ATOMIC))) if (!(skb = alloc_skb(count, GFP_ATOMIC)))
...@@ -432,7 +413,6 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -432,7 +413,6 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
skb_queue_tail(&cs->rq, skb); skb_queue_tail(&cs->rq, skb);
} }
} }
spin_unlock_irqrestore(&w6692_lock , flags);
} }
cs->rcvidx = 0; cs->rcvidx = 0;
W6692_sched_event(cs, D_RCVBUFREADY); W6692_sched_event(cs, D_RCVBUFREADY);
...@@ -539,6 +519,7 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -539,6 +519,7 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
printk(KERN_WARNING "W6692 IRQ LOOP\n"); printk(KERN_WARNING "W6692 IRQ LOOP\n");
cs->writeW6692(cs, W_IMASK, 0xff); cs->writeW6692(cs, W_IMASK, 0xff);
} }
spin_unlock(&cs->lock);
} }
static void static void
...@@ -724,21 +705,10 @@ static void ...@@ -724,21 +705,10 @@ static void
W6692_l2l1(struct PStack *st, int pr, void *arg) W6692_l2l1(struct PStack *st, int pr, void *arg)
{ {
struct sk_buff *skb = arg; struct sk_buff *skb = arg;
unsigned long flags;
switch (pr) { switch (pr) {
case (PH_DATA | REQUEST): case (PH_DATA | REQUEST):
spin_lock_irqsave(&w6692_lock, flags); xmit_data_req_b(st->l1.bcs, skb);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
spin_unlock_irqrestore(&w6692_lock , flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->count = 0;
spin_unlock_irqrestore(&w6692_lock , flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break; break;
case (PH_PULL | INDICATION): case (PH_PULL | INDICATION):
if (st->l1.bcs->tx_skb) { if (st->l1.bcs->tx_skb) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment