diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-10-14 22:07:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:34 -0400 |
commit | 5e73444e91889ea6c7a83bc174ef8e8b6aaeea9b (patch) | |
tree | 84fb678e99ed7f52c4588861d45651dbea2f24e5 | |
parent | b92f30d65aeb0502e2ed8beb80c8465578b40002 (diff) |
p54: borrow some setup code from stlc45xx
This patch initialize all remaining values which are necessary for
SPI firmwares.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/p54/p54.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 75 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54common.h | 18 |
3 files changed, 51 insertions, 46 deletions
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h index e9988e78a0c2..7a3bf759a40e 100644 --- a/drivers/net/wireless/p54/p54.h +++ b/drivers/net/wireless/p54/p54.h | |||
@@ -15,7 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | enum control_frame_types { | 17 | enum control_frame_types { |
18 | P54_CONTROL_TYPE_FILTER_SET = 0, | 18 | P54_CONTROL_TYPE_SETUP = 0, |
19 | P54_CONTROL_TYPE_CHANNEL_CHANGE, | 19 | P54_CONTROL_TYPE_CHANNEL_CHANGE, |
20 | P54_CONTROL_TYPE_FREQDONE, | 20 | P54_CONTROL_TYPE_FREQDONE, |
21 | P54_CONTROL_TYPE_DCFINIT, | 21 | P54_CONTROL_TYPE_DCFINIT, |
@@ -80,7 +80,7 @@ struct p54_common { | |||
80 | struct mutex conf_mutex; | 80 | struct mutex conf_mutex; |
81 | u8 mac_addr[ETH_ALEN]; | 81 | u8 mac_addr[ETH_ALEN]; |
82 | u8 bssid[ETH_ALEN]; | 82 | u8 bssid[ETH_ALEN]; |
83 | __le16 filter_type; | 83 | u16 mac_mode; |
84 | struct pda_iq_autocal_entry *iq_autocal; | 84 | struct pda_iq_autocal_entry *iq_autocal; |
85 | unsigned int iq_autocal_len; | 85 | unsigned int iq_autocal_len; |
86 | struct pda_channel_output_limit *output_limit; | 86 | struct pda_channel_output_limit *output_limit; |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 13080b1ba5e7..525a684c57be 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -1018,43 +1018,48 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
1018 | return 0; | 1018 | return 0; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type, | 1021 | static int p54_setup_mac(struct ieee80211_hw *dev, u16 mode, const u8 *bssid) |
1022 | const u8 *bssid) | ||
1023 | { | 1022 | { |
1024 | struct p54_common *priv = dev->priv; | 1023 | struct p54_common *priv = dev->priv; |
1025 | struct sk_buff *skb; | 1024 | struct sk_buff *skb; |
1026 | struct p54_tx_control_filter *filter; | 1025 | struct p54_setup_mac *setup; |
1027 | u16 data_len = sizeof(struct p54_control_hdr) + sizeof(*filter); | ||
1028 | 1026 | ||
1029 | if (priv->fw_var < 0x500) | 1027 | skb = p54_alloc_skb(dev, 0x8001, sizeof(struct p54_control_hdr) + |
1030 | data_len += P54_TX_CONTROL_FILTER_V1_LEN; | 1028 | sizeof(*setup), P54_CONTROL_TYPE_SETUP, |
1031 | else | ||
1032 | data_len += P54_TX_CONTROL_FILTER_V2_LEN; | ||
1033 | |||
1034 | skb = p54_alloc_skb(dev, 0x8001, data_len, P54_CONTROL_TYPE_FILTER_SET, | ||
1035 | GFP_ATOMIC); | 1029 | GFP_ATOMIC); |
1036 | if (!skb) | 1030 | if (!skb) |
1037 | return -ENOMEM; | 1031 | return -ENOMEM; |
1038 | 1032 | ||
1039 | filter = (struct p54_tx_control_filter *) skb_put(skb, sizeof(*filter)); | 1033 | setup = (struct p54_setup_mac *) skb_put(skb, sizeof(*setup)); |
1040 | filter->filter_type = priv->filter_type = cpu_to_le16(filter_type); | 1034 | priv->mac_mode = mode; |
1041 | memcpy(filter->mac_addr, priv->mac_addr, ETH_ALEN); | 1035 | setup->mac_mode = cpu_to_le16(mode); |
1036 | memcpy(setup->mac_addr, priv->mac_addr, ETH_ALEN); | ||
1042 | if (!bssid) | 1037 | if (!bssid) |
1043 | memset(filter->bssid, ~0, ETH_ALEN); | 1038 | memset(setup->bssid, ~0, ETH_ALEN); |
1044 | else | 1039 | else |
1045 | memcpy(filter->bssid, bssid, ETH_ALEN); | 1040 | memcpy(setup->bssid, bssid, ETH_ALEN); |
1046 | filter->rx_antenna = priv->rx_antenna; | 1041 | setup->rx_antenna = priv->rx_antenna; |
1047 | if (priv->fw_var < 0x500) { | 1042 | if (priv->fw_var < 0x500) { |
1048 | filter->v1.basic_rate_mask = cpu_to_le32(0x15f); | 1043 | setup->v1.basic_rate_mask = cpu_to_le32(0x15f); |
1049 | filter->v1.rx_addr = cpu_to_le32(priv->rx_end); | 1044 | setup->v1.rx_addr = cpu_to_le32(priv->rx_end); |
1050 | filter->v1.max_rx = cpu_to_le16(priv->rx_mtu); | 1045 | setup->v1.max_rx = cpu_to_le16(priv->rx_mtu); |
1051 | filter->v1.rxhw = cpu_to_le16(priv->rxhw); | 1046 | setup->v1.rxhw = cpu_to_le16(priv->rxhw); |
1052 | filter->v1.wakeup_timer = cpu_to_le16(500); | 1047 | setup->v1.wakeup_timer = cpu_to_le16(500); |
1048 | setup->v1.unalloc0 = cpu_to_le16(0); | ||
1053 | } else { | 1049 | } else { |
1054 | filter->v2.rx_addr = cpu_to_le32(priv->rx_end); | 1050 | setup->v2.rx_addr = cpu_to_le32(priv->rx_end); |
1055 | filter->v2.max_rx = cpu_to_le16(priv->rx_mtu); | 1051 | setup->v2.max_rx = cpu_to_le16(priv->rx_mtu); |
1056 | filter->v2.rxhw = cpu_to_le16(priv->rxhw); | 1052 | setup->v2.rxhw = cpu_to_le16(priv->rxhw); |
1057 | filter->v2.timer = cpu_to_le16(1000); | 1053 | setup->v2.timer = cpu_to_le16(1000); |
1054 | setup->v2.truncate = cpu_to_le16(48896); | ||
1055 | setup->v2.basic_rate_mask = cpu_to_le32(0x15f); | ||
1056 | setup->v2.sbss_offset = 0; | ||
1057 | setup->v2.mcast_window = 0; | ||
1058 | setup->v2.rx_rssi_threshold = 0; | ||
1059 | setup->v2.rx_ed_threshold = 0; | ||
1060 | setup->v2.ref_clock = cpu_to_le32(644245094); | ||
1061 | setup->v2.lpf_bandwidth = cpu_to_le16(65535); | ||
1062 | setup->v2.osc_start_delay = cpu_to_le16(65535); | ||
1058 | } | 1063 | } |
1059 | priv->tx(dev, skb, 1); | 1064 | priv->tx(dev, skb, 1); |
1060 | return 0; | 1065 | return 0; |
@@ -1272,11 +1277,11 @@ static int p54_add_interface(struct ieee80211_hw *dev, | |||
1272 | 1277 | ||
1273 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | 1278 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); |
1274 | 1279 | ||
1275 | p54_set_filter(dev, 0, NULL); | 1280 | p54_setup_mac(dev, 0, NULL); |
1276 | 1281 | ||
1277 | switch (conf->type) { | 1282 | switch (conf->type) { |
1278 | case NL80211_IFTYPE_STATION: | 1283 | case NL80211_IFTYPE_STATION: |
1279 | p54_set_filter(dev, 1, NULL); | 1284 | p54_setup_mac(dev, 1, NULL); |
1280 | break; | 1285 | break; |
1281 | default: | 1286 | default: |
1282 | BUG(); /* impossible */ | 1287 | BUG(); /* impossible */ |
@@ -1294,7 +1299,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev, | |||
1294 | struct p54_common *priv = dev->priv; | 1299 | struct p54_common *priv = dev->priv; |
1295 | priv->mode = NL80211_IFTYPE_MONITOR; | 1300 | priv->mode = NL80211_IFTYPE_MONITOR; |
1296 | memset(priv->mac_addr, 0, ETH_ALEN); | 1301 | memset(priv->mac_addr, 0, ETH_ALEN); |
1297 | p54_set_filter(dev, 0, NULL); | 1302 | p54_setup_mac(dev, 0, NULL); |
1298 | } | 1303 | } |
1299 | 1304 | ||
1300 | static int p54_config(struct ieee80211_hw *dev, u32 changed) | 1305 | static int p54_config(struct ieee80211_hw *dev, u32 changed) |
@@ -1320,7 +1325,7 @@ static int p54_config_interface(struct ieee80211_hw *dev, | |||
1320 | struct p54_common *priv = dev->priv; | 1325 | struct p54_common *priv = dev->priv; |
1321 | 1326 | ||
1322 | mutex_lock(&priv->conf_mutex); | 1327 | mutex_lock(&priv->conf_mutex); |
1323 | p54_set_filter(dev, 0, conf->bssid); | 1328 | p54_setup_mac(dev, 0, conf->bssid); |
1324 | p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); | 1329 | p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); |
1325 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 1330 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
1326 | mutex_unlock(&priv->conf_mutex); | 1331 | mutex_unlock(&priv->conf_mutex); |
@@ -1342,20 +1347,16 @@ static void p54_configure_filter(struct ieee80211_hw *dev, | |||
1342 | 1347 | ||
1343 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | 1348 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
1344 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | 1349 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) |
1345 | p54_set_filter(dev, le16_to_cpu(priv->filter_type), | 1350 | p54_setup_mac(dev, priv->mac_mode, NULL); |
1346 | NULL); | ||
1347 | else | 1351 | else |
1348 | p54_set_filter(dev, le16_to_cpu(priv->filter_type), | 1352 | p54_setup_mac(dev, priv->mac_mode, priv->bssid); |
1349 | priv->bssid); | ||
1350 | } | 1353 | } |
1351 | 1354 | ||
1352 | if (changed_flags & FIF_PROMISC_IN_BSS) { | 1355 | if (changed_flags & FIF_PROMISC_IN_BSS) { |
1353 | if (*total_flags & FIF_PROMISC_IN_BSS) | 1356 | if (*total_flags & FIF_PROMISC_IN_BSS) |
1354 | p54_set_filter(dev, le16_to_cpu(priv->filter_type) | | 1357 | p54_setup_mac(dev, priv->mac_mode | 0x8, NULL); |
1355 | 0x8, NULL); | ||
1356 | else | 1358 | else |
1357 | p54_set_filter(dev, le16_to_cpu(priv->filter_type) & | 1359 | p54_setup_mac(dev, priv->mac_mode & ~0x8, priv->bssid); |
1358 | ~0x8, priv->bssid); | ||
1359 | } | 1360 | } |
1360 | } | 1361 | } |
1361 | 1362 | ||
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h index 2cb3885c0210..125f70a90dab 100644 --- a/drivers/net/wireless/p54/p54common.h +++ b/drivers/net/wireless/p54/p54common.h | |||
@@ -219,8 +219,8 @@ struct p54_tx_control_allocdata { | |||
219 | u8 align[0]; | 219 | u8 align[0]; |
220 | } __attribute__ ((packed)); | 220 | } __attribute__ ((packed)); |
221 | 221 | ||
222 | struct p54_tx_control_filter { | 222 | struct p54_setup_mac { |
223 | __le16 filter_type; | 223 | __le16 mac_mode; |
224 | u8 mac_addr[ETH_ALEN]; | 224 | u8 mac_addr[ETH_ALEN]; |
225 | u8 bssid[ETH_ALEN]; | 225 | u8 bssid[ETH_ALEN]; |
226 | u8 rx_antenna; | 226 | u8 rx_antenna; |
@@ -240,15 +240,19 @@ struct p54_tx_control_filter { | |||
240 | __le16 max_rx; | 240 | __le16 max_rx; |
241 | __le16 rxhw; | 241 | __le16 rxhw; |
242 | __le16 timer; | 242 | __le16 timer; |
243 | __le16 unalloc0; | 243 | __le16 truncate; |
244 | __le32 unalloc1; | 244 | __le32 basic_rate_mask; |
245 | u8 sbss_offset; | ||
246 | u8 mcast_window; | ||
247 | u8 rx_rssi_threshold; | ||
248 | u8 rx_ed_threshold; | ||
249 | __le32 ref_clock; | ||
250 | __le16 lpf_bandwidth; | ||
251 | __le16 osc_start_delay; | ||
245 | } v2 __attribute__ ((packed)); | 252 | } v2 __attribute__ ((packed)); |
246 | } __attribute__ ((packed)); | 253 | } __attribute__ ((packed)); |
247 | } __attribute__ ((packed)); | 254 | } __attribute__ ((packed)); |
248 | 255 | ||
249 | #define P54_TX_CONTROL_FILTER_V1_LEN (sizeof(struct p54_tx_control_filter)) | ||
250 | #define P54_TX_CONTROL_FILTER_V2_LEN (sizeof(struct p54_tx_control_filter)-8) | ||
251 | |||
252 | struct p54_tx_control_channel { | 256 | struct p54_tx_control_channel { |
253 | __le16 flags; | 257 | __le16 flags; |
254 | __le16 dwell; | 258 | __le16 dwell; |