0001
0002
0003
0004
0005 #ifndef __iwl_scd_h__
0006 #define __iwl_scd_h__
0007
0008 #include "iwl-trans.h"
0009 #include "iwl-io.h"
0010 #include "iwl-prph.h"
0011
0012
0013 static inline void iwl_scd_txq_set_chain(struct iwl_trans *trans,
0014 u16 txq_id)
0015 {
0016 iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id));
0017 }
0018
0019 static inline void iwl_scd_txq_enable_agg(struct iwl_trans *trans,
0020 u16 txq_id)
0021 {
0022 iwl_set_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id));
0023 }
0024
0025 static inline void iwl_scd_txq_disable_agg(struct iwl_trans *trans,
0026 u16 txq_id)
0027 {
0028 iwl_clear_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id));
0029 }
0030
0031 static inline void iwl_scd_disable_agg(struct iwl_trans *trans)
0032 {
0033 iwl_set_bits_prph(trans, SCD_AGGR_SEL, 0);
0034 }
0035
0036 static inline void iwl_scd_activate_fifos(struct iwl_trans *trans)
0037 {
0038 iwl_write_prph(trans, SCD_TXFACT, IWL_MASK(0, 7));
0039 }
0040
0041 static inline void iwl_scd_deactivate_fifos(struct iwl_trans *trans)
0042 {
0043 iwl_write_prph(trans, SCD_TXFACT, 0);
0044 }
0045
0046 static inline void iwl_scd_enable_set_active(struct iwl_trans *trans,
0047 u32 value)
0048 {
0049 iwl_write_prph(trans, SCD_EN_CTRL, value);
0050 }
0051
0052 static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl)
0053 {
0054 if (chnl < 20)
0055 return SCD_BASE + 0x18 + chnl * 4;
0056 WARN_ON_ONCE(chnl >= 32);
0057 return SCD_BASE + 0x284 + (chnl - 20) * 4;
0058 }
0059
0060 static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl)
0061 {
0062 if (chnl < 20)
0063 return SCD_BASE + 0x68 + chnl * 4;
0064 WARN_ON_ONCE(chnl >= 32);
0065 return SCD_BASE + 0x2B4 + chnl * 4;
0066 }
0067
0068 static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl)
0069 {
0070 if (chnl < 20)
0071 return SCD_BASE + 0x10c + chnl * 4;
0072 WARN_ON_ONCE(chnl >= 32);
0073 return SCD_BASE + 0x334 + chnl * 4;
0074 }
0075
0076 static inline void iwl_scd_txq_set_inactive(struct iwl_trans *trans,
0077 u16 txq_id)
0078 {
0079 iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id),
0080 (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
0081 (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
0082 }
0083
0084 #endif