snoc.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _SNOC_H_
  17. #define _SNOC_H_
  18. #include "hw.h"
  19. #include "ce.h"
  20. struct ath10k_snoc_drv_priv {
  21. enum ath10k_hw_rev hw_rev;
  22. u64 dma_mask;
  23. };
  24. struct snoc_state {
  25. u32 pipe_cfg_addr;
  26. u32 svc_to_pipe_map;
  27. };
  28. struct ath10k_snoc_pipe {
  29. struct ath10k_ce_pipe *ce_hdl;
  30. u8 pipe_num;
  31. struct ath10k *hif_ce_state;
  32. size_t buf_sz;
  33. /* protect ce info */
  34. spinlock_t pipe_lock;
  35. struct ath10k_snoc *ar_snoc;
  36. };
  37. struct ath10k_snoc_target_info {
  38. u32 target_version;
  39. u32 target_type;
  40. u32 target_revision;
  41. u32 soc_version;
  42. };
  43. struct ath10k_snoc_ce_irq {
  44. u32 irq_line;
  45. };
  46. struct ath10k_wcn3990_vreg_info {
  47. struct regulator *reg;
  48. const char *name;
  49. u32 min_v;
  50. u32 max_v;
  51. u32 load_ua;
  52. unsigned long settle_delay;
  53. bool required;
  54. };
  55. struct ath10k_wcn3990_clk_info {
  56. struct clk *handle;
  57. const char *name;
  58. u32 freq;
  59. bool required;
  60. };
  61. struct ath10k_snoc {
  62. struct platform_device *dev;
  63. struct ath10k *ar;
  64. void __iomem *mem;
  65. dma_addr_t mem_pa;
  66. struct ath10k_snoc_target_info target_info;
  67. size_t mem_len;
  68. struct ath10k_snoc_pipe pipe_info[CE_COUNT_MAX];
  69. struct ath10k_snoc_ce_irq ce_irqs[CE_COUNT_MAX];
  70. struct ath10k_ce ce;
  71. struct timer_list rx_post_retry;
  72. struct ath10k_wcn3990_vreg_info *vreg;
  73. struct ath10k_wcn3990_clk_info *clk;
  74. };
  75. static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
  76. {
  77. return (struct ath10k_snoc *)ar->drv_priv;
  78. }
  79. void ath10k_snoc_write32(struct ath10k *ar, u32 offset, u32 value);
  80. u32 ath10k_snoc_read32(struct ath10k *ar, u32 offset);
  81. #endif /* _SNOC_H_ */