aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00reg.h9
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c12
9 files changed, 45 insertions, 51 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 28999ffaba2e..0e345659f421 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -265,9 +265,9 @@ static void rt2400pci_config_bssid(struct rt2x00_dev *rt2x00dev,
265 (2 * sizeof(__le32))); 265 (2 * sizeof(__le32)));
266} 266}
267 267
268static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, int type) 268static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
269 const int tsf_sync)
269{ 270{
270 struct interface *intf = &rt2x00dev->interface;
271 u32 reg; 271 u32 reg;
272 272
273 rt2x00pci_register_write(rt2x00dev, CSR14, 0); 273 rt2x00pci_register_write(rt2x00dev, CSR14, 0);
@@ -287,13 +287,7 @@ static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, int type)
287 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1); 287 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
288 rt2x00_set_field32(&reg, CSR14_TBCN, 1); 288 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
289 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0); 289 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
290 if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) || 290 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, tsf_sync);
291 is_interface_type(intf, IEEE80211_IF_TYPE_AP))
292 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 2);
293 else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
294 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 1);
295 else
296 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 0);
297 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 291 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
298} 292}
299 293
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 9d9b4377a6f2..fa8669f5c965 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -265,9 +265,9 @@ static void rt2500pci_config_bssid(struct rt2x00_dev *rt2x00dev,
265 (2 * sizeof(__le32))); 265 (2 * sizeof(__le32)));
266} 266}
267 267
268static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type) 268static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
269 const int tsf_sync)
269{ 270{
270 struct interface *intf = &rt2x00dev->interface;
271 u32 reg; 271 u32 reg;
272 272
273 rt2x00pci_register_write(rt2x00dev, CSR14, 0); 273 rt2x00pci_register_write(rt2x00dev, CSR14, 0);
@@ -291,13 +291,7 @@ static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type)
291 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1); 291 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
292 rt2x00_set_field32(&reg, CSR14_TBCN, 1); 292 rt2x00_set_field32(&reg, CSR14_TBCN, 1);
293 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0); 293 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
294 if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) || 294 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, tsf_sync);
295 is_interface_type(intf, IEEE80211_IF_TYPE_AP))
296 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 2);
297 else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
298 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 1);
299 else
300 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 0);
301 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 295 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
302} 296}
303 297
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 3dbd381f1428..6d5444b58e6c 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -268,9 +268,9 @@ static void rt2500usb_config_bssid(struct rt2x00_dev *rt2x00dev,
268 (3 * sizeof(__le16))); 268 (3 * sizeof(__le16)));
269} 269}
270 270
271static void rt2500usb_config_type(struct rt2x00_dev *rt2x00dev, const int type) 271static void rt2500usb_config_type(struct rt2x00_dev *rt2x00dev, const int type,
272 const int tsf_sync)
272{ 273{
273 struct interface *intf = &rt2x00dev->interface;
274 u16 reg; 274 u16 reg;
275 275
276 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, 0); 276 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, 0);
@@ -281,7 +281,7 @@ static void rt2500usb_config_type(struct rt2x00_dev *rt2x00dev, const int type)
281 rt2500usb_register_read(rt2x00dev, TXRX_CSR20, &reg); 281 rt2500usb_register_read(rt2x00dev, TXRX_CSR20, &reg);
282 rt2x00_set_field16(&reg, TXRX_CSR20_OFFSET, 282 rt2x00_set_field16(&reg, TXRX_CSR20_OFFSET,
283 (PREAMBLE + get_duration(IEEE80211_HEADER, 2)) >> 6); 283 (PREAMBLE + get_duration(IEEE80211_HEADER, 2)) >> 6);
284 if (is_interface_type(intf, IEEE80211_IF_TYPE_STA)) 284 if (type == IEEE80211_IF_TYPE_STA)
285 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW, 0); 285 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW, 0);
286 else 286 else
287 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW, 2); 287 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW, 2);
@@ -298,13 +298,7 @@ static void rt2500usb_config_type(struct rt2x00_dev *rt2x00dev, const int type)
298 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 1); 298 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 1);
299 rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 1); 299 rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 1);
300 rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0); 300 rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0);
301 if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) || 301 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_SYNC, tsf_sync);
302 is_interface_type(intf, IEEE80211_IF_TYPE_AP))
303 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_SYNC, 2);
304 else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
305 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_SYNC, 1);
306 else
307 rt2x00_set_field16(&reg, TXRX_CSR19_TSF_SYNC, 0);
308 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); 302 rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
309} 303}
310 304
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 235e5ad21908..27bec6ec33df 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -410,7 +410,8 @@ struct rt2x00lib_ops {
410 */ 410 */
411 void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac); 411 void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac);
412 void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid); 412 void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid);
413 void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type); 413 void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type,
414 const int tsf_sync);
414 void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags, 415 void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags,
415 struct ieee80211_conf *conf); 416 struct ieee80211_conf *conf);
416#define CONFIG_UPDATE_PHYMODE ( 1 << 1 ) 417#define CONFIG_UPDATE_PHYMODE ( 1 << 1 )
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index aeeaa0c14245..f8e87aa86335 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -74,10 +74,24 @@ void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
74 rt2x00dev->ops->lib->config_bssid(rt2x00dev, &reg[0]); 74 rt2x00dev->ops->lib->config_bssid(rt2x00dev, &reg[0]);
75} 75}
76 76
77void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type) 77void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type)
78{ 78{
79 if (type != INVALID_INTERFACE) 79 int tsf_sync;
80 rt2x00dev->ops->lib->config_type(rt2x00dev, type); 80
81 switch (type) {
82 case IEEE80211_IF_TYPE_IBSS:
83 case IEEE80211_IF_TYPE_AP:
84 tsf_sync = TSF_SYNC_BEACON;
85 break;
86 case IEEE80211_IF_TYPE_STA:
87 tsf_sync = TSF_SYNC_INFRA;
88 break;
89 default:
90 tsf_sync = TSF_SYNC_NONE;
91 break;
92 }
93
94 rt2x00dev->ops->lib->config_type(rt2x00dev, type, tsf_sync);
81} 95}
82 96
83void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 97void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 0ab39cad3cc8..29ca932d77ab 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -52,7 +52,7 @@ void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev);
52 */ 52 */
53void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac); 53void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac);
54void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid); 54void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid);
55void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type); 55void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type);
56void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 56void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
57 struct ieee80211_conf *conf, const int force_config); 57 struct ieee80211_conf *conf, const int force_config);
58 58
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 7927d5f7bcc7..838421216da0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -59,6 +59,15 @@ enum led_mode {
59}; 59};
60 60
61/* 61/*
62 * TSF sync values
63 */
64enum tsf_sync {
65 TSF_SYNC_NONE = 0,
66 TSF_SYNC_INFRA = 1,
67 TSF_SYNC_BEACON = 2,
68};
69
70/*
62 * Device states 71 * Device states
63 */ 72 */
64enum dev_state { 73enum dev_state {
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 1c3937a3f9dc..1c0789f2a411 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -300,9 +300,9 @@ static void rt61pci_config_bssid(struct rt2x00_dev *rt2x00dev, __le32 *bssid)
300 (2 * sizeof(__le32))); 300 (2 * sizeof(__le32)));
301} 301}
302 302
303static void rt61pci_config_type(struct rt2x00_dev *rt2x00dev, const int type) 303static void rt61pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
304 const int tsf_sync)
304{ 305{
305 struct interface *intf = &rt2x00dev->interface;
306 u32 reg; 306 u32 reg;
307 307
308 /* 308 /*
@@ -324,13 +324,7 @@ static void rt61pci_config_type(struct rt2x00_dev *rt2x00dev, const int type)
324 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1); 324 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
325 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1); 325 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
326 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0); 326 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
327 if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) || 327 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, tsf_sync);
328 is_interface_type(intf, IEEE80211_IF_TYPE_AP))
329 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 2);
330 else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
331 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 1);
332 else
333 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 0);
334 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); 328 rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
335} 329}
336 330
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 6d1635b5cd07..919cca593bc1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -279,9 +279,9 @@ static void rt73usb_config_bssid(struct rt2x00_dev *rt2x00dev, __le32 *bssid)
279 (2 * sizeof(__le32))); 279 (2 * sizeof(__le32)));
280} 280}
281 281
282static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type) 282static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type,
283 const int tsf_sync)
283{ 284{
284 struct interface *intf = &rt2x00dev->interface;
285 u32 reg; 285 u32 reg;
286 286
287 /* 287 /*
@@ -303,13 +303,7 @@ static void rt73usb_config_type(struct rt2x00_dev *rt2x00dev, const int type)
303 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1); 303 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 1);
304 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1); 304 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 1);
305 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0); 305 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
306 if (is_interface_type(intf, IEEE80211_IF_TYPE_IBSS) || 306 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, tsf_sync);
307 is_interface_type(intf, IEEE80211_IF_TYPE_AP))
308 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 2);
309 else if (is_interface_type(intf, IEEE80211_IF_TYPE_STA))
310 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 1);
311 else
312 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 0);
313 rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg); 307 rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg);
314} 308}
315 309