aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/pio.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43legacy/pio.h')
-rw-r--r--drivers/net/wireless/b43legacy/pio.h172
1 files changed, 172 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43legacy/pio.h b/drivers/net/wireless/b43legacy/pio.h
new file mode 100644
index 000000000000..5bfed0c40030
--- /dev/null
+++ b/drivers/net/wireless/b43legacy/pio.h
@@ -0,0 +1,172 @@
1#ifndef B43legacy_PIO_H_
2#define B43legacy_PIO_H_
3
4#include "b43legacy.h"
5
6#include <linux/interrupt.h>
7#include <linux/list.h>
8#include <linux/skbuff.h>
9
10
11#define B43legacy_PIO_TXCTL 0x00
12#define B43legacy_PIO_TXDATA 0x02
13#define B43legacy_PIO_TXQBUFSIZE 0x04
14#define B43legacy_PIO_RXCTL 0x08
15#define B43legacy_PIO_RXDATA 0x0A
16
17#define B43legacy_PIO_TXCTL_WRITELO (1 << 0)
18#define B43legacy_PIO_TXCTL_WRITEHI (1 << 1)
19#define B43legacy_PIO_TXCTL_COMPLETE (1 << 2)
20#define B43legacy_PIO_TXCTL_INIT (1 << 3)
21#define B43legacy_PIO_TXCTL_SUSPEND (1 << 7)
22
23#define B43legacy_PIO_RXCTL_DATAAVAILABLE (1 << 0)
24#define B43legacy_PIO_RXCTL_READY (1 << 1)
25
26/* PIO constants */
27#define B43legacy_PIO_MAXTXDEVQPACKETS 31
28#define B43legacy_PIO_TXQADJUST 80
29
30/* PIO tuning knobs */
31#define B43legacy_PIO_MAXTXPACKETS 256
32
33
34
35#ifdef CONFIG_B43LEGACY_PIO
36
37
38struct b43legacy_pioqueue;
39struct b43legacy_xmitstatus;
40
41struct b43legacy_pio_txpacket {
42 struct b43legacy_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) - \
49 (packet)->queue->tx_packets_cache))
50
51struct b43legacy_pioqueue {
52 struct b43legacy_wldev *dev;
53 u16 mmio_base;
54
55 bool tx_suspended;
56 bool tx_frozen;
57 bool need_workarounds; /* Workarounds needed for core.rev < 3 */
58
59 /* Adjusted size of the device internal TX buffer. */
60 u16 tx_devq_size;
61 /* Used octets of the device internal TX buffer. */
62 u16 tx_devq_used;
63 /* Used packet slots in the device internal TX buffer. */
64 u8 tx_devq_packets;
65 /* Packets from the txfree list can
66 * be taken on incoming TX requests.
67 */
68 struct list_head txfree;
69 unsigned int nr_txfree;
70 /* Packets on the txqueue are queued,
71 * but not completely written to the chip, yet.
72 */
73 struct list_head txqueue;
74 /* Packets on the txrunning queue are completely
75 * posted to the device. We are waiting for the txstatus.
76 */
77 struct list_head txrunning;
78 /* Total number or packets sent.
79 * (This counter can obviously wrap).
80 */
81 unsigned int nr_tx_packets;
82 struct tasklet_struct txtask;
83 struct b43legacy_pio_txpacket
84 tx_packets_cache[B43legacy_PIO_MAXTXPACKETS];
85};
86
87static inline
88u16 b43legacy_pio_read(struct b43legacy_pioqueue *queue,
89 u16 offset)
90{
91 return b43legacy_read16(queue->dev, queue->mmio_base + offset);
92}
93
94static inline
95void b43legacy_pio_write(struct b43legacy_pioqueue *queue,
96 u16 offset, u16 value)
97{
98 b43legacy_write16(queue->dev, queue->mmio_base + offset, value);
99 mmiowb();
100}
101
102
103int b43legacy_pio_init(struct b43legacy_wldev *dev);
104void b43legacy_pio_free(struct b43legacy_wldev *dev);
105
106int b43legacy_pio_tx(struct b43legacy_wldev *dev,
107 struct sk_buff *skb,
108 struct ieee80211_tx_control *ctl);
109void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
110 const struct b43legacy_txstatus *status);
111void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
112 struct ieee80211_tx_queue_stats *stats);
113void b43legacy_pio_rx(struct b43legacy_pioqueue *queue);
114
115/* Suspend TX queue in hardware. */
116void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue);
117void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue);
118/* Suspend (freeze) the TX tasklet (software level). */
119void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev);
120void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev);
121
122#else /* CONFIG_B43LEGACY_PIO */
123
124static inline
125int b43legacy_pio_init(struct b43legacy_wldev *dev)
126{
127 return 0;
128}
129static inline
130void b43legacy_pio_free(struct b43legacy_wldev *dev)
131{
132}
133static inline
134int b43legacy_pio_tx(struct b43legacy_wldev *dev,
135 struct sk_buff *skb,
136 struct ieee80211_tx_control *ctl)
137{
138 return 0;
139}
140static inline
141void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
142 const struct b43legacy_txstatus *status)
143{
144}
145static inline
146void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
147 struct ieee80211_tx_queue_stats *stats)
148{
149}
150static inline
151void b43legacy_pio_rx(struct b43legacy_pioqueue *queue)
152{
153}
154static inline
155void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue)
156{
157}
158static inline
159void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue)
160{
161}
162static inline
163void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev)
164{
165}
166static inline
167void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev)
168{
169}
170
171#endif /* CONFIG_B43LEGACY_PIO */
172#endif /* B43legacy_PIO_H_ */