aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/pio.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/pio.h')
-rw-r--r--drivers/net/wireless/b43/pio.h153
1 files changed, 153 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/pio.h b/drivers/net/wireless/b43/pio.h
new file mode 100644
index 000000000000..46d6d2ea9b5f
--- /dev/null
+++ b/drivers/net/wireless/b43/pio.h
@@ -0,0 +1,153 @@
1#ifndef B43_PIO_H_
2#define B43_PIO_H_
3
4#include "b43.h"
5
6#include <linux/interrupt.h>
7#include <linux/list.h>
8#include <linux/skbuff.h>
9
10#define B43_PIO_TXCTL 0x00
11#define B43_PIO_TXDATA 0x02
12#define B43_PIO_TXQBUFSIZE 0x04
13#define B43_PIO_RXCTL 0x08
14#define B43_PIO_RXDATA 0x0A
15
16#define B43_PIO_TXCTL_WRITELO (1 << 0)
17#define B43_PIO_TXCTL_WRITEHI (1 << 1)
18#define B43_PIO_TXCTL_COMPLETE (1 << 2)
19#define B43_PIO_TXCTL_INIT (1 << 3)
20#define B43_PIO_TXCTL_SUSPEND (1 << 7)
21
22#define B43_PIO_RXCTL_DATAAVAILABLE (1 << 0)
23#define B43_PIO_RXCTL_READY (1 << 1)
24
25/* PIO constants */
26#define B43_PIO_MAXTXDEVQPACKETS 31
27#define B43_PIO_TXQADJUST 80
28
29/* PIO tuning knobs */
30#define B43_PIO_MAXTXPACKETS 256
31
32#ifdef CONFIG_B43_PIO
33
34struct b43_pioqueue;
35struct b43_xmitstatus;
36
37struct b43_pio_txpacket {
38 struct b43_pioqueue *queue;
39 struct sk_buff *skb;
40 struct ieee80211_tx_status txstat;
41 struct list_head list;
42};
43
44#define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->tx_packets_cache))
45
46struct b43_pioqueue {
47 struct b43_wldev *dev;
48 u16 mmio_base;
49
50 bool tx_suspended;
51 bool tx_frozen;
52 bool need_workarounds; /* Workarounds needed for core.rev < 3 */
53
54 /* Adjusted size of the device internal TX buffer. */
55 u16 tx_devq_size;
56 /* Used octets of the device internal TX buffer. */
57 u16 tx_devq_used;
58 /* Used packet slots in the device internal TX buffer. */
59 u8 tx_devq_packets;
60 /* Packets from the txfree list can
61 * be taken on incoming TX requests.
62 */
63 struct list_head txfree;
64 unsigned int nr_txfree;
65 /* Packets on the txqueue are queued,
66 * but not completely written to the chip, yet.
67 */
68 struct list_head txqueue;
69 /* Packets on the txrunning queue are completely
70 * posted to the device. We are waiting for the txstatus.
71 */
72 struct list_head txrunning;
73 /* Total number or packets sent.
74 * (This counter can obviously wrap).
75 */
76 unsigned int nr_tx_packets;
77 struct tasklet_struct txtask;
78 struct b43_pio_txpacket tx_packets_cache[B43_PIO_MAXTXPACKETS];
79};
80
81static inline u16 b43_pio_read(struct b43_pioqueue *queue, u16 offset)
82{
83 return b43_read16(queue->dev, queue->mmio_base + offset);
84}
85
86static inline
87 void b43_pio_write(struct b43_pioqueue *queue, u16 offset, u16 value)
88{
89 b43_write16(queue->dev, queue->mmio_base + offset, value);
90 mmiowb();
91}
92
93int b43_pio_init(struct b43_wldev *dev);
94void b43_pio_free(struct b43_wldev *dev);
95
96int b43_pio_tx(struct b43_wldev *dev,
97 struct sk_buff *skb, struct ieee80211_tx_control *ctl);
98void b43_pio_handle_txstatus(struct b43_wldev *dev,
99 const struct b43_txstatus *status);
100void b43_pio_get_tx_stats(struct b43_wldev *dev,
101 struct ieee80211_tx_queue_stats *stats);
102void b43_pio_rx(struct b43_pioqueue *queue);
103
104/* Suspend TX queue in hardware. */
105void b43_pio_tx_suspend(struct b43_pioqueue *queue);
106void b43_pio_tx_resume(struct b43_pioqueue *queue);
107/* Suspend (freeze) the TX tasklet (software level). */
108void b43_pio_freeze_txqueues(struct b43_wldev *dev);
109void b43_pio_thaw_txqueues(struct b43_wldev *dev);
110
111#else /* CONFIG_B43_PIO */
112
113static inline int b43_pio_init(struct b43_wldev *dev)
114{
115 return 0;
116}
117static inline void b43_pio_free(struct b43_wldev *dev)
118{
119}
120static inline
121 int b43_pio_tx(struct b43_wldev *dev,
122 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
123{
124 return 0;
125}
126static inline
127 void b43_pio_handle_txstatus(struct b43_wldev *dev,
128 const struct b43_txstatus *status)
129{
130}
131static inline
132 void b43_pio_get_tx_stats(struct b43_wldev *dev,
133 struct ieee80211_tx_queue_stats *stats)
134{
135}
136static inline void b43_pio_rx(struct b43_pioqueue *queue)
137{
138}
139static inline void b43_pio_tx_suspend(struct b43_pioqueue *queue)
140{
141}
142static inline void b43_pio_tx_resume(struct b43_pioqueue *queue)
143{
144}
145static inline void b43_pio_freeze_txqueues(struct b43_wldev *dev)
146{
147}
148static inline void b43_pio_thaw_txqueues(struct b43_wldev *dev)
149{
150}
151
152#endif /* CONFIG_B43_PIO */
153#endif /* B43_PIO_H_ */