aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 181a146b4768..ef42cc04a2d7 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -231,7 +231,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = {
231}; 231};
232#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 232#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
233 233
234#ifdef CONFIG_RT2500PCI_RFKILL 234#ifdef CONFIG_RT2X00_LIB_RFKILL
235static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) 235static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
236{ 236{
237 u32 reg; 237 u32 reg;
@@ -241,9 +241,9 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
241} 241}
242#else 242#else
243#define rt2500pci_rfkill_poll NULL 243#define rt2500pci_rfkill_poll NULL
244#endif /* CONFIG_RT2500PCI_RFKILL */ 244#endif /* CONFIG_RT2X00_LIB_RFKILL */
245 245
246#ifdef CONFIG_RT2500PCI_LEDS 246#ifdef CONFIG_RT2X00_LIB_LEDS
247static void rt2500pci_brightness_set(struct led_classdev *led_cdev, 247static void rt2500pci_brightness_set(struct led_classdev *led_cdev,
248 enum led_brightness brightness) 248 enum led_brightness brightness)
249{ 249{
@@ -288,7 +288,7 @@ static void rt2500pci_init_led(struct rt2x00_dev *rt2x00dev,
288 led->led_dev.blink_set = rt2500pci_blink_set; 288 led->led_dev.blink_set = rt2500pci_blink_set;
289 led->flags = LED_INITIALIZED; 289 led->flags = LED_INITIALIZED;
290} 290}
291#endif /* CONFIG_RT2500PCI_LEDS */ 291#endif /* CONFIG_RT2X00_LIB_LEDS */
292 292
293/* 293/*
294 * Configuration handlers. 294 * Configuration handlers.
@@ -1316,6 +1316,8 @@ static void rt2500pci_fill_rxdone(struct queue_entry *entry,
1316 1316
1317 if (rt2x00_get_field32(word0, RXD_W0_OFDM)) 1317 if (rt2x00_get_field32(word0, RXD_W0_OFDM))
1318 rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; 1318 rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
1319 else
1320 rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE;
1319 if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) 1321 if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
1320 rxdesc->dev_flags |= RXDONE_MY_BSS; 1322 rxdesc->dev_flags |= RXDONE_MY_BSS;
1321} 1323}
@@ -1377,7 +1379,7 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)
1377 if (!reg) 1379 if (!reg)
1378 return IRQ_NONE; 1380 return IRQ_NONE;
1379 1381
1380 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) 1382 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1381 return IRQ_HANDLED; 1383 return IRQ_HANDLED;
1382 1384
1383 /* 1385 /*
@@ -1531,22 +1533,22 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1531 /* 1533 /*
1532 * Store led mode, for correct led behaviour. 1534 * Store led mode, for correct led behaviour.
1533 */ 1535 */
1534#ifdef CONFIG_RT2500PCI_LEDS 1536#ifdef CONFIG_RT2X00_LIB_LEDS
1535 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); 1537 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
1536 1538
1537 rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); 1539 rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
1538 if (value == LED_MODE_TXRX_ACTIVITY) 1540 if (value == LED_MODE_TXRX_ACTIVITY)
1539 rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_qual, 1541 rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_qual,
1540 LED_TYPE_ACTIVITY); 1542 LED_TYPE_ACTIVITY);
1541#endif /* CONFIG_RT2500PCI_LEDS */ 1543#endif /* CONFIG_RT2X00_LIB_LEDS */
1542 1544
1543 /* 1545 /*
1544 * Detect if this device has an hardware controlled radio. 1546 * Detect if this device has an hardware controlled radio.
1545 */ 1547 */
1546#ifdef CONFIG_RT2500PCI_RFKILL 1548#ifdef CONFIG_RT2X00_LIB_RFKILL
1547 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1549 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
1548 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 1550 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
1549#endif /* CONFIG_RT2500PCI_RFKILL */ 1551#endif /* CONFIG_RT2X00_LIB_RFKILL */
1550 1552
1551 /* 1553 /*
1552 * Check if the BBP tuning should be enabled. 1554 * Check if the BBP tuning should be enabled.
@@ -1721,10 +1723,11 @@ static const struct rf_channel rf_vals_5222[] = {
1721 { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 }, 1723 { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 },
1722}; 1724};
1723 1725
1724static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) 1726static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1725{ 1727{
1726 struct hw_mode_spec *spec = &rt2x00dev->spec; 1728 struct hw_mode_spec *spec = &rt2x00dev->spec;
1727 u8 *txpower; 1729 struct channel_info *info;
1730 char *tx_power;
1728 unsigned int i; 1731 unsigned int i;
1729 1732
1730 /* 1733 /*
@@ -1741,20 +1744,10 @@ static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1741 EEPROM_MAC_ADDR_0)); 1744 EEPROM_MAC_ADDR_0));
1742 1745
1743 /* 1746 /*
1744 * Convert tx_power array in eeprom.
1745 */
1746 txpower = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1747 for (i = 0; i < 14; i++)
1748 txpower[i] = TXPOWER_FROM_DEV(txpower[i]);
1749
1750 /*
1751 * Initialize hw_mode information. 1747 * Initialize hw_mode information.
1752 */ 1748 */
1753 spec->supported_bands = SUPPORT_BAND_2GHZ; 1749 spec->supported_bands = SUPPORT_BAND_2GHZ;
1754 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 1750 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
1755 spec->tx_power_a = NULL;
1756 spec->tx_power_bg = txpower;
1757 spec->tx_power_default = DEFAULT_TXPOWER;
1758 1751
1759 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) { 1752 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) {
1760 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); 1753 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522);
@@ -1776,6 +1769,26 @@ static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1776 spec->num_channels = ARRAY_SIZE(rf_vals_5222); 1769 spec->num_channels = ARRAY_SIZE(rf_vals_5222);
1777 spec->channels = rf_vals_5222; 1770 spec->channels = rf_vals_5222;
1778 } 1771 }
1772
1773 /*
1774 * Create channel information array
1775 */
1776 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
1777 if (!info)
1778 return -ENOMEM;
1779
1780 spec->channels_info = info;
1781
1782 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1783 for (i = 0; i < 14; i++)
1784 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1785
1786 if (spec->num_channels > 14) {
1787 for (i = 14; i < spec->num_channels; i++)
1788 info[i].tx_power1 = DEFAULT_TXPOWER;
1789 }
1790
1791 return 0;
1779} 1792}
1780 1793
1781static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) 1794static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
@@ -1796,7 +1809,9 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1796 /* 1809 /*
1797 * Initialize hw specifications. 1810 * Initialize hw specifications.
1798 */ 1811 */
1799 rt2500pci_probe_hw_mode(rt2x00dev); 1812 retval = rt2500pci_probe_hw_mode(rt2x00dev);
1813 if (retval)
1814 return retval;
1800 1815
1801 /* 1816 /*
1802 * This device requires the atim queue and DMA-mapped skbs. 1817 * This device requires the atim queue and DMA-mapped skbs.