aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500usb.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2008-10-13 12:13:56 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-10-13 12:13:56 -0400
commite758936e02700ff88a0b08b722a3847b95283ef2 (patch)
tree50c919bef1b459a778b85159d5929de95b6c4a01 /drivers/net/wireless/rt2x00/rt2500usb.c
parent239cfbde1f5843c4a24199f117d5f67f637d72d5 (diff)
parent4480f15b3306f43bbb0310d461142b4e897ca45b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: include/asm-x86/statfs.h
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index cd5af656932d..d3bf7bba611a 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -288,7 +288,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
288}; 288};
289#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 289#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
290 290
291#ifdef CONFIG_RT2500USB_LEDS 291#ifdef CONFIG_RT2X00_LIB_LEDS
292static void rt2500usb_brightness_set(struct led_classdev *led_cdev, 292static void rt2500usb_brightness_set(struct led_classdev *led_cdev,
293 enum led_brightness brightness) 293 enum led_brightness brightness)
294{ 294{
@@ -333,7 +333,7 @@ static void rt2500usb_init_led(struct rt2x00_dev *rt2x00dev,
333 led->led_dev.blink_set = rt2500usb_blink_set; 333 led->led_dev.blink_set = rt2500usb_blink_set;
334 led->flags = LED_INITIALIZED; 334 led->flags = LED_INITIALIZED;
335} 335}
336#endif /* CONFIG_RT2500USB_LEDS */ 336#endif /* CONFIG_RT2X00_LIB_LEDS */
337 337
338/* 338/*
339 * Configuration handlers. 339 * Configuration handlers.
@@ -384,7 +384,7 @@ static void rt2500usb_config_intf(struct rt2x00_dev *rt2x00dev,
384 rt2500usb_register_read(rt2x00dev, TXRX_CSR20, &reg); 384 rt2500usb_register_read(rt2x00dev, TXRX_CSR20, &reg);
385 rt2x00_set_field16(&reg, TXRX_CSR20_OFFSET, bcn_preload >> 6); 385 rt2x00_set_field16(&reg, TXRX_CSR20_OFFSET, bcn_preload >> 6);
386 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW, 386 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW,
387 2 * (conf->type != IEEE80211_IF_TYPE_STA)); 387 2 * (conf->type != NL80211_IFTYPE_STATION));
388 rt2500usb_register_write(rt2x00dev, TXRX_CSR20, reg); 388 rt2500usb_register_write(rt2x00dev, TXRX_CSR20, reg);
389 389
390 /* 390 /*
@@ -1114,8 +1114,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1114 rt2x00_set_field32(&word, TXD_W0_NEW_SEQ, 1114 rt2x00_set_field32(&word, TXD_W0_NEW_SEQ,
1115 test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); 1115 test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags));
1116 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); 1116 rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
1117 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, 1117 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len);
1118 skb->len - skbdesc->desc_len);
1119 rt2x00_set_field32(&word, TXD_W0_CIPHER, CIPHER_NONE); 1118 rt2x00_set_field32(&word, TXD_W0_CIPHER, CIPHER_NONE);
1120 rt2x00_desc_write(txd, 0, word); 1119 rt2x00_desc_write(txd, 0, word);
1121} 1120}
@@ -1134,7 +1133,6 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1134 int pipe = usb_sndbulkpipe(usb_dev, 1); 1133 int pipe = usb_sndbulkpipe(usb_dev, 1);
1135 int length; 1134 int length;
1136 u16 reg; 1135 u16 reg;
1137 u32 word, len;
1138 1136
1139 /* 1137 /*
1140 * Add the descriptor in front of the skb. 1138 * Add the descriptor in front of the skb.
@@ -1144,17 +1142,6 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1144 skbdesc->desc = entry->skb->data; 1142 skbdesc->desc = entry->skb->data;
1145 1143
1146 /* 1144 /*
1147 * Adjust the beacon databyte count. The current number is
1148 * calculated before this function gets called, but falsely
1149 * assumes that the descriptor was already present in the SKB.
1150 */
1151 rt2x00_desc_read(skbdesc->desc, 0, &word);
1152 len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
1153 len += skbdesc->desc_len;
1154 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
1155 rt2x00_desc_write(skbdesc->desc, 0, word);
1156
1157 /*
1158 * Disable beaconing while we are reloading the beacon data, 1145 * Disable beaconing while we are reloading the beacon data,
1159 * otherwise we might be sending out invalid data. 1146 * otherwise we might be sending out invalid data.
1160 */ 1147 */
@@ -1280,6 +1267,8 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1280 1267
1281 if (rt2x00_get_field32(word0, RXD_W0_OFDM)) 1268 if (rt2x00_get_field32(word0, RXD_W0_OFDM))
1282 rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; 1269 rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
1270 else
1271 rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE;
1283 if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) 1272 if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
1284 rxdesc->dev_flags |= RXDONE_MY_BSS; 1273 rxdesc->dev_flags |= RXDONE_MY_BSS;
1285 1274
@@ -1297,7 +1286,7 @@ static void rt2500usb_beacondone(struct urb *urb)
1297 struct queue_entry *entry = (struct queue_entry *)urb->context; 1286 struct queue_entry *entry = (struct queue_entry *)urb->context;
1298 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; 1287 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data;
1299 1288
1300 if (!test_bit(DEVICE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags)) 1289 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags))
1301 return; 1290 return;
1302 1291
1303 /* 1292 /*
@@ -1484,14 +1473,14 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1484 /* 1473 /*
1485 * Store led mode, for correct led behaviour. 1474 * Store led mode, for correct led behaviour.
1486 */ 1475 */
1487#ifdef CONFIG_RT2500USB_LEDS 1476#ifdef CONFIG_RT2X00_LIB_LEDS
1488 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); 1477 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
1489 1478
1490 rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); 1479 rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
1491 if (value == LED_MODE_TXRX_ACTIVITY) 1480 if (value == LED_MODE_TXRX_ACTIVITY)
1492 rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_qual, 1481 rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_qual,
1493 LED_TYPE_ACTIVITY); 1482 LED_TYPE_ACTIVITY);
1494#endif /* CONFIG_RT2500USB_LEDS */ 1483#endif /* CONFIG_RT2X00_LIB_LEDS */
1495 1484
1496 /* 1485 /*
1497 * Check if the BBP tuning should be disabled. 1486 * Check if the BBP tuning should be disabled.
@@ -1665,10 +1654,11 @@ static const struct rf_channel rf_vals_5222[] = {
1665 { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 }, 1654 { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 },
1666}; 1655};
1667 1656
1668static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) 1657static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1669{ 1658{
1670 struct hw_mode_spec *spec = &rt2x00dev->spec; 1659 struct hw_mode_spec *spec = &rt2x00dev->spec;
1671 u8 *txpower; 1660 struct channel_info *info;
1661 char *tx_power;
1672 unsigned int i; 1662 unsigned int i;
1673 1663
1674 /* 1664 /*
@@ -1687,20 +1677,10 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1687 EEPROM_MAC_ADDR_0)); 1677 EEPROM_MAC_ADDR_0));
1688 1678
1689 /* 1679 /*
1690 * Convert tx_power array in eeprom.
1691 */
1692 txpower = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1693 for (i = 0; i < 14; i++)
1694 txpower[i] = TXPOWER_FROM_DEV(txpower[i]);
1695
1696 /*
1697 * Initialize hw_mode information. 1680 * Initialize hw_mode information.
1698 */ 1681 */
1699 spec->supported_bands = SUPPORT_BAND_2GHZ; 1682 spec->supported_bands = SUPPORT_BAND_2GHZ;
1700 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 1683 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
1701 spec->tx_power_a = NULL;
1702 spec->tx_power_bg = txpower;
1703 spec->tx_power_default = DEFAULT_TXPOWER;
1704 1684
1705 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) { 1685 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) {
1706 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); 1686 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522);
@@ -1722,6 +1702,26 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1722 spec->num_channels = ARRAY_SIZE(rf_vals_5222); 1702 spec->num_channels = ARRAY_SIZE(rf_vals_5222);
1723 spec->channels = rf_vals_5222; 1703 spec->channels = rf_vals_5222;
1724 } 1704 }
1705
1706 /*
1707 * Create channel information array
1708 */
1709 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
1710 if (!info)
1711 return -ENOMEM;
1712
1713 spec->channels_info = info;
1714
1715 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1716 for (i = 0; i < 14; i++)
1717 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1718
1719 if (spec->num_channels > 14) {
1720 for (i = 14; i < spec->num_channels; i++)
1721 info[i].tx_power1 = DEFAULT_TXPOWER;
1722 }
1723
1724 return 0;
1725} 1725}
1726 1726
1727static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) 1727static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
@@ -1742,7 +1742,9 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
1742 /* 1742 /*
1743 * Initialize hw specifications. 1743 * Initialize hw specifications.
1744 */ 1744 */
1745 rt2500usb_probe_hw_mode(rt2x00dev); 1745 retval = rt2500usb_probe_hw_mode(rt2x00dev);
1746 if (retval)
1747 return retval;
1746 1748
1747 /* 1749 /*
1748 * This device requires the atim queue 1750 * This device requires the atim queue