rootfs_split fixes
[openwrt.git] / package / bcm43xx-mac80211 / src / bcm43xx / bcm43xx_pio.h
1 #ifndef BCM43xx_PIO_H_
2 #define BCM43xx_PIO_H_
3
4 #include "bcm43xx.h"
5
6 #include <linux/interrupt.h>
7 #include <linux/list.h>
8 #include <linux/skbuff.h>
9
10
11 #define BCM43xx_PIO_TXCTL 0x00
12 #define BCM43xx_PIO_TXDATA 0x02
13 #define BCM43xx_PIO_TXQBUFSIZE 0x04
14 #define BCM43xx_PIO_RXCTL 0x08
15 #define BCM43xx_PIO_RXDATA 0x0A
16
17 #define BCM43xx_PIO_TXCTL_WRITELO (1 << 0)
18 #define BCM43xx_PIO_TXCTL_WRITEHI (1 << 1)
19 #define BCM43xx_PIO_TXCTL_COMPLETE (1 << 2)
20 #define BCM43xx_PIO_TXCTL_INIT (1 << 3)
21 #define BCM43xx_PIO_TXCTL_SUSPEND (1 << 7)
22
23 #define BCM43xx_PIO_RXCTL_DATAAVAILABLE (1 << 0)
24 #define BCM43xx_PIO_RXCTL_READY (1 << 1)
25
26 /* PIO constants */
27 #define BCM43xx_PIO_MAXTXDEVQPACKETS 31
28 #define BCM43xx_PIO_TXQADJUST 80
29
30 /* PIO tuning knobs */
31 #define BCM43xx_PIO_MAXTXPACKETS 256
32
33
34
35 #ifdef CONFIG_BCM43XX_MAC80211_PIO
36
37
38 struct bcm43xx_pioqueue;
39 struct bcm43xx_xmitstatus;
40
41 struct bcm43xx_pio_txpacket {
42 struct bcm43xx_pioqueue *queue;
43 struct sk_buff *skb;
44 struct ieee80211_tx_status txstat;
45 struct list_head list;
46 };
47
48 #define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->tx_packets_cache))
49
50 struct bcm43xx_pioqueue {
51 struct bcm43xx_wldev *dev;
52 u16 mmio_base;
53
54 u8 tx_suspended:1,
55 tx_frozen:1,
56 need_workarounds:1; /* Workarounds needed for core.rev < 3 */
57
58 /* Adjusted size of the device internal TX buffer. */
59 u16 tx_devq_size;
60 /* Used octets of the device internal TX buffer. */
61 u16 tx_devq_used;
62 /* Used packet slots in the device internal TX buffer. */
63 u8 tx_devq_packets;
64 /* Packets from the txfree list can
65 * be taken on incoming TX requests.
66 */
67 struct list_head txfree;
68 unsigned int nr_txfree;
69 /* Packets on the txqueue are queued,
70 * but not completely written to the chip, yet.
71 */
72 struct list_head txqueue;
73 /* Packets on the txrunning queue are completely
74 * posted to the device. We are waiting for the txstatus.
75 */
76 struct list_head txrunning;
77 /* Total number or packets sent.
78 * (This counter can obviously wrap).
79 */
80 unsigned int nr_tx_packets;
81 struct tasklet_struct txtask;
82 struct bcm43xx_pio_txpacket tx_packets_cache[BCM43xx_PIO_MAXTXPACKETS];
83 };
84
85 static inline
86 u16 bcm43xx_pio_read(struct bcm43xx_pioqueue *queue,
87 u16 offset)
88 {
89 return bcm43xx_read16(queue->dev, queue->mmio_base + offset);
90 }
91
92 static inline
93 void bcm43xx_pio_write(struct bcm43xx_pioqueue *queue,
94 u16 offset, u16 value)
95 {
96 bcm43xx_write16(queue->dev, queue->mmio_base + offset, value);
97 mmiowb();
98 }
99
100
101 int bcm43xx_pio_init(struct bcm43xx_wldev *dev);
102 void bcm43xx_pio_free(struct bcm43xx_wldev *dev);
103
104 int bcm43xx_pio_tx(struct bcm43xx_wldev *dev,
105 struct sk_buff *skb,
106 struct ieee80211_tx_control *ctl);
107 void bcm43xx_pio_handle_txstatus(struct bcm43xx_wldev *dev,
108 const struct bcm43xx_txstatus *status);
109 void bcm43xx_pio_get_tx_stats(struct bcm43xx_wldev *dev,
110 struct ieee80211_tx_queue_stats *stats);
111 void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue);
112
113 /* Suspend TX queue in hardware. */
114 void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue);
115 void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue);
116 /* Suspend (freeze) the TX tasklet (software level). */
117 void bcm43xx_pio_freeze_txqueues(struct bcm43xx_wldev *dev);
118 void bcm43xx_pio_thaw_txqueues(struct bcm43xx_wldev *dev);
119
120 #else /* CONFIG_BCM43XX_MAC80211_PIO */
121
122 static inline
123 int bcm43xx_pio_init(struct bcm43xx_wldev *dev)
124 {
125 return 0;
126 }
127 static inline
128 void bcm43xx_pio_free(struct bcm43xx_wldev *dev)
129 {
130 }
131 static inline
132 int bcm43xx_pio_tx(struct bcm43xx_wldev *dev,
133 struct sk_buff *skb,
134 struct ieee80211_tx_control *ctl)
135 {
136 return 0;
137 }
138 static inline
139 void bcm43xx_pio_handle_txstatus(struct bcm43xx_wldev *dev,
140 const struct bcm43xx_txstatus *status)
141 {
142 }
143 static inline
144 void bcm43xx_pio_get_tx_stats(struct bcm43xx_wldev *dev,
145 struct ieee80211_tx_queue_stats *stats)
146 {
147 }
148 static inline
149 void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue)
150 {
151 }
152 static inline
153 void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue)
154 {
155 }
156 static inline
157 void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue)
158 {
159 }
160 static inline
161 void bcm43xx_pio_freeze_txqueues(struct bcm43xx_wldev *dev)
162 {
163 }
164 static inline
165 void bcm43xx_pio_thaw_txqueues(struct bcm43xx_wldev *dev)
166 {
167 }
168
169 #endif /* CONFIG_BCM43XX_MAC80211_PIO */
170 #endif /* BCM43xx_PIO_H_ */
This page took 0.048791 seconds and 5 git commands to generate.