dp_umac_reset.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 _DP_UMAC_RESET_H_
  17. #define _DP_UMAC_RESET_H_
  18. #ifdef DP_UMAC_HW_RESET_SUPPORT
  19. #include <qdf_types.h>
  20. #define dp_umac_reset_alert(params...) \
  21. QDF_TRACE_FATAL(QDF_MODULE_ID_DP_UMAC_RESET, params)
  22. #define dp_umac_reset_err(params...) \
  23. QDF_TRACE_ERROR(QDF_MODULE_ID_DP_UMAC_RESET, params)
  24. #define dp_umac_reset_warn(params...) \
  25. QDF_TRACE_WARN(QDF_MODULE_ID_DP_UMAC_RESET, params)
  26. #define dp_umac_reset_notice(params...) \
  27. QDF_TRACE_INFO(QDF_MODULE_ID_DP_UMAC_RESET, params)
  28. #define dp_umac_reset_info(params...) \
  29. QDF_TRACE_INFO(QDF_MODULE_ID_DP_UMAC_RESET, params)
  30. #define dp_umac_reset_debug(params...) \
  31. QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_UMAC_RESET, params)
  32. #define DP_UMAC_RESET_SHMEM_ALIGN 8
  33. struct dp_soc;
  34. /**
  35. * enum umac_reset_state - States required for UMAC reset state machine
  36. * @UMAC_RESET_STATE_WAIT_FOR_PRE_RESET: Waiting for the PRE_RESET event
  37. * @UMAC_RESET_STATE_PRE_RESET_RECEIVED: Received the PRE_RESET event
  38. * @UMAC_RESET_STATE_HOST_PRE_RESET_COMPLETED: Host has completed handling the
  39. * PRE_RESET event
  40. * @UMAC_RESET_STATE_WAIT_FOR_POST_RESET: Waiting for the POST_RESET event
  41. * @UMAC_RESET_STATE_POST_RESET_RECEIVED: Received the POST_RESET event
  42. * @UMAC_RESET_STATE_HOST_POST_RESET_COMPLETED: Host has completed handling the
  43. * POST_RESET event
  44. */
  45. enum umac_reset_state {
  46. UMAC_RESET_STATE_WAIT_FOR_PRE_RESET = 0,
  47. UMAC_RESET_STATE_PRE_RESET_RECEIVED,
  48. UMAC_RESET_STATE_HOST_PRE_RESET_COMPLETED,
  49. UMAC_RESET_STATE_WAIT_FOR_POST_RESET,
  50. UMAC_RESET_STATE_POST_RESET_RECEIVED,
  51. UMAC_RESET_STATE_HOST_POST_RESET_COMPLETED,
  52. };
  53. /**
  54. * struct umac_reset_shmem - Shared memory layout for UMAC reset feature
  55. * @t2h_indication: target to host communicaton
  56. * @h2t_indication: host to target communicaton
  57. */
  58. struct umac_reset_shmem {
  59. uint32_t t2h_indication;
  60. uint32_t h2t_indication;
  61. };
  62. /**
  63. * struct dp_soc_umac_reset_ctx - UMAC reset context at soc level
  64. * @shmem_paddr_unaligned: Physical address of the shared memory (unaligned)
  65. * @shmem_vaddr_unaligned: Virtual address of the shared memory (unaligned)
  66. * @shmem_paddr_aligned: Physical address of the shared memory (aligned)
  67. * @shmem_vaddr_aligned: Virtual address of the shared memory (aligned)
  68. * @intr_offset: Offset of the UMAC reset interrupt w.r.t DP base interrupt
  69. * @current_state: current state of the UMAC reset state machine
  70. */
  71. struct dp_soc_umac_reset_ctx {
  72. qdf_dma_addr_t shmem_paddr_unaligned;
  73. struct umac_reset_shmem *shmem_vaddr_unaligned;
  74. qdf_dma_addr_t shmem_paddr_aligned;
  75. struct umac_reset_shmem *shmem_vaddr_aligned;
  76. uint32_t intr_offset;
  77. enum umac_reset_state current_state;
  78. };
  79. /**
  80. * dp_soc_umac_reset_init() - Initialize UMAC reset context
  81. * @soc: DP soc object
  82. *
  83. * Return: QDF status of operation
  84. */
  85. QDF_STATUS dp_soc_umac_reset_init(struct dp_soc *soc);
  86. #endif /* DP_UMAC_HW_RESET_SUPPORT */
  87. #endif /* _DP_UMAC_RESET_H_ */