snoc.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #include "pci.h"
  21. struct ath10k_snoc_drv_priv {
  22. enum ath10k_hw_rev hw_rev;
  23. u64 dma_mask;
  24. };
  25. struct snoc_state {
  26. u32 pipe_cfg_addr;
  27. u32 svc_to_pipe_map;
  28. };
  29. struct ath10k_snoc_pipe {
  30. struct ath10k_ce_pipe *ce_hdl;
  31. u8 pipe_num;
  32. struct ath10k *hif_ce_state;
  33. size_t buf_sz;
  34. /* protect ce info */
  35. spinlock_t pipe_lock;
  36. struct ath10k_snoc *ar_snoc;
  37. };
  38. struct ath10k_snoc_target_info {
  39. u32 target_version;
  40. u32 target_type;
  41. u32 target_revision;
  42. u32 soc_version;
  43. };
  44. struct ath10k_snoc_ce_irq {
  45. u32 irq_line;
  46. };
  47. struct ath10k_wcn3990_vreg_info {
  48. struct regulator *reg;
  49. const char *name;
  50. u32 min_v;
  51. u32 max_v;
  52. u32 load_ua;
  53. unsigned long settle_delay;
  54. bool required;
  55. };
  56. struct ath10k_wcn3990_clk_info {
  57. struct clk *handle;
  58. const char *name;
  59. u32 freq;
  60. bool required;
  61. };
  62. struct ath10k_snoc {
  63. struct platform_device *dev;
  64. struct ath10k *ar;
  65. void __iomem *mem;
  66. dma_addr_t mem_pa;
  67. struct ath10k_snoc_target_info target_info;
  68. size_t mem_len;
  69. struct ath10k_snoc_pipe pipe_info[CE_COUNT_MAX];
  70. struct ath10k_snoc_ce_irq ce_irqs[CE_COUNT_MAX];
  71. struct ath10k_ce ce;
  72. struct timer_list rx_post_retry;
  73. struct ath10k_wcn3990_vreg_info *vreg;
  74. struct ath10k_wcn3990_clk_info *clk;
  75. };
  76. static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
  77. {
  78. return (struct ath10k_snoc *)ar->drv_priv;
  79. }
  80. void ath10k_snoc_write32(struct ath10k *ar, u32 offset, u32 value);
  81. u32 ath10k_snoc_read32(struct ath10k *ar, u32 offset);
  82. #endif /* _SNOC_H_ */