[PATCH] ipw2200: Bluetooth coexistence support

I've added a new module param "bt_coexist" which defaults to OFF.

This does not seem to fix the firmware restarts, but it does do "the
right thing" and disables something that we were enabling by default:
signaling the Bluetooth h/w which channel we're on (whether or not the
BT h/w was out there).

Signed-off-by: Ben M Cahill <[EMAIL PROTECTED]>
Signed-off-by: Zhu Yi <[EMAIL PROTECTED]>
---

--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -55,6 +55,7 @@ static int associate = 1;
 static int auto_create = 1;
 static int led = 0;
 static int disable = 0;
+static int bt_coexist = 0;
 static int hwcrypto = 1;
 static const char ipw_modes[] = {
        'a', 'b', 'g', '?'
@@ -9653,7 +9659,7 @@ static struct iw_statistics *ipw_get_wir
 static  void init_sys_config(struct ipw_sys_config *sys_config)
 {
        memset(sys_config, 0, sizeof(struct ipw_sys_config));
-       sys_config->bt_coexistence = 1; /* We may need to look into 
prvStaBtConfig */
+       sys_config->bt_coexistence = 0;
        sys_config->answer_broadcast_ssid_probe = 0;
        sys_config->accept_all_data_frames = 0;
        sys_config->accept_non_directed_frames = 1;
@@ -10355,6 +10362,20 @@ static int ipw_config(struct ipw_priv *p
 
        /* set basic system config settings */
        init_sys_config(&priv->sys_config);
+
+       /* Support Bluetooth if we have BT h/w on board, and user wants to.
+        * Does not support BT priority yet (don't abort or defer our Tx) */
+       if (bt_coexist) {
+               unsigned char bt_caps = priv->eeprom[EEPROM_SKU_CAPABILITY];    
+
+               if (bt_caps & EEPROM_SKU_CAP_BT_CHANNEL_SIG)
+                       priv->sys_config.bt_coexistence
+                               |= CFG_BT_COEXISTENCE_SIGNAL_CHNL;
+               if (bt_caps & EEPROM_SKU_CAP_BT_OOB)
+                       priv->sys_config.bt_coexistence
+                               |= CFG_BT_COEXISTENCE_OOB;
+       }
+
        if (priv->ieee->iw_mode == IW_MODE_ADHOC)
                priv->sys_config.answer_broadcast_ssid_probe = 1;
        else
@@ -11344,6 +11365,9 @@ module_param(mode, int, 0444);
 MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)");
 #endif
 
+module_param(bt_coexist, int, 0444);
+MODULE_PARM_DESC(bt_coexist, "enable bluetooth coexistence (default off)");
+
 module_param(hwcrypto, int, 0444);
 MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)");
 
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -1566,13 +1566,18 @@ do { if (ipw_debug_level & (level)) \
 #define EEPROM_BSS_CHANNELS_BG  (GET_EEPROM_ADDR(0x2c,LSB))    /* 2 bytes  */
 #define EEPROM_HW_VERSION       (GET_EEPROM_ADDR(0x72,LSB))    /* 2 bytes  */
 
-/* NIC type as found in the one byte EEPROM_NIC_TYPE  offset*/
+/* NIC type as found in the one byte EEPROM_NIC_TYPE offset */
 #define EEPROM_NIC_TYPE_0 0
 #define EEPROM_NIC_TYPE_1 1
 #define EEPROM_NIC_TYPE_2 2
 #define EEPROM_NIC_TYPE_3 3
 #define EEPROM_NIC_TYPE_4 4
 
+/* Bluetooth Coexistence capabilities as found in EEPROM_SKU_CAPABILITY */
+#define EEPROM_SKU_CAP_BT_CHANNEL_SIG  0x01 /* we can tell BT our channel # */
+#define EEPROM_SKU_CAP_BT_PRIORITY     0x02 /* BT can take priority over us */
+#define EEPROM_SKU_CAP_BT_OOB          0x04 /* we can signal BT out-of-band */
+
 #define FW_MEM_REG_LOWER_BOUND          0x00300000
 #define FW_MEM_REG_EEPROM_ACCESS        (FW_MEM_REG_LOWER_BOUND + 0x40)
 #define IPW_EVENT_REG                   (FW_MEM_REG_LOWER_BOUND + 0x04)
@@ -1869,21 +1874,23 @@ struct ipw_cmd_log {
        struct host_cmd cmd;
 };
 
-#define CFG_BT_COEXISTENCE_MIN                  0x00
-#define CFG_BT_COEXISTENCE_DEFER                0x02
-#define CFG_BT_COEXISTENCE_KILL                 0x04
-#define CFG_BT_COEXISTENCE_WME_OVER_BT          0x08
-#define CFG_BT_COEXISTENCE_OOB                  0x10
-#define CFG_BT_COEXISTENCE_MAX                  0xFF
-#define CFG_BT_COEXISTENCE_DEF                  0x80   /* read Bt from EEPROM 
*/
-
-#define CFG_CTS_TO_ITSELF_ENABLED_MIN  0x0
-#define CFG_CTS_TO_ITSELF_ENABLED_MAX  0x1
+/* SysConfig command parameters ... */
+/* bt_coexistence param */
+#define CFG_BT_COEXISTENCE_SIGNAL_CHNL  0x01 /* tell BT our chnl # */
+#define CFG_BT_COEXISTENCE_DEFER        0x02 /* defer our Tx if BT traffic */
+#define CFG_BT_COEXISTENCE_KILL         0x04 /* kill our Tx if BT traffic */
+#define CFG_BT_COEXISTENCE_WME_OVER_BT  0x08 /* multimedia extensions */
+#define CFG_BT_COEXISTENCE_OOB          0x10 /* signal BT via out-of-band */
+
+/* clear-to-send to self param */
+#define CFG_CTS_TO_ITSELF_ENABLED_MIN  0x00
+#define CFG_CTS_TO_ITSELF_ENABLED_MAX  0x01
 #define CFG_CTS_TO_ITSELF_ENABLED_DEF  CFG_CTS_TO_ITSELF_ENABLED_MIN
 
-#define CFG_SYS_ANTENNA_BOTH                      0x000
-#define CFG_SYS_ANTENNA_A                         0x001
-#define CFG_SYS_ANTENNA_B                         0x003
+/* Antenna diversity param (h/w can select best antenna, based on signal) */
+#define CFG_SYS_ANTENNA_BOTH            0x00 /* NIC selects best antenna */
+#define CFG_SYS_ANTENNA_A               0x01 /* force antenna A */
+#define CFG_SYS_ANTENNA_B               0x03 /* force antenna B */
 
 /*
  * The definitions below were lifted off the ipw2100 driver, which only
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to