Linux 3.16.62
[linux/fpc-iii.git] / drivers / net / irda / bfin_sir.h
blob29cbde8501ed8e09750f771204dfe9fc38503d34
1 /*
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>
25 #include <asm/irq.h>
26 #include <asm/cacheflush.h>
27 #include <asm/dma.h>
28 #include <asm/portmux.h>
29 #undef DRIVER_NAME
31 #ifdef CONFIG_SIR_BFIN_DMA
32 struct dma_rx_buf {
33 char *buf;
34 int head;
35 int tail;
37 #endif
39 struct bfin_sir_port {
40 unsigned char __iomem *membase;
41 unsigned int irq;
42 unsigned int lsr;
43 unsigned long clk;
44 struct net_device *dev;
45 #ifdef CONFIG_SIR_BFIN_DMA
46 int tx_done;
47 struct dma_rx_buf rx_dma_buf;
48 struct timer_list rx_dma_timer;
49 int rx_dma_nrows;
50 #endif
51 unsigned int tx_dma_channel;
52 unsigned int rx_dma_channel;
55 struct bfin_sir_port_res {
56 unsigned long base_addr;
57 int irq;
58 unsigned int rx_dma_channel;
59 unsigned int tx_dma_channel;
62 struct bfin_sir_self {
63 struct bfin_sir_port *sir_port;
64 spinlock_t lock;
65 unsigned int open;
66 int speed;
67 int newspeed;
69 struct sk_buff *txskb;
70 struct sk_buff *rxskb;
71 struct net_device_stats stats;
72 struct device *dev;
73 struct irlap_cb *irlap;
74 struct qos_info qos;
76 iobuff_t tx_buff;
77 iobuff_t rx_buff;
79 struct work_struct work;
80 int mtt;
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},