diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-20 20:43:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-20 20:43:29 -0400 |
commit | db6d8c7a4027b48d797b369a53f8470aaeed7063 (patch) | |
tree | e140c104a89abc2154e1f41a7db8ebecbb6fa0b4 /drivers/net/wireless/rtl8187.h | |
parent | 3a533374283aea50eab3976d8a6d30532175f009 (diff) | |
parent | fb65a7c091529bfffb1262515252c0d0f6241c5c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (1232 commits)
iucv: Fix bad merging.
net_sched: Add size table for qdiscs
net_sched: Add accessor function for packet length for qdiscs
net_sched: Add qdisc_enqueue wrapper
highmem: Export totalhigh_pages.
ipv6 mcast: Omit redundant address family checks in ip6_mc_source().
net: Use standard structures for generic socket address structures.
ipv6 netns: Make several "global" sysctl variables namespace aware.
netns: Use net_eq() to compare net-namespaces for optimization.
ipv6: remove unused macros from net/ipv6.h
ipv6: remove unused parameter from ip6_ra_control
tcp: fix kernel panic with listening_get_next
tcp: Remove redundant checks when setting eff_sacks
tcp: options clean up
tcp: Fix MD5 signatures for non-linear skbs
sctp: Update sctp global memory limit allocations.
sctp: remove unnecessary byteshifting, calculate directly in big-endian
sctp: Allow only 1 listening socket with SO_REUSEADDR
sctp: Do not leak memory on multiple listen() calls
sctp: Support ipv6only AF_INET6 sockets.
...
Diffstat (limited to 'drivers/net/wireless/rtl8187.h')
-rw-r--r-- | drivers/net/wireless/rtl8187.h | 119 |
1 files changed, 97 insertions, 22 deletions
diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h index 076d88b6db0e..3afb49f8866a 100644 --- a/drivers/net/wireless/rtl8187.h +++ b/drivers/net/wireless/rtl8187.h | |||
@@ -44,23 +44,48 @@ struct rtl8187_rx_hdr { | |||
44 | __le64 mac_time; | 44 | __le64 mac_time; |
45 | } __attribute__((packed)); | 45 | } __attribute__((packed)); |
46 | 46 | ||
47 | struct rtl8187_tx_info { | 47 | struct rtl8187b_rx_hdr { |
48 | struct ieee80211_tx_control *control; | ||
49 | struct urb *urb; | ||
50 | struct ieee80211_hw *dev; | ||
51 | }; | ||
52 | |||
53 | struct rtl8187_tx_hdr { | ||
54 | __le32 flags; | 48 | __le32 flags; |
49 | __le64 mac_time; | ||
50 | u8 noise; | ||
51 | u8 signal; | ||
52 | u8 agc; | ||
53 | u8 reserved; | ||
54 | __le32 unused; | ||
55 | } __attribute__((packed)); | ||
56 | |||
57 | /* {rtl8187,rtl8187b}_tx_info is in skb */ | ||
58 | |||
59 | /* Tx flags are common between rtl8187 and rtl8187b */ | ||
55 | #define RTL8187_TX_FLAG_NO_ENCRYPT (1 << 15) | 60 | #define RTL8187_TX_FLAG_NO_ENCRYPT (1 << 15) |
56 | #define RTL8187_TX_FLAG_MORE_FRAG (1 << 17) | 61 | #define RTL8187_TX_FLAG_MORE_FRAG (1 << 17) |
57 | #define RTL8187_TX_FLAG_CTS (1 << 18) | 62 | #define RTL8187_TX_FLAG_CTS (1 << 18) |
58 | #define RTL8187_TX_FLAG_RTS (1 << 23) | 63 | #define RTL8187_TX_FLAG_RTS (1 << 23) |
64 | |||
65 | struct rtl8187_tx_hdr { | ||
66 | __le32 flags; | ||
67 | __le16 rts_duration; | ||
68 | __le16 len; | ||
69 | __le32 retry; | ||
70 | } __attribute__((packed)); | ||
71 | |||
72 | struct rtl8187b_tx_hdr { | ||
73 | __le32 flags; | ||
59 | __le16 rts_duration; | 74 | __le16 rts_duration; |
60 | __le16 len; | 75 | __le16 len; |
76 | __le32 unused_1; | ||
77 | __le16 unused_2; | ||
78 | __le16 tx_duration; | ||
79 | __le32 unused_3; | ||
61 | __le32 retry; | 80 | __le32 retry; |
81 | __le32 unused_4[2]; | ||
62 | } __attribute__((packed)); | 82 | } __attribute__((packed)); |
63 | 83 | ||
84 | enum { | ||
85 | DEVICE_RTL8187, | ||
86 | DEVICE_RTL8187B | ||
87 | }; | ||
88 | |||
64 | struct rtl8187_priv { | 89 | struct rtl8187_priv { |
65 | /* common between rtl818x drivers */ | 90 | /* common between rtl818x drivers */ |
66 | struct rtl818x_csr *map; | 91 | struct rtl818x_csr *map; |
@@ -76,70 +101,120 @@ struct rtl8187_priv { | |||
76 | u32 rx_conf; | 101 | u32 rx_conf; |
77 | u16 txpwr_base; | 102 | u16 txpwr_base; |
78 | u8 asic_rev; | 103 | u8 asic_rev; |
104 | u8 is_rtl8187b; | ||
105 | enum { | ||
106 | RTL8187BvB, | ||
107 | RTL8187BvD, | ||
108 | RTL8187BvE | ||
109 | } hw_rev; | ||
79 | struct sk_buff_head rx_queue; | 110 | struct sk_buff_head rx_queue; |
111 | u8 signal; | ||
112 | u8 quality; | ||
113 | u8 noise; | ||
80 | }; | 114 | }; |
81 | 115 | ||
82 | void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); | 116 | void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); |
83 | 117 | ||
84 | static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr) | 118 | static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv, |
119 | u8 *addr, u8 idx) | ||
85 | { | 120 | { |
86 | u8 val; | 121 | u8 val; |
87 | 122 | ||
88 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), | 123 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), |
89 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, | 124 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, |
90 | (unsigned long)addr, 0, &val, sizeof(val), HZ / 2); | 125 | (unsigned long)addr, idx & 0x03, &val, |
126 | sizeof(val), HZ / 2); | ||
91 | 127 | ||
92 | return val; | 128 | return val; |
93 | } | 129 | } |
94 | 130 | ||
95 | static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr) | 131 | static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr) |
132 | { | ||
133 | return rtl818x_ioread8_idx(priv, addr, 0); | ||
134 | } | ||
135 | |||
136 | static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv, | ||
137 | __le16 *addr, u8 idx) | ||
96 | { | 138 | { |
97 | __le16 val; | 139 | __le16 val; |
98 | 140 | ||
99 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), | 141 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), |
100 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, | 142 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, |
101 | (unsigned long)addr, 0, &val, sizeof(val), HZ / 2); | 143 | (unsigned long)addr, idx & 0x03, &val, |
144 | sizeof(val), HZ / 2); | ||
102 | 145 | ||
103 | return le16_to_cpu(val); | 146 | return le16_to_cpu(val); |
104 | } | 147 | } |
105 | 148 | ||
106 | static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr) | 149 | static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr) |
150 | { | ||
151 | return rtl818x_ioread16_idx(priv, addr, 0); | ||
152 | } | ||
153 | |||
154 | static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv, | ||
155 | __le32 *addr, u8 idx) | ||
107 | { | 156 | { |
108 | __le32 val; | 157 | __le32 val; |
109 | 158 | ||
110 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), | 159 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), |
111 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, | 160 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, |
112 | (unsigned long)addr, 0, &val, sizeof(val), HZ / 2); | 161 | (unsigned long)addr, idx & 0x03, &val, |
162 | sizeof(val), HZ / 2); | ||
113 | 163 | ||
114 | return le32_to_cpu(val); | 164 | return le32_to_cpu(val); |
115 | } | 165 | } |
116 | 166 | ||
117 | static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, | 167 | static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr) |
118 | u8 *addr, u8 val) | 168 | { |
169 | return rtl818x_ioread32_idx(priv, addr, 0); | ||
170 | } | ||
171 | |||
172 | static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv, | ||
173 | u8 *addr, u8 val, u8 idx) | ||
119 | { | 174 | { |
120 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | 175 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), |
121 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | 176 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, |
122 | (unsigned long)addr, 0, &val, sizeof(val), HZ / 2); | 177 | (unsigned long)addr, idx & 0x03, &val, |
178 | sizeof(val), HZ / 2); | ||
179 | } | ||
180 | |||
181 | static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val) | ||
182 | { | ||
183 | rtl818x_iowrite8_idx(priv, addr, val, 0); | ||
123 | } | 184 | } |
124 | 185 | ||
125 | static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, | 186 | static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv, |
126 | __le16 *addr, u16 val) | 187 | __le16 *addr, u16 val, u8 idx) |
127 | { | 188 | { |
128 | __le16 buf = cpu_to_le16(val); | 189 | __le16 buf = cpu_to_le16(val); |
129 | 190 | ||
130 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | 191 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), |
131 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | 192 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, |
132 | (unsigned long)addr, 0, &buf, sizeof(buf), HZ / 2); | 193 | (unsigned long)addr, idx & 0x03, &buf, sizeof(buf), |
194 | HZ / 2); | ||
133 | } | 195 | } |
134 | 196 | ||
135 | static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, | 197 | static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr, |
136 | __le32 *addr, u32 val) | 198 | u16 val) |
199 | { | ||
200 | rtl818x_iowrite16_idx(priv, addr, val, 0); | ||
201 | } | ||
202 | |||
203 | static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv, | ||
204 | __le32 *addr, u32 val, u8 idx) | ||
137 | { | 205 | { |
138 | __le32 buf = cpu_to_le32(val); | 206 | __le32 buf = cpu_to_le32(val); |
139 | 207 | ||
140 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | 208 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), |
141 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | 209 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, |
142 | (unsigned long)addr, 0, &buf, sizeof(buf), HZ / 2); | 210 | (unsigned long)addr, idx & 0x03, &buf, sizeof(buf), |
211 | HZ / 2); | ||
212 | } | ||
213 | |||
214 | static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr, | ||
215 | u32 val) | ||
216 | { | ||
217 | rtl818x_iowrite32_idx(priv, addr, val, 0); | ||
143 | } | 218 | } |
144 | 219 | ||
145 | #endif /* RTL8187_H */ | 220 | #endif /* RTL8187_H */ |