btif_priv.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef __HAL_BTIF_H_
  2. #define __HAL_BTIF_H_
  3. #ifndef CONFIG_OF
  4. #define MTK_BTIF_REG_BASE BTIF_BASE
  5. #endif
  6. #if defined(CONFIG_MTK_CLKMGR)
  7. #if defined(CONFIG_ARCH_MT6580)
  8. #define MTK_BTIF_CG_BIT MT_CG_BTIF_SW_CG
  9. #elif defined(CONFIG_ARCH_MT6735) || defined(CONFIG_ARCH_MT6735M) || defined(CONFIG_ARCH_MT6753)
  10. #define MTK_BTIF_CG_BIT MT_CG_PERI_BTIF
  11. #endif
  12. #else
  13. struct clk *clk_btif_apdma; /*btif apdma clock*/
  14. struct clk *clk_btif; /*btif clock*/
  15. #endif /* !defined(CONFIG_MTK_CLKMGR) */
  16. #define BTIF_RBR(base) (unsigned long)(base + 0x0) /*RX Buffer Register: read only */
  17. #define BTIF_THR(base) (unsigned long)(base + 0x0) /*Rx Holding Register: write only */
  18. #define BTIF_IER(base) (unsigned long)(base + 0x4) /*Interrupt Enable Register: read/write */
  19. #define BTIF_IIR(base) (unsigned long)(base + 0x8) /*Interrupt Identification Register: read only */
  20. #define BTIF_FIFOCTRL(base) (unsigned long)(base + 0x8) /*FIFO Control Register: write only */
  21. #define BTIF_FAKELCR(base) (unsigned long)(base + 0xC) /*FAKE LCR Register: read/write */
  22. #define BTIF_LSR(base) (unsigned long)(base + 0x14) /*Line Status Register: read only */
  23. #define BTIF_SLEEP_EN(base) (unsigned long)(base + 0x48) /*Sleep Enable Register: read/write */
  24. #define BTIF_DMA_EN(base) (unsigned long)(base + 0x4C) /*DMA Enable Register: read/write */
  25. #define BTIF_RTOCNT(base) (unsigned long)(base + 0x54) /*Rx Timeout Count Register: read/write */
  26. #define BTIF_TRI_LVL(base) (unsigned long)(base + 0x60) /*Tx/Rx Trigger Level Control Register: read/write */
  27. #define BTIF_WAK(base) (unsigned long)(base + 0x64) /*BTIF module wakeup Register: write only */
  28. #define BTIF_WAT_TIME(base) (unsigned long)(base + 0x68) /*BTIF ASYNC Wait Time Control Register: read/write */
  29. #define BTIF_HANDSHAKE(base) (unsigned long)(base + 0x6C) /*BTIF New Handshake Control Register: read/write */
  30. /*BTIF_IER bits*/
  31. #define BTIF_IER_TXEEN (0x1 << 1) /*1: Tx holding register is empty */
  32. #define BTIF_IER_RXFEN (0x1 << 0) /*1: Rx buffer contains data */
  33. /*BTIF_IIR bits*/
  34. #define BTIF_IIR_NINT (0x1 << 0) /*No INT Pending */
  35. #define BTIF_IIR_TX_EMPTY (0x1 << 1) /*Tx Holding Register empty */
  36. #define BTIF_IIR_RX (0x1 << 2) /*Rx data received */
  37. #define BTIF_IIR_RX_TIMEOUT (0x11 << 2) /*Rx data received */
  38. /*BTIF_LSR bits*/
  39. #define BTIF_LSR_DR_BIT (0x1 << 0)
  40. #define BTIF_LSR_THRE_BIT (0x1 << 5)
  41. #define BTIF_LSR_TEMT_BIT (0x1 << 6)
  42. /*BTIF_FIFOCTRL bits*/
  43. #define BTIF_FIFOCTRL_CLR_TX (0x1 << 2) /*Clear Tx FIRO */
  44. #define BTIF_FIFOCTRL_CLR_RX (0x1 << 1) /*Clear Rx FIRO */
  45. /*BTIF_FAKELCR bits*/
  46. #define BTIF_FAKELCR_NORMAL_MODE 0x0
  47. /*BTIF_SLEEP_EN bits*/
  48. #define BTIF_SLEEP_EN_BIT (0x1 << 0) /*enable Sleep mode */
  49. #define BTIF_SLEEP_DIS_BIT (0x0) /*disable sleep mode */
  50. /*BTIF_DMA_EN bits*/
  51. #define BTIF_DMA_EN_RX (0x1 << 0) /*Enable Rx DMA */
  52. #define BTIF_DMA_EN_TX (0x1 << 1) /*Enable Tx DMA */
  53. #define BTIF_DMA_EN_AUTORST_EN (0x1 << 2) /*1: timeout counter will be auto reset */
  54. #define BTIF_DMA_EN_AUTORST_DIS (0x0 << 2) /*0: after Rx timeout happens,
  55. SW shall reset the interrupt by reading BTIF 0x4C */
  56. /*BTIF_TRI_LVL bits*/
  57. #define BTIF_TRI_LVL_TX_MASK ((0xf) << 0)
  58. #define BTIF_TRI_LVL_RX_MASK ((0x7) << 4)
  59. #define BTIF_TRI_LVL_TX(x) ((x & 0xf) << 0)
  60. #define BTIF_TRI_LVL_RX(x) ((x & 0x7) << 4)
  61. #define BTIF_TRI_LOOP_EN (0x1 << 7)
  62. #define BTIF_TRI_LOOP_DIS (0x0 << 7)
  63. /*BTIF_WAK bits*/
  64. #define BTIF_WAK_BIT (0x1 << 0)
  65. /*BTIF_HANDSHAKE bits*/
  66. #define BTIF_HANDSHAKE_EN_HANDSHAKE 1
  67. #define BTIF_HANDSHAKE_DIS_HANDSHAKE 0
  68. #define BTIF_TX_FIFO_SIZE 16
  69. #define BTIF_RX_FIFO_SIZE 8
  70. #define BTIF_TX_FIFO_THRE (BTIF_TX_FIFO_SIZE / 2)
  71. #define BTIF_RX_FIFO_THRE 0x1 /* 0x5 */
  72. #endif /*__HAL_BTIF_H_*/