diff options
Diffstat (limited to 'drivers/net/irda/pxaficp_ir.c')
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 102 |
1 files changed, 67 insertions, 35 deletions
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index c5b02b66f756..31794c2363ec 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c @@ -22,9 +22,53 @@ #include <net/irda/wrapper.h> #include <net/irda/irda_device.h> -#include <asm/dma.h> +#include <mach/dma.h> #include <mach/irda.h> +#include <mach/hardware.h> #include <mach/pxa-regs.h> +#include <mach/regs-uart.h> + +#define FICP __REG(0x40800000) /* Start of FICP area */ +#define ICCR0 __REG(0x40800000) /* ICP Control Register 0 */ +#define ICCR1 __REG(0x40800004) /* ICP Control Register 1 */ +#define ICCR2 __REG(0x40800008) /* ICP Control Register 2 */ +#define ICDR __REG(0x4080000c) /* ICP Data Register */ +#define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */ +#define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */ + +#define ICCR0_AME (1 << 7) /* Address match enable */ +#define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */ +#define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */ +#define ICCR0_RXE (1 << 4) /* Receive enable */ +#define ICCR0_TXE (1 << 3) /* Transmit enable */ +#define ICCR0_TUS (1 << 2) /* Transmit FIFO underrun select */ +#define ICCR0_LBM (1 << 1) /* Loopback mode */ +#define ICCR0_ITR (1 << 0) /* IrDA transmission */ + +#define ICCR2_RXP (1 << 3) /* Receive Pin Polarity select */ +#define ICCR2_TXP (1 << 2) /* Transmit Pin Polarity select */ +#define ICCR2_TRIG (3 << 0) /* Receive FIFO Trigger threshold */ +#define ICCR2_TRIG_8 (0 << 0) /* >= 8 bytes */ +#define ICCR2_TRIG_16 (1 << 0) /* >= 16 bytes */ +#define ICCR2_TRIG_32 (2 << 0) /* >= 32 bytes */ + +#ifdef CONFIG_PXA27x +#define ICSR0_EOC (1 << 6) /* DMA End of Descriptor Chain */ +#endif +#define ICSR0_FRE (1 << 5) /* Framing error */ +#define ICSR0_RFS (1 << 4) /* Receive FIFO service request */ +#define ICSR0_TFS (1 << 3) /* Transnit FIFO service request */ +#define ICSR0_RAB (1 << 2) /* Receiver abort */ +#define ICSR0_TUR (1 << 1) /* Trunsmit FIFO underun */ +#define ICSR0_EIF (1 << 0) /* End/Error in FIFO */ + +#define ICSR1_ROR (1 << 6) /* Receiver FIFO underrun */ +#define ICSR1_CRE (1 << 5) /* CRC error */ +#define ICSR1_EOF (1 << 4) /* End of frame */ +#define ICSR1_TNF (1 << 3) /* Transmit FIFO not full */ +#define ICSR1_RNE (1 << 2) /* Receive FIFO not empty */ +#define ICSR1_TBY (1 << 1) /* Tramsmiter busy flag */ +#define ICSR1_RSY (1 << 0) /* Recevier synchronized flag */ #define IrSR_RXPL_NEG_IS_ZERO (1<<4) #define IrSR_RXPL_POS_IS_ZERO 0x0 @@ -64,7 +108,6 @@ struct pxa_irda { int txdma; int rxdma; - struct net_device_stats stats; struct irlap_cb *irlap; struct qos_info qos; @@ -214,18 +257,18 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id) data = STRBR; if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) { printk(KERN_DEBUG "pxa_ir: sir receiving error\n"); - si->stats.rx_errors++; + dev->stats.rx_errors++; if (lsr & LSR_FE) - si->stats.rx_frame_errors++; + dev->stats.rx_frame_errors++; if (lsr & LSR_OE) - si->stats.rx_fifo_errors++; + dev->stats.rx_fifo_errors++; } else { - si->stats.rx_bytes++; - async_unwrap_char(dev, &si->stats, &si->rx_buff, data); + dev->stats.rx_bytes++; + async_unwrap_char(dev, &dev->stats, + &si->rx_buff, data); } lsr = STLSR; } - dev->last_rx = jiffies; si->last_oscr = OSCR; break; @@ -234,10 +277,9 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id) case 0x0C: /* Character Timeout Indication */ do { - si->stats.rx_bytes++; - async_unwrap_char(dev, &si->stats, &si->rx_buff, STRBR); + dev->stats.rx_bytes++; + async_unwrap_char(dev, &dev->stats, &si->rx_buff, STRBR); } while (STLSR & LSR_DR); - dev->last_rx = jiffies; si->last_oscr = OSCR; break; @@ -248,9 +290,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id) } if (si->tx_buff.len == 0) { - si->stats.tx_packets++; - si->stats.tx_bytes += si->tx_buff.data - - si->tx_buff.head; + dev->stats.tx_packets++; + dev->stats.tx_bytes += si->tx_buff.data - si->tx_buff.head; /* We need to ensure that the transmitter has finished. */ while ((STLSR & LSR_TEMT) == 0) @@ -301,10 +342,10 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data) DCSR(channel) = dcsr & ~DCSR_RUN; if (dcsr & DCSR_ENDINTR) { - si->stats.tx_packets++; - si->stats.tx_bytes += si->dma_tx_buff_len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += si->dma_tx_buff_len; } else { - si->stats.tx_errors++; + dev->stats.tx_errors++; } while (ICSR1 & ICSR1_TBY) @@ -350,14 +391,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in data = ICDR; if (stat & (ICSR1_CRE | ICSR1_ROR)) { - si->stats.rx_errors++; + dev->stats.rx_errors++; if (stat & ICSR1_CRE) { printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n"); - si->stats.rx_crc_errors++; + dev->stats.rx_crc_errors++; } if (stat & ICSR1_ROR) { printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); - si->stats.rx_over_errors++; + dev->stats.rx_over_errors++; } } else { si->dma_rx_buff[len++] = data; @@ -373,14 +414,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in if (icsr0 & ICSR0_FRE) { printk(KERN_ERR "pxa_ir: dropping erroneous frame\n"); - si->stats.rx_dropped++; + dev->stats.rx_dropped++; return; } skb = alloc_skb(len+1,GFP_ATOMIC); if (!skb) { printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); - si->stats.rx_dropped++; + dev->stats.rx_dropped++; return; } @@ -395,10 +436,8 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in skb->protocol = htons(ETH_P_IRDA); netif_rx(skb); - si->stats.rx_packets++; - si->stats.rx_bytes += len; - - dev->last_rx = jiffies; + dev->stats.rx_packets++; + dev->stats.rx_bytes += len; } } @@ -417,10 +456,10 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id) if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) { if (icsr0 & ICSR0_FRE) { printk(KERN_DEBUG "pxa_ir: fir receive frame error\n"); - si->stats.rx_frame_errors++; + dev->stats.rx_frame_errors++; } else { printk(KERN_DEBUG "pxa_ir: fir receive abort\n"); - si->stats.rx_errors++; + dev->stats.rx_errors++; } ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB); } @@ -549,12 +588,6 @@ static int pxa_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) return ret; } -static struct net_device_stats *pxa_irda_stats(struct net_device *dev) -{ - struct pxa_irda *si = netdev_priv(dev); - return &si->stats; -} - static void pxa_irda_startup(struct pxa_irda *si) { /* Disable STUART interrupts */ @@ -817,7 +850,6 @@ static int pxa_irda_probe(struct platform_device *pdev) dev->open = pxa_irda_start; dev->stop = pxa_irda_stop; dev->do_ioctl = pxa_irda_ioctl; - dev->get_stats = pxa_irda_stats; irda_init_max_qos_capabilies(&si->qos); |