diff options
Diffstat (limited to 'drivers/net/wireless/p54common.c')
-rw-r--r-- | drivers/net/wireless/p54common.c | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c index 5cda49aff3a8..218ff7770ef6 100644 --- a/drivers/net/wireless/p54common.c +++ b/drivers/net/wireless/p54common.c | |||
@@ -27,6 +27,46 @@ MODULE_DESCRIPTION("Softmac Prism54 common code"); | |||
27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
28 | MODULE_ALIAS("prism54common"); | 28 | MODULE_ALIAS("prism54common"); |
29 | 29 | ||
30 | static struct ieee80211_rate p54_rates[] = { | ||
31 | { .bitrate = 10, .hw_value = 0, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
32 | { .bitrate = 20, .hw_value = 1, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
33 | { .bitrate = 55, .hw_value = 2, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
34 | { .bitrate = 110, .hw_value = 3, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
35 | { .bitrate = 60, .hw_value = 4, }, | ||
36 | { .bitrate = 90, .hw_value = 5, }, | ||
37 | { .bitrate = 120, .hw_value = 6, }, | ||
38 | { .bitrate = 180, .hw_value = 7, }, | ||
39 | { .bitrate = 240, .hw_value = 8, }, | ||
40 | { .bitrate = 360, .hw_value = 9, }, | ||
41 | { .bitrate = 480, .hw_value = 10, }, | ||
42 | { .bitrate = 540, .hw_value = 11, }, | ||
43 | }; | ||
44 | |||
45 | static struct ieee80211_channel p54_channels[] = { | ||
46 | { .center_freq = 2412, .hw_value = 1, }, | ||
47 | { .center_freq = 2417, .hw_value = 2, }, | ||
48 | { .center_freq = 2422, .hw_value = 3, }, | ||
49 | { .center_freq = 2427, .hw_value = 4, }, | ||
50 | { .center_freq = 2432, .hw_value = 5, }, | ||
51 | { .center_freq = 2437, .hw_value = 6, }, | ||
52 | { .center_freq = 2442, .hw_value = 7, }, | ||
53 | { .center_freq = 2447, .hw_value = 8, }, | ||
54 | { .center_freq = 2452, .hw_value = 9, }, | ||
55 | { .center_freq = 2457, .hw_value = 10, }, | ||
56 | { .center_freq = 2462, .hw_value = 11, }, | ||
57 | { .center_freq = 2467, .hw_value = 12, }, | ||
58 | { .center_freq = 2472, .hw_value = 13, }, | ||
59 | { .center_freq = 2484, .hw_value = 14, }, | ||
60 | }; | ||
61 | |||
62 | struct ieee80211_supported_band band_2GHz = { | ||
63 | .channels = p54_channels, | ||
64 | .n_channels = ARRAY_SIZE(p54_channels), | ||
65 | .bitrates = p54_rates, | ||
66 | .n_bitrates = ARRAY_SIZE(p54_rates), | ||
67 | }; | ||
68 | |||
69 | |||
30 | void p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | 70 | void p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) |
31 | { | 71 | { |
32 | struct p54_common *priv = dev->priv; | 72 | struct p54_common *priv = dev->priv; |
@@ -308,10 +348,10 @@ static void p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
308 | u16 freq = le16_to_cpu(hdr->freq); | 348 | u16 freq = le16_to_cpu(hdr->freq); |
309 | 349 | ||
310 | rx_status.ssi = hdr->rssi; | 350 | rx_status.ssi = hdr->rssi; |
311 | rx_status.rate = hdr->rate & 0x1f; /* report short preambles & CCK too */ | 351 | /* XX correct? */ |
312 | rx_status.channel = freq == 2484 ? 14 : (freq - 2407)/5; | 352 | rx_status.rate_idx = hdr->rate & 0xf; |
313 | rx_status.freq = freq; | 353 | rx_status.freq = freq; |
314 | rx_status.phymode = MODE_IEEE80211G; | 354 | rx_status.band = IEEE80211_BAND_2GHZ; |
315 | rx_status.antenna = hdr->antenna; | 355 | rx_status.antenna = hdr->antenna; |
316 | rx_status.mactime = le64_to_cpu(hdr->timestamp); | 356 | rx_status.mactime = le64_to_cpu(hdr->timestamp); |
317 | rx_status.flag |= RX_FLAG_TSFT; | 357 | rx_status.flag |= RX_FLAG_TSFT; |
@@ -547,7 +587,9 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
547 | txhdr->padding2 = 0; | 587 | txhdr->padding2 = 0; |
548 | 588 | ||
549 | /* TODO: add support for alternate retry TX rates */ | 589 | /* TODO: add support for alternate retry TX rates */ |
550 | rate = control->tx_rate; | 590 | rate = control->tx_rate->hw_value; |
591 | if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) | ||
592 | rate |= 0x10; | ||
551 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) | 593 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) |
552 | rate |= 0x40; | 594 | rate |= 0x40; |
553 | else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) | 595 | else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) |
@@ -849,7 +891,7 @@ static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) | |||
849 | { | 891 | { |
850 | int ret; | 892 | int ret; |
851 | 893 | ||
852 | ret = p54_set_freq(dev, cpu_to_le16(conf->freq)); | 894 | ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq)); |
853 | p54_set_vdcf(dev); | 895 | p54_set_vdcf(dev); |
854 | return ret; | 896 | return ret; |
855 | } | 897 | } |
@@ -944,7 +986,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
944 | { | 986 | { |
945 | struct ieee80211_hw *dev; | 987 | struct ieee80211_hw *dev; |
946 | struct p54_common *priv; | 988 | struct p54_common *priv; |
947 | int i; | ||
948 | 989 | ||
949 | dev = ieee80211_alloc_hw(priv_data_len, &p54_ops); | 990 | dev = ieee80211_alloc_hw(priv_data_len, &p54_ops); |
950 | if (!dev) | 991 | if (!dev) |
@@ -953,18 +994,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
953 | priv = dev->priv; | 994 | priv = dev->priv; |
954 | priv->mode = IEEE80211_IF_TYPE_INVALID; | 995 | priv->mode = IEEE80211_IF_TYPE_INVALID; |
955 | skb_queue_head_init(&priv->tx_queue); | 996 | skb_queue_head_init(&priv->tx_queue); |
956 | memcpy(priv->channels, p54_channels, sizeof(p54_channels)); | 997 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz; |
957 | memcpy(priv->rates, p54_rates, sizeof(p54_rates)); | ||
958 | priv->modes[1].mode = MODE_IEEE80211B; | ||
959 | priv->modes[1].num_rates = 4; | ||
960 | priv->modes[1].rates = priv->rates; | ||
961 | priv->modes[1].num_channels = ARRAY_SIZE(p54_channels); | ||
962 | priv->modes[1].channels = priv->channels; | ||
963 | priv->modes[0].mode = MODE_IEEE80211G; | ||
964 | priv->modes[0].num_rates = ARRAY_SIZE(p54_rates); | ||
965 | priv->modes[0].rates = priv->rates; | ||
966 | priv->modes[0].num_channels = ARRAY_SIZE(p54_channels); | ||
967 | priv->modes[0].channels = priv->channels; | ||
968 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | /* not sure */ | 998 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | /* not sure */ |
969 | IEEE80211_HW_RX_INCLUDES_FCS; | 999 | IEEE80211_HW_RX_INCLUDES_FCS; |
970 | dev->channel_change_time = 1000; /* TODO: find actual value */ | 1000 | dev->channel_change_time = 1000; /* TODO: find actual value */ |
@@ -986,14 +1016,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
986 | 1016 | ||
987 | p54_init_vdcf(dev); | 1017 | p54_init_vdcf(dev); |
988 | 1018 | ||
989 | for (i = 0; i < 2; i++) { | ||
990 | if (ieee80211_register_hwmode(dev, &priv->modes[i])) { | ||
991 | kfree(priv->cached_vdcf); | ||
992 | ieee80211_free_hw(dev); | ||
993 | return NULL; | ||
994 | } | ||
995 | } | ||
996 | |||
997 | return dev; | 1019 | return dev; |
998 | } | 1020 | } |
999 | EXPORT_SYMBOL_GPL(p54_init_common); | 1021 | EXPORT_SYMBOL_GPL(p54_init_common); |