btqca.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Bluetooth supports for Qualcomm Atheros ROME chips
  3. *
  4. * Copyright (c) 2015 The Linux Foundation. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2
  8. * as published by the Free Software Foundation
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #define EDL_PATCH_CMD_OPCODE (0xFC00)
  21. #define EDL_NVM_ACCESS_OPCODE (0xFC0B)
  22. #define EDL_PATCH_CMD_LEN (1)
  23. #define EDL_PATCH_VER_REQ_CMD (0x19)
  24. #define EDL_PATCH_TLV_REQ_CMD (0x1E)
  25. #define EDL_NVM_ACCESS_SET_REQ_CMD (0x01)
  26. #define MAX_SIZE_PER_TLV_SEGMENT (243)
  27. #define EDL_CMD_REQ_RES_EVT (0x00)
  28. #define EDL_PATCH_VER_RES_EVT (0x19)
  29. #define EDL_APP_VER_RES_EVT (0x02)
  30. #define EDL_TVL_DNLD_RES_EVT (0x04)
  31. #define EDL_CMD_EXE_STATUS_EVT (0x00)
  32. #define EDL_SET_BAUDRATE_RSP_EVT (0x92)
  33. #define EDL_NVM_ACCESS_CODE_EVT (0x0B)
  34. #define EDL_TAG_ID_HCI (17)
  35. #define EDL_TAG_ID_DEEP_SLEEP (27)
  36. enum qca_bardrate {
  37. QCA_BAUDRATE_115200 = 0,
  38. QCA_BAUDRATE_57600,
  39. QCA_BAUDRATE_38400,
  40. QCA_BAUDRATE_19200,
  41. QCA_BAUDRATE_9600,
  42. QCA_BAUDRATE_230400,
  43. QCA_BAUDRATE_250000,
  44. QCA_BAUDRATE_460800,
  45. QCA_BAUDRATE_500000,
  46. QCA_BAUDRATE_720000,
  47. QCA_BAUDRATE_921600,
  48. QCA_BAUDRATE_1000000,
  49. QCA_BAUDRATE_1250000,
  50. QCA_BAUDRATE_2000000,
  51. QCA_BAUDRATE_3000000,
  52. QCA_BAUDRATE_4000000,
  53. QCA_BAUDRATE_1600000,
  54. QCA_BAUDRATE_3200000,
  55. QCA_BAUDRATE_3500000,
  56. QCA_BAUDRATE_AUTO = 0xFE,
  57. QCA_BAUDRATE_RESERVED
  58. };
  59. enum rome_tlv_type {
  60. TLV_TYPE_PATCH = 1,
  61. TLV_TYPE_NVM
  62. };
  63. struct rome_config {
  64. u8 type;
  65. char fwname[64];
  66. uint8_t user_baud_rate;
  67. };
  68. struct edl_event_hdr {
  69. __u8 cresp;
  70. __u8 rtype;
  71. __u8 data[0];
  72. } __packed;
  73. struct rome_version {
  74. __le32 product_id;
  75. __le16 patch_ver;
  76. __le16 rome_ver;
  77. __le32 soc_id;
  78. } __packed;
  79. struct tlv_seg_resp {
  80. __u8 result;
  81. } __packed;
  82. struct tlv_type_patch {
  83. __le32 total_size;
  84. __le32 data_length;
  85. __u8 format_version;
  86. __u8 signature;
  87. __le16 reserved1;
  88. __le16 product_id;
  89. __le16 rom_build;
  90. __le16 patch_version;
  91. __le16 reserved2;
  92. __le32 entry;
  93. } __packed;
  94. struct tlv_type_nvm {
  95. __le16 tag_id;
  96. __le16 tag_len;
  97. __le32 reserve1;
  98. __le32 reserve2;
  99. __u8 data[0];
  100. } __packed;
  101. struct tlv_type_hdr {
  102. __le32 type_len;
  103. __u8 data[0];
  104. } __packed;
  105. #if IS_ENABLED(CONFIG_BT_QCA)
  106. int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
  107. int qca_uart_setup_rome(struct hci_dev *hdev, uint8_t baudrate);
  108. #else
  109. static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
  110. {
  111. return -EOPNOTSUPP;
  112. }
  113. static inline int qca_uart_setup_rome(struct hci_dev *hdev, int speed)
  114. {
  115. return -EOPNOTSUPP;
  116. }
  117. #endif