diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-09-06 08:25:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-11 15:53:32 -0400 |
commit | 1b9975347e852c22a7c4c67b68814403ef16d2bd (patch) | |
tree | f577763ea0815273cf78ddaf1070421587ad786a /drivers/net/wireless/p54/p54common.c | |
parent | 09adf284039f896401df8ea219ee1d13e80333a8 (diff) |
p54: 802.11a 5GHz phy support
This patch brings the 5GHz Phy in any prism54 devices (of course, only those who have one) to life.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 124 |
1 files changed, 104 insertions, 20 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 7ec695ca9ea4..da51786254dc 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -27,7 +27,7 @@ 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[] = { | 30 | static struct ieee80211_rate p54_bgrates[] = { |
31 | { .bitrate = 10, .hw_value = 0, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | 31 | { .bitrate = 10, .hw_value = 0, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, |
32 | { .bitrate = 20, .hw_value = 1, .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 }, | 33 | { .bitrate = 55, .hw_value = 2, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, |
@@ -42,7 +42,7 @@ static struct ieee80211_rate p54_rates[] = { | |||
42 | { .bitrate = 540, .hw_value = 11, }, | 42 | { .bitrate = 540, .hw_value = 11, }, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static struct ieee80211_channel p54_channels[] = { | 45 | static struct ieee80211_channel p54_bgchannels[] = { |
46 | { .center_freq = 2412, .hw_value = 1, }, | 46 | { .center_freq = 2412, .hw_value = 1, }, |
47 | { .center_freq = 2417, .hw_value = 2, }, | 47 | { .center_freq = 2417, .hw_value = 2, }, |
48 | { .center_freq = 2422, .hw_value = 3, }, | 48 | { .center_freq = 2422, .hw_value = 3, }, |
@@ -60,10 +60,66 @@ static struct ieee80211_channel p54_channels[] = { | |||
60 | }; | 60 | }; |
61 | 61 | ||
62 | static struct ieee80211_supported_band band_2GHz = { | 62 | static struct ieee80211_supported_band band_2GHz = { |
63 | .channels = p54_channels, | 63 | .channels = p54_bgchannels, |
64 | .n_channels = ARRAY_SIZE(p54_channels), | 64 | .n_channels = ARRAY_SIZE(p54_bgchannels), |
65 | .bitrates = p54_rates, | 65 | .bitrates = p54_bgrates, |
66 | .n_bitrates = ARRAY_SIZE(p54_rates), | 66 | .n_bitrates = ARRAY_SIZE(p54_bgrates), |
67 | }; | ||
68 | |||
69 | static struct ieee80211_rate p54_arates[] = { | ||
70 | { .bitrate = 60, .hw_value = 4, }, | ||
71 | { .bitrate = 90, .hw_value = 5, }, | ||
72 | { .bitrate = 120, .hw_value = 6, }, | ||
73 | { .bitrate = 180, .hw_value = 7, }, | ||
74 | { .bitrate = 240, .hw_value = 8, }, | ||
75 | { .bitrate = 360, .hw_value = 9, }, | ||
76 | { .bitrate = 480, .hw_value = 10, }, | ||
77 | { .bitrate = 540, .hw_value = 11, }, | ||
78 | }; | ||
79 | |||
80 | static struct ieee80211_channel p54_achannels[] = { | ||
81 | { .center_freq = 4920 }, | ||
82 | { .center_freq = 4940 }, | ||
83 | { .center_freq = 4960 }, | ||
84 | { .center_freq = 4980 }, | ||
85 | { .center_freq = 5040 }, | ||
86 | { .center_freq = 5060 }, | ||
87 | { .center_freq = 5080 }, | ||
88 | { .center_freq = 5170 }, | ||
89 | { .center_freq = 5180 }, | ||
90 | { .center_freq = 5190 }, | ||
91 | { .center_freq = 5200 }, | ||
92 | { .center_freq = 5210 }, | ||
93 | { .center_freq = 5220 }, | ||
94 | { .center_freq = 5230 }, | ||
95 | { .center_freq = 5240 }, | ||
96 | { .center_freq = 5260 }, | ||
97 | { .center_freq = 5280 }, | ||
98 | { .center_freq = 5300 }, | ||
99 | { .center_freq = 5320 }, | ||
100 | { .center_freq = 5500 }, | ||
101 | { .center_freq = 5520 }, | ||
102 | { .center_freq = 5540 }, | ||
103 | { .center_freq = 5560 }, | ||
104 | { .center_freq = 5580 }, | ||
105 | { .center_freq = 5600 }, | ||
106 | { .center_freq = 5620 }, | ||
107 | { .center_freq = 5640 }, | ||
108 | { .center_freq = 5660 }, | ||
109 | { .center_freq = 5680 }, | ||
110 | { .center_freq = 5700 }, | ||
111 | { .center_freq = 5745 }, | ||
112 | { .center_freq = 5765 }, | ||
113 | { .center_freq = 5785 }, | ||
114 | { .center_freq = 5805 }, | ||
115 | { .center_freq = 5825 }, | ||
116 | }; | ||
117 | |||
118 | static struct ieee80211_supported_band band_5GHz = { | ||
119 | .channels = p54_achannels, | ||
120 | .n_channels = ARRAY_SIZE(p54_achannels), | ||
121 | .bitrates = p54_arates, | ||
122 | .n_bitrates = ARRAY_SIZE(p54_arates), | ||
67 | }; | 123 | }; |
68 | 124 | ||
69 | int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | 125 | int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) |
@@ -252,6 +308,7 @@ static int p54_convert_rev1(struct ieee80211_hw *dev, | |||
252 | 308 | ||
253 | const char* p54_rf_chips[] = { "NULL", "Indigo?", "Duette", | 309 | const char* p54_rf_chips[] = { "NULL", "Indigo?", "Duette", |
254 | "Frisbee", "Xbow", "Longbow" }; | 310 | "Frisbee", "Xbow", "Longbow" }; |
311 | static int p54_init_xbow_synth(struct ieee80211_hw *dev); | ||
255 | 312 | ||
256 | int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | 313 | int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) |
257 | { | 314 | { |
@@ -371,20 +428,20 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
371 | } | 428 | } |
372 | 429 | ||
373 | switch (priv->rxhw) { | 430 | switch (priv->rxhw) { |
374 | case 4: /* XBow */ | 431 | case 4: /* XBow */ |
375 | case 1: /* Indigo? */ | 432 | p54_init_xbow_synth(dev); |
376 | case 2: /* Duette */ | 433 | case 1: /* Indigo? */ |
377 | /* TODO: 5GHz initialization goes here */ | 434 | case 2: /* Duette */ |
378 | 435 | dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz; | |
379 | case 3: /* Frisbee */ | 436 | case 3: /* Frisbee */ |
380 | case 5: /* Longbow */ | 437 | case 5: /* Longbow */ |
381 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz; | 438 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz; |
382 | break; | 439 | break; |
383 | default: | 440 | default: |
384 | printk(KERN_ERR "%s: unsupported RF-Chip\n", | 441 | printk(KERN_ERR "%s: unsupported RF-Chip\n", |
385 | wiphy_name(dev->wiphy)); | 442 | wiphy_name(dev->wiphy)); |
386 | err = -EINVAL; | 443 | err = -EINVAL; |
387 | goto err; | 444 | goto err; |
388 | } | 445 | } |
389 | 446 | ||
390 | if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { | 447 | if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { |
@@ -1225,6 +1282,33 @@ static int p54_conf_tx(struct ieee80211_hw *dev, u16 queue, | |||
1225 | return 0; | 1282 | return 0; |
1226 | } | 1283 | } |
1227 | 1284 | ||
1285 | static int p54_init_xbow_synth(struct ieee80211_hw *dev) | ||
1286 | { | ||
1287 | struct p54_common *priv = dev->priv; | ||
1288 | struct p54_control_hdr *hdr; | ||
1289 | struct p54_tx_control_xbow_synth *xbow; | ||
1290 | |||
1291 | hdr = kzalloc(sizeof(*hdr) + sizeof(*xbow) + | ||
1292 | priv->tx_hdr_len, GFP_KERNEL); | ||
1293 | if (!hdr) | ||
1294 | return -ENOMEM; | ||
1295 | |||
1296 | hdr = (void *)hdr + priv->tx_hdr_len; | ||
1297 | hdr->magic1 = cpu_to_le16(0x8001); | ||
1298 | hdr->len = cpu_to_le16(sizeof(*xbow)); | ||
1299 | hdr->type = cpu_to_le16(P54_CONTROL_TYPE_XBOW_SYNTH_CFG); | ||
1300 | p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*xbow)); | ||
1301 | |||
1302 | xbow = (struct p54_tx_control_xbow_synth *) hdr->data; | ||
1303 | xbow->magic1 = cpu_to_le16(0x1); | ||
1304 | xbow->magic2 = cpu_to_le16(0x2); | ||
1305 | xbow->freq = cpu_to_le16(5390); | ||
1306 | |||
1307 | priv->tx(dev, hdr, sizeof(*hdr) + sizeof(*xbow), 1); | ||
1308 | |||
1309 | return 0; | ||
1310 | } | ||
1311 | |||
1228 | static void p54_statistics_timer(unsigned long data) | 1312 | static void p54_statistics_timer(unsigned long data) |
1229 | { | 1313 | { |
1230 | struct ieee80211_hw *dev = (struct ieee80211_hw *) data; | 1314 | struct ieee80211_hw *dev = (struct ieee80211_hw *) data; |