htc_hif.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. struct ath6kl_device {
  56. spinlock_t lock;
  57. u8 pad1[A_CACHE_LINE_PAD];
  58. struct ath6kl_irq_proc_registers irq_proc_reg;
  59. u8 pad2[A_CACHE_LINE_PAD];
  60. struct ath6kl_irq_enable_reg irq_en_reg;
  61. u8 pad3[A_CACHE_LINE_PAD];
  62. struct htc_target *htc_cnxt;
  63. struct ath6kl *ar;
  64. };
  65. int ath6kldev_setup(struct ath6kl_device *dev);
  66. int ath6kldev_unmask_intrs(struct ath6kl_device *dev);
  67. int ath6kldev_mask_intrs(struct ath6kl_device *dev);
  68. int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev,
  69. u32 *lk_ahd, int timeout);
  70. int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx);
  71. int ath6kldev_disable_intrs(struct ath6kl_device *dev);
  72. int ath6kldev_rw_comp_handler(void *context, int status);
  73. int ath6kldev_intr_bh_handler(struct ath6kl *ar);
  74. /* Scatter Function and Definitions */
  75. int ath6kldev_submit_scat_req(struct ath6kl_device *dev,
  76. struct hif_scatter_req *scat_req, bool read);
  77. #endif /*ATH6KL_H_ */