From 8624512aa908741ba2795200133eae0d7f4557ea Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 2 Mar 2000 02:36:47 +0000 Subject: Merge with 2.3.48. --- drivers/net/irda/nsc-ircc.c | 49 ++++++++++++++++++++++++++------------------- drivers/net/irda/smc-ircc.c | 15 +++----------- 2 files changed, 31 insertions(+), 33 deletions(-) (limited to 'drivers/net/irda') diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 1886ec73a..7a6cc5091 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c @@ -6,7 +6,7 @@ * Status: Stable. * Author: Dag Brattli * Created at: Sat Nov 7 21:43:15 1998 - * Modified at: Fri Jan 28 12:10:10 2000 + * Modified at: Fri Feb 18 01:48:51 2000 * Modified by: Dag Brattli * * Copyright (c) 1998-2000 Dag Brattli @@ -42,6 +42,7 @@ ********************************************************************/ #include + #include #include #include @@ -1431,8 +1432,10 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) /* We must empty the status FIFO no matter what */ len = inb(iobase+RFLFL) | ((inb(iobase+RFLFH) & 0x1f) << 8); - if (st_fifo->tail >= MAX_RX_WINDOW) + if (st_fifo->tail >= MAX_RX_WINDOW) { + IRDA_DEBUG(0, __FUNCTION__ "(), window is full!\n"); continue; + } st_fifo->entries[st_fifo->tail].status = status; st_fifo->entries[st_fifo->tail].len = len; @@ -1492,7 +1495,18 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) st_fifo->pending_bytes += len; st_fifo->entries[st_fifo->head].status = status; st_fifo->entries[st_fifo->head].len = len; - + /* + * DMA not finished yet, so try again + * later, set timer value, resolution + * 125 us + */ + switch_bank(iobase, BANK4); + outb(0x02, iobase+TMRL); /* x 125 us */ + outb(0x00, iobase+TMRH); + + /* Start timer */ + outb(IRCR1_TMR_EN, iobase+IRCR1); + /* Restore bank register */ outb(bank, iobase+BSR); @@ -1597,7 +1611,7 @@ static void nsc_ircc_sir_interrupt(struct nsc_ircc_cb *self, int eir) else { self->stats.tx_packets++; - netif_wakeup_queue(self->netdev); + netif_wake_queue(self->netdev); self->ier = IER_TXEMP_IE; } @@ -1648,21 +1662,12 @@ static void nsc_ircc_fir_interrupt(struct nsc_ircc_cb *self, int iobase, /* Status FIFO event*/ if (eir & EIR_SFIF_EV) { + /* Check if DMA has finished */ if (nsc_ircc_dma_receive_complete(self, iobase)) { /* Wait for next status FIFO interrupt */ self->ier = IER_SFIF_IE; } else { - /* - * DMA not finished yet, so try again later, set - * timer value, resolution 125 us - */ - switch_bank(iobase, BANK4); - outb(0x02, iobase+TMRL); /* 2 * 125 us */ - outb(0x00, iobase+TMRH); - - /* Start timer */ - outb(IRCR1_TMR_EN, iobase+IRCR1); - self->ier = IER_TMR_IE | IER_SFIF_IE; + self->ier = IER_SFIF_IE | IER_TMR_IE; } } else if (eir & EIR_TMR_EV) { /* Timer finished */ /* Disable timer */ @@ -1677,15 +1682,17 @@ static void nsc_ircc_fir_interrupt(struct nsc_ircc_cb *self, int iobase, if (self->io.direction == IO_XMIT) { nsc_ircc_dma_xmit(self, iobase); - /* Interrupt on DMA */ + /* Interrupt on DMA */ self->ier = IER_DMA_IE; } else { - /* Check if DMA has now finished */ - nsc_ircc_dma_receive_complete(self, iobase); - - self->ier = IER_SFIF_IE; + /* Check (again) if DMA has finished */ + if (nsc_ircc_dma_receive_complete(self, iobase)) { + self->ier = IER_SFIF_IE; + } else { + self->ier = IER_SFIF_IE | IER_TMR_IE; + } } - } else if (eir & EIR_DMA_EV) { + } else if (eir & EIR_DMA_EV) { /* Finished with all transmissions? */ if (nsc_ircc_dma_xmit_complete(self)) { /* Check if there are more frames to be transmitted */ diff --git a/drivers/net/irda/smc-ircc.c b/drivers/net/irda/smc-ircc.c index a93720cc9..06ebc072c 100644 --- a/drivers/net/irda/smc-ircc.c +++ b/drivers/net/irda/smc-ircc.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Thomas Davis (tadavis@jps.net) * Created at: - * Modified at: Fri Jan 21 09:41:08 2000 + * Modified at: Tue Feb 22 10:05:06 2000 * Modified by: Dag Brattli * * Copyright (c) 1999-2000 Dag Brattli @@ -567,7 +567,6 @@ static void ircc_change_speed(void *priv, __u32 speed) "(), using irport to change speed to %d\n", speed); irport_change_speed(self->irport, speed); } - dev->tbusy = 0; register_bank(iobase, 1); outb(((inb(iobase+IRCC_SCE_CFGA) & 0x87) | ir_mode), @@ -617,9 +616,7 @@ static int ircc_hard_xmit(struct sk_buff *skb, struct net_device *dev) if ((speed = irda_get_speed(skb)) != self->io.speed) self->new_speed = speed; - /* Lock transmit buffer */ - if (irda_lock((void *) &dev->tbusy) == FALSE) - return -EBUSY; + netif_stop_queue(dev); memcpy(self->tx_buff.head, skb->data, skb->len); @@ -741,11 +738,7 @@ static void ircc_dma_xmit_complete(struct ircc_cb *self, int iobase) self->new_speed = 0; } - /* Unlock tx_buff and request another frame */ - self->netdev->tbusy = 0; /* Unlock */ - - /* Tell the network layer, that we can accept more frames */ - mark_bh(NET_BH); + netif_wake_queue(self->netdev); } /* @@ -875,7 +868,6 @@ static void ircc_interrupt(int irq, void *dev_id, struct pt_regs *regs) iobase = self->io.fir_base; spin_lock(&self->lock); - dev->interrupt = 1; register_bank(iobase, 0); iir = inb(iobase+IRCC_IIR); @@ -898,7 +890,6 @@ static void ircc_interrupt(int irq, void *dev_id, struct pt_regs *regs) register_bank(iobase, 0); outb(IRCC_IER_ACTIVE_FRAME|IRCC_IER_EOM, iobase+IRCC_IER); - dev->interrupt = 0; spin_unlock(&self->lock); } -- cgit v1.2.3