htc_hif.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (c) 2007-2011 Atheros Communications Inc.
  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 HTC_HIF_H
  17. #define HTC_HIF_H
  18. #include "htc.h"
  19. #include "hif.h"
  20. #define ATH6KL_MAILBOXES 4
  21. /* HTC runs over mailbox 0 */
  22. #define HTC_MAILBOX 0
  23. #define ATH6KL_TARGET_DEBUG_INTR_MASK 0x01
  24. #define OTHER_INTS_ENABLED (INT_STATUS_ENABLE_ERROR_MASK | \
  25. INT_STATUS_ENABLE_CPU_MASK | \
  26. INT_STATUS_ENABLE_COUNTER_MASK)
  27. #define ATH6KL_REG_IO_BUFFER_SIZE 32
  28. #define ATH6KL_MAX_REG_IO_BUFFERS 8
  29. #define ATH6KL_SCATTER_ENTRIES_PER_REQ 16
  30. #define ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER (16 * 1024)
  31. #define ATH6KL_SCATTER_REQS 4
  32. #ifndef A_CACHE_LINE_PAD
  33. #define A_CACHE_LINE_PAD 128
  34. #endif
  35. #define ATH6KL_MIN_SCATTER_ENTRIES_PER_REQ 2
  36. #define ATH6KL_MIN_TRANSFER_SIZE_PER_SCATTER (4 * 1024)
  37. struct ath6kl_irq_proc_registers {
  38. u8 host_int_status;
  39. u8 cpu_int_status;
  40. u8 error_int_status;
  41. u8 counter_int_status;
  42. u8 mbox_frame;
  43. u8 rx_lkahd_valid;
  44. u8 host_int_status2;
  45. u8 gmbox_rx_avail;
  46. __le32 rx_lkahd[2];
  47. __le32 rx_gmbox_lkahd_alias[2];
  48. } __packed;
  49. struct ath6kl_irq_enable_reg {
  50. u8 int_status_en;
  51. u8 cpu_int_status_en;
  52. u8 err_int_status_en;
  53. u8 cntr_int_status_en;
  54. } __packed;
  55. /* buffers for ASYNC I/O */
  56. struct ath6kl_async_reg_io_buffer {
  57. struct htc_packet packet;
  58. u8 pad1[A_CACHE_LINE_PAD];
  59. /* cache-line safe with pads around */
  60. u8 buf[ATH6KL_REG_IO_BUFFER_SIZE];
  61. u8 pad2[A_CACHE_LINE_PAD];
  62. };
  63. struct ath6kl_device {
  64. spinlock_t lock;
  65. u8 pad1[A_CACHE_LINE_PAD];
  66. struct ath6kl_irq_proc_registers irq_proc_reg;
  67. u8 pad2[A_CACHE_LINE_PAD];
  68. struct ath6kl_irq_enable_reg irq_en_reg;
  69. u8 pad3[A_CACHE_LINE_PAD];
  70. u32 block_sz;
  71. u32 block_mask;
  72. struct htc_target *htc_cnxt;
  73. struct list_head reg_io;
  74. struct ath6kl_async_reg_io_buffer reg_io_buf[ATH6KL_MAX_REG_IO_BUFFERS];
  75. int (*msg_pending) (struct htc_target *target, u32 lk_ahds[],
  76. int *npkts_fetched);
  77. struct hif_dev_scat_sup_info hif_scat_info;
  78. int max_rx_bndl_sz;
  79. int max_tx_bndl_sz;
  80. int chk_irq_status_cnt;
  81. struct ath6kl *ar;
  82. };
  83. int ath6kldev_setup(struct ath6kl_device *dev);
  84. int ath6kldev_unmask_intrs(struct ath6kl_device *dev);
  85. int ath6kldev_mask_intrs(struct ath6kl_device *dev);
  86. int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev,
  87. u32 *lk_ahd, int timeout);
  88. int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx);
  89. int ath6kldev_disable_intrs(struct ath6kl_device *dev);
  90. int ath6kldev_rw_comp_handler(void *context, int status);
  91. int ath6kldev_intr_bh_handler(struct ath6kl *ar);
  92. /* Scatter Function and Definitions */
  93. int ath6kldev_setup_msg_bndl(struct ath6kl_device *dev, int max_msg_per_xfer);
  94. int ath6kldev_submit_scat_req(struct ath6kl_device *dev,
  95. struct hif_scatter_req *scat_req, bool read);
  96. #endif /*ATH6KL_H_ */