[mac80211] Build modules only if realy needed.
[openwrt.git] / package / mac80211 / patches / 302-rt2x00-Implement-support-for-rt2800pci.patch
index 7584e5a..6b9d282 100644 (file)
@@ -1,22 +1,23 @@
-From 67432230daedc23f808b79173703e27675fd0659 Mon Sep 17 00:00:00 2001
+From 8dff6729a634d7cf223679d9a29a3df77927540c Mon Sep 17 00:00:00 2001
 From: Ivo van Doorn <IvDoorn@gmail.com>
 From: Ivo van Doorn <IvDoorn@gmail.com>
-Date: Sun, 26 Apr 2009 15:54:03 +0200
-Subject: [PATCH 2/4] rt2x00: Implement support for rt2800pci
+Date: Sat, 8 Aug 2009 23:47:53 +0200
+Subject: [PATCH 2/3] rt2x00: Implement support for rt2800pci
 
 Add support for the rt2800pci chipset.
 
 
 Add support for the rt2800pci chipset.
 
-Includes various patches from Mattias, Mark, Felix and Xose.
+Includes various patches from Luis, Mattias, Mark, Felix and Xose.
 
 Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
 Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
 Signed-off-by: Mark Asselstine <asselsm@gmail.com>
 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
 
 Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
 Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
 Signed-off-by: Mark Asselstine <asselsm@gmail.com>
 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: Luis Correia <luis.f.correia@gmail.com>
 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 ---
  drivers/net/wireless/rt2x00/Kconfig     |   26 +
  drivers/net/wireless/rt2x00/Makefile    |    1 +
 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 ---
  drivers/net/wireless/rt2x00/Kconfig     |   26 +
  drivers/net/wireless/rt2x00/Makefile    |    1 +
- drivers/net/wireless/rt2x00/rt2800pci.c | 3245 +++++++++++++++++++++++++++++++
- drivers/net/wireless/rt2x00/rt2800pci.h | 1927 ++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.c | 3243 +++++++++++++++++++++++++++++++
+ drivers/net/wireless/rt2x00/rt2800pci.h | 1929 ++++++++++++++++++
  drivers/net/wireless/rt2x00/rt2x00.h    |    6 +
  5 files changed, 5205 insertions(+), 0 deletions(-)
  create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c
  drivers/net/wireless/rt2x00/rt2x00.h    |    6 +
  5 files changed, 5205 insertions(+), 0 deletions(-)
  create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c
@@ -24,7 +25,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 
 --- a/drivers/net/wireless/rt2x00/Makefile
 +++ b/drivers/net/wireless/rt2x00/Makefile
 
 --- a/drivers/net/wireless/rt2x00/Makefile
 +++ b/drivers/net/wireless/rt2x00/Makefile
-@@ -17,6 +17,7 @@ obj-$(CONFIG_RT2X00_LIB_USB)         += rt2x00u
+@@ -16,6 +16,7 @@ obj-$(CONFIG_RT2X00_LIB_USB)         += rt2x00u
  obj-$(CONFIG_RT2400PCI)                       += rt2400pci.o
  obj-$(CONFIG_RT2500PCI)                       += rt2500pci.o
  obj-$(CONFIG_RT61PCI)                 += rt61pci.o
  obj-$(CONFIG_RT2400PCI)                       += rt2400pci.o
  obj-$(CONFIG_RT2500PCI)                       += rt2500pci.o
  obj-$(CONFIG_RT61PCI)                 += rt61pci.o
@@ -34,7 +35,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
  obj-$(CONFIG_RT2800USB)                       += rt2800usb.o
 --- /dev/null
 +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
  obj-$(CONFIG_RT2800USB)                       += rt2800usb.o
 --- /dev/null
 +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
-@@ -0,0 +1,3245 @@
+@@ -0,0 +1,3241 @@
 +/*
 +      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +/*
 +      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
@@ -412,7 +413,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +};
 +#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 +
 +};
 +#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 +
-+#ifdef CONFIG_RT2X00_LIB_RFKILL
 +static int rt2800pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
 +{
 +      u32 reg;
 +static int rt2800pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
 +{
 +      u32 reg;
@@ -420,9 +420,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
 +      return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2);
 +}
 +      rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
 +      return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2);
 +}
-+#else
-+#define rt2800pci_rfkill_poll NULL
-+#endif /* CONFIG_RT2X00_LIB_RFKILL */
 +
 +#ifdef CONFIG_RT2X00_LIB_LEDS
 +static void rt2800pci_brightness_set(struct led_classdev *led_cdev,
 +
 +#ifdef CONFIG_RT2X00_LIB_LEDS
 +static void rt2800pci_brightness_set(struct led_classdev *led_cdev,
@@ -661,7 +658,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_RTS,
 +                         !(filter_flags & FIF_CONTROL));
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PSPOLL,
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_RTS,
 +                         !(filter_flags & FIF_CONTROL));
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PSPOLL,
-+                         !(filter_flags & FIF_CONTROL));
++                         !(filter_flags & FIF_PSPOLL));
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BA, 1);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BAR, 0);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_CNTL,
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BA, 1);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BAR, 0);
 +      rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_CNTL,
@@ -755,6 +752,11 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs);
 +      rt2x00_set_field32(&reg, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1);
 +      rt2x00pci_register_write(rt2x00dev, XIFS_TIME_CFG, reg);
 +      rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs);
 +      rt2x00_set_field32(&reg, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1);
 +      rt2x00pci_register_write(rt2x00dev, XIFS_TIME_CFG, reg);
++
++      rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
++      rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_INTERVAL,
++                         erp->beacon_int * 16);
++      rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 +}
 +
 +static void rt2800pci_config_ant(struct rt2x00_dev *rt2x00dev,
 +}
 +
 +static void rt2800pci_config_ant(struct rt2x00_dev *rt2x00dev,
@@ -1095,17 +1097,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      rt2x00pci_register_write(rt2x00dev, TX_RTY_CFG, reg);
 +}
 +
 +      rt2x00pci_register_write(rt2x00dev, TX_RTY_CFG, reg);
 +}
 +
-+static void rt2800pci_config_duration(struct rt2x00_dev *rt2x00dev,
-+                                    struct rt2x00lib_conf *libconf)
-+{
-+      u32 reg;
-+
-+      rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
-+      rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_INTERVAL,
-+                         libconf->conf->beacon_int * 16);
-+      rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
-+}
-+
 +static void rt2800pci_config_ps(struct rt2x00_dev *rt2x00dev,
 +                              struct rt2x00lib_conf *libconf)
 +{
 +static void rt2800pci_config_ps(struct rt2x00_dev *rt2x00dev,
 +                              struct rt2x00lib_conf *libconf)
 +{
@@ -1150,8 +1141,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              rt2800pci_config_txpower(rt2x00dev, libconf->conf->power_level);
 +      if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
 +              rt2800pci_config_retry_limit(rt2x00dev, libconf);
 +              rt2800pci_config_txpower(rt2x00dev, libconf->conf->power_level);
 +      if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
 +              rt2800pci_config_retry_limit(rt2x00dev, libconf);
-+      if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
-+              rt2800pci_config_duration(rt2x00dev, libconf);
 +      if (flags & IEEE80211_CONF_CHANGE_PS)
 +              rt2800pci_config_ps(rt2x00dev, libconf);
 +}
 +      if (flags & IEEE80211_CONF_CHANGE_PS)
 +              rt2800pci_config_ps(rt2x00dev, libconf);
 +}
@@ -2085,13 +2074,17 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
 +                             enum dev_state state)
 +{
 +static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
 +                             enum dev_state state)
 +{
-+      rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
++      /*
++       * Always put the device to sleep (even when we intend to wakeup!)
++       * if the device is booting and wasn't asleep it will return
++       * failure when attempting to wakeup.
++       */
++      rt2800pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 2);
 +
 +      if (state == STATE_AWAKE) {
 +              rt2800pci_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0);
 +              rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP);
 +
 +      if (state == STATE_AWAKE) {
 +              rt2800pci_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0);
 +              rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP);
-+      } else
-+              rt2800pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 2);
++      }
 +
 +      return 0;
 +}
 +
 +      return 0;
 +}
@@ -2106,7 +2099,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              /*
 +               * Before the radio can be enabled, the device first has
 +               * to be woken up. After that it needs a bit of time
 +              /*
 +               * Before the radio can be enabled, the device first has
 +               * to be woken up. After that it needs a bit of time
-+               * to be fully awake and the radio can be enabled.
++               * to be fully awake and then the radio can be enabled.
 +               */
 +              rt2800pci_set_state(rt2x00dev, STATE_AWAKE);
 +              msleep(1);
 +               */
 +              rt2800pci_set_state(rt2x00dev, STATE_AWAKE);
 +              msleep(1);
@@ -2114,7 +2107,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              break;
 +      case STATE_RADIO_OFF:
 +              /*
 +              break;
 +      case STATE_RADIO_OFF:
 +              /*
-+               * After the radio has been disablee, the device should
++               * After the radio has been disabled, the device should
 +               * be put to sleep for powersaving.
 +               */
 +              rt2800pci_disable_radio(rt2x00dev);
 +               * be put to sleep for powersaving.
 +               */
 +              rt2800pci_disable_radio(rt2x00dev);
@@ -2254,8 +2247,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +       * otherwise we might be sending out invalid data.
 +       */
 +      rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
 +       * otherwise we might be sending out invalid data.
 +       */
 +      rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
-+      rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
-+      rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
 +      rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
 +      rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 +
 +      rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
 +      rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 +
@@ -2719,10 +2710,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      /*
 +       * Detect if this device has an hardware controlled radio.
 +       */
 +      /*
 +       * Detect if this device has an hardware controlled radio.
 +       */
-+#ifdef CONFIG_RT2X00_LIB_RFKILL
 +      if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
 +              __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
 +      if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
 +              __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
-+#endif /* CONFIG_RT2X00_LIB_RFKILL */
 +
 +      /*
 +       * Store led settings, for correct led behaviour.
 +
 +      /*
 +       * Store led settings, for correct led behaviour.
@@ -2938,11 +2927,19 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +              return retval;
 +
 +      /*
 +              return retval;
 +
 +      /*
++       * This device has multiple filters for control frames
++       * and has a separate filter for PS Poll frames.
++       */
++      __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
++      __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
++
++      /*
 +       * This device requires firmware.
 +       */
 +      if (!rt2x00_rt(&rt2x00dev->chip, RT2880) &&
 +          !rt2x00_rt(&rt2x00dev->chip, RT3052))
 +              __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
 +       * This device requires firmware.
 +       */
 +      if (!rt2x00_rt(&rt2x00dev->chip, RT2880) &&
 +          !rt2x00_rt(&rt2x00dev->chip, RT3052))
 +              __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
++      __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
 +      __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
 +      if (!modparam_nohwcrypt)
 +              __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
 +      __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
 +      if (!modparam_nohwcrypt)
 +              __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
@@ -3098,7 +3095,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      .add_interface          = rt2x00mac_add_interface,
 +      .remove_interface       = rt2x00mac_remove_interface,
 +      .config                 = rt2x00mac_config,
 +      .add_interface          = rt2x00mac_add_interface,
 +      .remove_interface       = rt2x00mac_remove_interface,
 +      .config                 = rt2x00mac_config,
-+      .config_interface       = rt2x00mac_config_interface,
 +      .configure_filter       = rt2x00mac_configure_filter,
 +      .set_key                = rt2x00mac_set_key,
 +      .get_stats              = rt2x00mac_get_stats,
 +      .configure_filter       = rt2x00mac_configure_filter,
 +      .set_key                = rt2x00mac_set_key,
 +      .get_stats              = rt2x00mac_get_stats,
@@ -3108,6 +3104,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +      .conf_tx                = rt2800pci_conf_tx,
 +      .get_tx_stats           = rt2x00mac_get_tx_stats,
 +      .get_tsf                = rt2800pci_get_tsf,
 +      .conf_tx                = rt2800pci_conf_tx,
 +      .get_tx_stats           = rt2x00mac_get_tx_stats,
 +      .get_tsf                = rt2800pci_get_tsf,
++      .rfkill_poll            = rt2x00mac_rfkill_poll,
 +};
 +
 +static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
 +};
 +
 +static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
@@ -3282,7 +3279,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +module_exit(rt2800pci_exit);
 --- /dev/null
 +++ b/drivers/net/wireless/rt2x00/rt2800pci.h
 +module_exit(rt2800pci_exit);
 --- /dev/null
 +++ b/drivers/net/wireless/rt2x00/rt2800pci.h
-@@ -0,0 +1,1927 @@
+@@ -0,0 +1,1929 @@
 +/*
 +      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
 +/*
 +      Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
 +      <http://rt2x00.serialmonkey.com>
@@ -3344,7 +3341,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +
 +/*
 + * Signal information.
 +
 +/*
 + * Signal information.
-+ * Defaul offset is required for RSSI <-> dBm conversion.
++ * Default offset is required for RSSI <-> dBm conversion.
 + */
 +#define DEFAULT_RSSI_OFFSET           120 /* FIXME */
 +
 + */
 +#define DEFAULT_RSSI_OFFSET           120 /* FIXME */
 +
@@ -4999,6 +4996,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#define MCU_SLEEP                     0x30
 +#define MCU_WAKEUP                    0x31
 +#define MCU_RADIO_OFF                 0x35
 +#define MCU_SLEEP                     0x30
 +#define MCU_WAKEUP                    0x31
 +#define MCU_RADIO_OFF                 0x35
++#define MCU_CURRENT                   0x36
 +#define MCU_LED                               0x50
 +#define MCU_LED_STRENGTH              0x51
 +#define MCU_LED_1                     0x52
 +#define MCU_LED                               0x50
 +#define MCU_LED_STRENGTH              0x51
 +#define MCU_LED_1                     0x52
@@ -5007,6 +5005,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#define MCU_RADAR                     0x60
 +#define MCU_BOOT_SIGNAL                       0x72
 +#define MCU_BBP_SIGNAL                        0x80
 +#define MCU_RADAR                     0x60
 +#define MCU_BOOT_SIGNAL                       0x72
 +#define MCU_BBP_SIGNAL                        0x80
++#define MCU_POWER_SAVE                        0x83
 +
 +/*
 + * MCU mailbox tokens
 +
 +/*
 + * MCU mailbox tokens
@@ -5047,7 +5046,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +
 +/*
 + * Word3
 +
 +/*
 + * Word3
-+ * WIV: Wireless Info Valid. 1: Driver filled WI,  0: DMA needs to copy WI
++ * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI
 + * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler.
 + *       0:MGMT, 1:HCCA 2:EDCA
 + */
 + * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler.
 + *       0:MGMT, 1:HCCA 2:EDCA
 + */
@@ -5188,7 +5187,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#define RXWI_W3_SNR1                  FIELD32(0x0000ff00)
 +
 +/*
 +#define RXWI_W3_SNR1                  FIELD32(0x0000ff00)
 +
 +/*
-+ * Macro's for converting txpower from EEPROM to mac80211 value
++ * Macros for converting txpower from EEPROM to mac80211 value
 + * and from mac80211 value to register value.
 + */
 +#define MIN_G_TXPOWER 0
 + * and from mac80211 value to register value.
 + */
 +#define MIN_G_TXPOWER 0
@@ -5212,7 +5211,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
 +#endif /* RT2800PCI_H */
 --- a/drivers/net/wireless/rt2x00/rt2x00.h
 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
 +#endif /* RT2800PCI_H */
 --- a/drivers/net/wireless/rt2x00/rt2x00.h
 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
-@@ -147,6 +147,12 @@ struct rt2x00_chip {
+@@ -158,6 +158,12 @@ struct rt2x00_chip {
  #define RT2561                0x0302
  #define RT2661                0x0401
  #define RT2571                0x1300
  #define RT2561                0x0302
  #define RT2661                0x0401
  #define RT2571                0x1300
This page took 0.029797 seconds and 4 git commands to generate.