aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/adm8211.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/adm8211.c')
-rw-r--r--drivers/net/wireless/adm8211.c80
1 files changed, 45 insertions, 35 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 79796186713e..7d4218206c47 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -48,6 +48,32 @@ static struct pci_device_id adm8211_pci_id_table[] __devinitdata = {
48 { 0 } 48 { 0 }
49}; 49};
50 50
51static struct ieee80211_rate adm8211_rates[] = {
52 { .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
53 { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
54 { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
55 { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
56 { .bitrate = 220, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, /* XX ?? */
57};
58
59static const struct ieee80211_channel adm8211_channels[] = {
60 { .center_freq = 2412},
61 { .center_freq = 2417},
62 { .center_freq = 2422},
63 { .center_freq = 2427},
64 { .center_freq = 2432},
65 { .center_freq = 2437},
66 { .center_freq = 2442},
67 { .center_freq = 2447},
68 { .center_freq = 2452},
69 { .center_freq = 2457},
70 { .center_freq = 2462},
71 { .center_freq = 2467},
72 { .center_freq = 2472},
73 { .center_freq = 2484},
74};
75
76
51static void adm8211_eeprom_register_read(struct eeprom_93cx6 *eeprom) 77static void adm8211_eeprom_register_read(struct eeprom_93cx6 *eeprom)
52{ 78{
53 struct adm8211_priv *priv = eeprom->data; 79 struct adm8211_priv *priv = eeprom->data;
@@ -155,17 +181,17 @@ static int adm8211_read_eeprom(struct ieee80211_hw *dev)
155 printk(KERN_DEBUG "%s (adm8211): Channel range: %d - %d\n", 181 printk(KERN_DEBUG "%s (adm8211): Channel range: %d - %d\n",
156 pci_name(priv->pdev), (int)chan_range.min, (int)chan_range.max); 182 pci_name(priv->pdev), (int)chan_range.min, (int)chan_range.max);
157 183
158 priv->modes[0].num_channels = chan_range.max - chan_range.min + 1; 184 BUILD_BUG_ON(sizeof(priv->channels) != sizeof(adm8211_channels));
159 priv->modes[0].channels = priv->channels;
160 185
161 memcpy(priv->channels, adm8211_channels, sizeof(adm8211_channels)); 186 memcpy(priv->channels, adm8211_channels, sizeof(priv->channels));
187 priv->band.channels = priv->channels;
188 priv->band.n_channels = ARRAY_SIZE(adm8211_channels);
189 priv->band.bitrates = adm8211_rates;
190 priv->band.n_bitrates = ARRAY_SIZE(adm8211_rates);
162 191
163 for (i = 1; i <= ARRAY_SIZE(adm8211_channels); i++) 192 for (i = 1; i <= ARRAY_SIZE(adm8211_channels); i++)
164 if (i >= chan_range.min && i <= chan_range.max) 193 if (i < chan_range.min || i > chan_range.max)
165 priv->channels[i - 1].flag = 194 priv->channels[i - 1].flags |= IEEE80211_CHAN_DISABLED;
166 IEEE80211_CHAN_W_SCAN |
167 IEEE80211_CHAN_W_ACTIVE_SCAN |
168 IEEE80211_CHAN_W_IBSS;
169 195
170 switch (priv->eeprom->specific_bbptype) { 196 switch (priv->eeprom->specific_bbptype) {
171 case ADM8211_BBP_RFMD3000: 197 case ADM8211_BBP_RFMD3000:
@@ -347,7 +373,6 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev)
347 unsigned int pktlen; 373 unsigned int pktlen;
348 struct sk_buff *skb, *newskb; 374 struct sk_buff *skb, *newskb;
349 unsigned int limit = priv->rx_ring_size; 375 unsigned int limit = priv->rx_ring_size;
350 static const u8 rate_tbl[] = {10, 20, 55, 110, 220};
351 u8 rssi, rate; 376 u8 rssi, rate;
352 377
353 while (!(priv->rx_ring[entry].status & cpu_to_le32(RDES0_STATUS_OWN))) { 378 while (!(priv->rx_ring[entry].status & cpu_to_le32(RDES0_STATUS_OWN))) {
@@ -425,12 +450,10 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev)
425 else 450 else
426 rx_status.ssi = 100 - rssi; 451 rx_status.ssi = 100 - rssi;
427 452
428 if (rate <= 4) 453 rx_status.rate_idx = rate;
429 rx_status.rate = rate_tbl[rate];
430 454
431 rx_status.channel = priv->channel; 455 rx_status.freq = adm8211_channels[priv->channel - 1].center_freq;
432 rx_status.freq = adm8211_channels[priv->channel - 1].freq; 456 rx_status.band = IEEE80211_BAND_2GHZ;
433 rx_status.phymode = MODE_IEEE80211B;
434 457
435 ieee80211_rx_irqsafe(dev, skb, &rx_status); 458 ieee80211_rx_irqsafe(dev, skb, &rx_status);
436 } 459 }
@@ -1054,7 +1077,7 @@ static int adm8211_set_rate(struct ieee80211_hw *dev)
1054 if (priv->pdev->revision != ADM8211_REV_BA) { 1077 if (priv->pdev->revision != ADM8211_REV_BA) {
1055 rate_buf[0] = ARRAY_SIZE(adm8211_rates); 1078 rate_buf[0] = ARRAY_SIZE(adm8211_rates);
1056 for (i = 0; i < ARRAY_SIZE(adm8211_rates); i++) 1079 for (i = 0; i < ARRAY_SIZE(adm8211_rates); i++)
1057 rate_buf[i + 1] = (adm8211_rates[i].rate / 5) | 0x80; 1080 rate_buf[i + 1] = (adm8211_rates[i].bitrate / 5) | 0x80;
1058 } else { 1081 } else {
1059 /* workaround for rev BA specific bug */ 1082 /* workaround for rev BA specific bug */
1060 rate_buf[0] = 0x04; 1083 rate_buf[0] = 0x04;
@@ -1303,9 +1326,10 @@ static int adm8211_set_ssid(struct ieee80211_hw *dev, u8 *ssid, size_t ssid_len)
1303static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 1326static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
1304{ 1327{
1305 struct adm8211_priv *priv = dev->priv; 1328 struct adm8211_priv *priv = dev->priv;
1329 int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
1306 1330
1307 if (conf->channel != priv->channel) { 1331 if (channel != priv->channel) {
1308 priv->channel = conf->channel; 1332 priv->channel = channel;
1309 adm8211_rf_set_channel(dev, priv->channel); 1333 adm8211_rf_set_channel(dev, priv->channel);
1310 } 1334 }
1311 1335
@@ -1680,10 +1704,10 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
1680 1704
1681 if (control->tx_rate < 0) { 1705 if (control->tx_rate < 0) {
1682 short_preamble = 1; 1706 short_preamble = 1;
1683 plcp_signal = -control->tx_rate; 1707 plcp_signal = -control->tx_rate->bitrate;
1684 } else { 1708 } else {
1685 short_preamble = 0; 1709 short_preamble = 0;
1686 plcp_signal = control->tx_rate; 1710 plcp_signal = control->tx_rate->bitrate;
1687 } 1711 }
1688 1712
1689 hdr = (struct ieee80211_hdr *)skb->data; 1713 hdr = (struct ieee80211_hdr *)skb->data;
@@ -1880,18 +1904,11 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
1880 SET_IEEE80211_PERM_ADDR(dev, perm_addr); 1904 SET_IEEE80211_PERM_ADDR(dev, perm_addr);
1881 1905
1882 dev->extra_tx_headroom = sizeof(struct adm8211_tx_hdr); 1906 dev->extra_tx_headroom = sizeof(struct adm8211_tx_hdr);
1883 dev->flags = IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED; 1907 /* dev->flags = IEEE80211_HW_RX_INCLUDES_FCS in promisc mode */
1884 /* IEEE80211_HW_RX_INCLUDES_FCS in promisc mode */
1885 1908
1886 dev->channel_change_time = 1000; 1909 dev->channel_change_time = 1000;
1887 dev->max_rssi = 100; /* FIXME: find better value */ 1910 dev->max_rssi = 100; /* FIXME: find better value */
1888 1911
1889 priv->modes[0].mode = MODE_IEEE80211B;
1890 /* channel info filled in by adm8211_read_eeprom */
1891 memcpy(priv->rates, adm8211_rates, sizeof(adm8211_rates));
1892 priv->modes[0].num_rates = ARRAY_SIZE(adm8211_rates);
1893 priv->modes[0].rates = priv->rates;
1894
1895 dev->queues = 1; /* ADM8211C supports more, maybe ADM8211B too */ 1912 dev->queues = 1; /* ADM8211C supports more, maybe ADM8211B too */
1896 1913
1897 priv->retry_limit = 3; 1914 priv->retry_limit = 3;
@@ -1917,14 +1934,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
1917 goto err_free_desc; 1934 goto err_free_desc;
1918 } 1935 }
1919 1936
1920 priv->channel = priv->modes[0].channels[0].chan; 1937 priv->channel = 1;
1921
1922 err = ieee80211_register_hwmode(dev, &priv->modes[0]);
1923 if (err) {
1924 printk(KERN_ERR "%s (adm8211): Can't register hwmode\n",
1925 pci_name(pdev));
1926 goto err_free_desc;
1927 }
1928 1938
1929 err = ieee80211_register_hw(dev); 1939 err = ieee80211_register_hw(dev);
1930 if (err) { 1940 if (err) {