2 * Blackfin Infra-red Driver
4 * Copyright 2006-2009 Analog Devices Inc.
6 * Enter bugs at http://blackfin.uclinux.org/
8 * Licensed under the GPL-2 or later.
12 #include <linux/serial.h>
13 #include <linux/module.h>
14 #include <linux/netdevice.h>
15 #include <linux/interrupt.h>
16 #include <linux/delay.h>
17 #include <linux/platform_device.h>
18 #include <linux/dma-mapping.h>
19 #include <linux/slab.h>
21 #include <net/irda/irda.h>
22 #include <net/irda/wrapper.h>
23 #include <net/irda/irda_device.h>
26 #include <asm/cacheflush.h>
28 #include <asm/portmux.h>
31 #ifdef CONFIG_SIR_BFIN_DMA
39 struct bfin_sir_port
{
40 unsigned char __iomem
*membase
;
44 struct net_device
*dev
;
45 #ifdef CONFIG_SIR_BFIN_DMA
47 struct dma_rx_buf rx_dma_buf
;
48 struct timer_list rx_dma_timer
;
51 unsigned int tx_dma_channel
;
52 unsigned int rx_dma_channel
;
55 struct bfin_sir_port_res
{
56 unsigned long base_addr
;
58 unsigned int rx_dma_channel
;
59 unsigned int tx_dma_channel
;
62 struct bfin_sir_self
{
63 struct bfin_sir_port
*sir_port
;
69 struct sk_buff
*txskb
;
70 struct sk_buff
*rxskb
;
71 struct net_device_stats stats
;
73 struct irlap_cb
*irlap
;
79 struct work_struct work
;
83 #define DRIVER_NAME "bfin_sir"
85 #define port_membase(port) (((struct bfin_sir_port *)(port))->membase)
86 #define get_lsr_cache(port) (((struct bfin_sir_port *)(port))->lsr)
87 #define put_lsr_cache(port, v) (((struct bfin_sir_port *)(port))->lsr = (v))
88 #include <asm/bfin_serial.h>
90 static const unsigned short per
[][4] = {
91 /* rx pin tx pin NULL uart_number */
92 {P_UART0_RX
, P_UART0_TX
, 0, 0},
93 {P_UART1_RX
, P_UART1_TX
, 0, 1},
94 {P_UART2_RX
, P_UART2_TX
, 0, 2},
95 {P_UART3_RX
, P_UART3_TX
, 0, 3},