patch-2.1.42 linux/drivers/isdn/hisax/ix1_micro.c
Next file: linux/drivers/isdn/hisax/l3_1tr6.c
Previous file: linux/drivers/isdn/hisax/isdnl3.h
Back to the patch index
Back to the overall index
- Lines: 663
- Date:
Wed May 28 10:49:09 1997
- Orig file:
v2.1.41/linux/drivers/isdn/hisax/ix1_micro.c
- Orig date:
Thu Feb 27 10:57:29 1997
diff -u --recursive --new-file v2.1.41/linux/drivers/isdn/hisax/ix1_micro.c linux/drivers/isdn/hisax/ix1_micro.c
@@ -1,4 +1,4 @@
-/* $Id: ix1_micro.c,v 1.1 1997/01/27 15:43:10 keil Exp $
+/* $Id: ix1_micro.c,v 1.3 1997/04/13 19:54:02 keil Exp $
* ix1_micro.c low level stuff for ITK ix1-micro Rev.2 isdn cards
* derived from the original file teles3.c from Karsten Keil
@@ -11,6 +11,12 @@
* Beat Doebeli
*
* $Log: ix1_micro.c,v $
+ * Revision 1.3 1997/04/13 19:54:02 keil
+ * Change in IRQ check delay for SMP
+ *
+ * Revision 1.2 1997/04/06 22:54:21 keil
+ * Using SKB's
+ *
* Revision 1.1 1997/01/27 15:43:10 keil
* first version
*
@@ -55,7 +61,7 @@
#include <linux/kernel_stat.h>
extern const char *CardType[];
-const char *ix1_revision = "$Revision: 1.1 $";
+const char *ix1_revision = "$Revision: 1.3 $";
#define byteout(addr,val) outb_p(val,addr)
#define bytein(addr) inb_p(addr)
@@ -72,15 +78,15 @@
#define TIMEOUT 50
-static inline byte
-IsacReadReg(unsigned int adr, byte off)
+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 void
-IsacWriteReg(unsigned int adr, byte off, byte data)
+IsacWriteReg(unsigned int adr, u_char off, u_char data)
{
byteout(adr + ISAC_COMMAND_OFFSET, off + 0x20);
byteout(adr + ISAC_DATA_OFFSET, data);
@@ -89,15 +95,15 @@
#define HSCX_OFFSET(WhichHscx,offset) \
( (WhichHscx) ? (offset+0x60) : (offset+0x20) )
-static inline byte
-HscxReadReg(unsigned int adr, int WhichHscx, byte off)
+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 void
-HscxWriteReg(unsigned int adr, int WhichHscx, byte off, byte data)
+HscxWriteReg(unsigned int adr, int WhichHscx, u_char off, u_char data)
{
byteout(adr + HSCX_COMMAND_OFFSET, HSCX_OFFSET(WhichHscx, off));
byteout(adr + HSCX_DATA_OFFSET, data);
@@ -105,7 +111,7 @@
static inline void
-IsacReadFifo(unsigned int adr, byte * data, int size)
+IsacReadFifo(unsigned int adr, u_char * data, int size)
{
byteout(adr + ISAC_COMMAND_OFFSET, 0);
while (size--)
@@ -113,7 +119,7 @@
}
static void
-IsacWriteFifo(unsigned int adr, byte * data, int size)
+IsacWriteFifo(unsigned int adr, u_char * data, int size)
{
byteout(adr + ISAC_COMMAND_OFFSET, 0);
while (size--) {
@@ -123,7 +129,7 @@
}
static inline void
-HscxReadFifo(unsigned int adr, int WhichHscx, byte * data, int size)
+HscxReadFifo(unsigned int adr, int WhichHscx, u_char * data, int size)
{
byteout(adr + HSCX_COMMAND_OFFSET, (WhichHscx) ? 0x40 : 0x00);
while (size--)
@@ -131,7 +137,7 @@
}
static void
-HscxWriteFifo(unsigned int adr, int WhichHscx, byte * data, int size)
+HscxWriteFifo(unsigned int adr, int WhichHscx, u_char * data, int size)
{
byteout(adr + HSCX_COMMAND_OFFSET, (WhichHscx) ? 0x40 : 0x00);
while (size--) {
@@ -168,7 +174,7 @@
}
static inline void
-writehscxCMDR(int adr, int WhichHscx, byte data)
+writehscxCMDR(int adr, int WhichHscx, u_char data)
{
long flags;
@@ -210,25 +216,22 @@
static void
hscx_empty_fifo(struct HscxState *hsp, int count)
{
- byte *ptr;
+ u_char *ptr;
struct IsdnCardState *sp = hsp->sp;
- struct BufHeader *ibh = hsp->rcvibh;
long flags;
if ((sp->debug & L1_DEB_HSCX) && !(sp->debug & L1_DEB_HSCX_FIFO))
debugl1(sp, "hscx_empty_fifo");
- if (hsp->rcvptr + count > BUFFER_SIZE(HSCX_RBUF_ORDER,
- HSCX_RBUF_BPPS)) {
+ if (hsp->rcvidx + count > HSCX_BUFMAX) {
if (sp->debug & L1_DEB_WARN)
debugl1(sp, "hscx_empty_fifo: incoming packet too large");
writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, 0x80);
+ hsp->rcvidx = 0;
return;
}
- ptr = DATAPTR(ibh);
- ptr += hsp->rcvptr;
-
- hsp->rcvptr += count;
+ ptr = hsp->rcvbuf + hsp->rcvidx;
+ hsp->rcvidx += count;
save_flags(flags);
cli();
HscxReadFifo(sp->hscx[hsp->hscx], hsp->hscx, ptr, count);
@@ -249,34 +252,32 @@
hscx_fill_fifo(struct HscxState *hsp)
{
struct IsdnCardState *sp = hsp->sp;
- struct BufHeader *ibh;
int more, count;
- byte *ptr;
+ u_char *ptr;
long flags;
if ((sp->debug & L1_DEB_HSCX) && !(sp->debug & L1_DEB_HSCX_FIFO))
debugl1(sp, "hscx_fill_fifo");
- ibh = hsp->xmtibh;
- if (!ibh)
+ if (!hsp->tx_skb)
return;
-
- count = ibh->datasize - hsp->sendptr;
- if (count <= 0)
+ if (hsp->tx_skb->len <= 0)
return;
more = (hsp->mode == 1) ? 1 : 0;
- if (count > 32) {
+ if (hsp->tx_skb->len > 32) {
more = !0;
count = 32;
- }
- ptr = DATAPTR(ibh);
- ptr += hsp->sendptr;
- hsp->sendptr += count;
+ } else
+ count = hsp->tx_skb->len;
waitforXFW(sp->hscx[hsp->hscx], hsp->hscx);
save_flags(flags);
cli();
+ ptr = hsp->tx_skb->data;
+ skb_pull(hsp->tx_skb, count);
+ hsp->tx_cnt -= count;
+ hsp->count += count;
HscxWriteFifo(sp->hscx[hsp->hscx], hsp->hscx, ptr, count);
writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, more ? 0x8 : 0xa);
restore_flags(flags);
@@ -292,11 +293,12 @@
}
static inline void
-hscx_interrupt(struct IsdnCardState *sp, byte val, byte hscx)
+hscx_interrupt(struct IsdnCardState *sp, u_char val, u_char hscx)
{
- byte r;
+ u_char r;
struct HscxState *hsp = sp->hs + hscx;
- int count, err;
+ struct sk_buff *skb;
+ int count;
char tmp[32];
if (!hsp->init)
@@ -318,79 +320,61 @@
if (!r & 0x20)
if (sp->debug & L1_DEB_WARN)
debugl1(sp, "HSCX CRC error");
- if (hsp->rcvibh)
- BufPoolRelease(hsp->rcvibh);
- hsp->rcvibh = NULL;
writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, 0x80);
- goto afterRME;
+ } else {
+ count = HscxReadReg(sp->hscx[hsp->hscx], hscx, HSCX_RBCL) & 0x1f;
+ if (count == 0)
+ count = 32;
+ hscx_empty_fifo(hsp, count);
+ if ((count = hsp->rcvidx - 1) > 0) {
+ if (sp->debug & L1_DEB_HSCX_FIFO) {
+ sprintf(tmp, "HX Frame %d", count);
+ debugl1(sp, tmp);
+ }
+ if (!(skb = dev_alloc_skb(count)))
+ printk(KERN_WARNING "IX1: receive out of memory\n");
+ else {
+ memcpy(skb_put(skb, count), hsp->rcvbuf, count);
+ skb_queue_tail(&hsp->rqueue, skb);
+ }
+ }
}
- if (!hsp->rcvibh)
- if (BufPoolGet(&hsp->rcvibh, &hsp->rbufpool,
- GFP_ATOMIC, (void *) 1, 1)) {
- if (sp->debug & L1_DEB_WARN)
- debugl1(sp, "HSCX RME out of buffers");
- writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, 0x80);
- goto afterRME;
- } else
- hsp->rcvptr = 0;
-
- count = HscxReadReg(sp->hscx[hsp->hscx], hscx, HSCX_RBCL) & 0x1f;
- if (count == 0)
- count = 32;
- hscx_empty_fifo(hsp, count);
- hsp->rcvibh->datasize = hsp->rcvptr - 1;
- BufQueueLink(&hsp->rq, hsp->rcvibh);
- hsp->rcvibh = NULL;
+ hsp->rcvidx = 0;
hscx_sched_event(hsp, HSCX_RCVBUFREADY);
}
- afterRME:
if (val & 0x40) { /* RPF */
- if (!hsp->rcvibh) {
- if (hsp->mode == 1)
- err = BufPoolGet(&hsp->rcvibh, &hsp->smallpool,
- GFP_ATOMIC, (void *) 1, 2);
- else
- err = BufPoolGet(&hsp->rcvibh, &hsp->rbufpool,
- GFP_ATOMIC, (void *) 1, 2);
-
- if (err) {
- if (sp->debug & L1_DEB_WARN)
- debugl1(sp, "HSCX RPF out of buffers");
- writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, 0x80);
- goto afterRPF;
- } else
- hsp->rcvptr = 0;
- }
hscx_empty_fifo(hsp, 32);
if (hsp->mode == 1) {
/* receive audio data */
- hsp->rcvibh->datasize = hsp->rcvptr;
- BufQueueLink(&hsp->rq, hsp->rcvibh);
- hsp->rcvibh = NULL;
+ if (!(skb = dev_alloc_skb(32)))
+ printk(KERN_WARNING "IX1: receive out of memory\n");
+ else {
+ memcpy(skb_put(skb, 32), hsp->rcvbuf, 32);
+ skb_queue_tail(&hsp->rqueue, skb);
+ }
+ hsp->rcvidx = 0;
hscx_sched_event(hsp, HSCX_RCVBUFREADY);
}
}
- afterRPF:
if (val & 0x10) { /* XPR */
- if (hsp->xmtibh)
- if (hsp->xmtibh->datasize > hsp->sendptr) {
+ if (hsp->tx_skb)
+ if (hsp->tx_skb->len) {
hscx_fill_fifo(hsp);
- goto afterXPR;
+ return;
} else {
- if (hsp->releasebuf)
- BufPoolRelease(hsp->xmtibh);
- hsp->sendptr = 0;
+ SET_SKB_FREE(hsp->tx_skb);
+ dev_kfree_skb(hsp->tx_skb, FREE_WRITE);
+ hsp->count = 0;
if (hsp->st->l4.l1writewakeup)
hsp->st->l4.l1writewakeup(hsp->st);
- hsp->xmtibh = NULL;
+ hsp->tx_skb = NULL;
}
- if (!BufQueueUnlink(&hsp->xmtibh, &hsp->sq)) {
- hsp->releasebuf = !0;
+ if ((hsp->tx_skb = skb_dequeue(&hsp->squeue))) {
+ hsp->count = 0;
hscx_fill_fifo(hsp);
} else
hscx_sched_event(hsp, HSCX_XMTBUFREADY);
}
- afterXPR:
}
/*
@@ -400,26 +384,26 @@
static void
isac_empty_fifo(struct IsdnCardState *sp, int count)
{
- byte *ptr;
- struct BufHeader *ibh = sp->rcvibh;
+ u_char *ptr;
long flags;
if ((sp->debug & L1_DEB_ISAC) && !(sp->debug & L1_DEB_ISAC_FIFO))
if (sp->debug & L1_DEB_ISAC)
debugl1(sp, "isac_empty_fifo");
- if (sp->rcvptr >= 3072) {
+ if ((sp->rcvidx + count) >= MAX_DFRAME_LEN) {
if (sp->debug & L1_DEB_WARN) {
char tmp[40];
- sprintf(tmp, "isac_empty_fifo rcvptr %d", sp->rcvptr);
+ sprintf(tmp, "isac_empty_fifo overrun %d",
+ sp->rcvidx + count);
debugl1(sp, tmp);
}
+ IsacWriteReg(sp->isac, ISAC_CMDR, 0x80);
+ sp->rcvidx = 0;
return;
}
- ptr = DATAPTR(ibh);
- ptr += sp->rcvptr;
- sp->rcvptr += count;
-
+ ptr = sp->rcvbuf + sp->rcvidx;
+ sp->rcvidx += count;
save_flags(flags);
cli();
IsacReadFifo(sp->isac, ptr, count);
@@ -438,35 +422,30 @@
static void
isac_fill_fifo(struct IsdnCardState *sp)
{
- struct BufHeader *ibh;
int count, more;
- byte *ptr;
+ u_char *ptr;
long flags;
if ((sp->debug & L1_DEB_ISAC) && !(sp->debug & L1_DEB_ISAC_FIFO))
debugl1(sp, "isac_fill_fifo");
- ibh = sp->xmtibh;
- if (!ibh)
+ if (!sp->tx_skb)
return;
- count = ibh->datasize - sp->sendptr;
+ count = sp->tx_skb->len;
if (count <= 0)
return;
- if (count >= 3072)
- return;
more = 0;
if (count > 32) {
more = !0;
count = 32;
}
- ptr = DATAPTR(ibh);
- ptr += sp->sendptr;
- sp->sendptr += count;
-
save_flags(flags);
cli();
+ ptr = sp->tx_skb->data;
+ skb_pull(sp->tx_skb, count);
+ sp->tx_cnt += count;
IsacWriteFifo(sp->isac, ptr, count);
IsacWriteReg(sp->isac, ISAC_CMDR, more ? 0x8 : 0xa);
restore_flags(flags);
@@ -493,9 +472,10 @@
static inline void
-isac_interrupt(struct IsdnCardState *sp, byte val)
+isac_interrupt(struct IsdnCardState *sp, u_char val)
{
- byte exval;
+ u_char exval;
+ struct sk_buff *skb;
unsigned int count;
char tmp[32];
@@ -512,62 +492,46 @@
if (!exval & 0x20)
if (sp->debug & L1_DEB_WARN)
debugl1(sp, "ISAC CRC error");
- if (sp->rcvibh)
- BufPoolRelease(sp->rcvibh);
- sp->rcvibh = NULL;
IsacWriteReg(sp->isac, ISAC_CMDR, 0x80);
- goto afterRME;
+ } else {
+ count = IsacReadReg(sp->isac, ISAC_RBCL) & 0x1f;
+ if (count == 0)
+ count = 32;
+ isac_empty_fifo(sp, count);
+ if ((count = sp->rcvidx) > 0) {
+ sp->rcvidx = 0;
+ if (!(skb = alloc_skb(count, GFP_ATOMIC)))
+ printk(KERN_WARNING "IX1: D receive out of memory\n");
+ else {
+ memcpy(skb_put(skb, count), sp->rcvbuf, count);
+ skb_queue_tail(&sp->rq, skb);
+ }
+ }
}
- if (!sp->rcvibh)
- if (BufPoolGet(&(sp->rcvibh), &(sp->rbufpool),
- GFP_ATOMIC, (void *) 1, 3)) {
- if (sp->debug & L1_DEB_WARN)
- debugl1(sp, "ISAC RME out of buffers!");
- IsacWriteReg(sp->isac, ISAC_CMDR, 0x80);
- goto afterRME;
- } else
- sp->rcvptr = 0;
- count = IsacReadReg(sp->isac, ISAC_RBCL) & 0x1f;
- if (count == 0)
- count = 32;
- isac_empty_fifo(sp, count);
- sp->rcvibh->datasize = sp->rcvptr;
- BufQueueLink(&(sp->rq), sp->rcvibh);
- sp->rcvibh = NULL;
+ sp->rcvidx = 0;
isac_sched_event(sp, ISAC_RCVBUFREADY);
}
- afterRME:
if (val & 0x40) { /* RPF */
- if (!sp->rcvibh)
- if (BufPoolGet(&(sp->rcvibh), &(sp->rbufpool),
- GFP_ATOMIC, (void *) 1, 4)) {
- if (sp->debug & L1_DEB_WARN)
- debugl1(sp, "ISAC RME out of buffers!");
- IsacWriteReg(sp->isac, ISAC_CMDR, 0x80);
- goto afterRPF;
- } else
- sp->rcvptr = 0;
isac_empty_fifo(sp, 32);
}
- afterRPF:
if (val & 0x20) { /* RSC */
/* never */
if (sp->debug & L1_DEB_WARN)
debugl1(sp, "ISAC RSC interrupt");
}
if (val & 0x10) { /* XPR */
- if (sp->xmtibh)
- if (sp->xmtibh->datasize > sp->sendptr) {
+ if (sp->tx_skb)
+ if (sp->tx_skb->len) {
isac_fill_fifo(sp);
goto afterXPR;
} else {
- if (sp->releasebuf)
- BufPoolRelease(sp->xmtibh);
- sp->xmtibh = NULL;
- sp->sendptr = 0;
+ SET_SKB_FREE(sp->tx_skb);
+ dev_kfree_skb(sp->tx_skb, FREE_WRITE);
+ sp->tx_cnt = 0;
+ sp->tx_skb = NULL;
}
- if (!BufQueueUnlink(&sp->xmtibh, &sp->sq)) {
- sp->releasebuf = !0;
+ if ((sp->tx_skb = skb_dequeue(&sp->sq))) {
+ sp->tx_cnt = 0;
isac_fill_fifo(sp);
} else
isac_sched_event(sp, ISAC_XMTBUFREADY);
@@ -597,10 +561,10 @@
}
static inline void
-hscx_int_main(struct IsdnCardState *sp, byte val)
+hscx_int_main(struct IsdnCardState *sp, u_char val)
{
- byte exval;
+ u_char exval;
struct HscxState *hsp;
char tmp[32];
@@ -615,7 +579,11 @@
/* Here we lost an TX interrupt, so
* restart transmitting the whole frame.
*/
- hsp->sendptr = 0;
+ if (hsp->tx_skb) {
+ skb_push(hsp->tx_skb, hsp->count);
+ hsp->tx_cnt += hsp->count;
+ hsp->count = 0;
+ }
writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, 0x01);
if (sp->debug & L1_DEB_WARN) {
sprintf(tmp, "HSCX B EXIR %x Lost TX", exval);
@@ -644,7 +612,11 @@
/* Here we lost an TX interrupt, so
* restart transmitting the whole frame.
*/
- hsp->sendptr = 0;
+ if (hsp->tx_skb) {
+ skb_push(hsp->tx_skb, hsp->count);
+ hsp->tx_cnt += hsp->count;
+ hsp->count = 0;
+ }
writehscxCMDR(sp->hscx[hsp->hscx], hsp->hscx, 0x01);
if (sp->debug & L1_DEB_WARN) {
sprintf(tmp, "HSCX A EXIR %x Lost TX", exval);
@@ -670,7 +642,7 @@
ix1micro_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{
struct IsdnCardState *sp;
- byte val, stat = 0;
+ u_char val, stat = 0;
sp = (struct IsdnCardState *) irq2dev_map[intno];
@@ -757,48 +729,48 @@
HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RLCR, 0x0);
switch (mode) {
- case 0:
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0xff);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0xff);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_MODE, 0x84);
- break;
- case 1:
- if (ichan == 0) {
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x2f);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x2f);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
- } else {
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x3);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x3);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
- }
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_MODE, 0xe4);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CMDR, 0x41);
- break;
- case 2:
- if (ichan == 0) {
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x2f);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x2f);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
- } else {
+ case 0:
HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x3);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x3);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0xff);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0xff);
HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
- }
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_MODE, 0x8c);
- HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CMDR, 0x41);
- break;
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_MODE, 0x84);
+ break;
+ case 1:
+ if (ichan == 0) {
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x2f);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x2f);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
+ } else {
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x3);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x3);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
+ }
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_MODE, 0xe4);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CMDR, 0x41);
+ break;
+ case 2:
+ if (ichan == 0) {
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x2f);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x2f);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
+ } else {
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CCR2, 0x30);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAX, 0x3);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_TSAR, 0x3);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_XCCR, 7);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_RCCR, 7);
+ }
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_MODE, 0x8c);
+ HscxWriteReg(sp->hscx[hscx], hscx, HSCX_CMDR, 0x41);
+ break;
}
HscxWriteReg(sp->hscx[hscx], hscx, HSCX_ISTA, 0x00);
}
@@ -866,6 +838,7 @@
initix1micro(struct IsdnCardState *sp)
{
int ret;
+ int loop = 0;
char tmp[40];
sp->counter = kstat.interrupts[sp->irq];
@@ -877,6 +850,16 @@
initisac(sp);
sp->modehscx(sp->hs, 0, 0);
sp->modehscx(sp->hs + 1, 0, 0);
+ while (loop++ < 10) {
+ /* At least 1-3 irqs must happen
+ * (one from HSCX A, one from HSCX B, 3rd from ISAC)
+ */
+ if (kstat.interrupts[sp->irq] > sp->counter)
+ break;
+ current->state = TASK_INTERRUPTIBLE;
+ current->timeout = jiffies + 1;
+ schedule();
+ }
sprintf(tmp, "IRQ %d count %d", sp->irq,
kstat.interrupts[sp->irq]);
debugl1(sp, tmp);
@@ -895,7 +878,7 @@
int
setup_ix1micro(struct IsdnCard *card)
{
- byte val, verA, verB;
+ u_char val, verA, verB;
struct IsdnCardState *sp = card->sp;
long flags;
char tmp[64];
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov