iwl-scd.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2. /*
  3. * Copyright (C) 2014 Intel Mobile Communications GmbH
  4. */
  5. #ifndef __iwl_scd_h__
  6. #define __iwl_scd_h__
  7. #include "iwl-trans.h"
  8. #include "iwl-io.h"
  9. #include "iwl-prph.h"
  10. static inline void iwl_scd_txq_set_chain(struct iwl_trans *trans,
  11. u16 txq_id)
  12. {
  13. iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id));
  14. }
  15. static inline void iwl_scd_txq_enable_agg(struct iwl_trans *trans,
  16. u16 txq_id)
  17. {
  18. iwl_set_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id));
  19. }
  20. static inline void iwl_scd_txq_disable_agg(struct iwl_trans *trans,
  21. u16 txq_id)
  22. {
  23. iwl_clear_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id));
  24. }
  25. static inline void iwl_scd_disable_agg(struct iwl_trans *trans)
  26. {
  27. iwl_set_bits_prph(trans, SCD_AGGR_SEL, 0);
  28. }
  29. static inline void iwl_scd_activate_fifos(struct iwl_trans *trans)
  30. {
  31. iwl_write_prph(trans, SCD_TXFACT, IWL_MASK(0, 7));
  32. }
  33. static inline void iwl_scd_deactivate_fifos(struct iwl_trans *trans)
  34. {
  35. iwl_write_prph(trans, SCD_TXFACT, 0);
  36. }
  37. static inline void iwl_scd_enable_set_active(struct iwl_trans *trans,
  38. u32 value)
  39. {
  40. iwl_write_prph(trans, SCD_EN_CTRL, value);
  41. }
  42. static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl)
  43. {
  44. if (chnl < 20)
  45. return SCD_BASE + 0x18 + chnl * 4;
  46. WARN_ON_ONCE(chnl >= 32);
  47. return SCD_BASE + 0x284 + (chnl - 20) * 4;
  48. }
  49. static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl)
  50. {
  51. if (chnl < 20)
  52. return SCD_BASE + 0x68 + chnl * 4;
  53. WARN_ON_ONCE(chnl >= 32);
  54. return SCD_BASE + 0x2B4 + chnl * 4;
  55. }
  56. static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl)
  57. {
  58. if (chnl < 20)
  59. return SCD_BASE + 0x10c + chnl * 4;
  60. WARN_ON_ONCE(chnl >= 32);
  61. return SCD_BASE + 0x334 + chnl * 4;
  62. }
  63. static inline void iwl_scd_txq_set_inactive(struct iwl_trans *trans,
  64. u16 txq_id)
  65. {
  66. iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id),
  67. (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
  68. (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
  69. }
  70. #endif