iwlwifi: pcie: prepare the enablement of 31 TFD queues
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 25 Jan 2015 08:36:31 +0000 (10:36 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 1 Feb 2015 13:57:20 +0000 (15:57 +0200)
Some devices have 31 TFD queues. Don't enable it yet since
there are still issues with it, but at least prepare the
code for it. There was a bug in the read pointer assignment,
fix that. Also, move the inline functions to iwl-scd.h which
is the right place.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/iwl-scd.h
drivers/net/wireless/iwlwifi/pcie/trans.c
drivers/net/wireless/iwlwifi/pcie/tx.c

index b21fcf042b7706393dc502289ecb3c9302bd2d06..6221e4dfc64fcc0ee907d1dcec4e29394bb4933f 100644 (file)
 #define SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK                (0x0000007F)
 #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS     (16)
 #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK     (0x007F0000)
+#define SCD_GP_CTRL_ENABLE_31_QUEUES           BIT(0)
 
 /* Context Data */
 #define SCD_CONTEXT_MEM_LOWER_BOUND    (SCD_MEM_LOWER_BOUND + 0x600)
 #define SCD_CHAINEXT_EN                (SCD_BASE + 0x244)
 #define SCD_AGGR_SEL           (SCD_BASE + 0x248)
 #define SCD_INTERRUPT_MASK     (SCD_BASE + 0x108)
+#define SCD_GP_CTRL            (SCD_BASE + 0x1a8)
 #define SCD_EN_CTRL            (SCD_BASE + 0x254)
 
-static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl)
-{
-       if (chnl < 20)
-               return SCD_BASE + 0x18 + chnl * 4;
-       WARN_ON_ONCE(chnl >= 32);
-       return SCD_BASE + 0x284 + (chnl - 20) * 4;
-}
-
-static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl)
-{
-       if (chnl < 20)
-               return SCD_BASE + 0x68 + chnl * 4;
-       WARN_ON_ONCE(chnl >= 32);
-       return SCD_BASE + 0x2B4 + (chnl - 20) * 4;
-}
-
-static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl)
-{
-       if (chnl < 20)
-               return SCD_BASE + 0x10c + chnl * 4;
-       WARN_ON_ONCE(chnl >= 32);
-       return SCD_BASE + 0x384 + (chnl - 20) * 4;
-}
-
 /*********************** END TX SCHEDULER *************************************/
 
 /* Oscillator clock */
index 6c622b21bba71d5b6abcc882a17ebd8ba6d664ea..f2353ebf2666969b620468a702701725835f4b01 100644 (file)
 #include "iwl-prph.h"
 
 
-static inline void iwl_scd_txq_set_inactive(struct iwl_trans *trans,
-                                           u16 txq_id)
-{
-       iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id),
-                      (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
-                      (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
-}
-
 static inline void iwl_scd_txq_set_chain(struct iwl_trans *trans,
                                         u16 txq_id)
 {
@@ -115,4 +107,37 @@ static inline void iwl_scd_enable_set_active(struct iwl_trans *trans,
 {
        iwl_write_prph(trans, SCD_EN_CTRL, value);
 }
+
+static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl)
+{
+       if (chnl < 20)
+               return SCD_BASE + 0x18 + chnl * 4;
+       WARN_ON_ONCE(chnl >= 32);
+       return SCD_BASE + 0x284 + (chnl - 20) * 4;
+}
+
+static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl)
+{
+       if (chnl < 20)
+               return SCD_BASE + 0x68 + chnl * 4;
+       WARN_ON_ONCE(chnl >= 32);
+       return SCD_BASE + 0x2B4 + chnl * 4;
+}
+
+static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl)
+{
+       if (chnl < 20)
+               return SCD_BASE + 0x10c + chnl * 4;
+       WARN_ON_ONCE(chnl >= 32);
+       return SCD_BASE + 0x334 + chnl * 4;
+}
+
+static inline void iwl_scd_txq_set_inactive(struct iwl_trans *trans,
+                                           u16 txq_id)
+{
+       iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id),
+                      (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
+                      (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
+}
+
 #endif
index 1ff87677c3d35ceaf68762cc4dda8b578a22e514..eb0ffc158b30e78b9d0e29ad9dc5f3dfa16ce744 100644 (file)
@@ -75,6 +75,7 @@
 #include "iwl-trans.h"
 #include "iwl-csr.h"
 #include "iwl-prph.h"
+#include "iwl-scd.h"
 #include "iwl-agn-hw.h"
 #include "iwl-fw-error-dump.h"
 #include "internal.h"
index 6c7bfe8905ca3d309cda2b6c019d17890c7d00c8..0a9408378707eefb434409b7f16385071d262835 100644 (file)
@@ -892,6 +892,10 @@ int iwl_pcie_tx_init(struct iwl_trans *trans)
                }
        }
 
+       if (trans->cfg->base_params->num_of_queues > 20)
+               iwl_set_bits_prph(trans, SCD_GP_CTRL,
+                                 SCD_GP_CTRL_ENABLE_31_QUEUES);
+
        return 0;
 error:
        /*Upon error, free only if we allocated something */