| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: ISC */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
|---|
| 3 | 4 | * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. |
|---|
| 4 | 5 | * Copyright (c) 2018 The Linux Foundation. All rights reserved. |
|---|
| 5 | | - * |
|---|
| 6 | | - * Permission to use, copy, modify, and/or distribute this software for any |
|---|
| 7 | | - * purpose with or without fee is hereby granted, provided that the above |
|---|
| 8 | | - * copyright notice and this permission notice appear in all copies. |
|---|
| 9 | | - * |
|---|
| 10 | | - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|---|
| 11 | | - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|---|
| 12 | | - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|---|
| 13 | | - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|---|
| 14 | | - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|---|
| 15 | | - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|---|
| 16 | | - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|---|
| 17 | 6 | */ |
|---|
| 18 | 7 | |
|---|
| 19 | 8 | #ifndef _HW_H_ |
|---|
| .. | .. |
|---|
| 21 | 10 | |
|---|
| 22 | 11 | #include "targaddrs.h" |
|---|
| 23 | 12 | |
|---|
| 13 | +enum ath10k_bus { |
|---|
| 14 | + ATH10K_BUS_PCI, |
|---|
| 15 | + ATH10K_BUS_AHB, |
|---|
| 16 | + ATH10K_BUS_SDIO, |
|---|
| 17 | + ATH10K_BUS_USB, |
|---|
| 18 | + ATH10K_BUS_SNOC, |
|---|
| 19 | +}; |
|---|
| 20 | + |
|---|
| 24 | 21 | #define ATH10K_FW_DIR "ath10k" |
|---|
| 25 | 22 | |
|---|
| 26 | 23 | #define QCA988X_2_0_DEVICE_ID_UBNT (0x11ac) |
|---|
| 27 | 24 | #define QCA988X_2_0_DEVICE_ID (0x003c) |
|---|
| 28 | 25 | #define QCA6164_2_1_DEVICE_ID (0x0041) |
|---|
| 29 | 26 | #define QCA6174_2_1_DEVICE_ID (0x003e) |
|---|
| 27 | +#define QCA6174_3_2_DEVICE_ID (0x0042) |
|---|
| 30 | 28 | #define QCA99X0_2_0_DEVICE_ID (0x0040) |
|---|
| 31 | 29 | #define QCA9888_2_0_DEVICE_ID (0x0056) |
|---|
| 32 | 30 | #define QCA9984_1_0_DEVICE_ID (0x0046) |
|---|
| .. | .. |
|---|
| 109 | 107 | #define QCA9984_HW_1_0_CHIP_ID_REV 0x0 |
|---|
| 110 | 108 | #define QCA9984_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA9984/hw1.0" |
|---|
| 111 | 109 | #define QCA9984_HW_1_0_BOARD_DATA_FILE "board.bin" |
|---|
| 110 | +#define QCA9984_HW_1_0_EBOARD_DATA_FILE "eboard.bin" |
|---|
| 112 | 111 | #define QCA9984_HW_1_0_PATCH_LOAD_ADDR 0x1234 |
|---|
| 113 | 112 | |
|---|
| 114 | 113 | /* QCA9888 2.0 defines */ |
|---|
| .. | .. |
|---|
| 153 | 152 | #define ATH10K_FW_UTF_FILE "utf.bin" |
|---|
| 154 | 153 | #define ATH10K_FW_UTF_API2_FILE "utf-2.bin" |
|---|
| 155 | 154 | |
|---|
| 155 | +#define ATH10K_FW_UTF_FILE_BASE "utf" |
|---|
| 156 | + |
|---|
| 156 | 157 | /* includes also the null byte */ |
|---|
| 157 | 158 | #define ATH10K_FIRMWARE_MAGIC "QCA-ATH10K" |
|---|
| 158 | 159 | #define ATH10K_BOARD_MAGIC "QCA-ATH10K-BOARD" |
|---|
| .. | .. |
|---|
| 164 | 165 | struct ath10k_fw_ie { |
|---|
| 165 | 166 | __le32 id; |
|---|
| 166 | 167 | __le32 len; |
|---|
| 167 | | - u8 data[0]; |
|---|
| 168 | + u8 data[]; |
|---|
| 168 | 169 | }; |
|---|
| 169 | 170 | |
|---|
| 170 | 171 | enum ath10k_fw_ie_type { |
|---|
| .. | .. |
|---|
| 221 | 222 | enum ath10k_bd_ie_type { |
|---|
| 222 | 223 | /* contains sub IEs of enum ath10k_bd_ie_board_type */ |
|---|
| 223 | 224 | ATH10K_BD_IE_BOARD = 0, |
|---|
| 225 | + ATH10K_BD_IE_BOARD_EXT = 1, |
|---|
| 224 | 226 | }; |
|---|
| 225 | 227 | |
|---|
| 226 | 228 | enum ath10k_bd_ie_board_type { |
|---|
| .. | .. |
|---|
| 343 | 345 | }; |
|---|
| 344 | 346 | |
|---|
| 345 | 347 | struct ath10k_hw_ce_regs { |
|---|
| 346 | | - u32 sr_base_addr; |
|---|
| 348 | + u32 sr_base_addr_lo; |
|---|
| 349 | + u32 sr_base_addr_hi; |
|---|
| 347 | 350 | u32 sr_size_addr; |
|---|
| 348 | | - u32 dr_base_addr; |
|---|
| 351 | + u32 dr_base_addr_lo; |
|---|
| 352 | + u32 dr_base_addr_hi; |
|---|
| 349 | 353 | u32 dr_size_addr; |
|---|
| 350 | 354 | u32 ce_cmd_addr; |
|---|
| 351 | 355 | u32 misc_ie_addr; |
|---|
| .. | .. |
|---|
| 375 | 379 | u8 num_target_ce_config_wlan; |
|---|
| 376 | 380 | u16 ce_desc_meta_data_mask; |
|---|
| 377 | 381 | u8 ce_desc_meta_data_lsb; |
|---|
| 382 | + u32 rfkill_pin; |
|---|
| 383 | + u32 rfkill_cfg; |
|---|
| 384 | + bool rfkill_on_level; |
|---|
| 378 | 385 | }; |
|---|
| 379 | 386 | |
|---|
| 380 | 387 | extern const struct ath10k_hw_values qca988x_values; |
|---|
| .. | .. |
|---|
| 388 | 395 | |
|---|
| 389 | 396 | void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey, |
|---|
| 390 | 397 | u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev); |
|---|
| 398 | + |
|---|
| 399 | +int ath10k_hw_diag_fast_download(struct ath10k *ar, |
|---|
| 400 | + u32 address, |
|---|
| 401 | + const void *buffer, |
|---|
| 402 | + u32 length); |
|---|
| 391 | 403 | |
|---|
| 392 | 404 | #define QCA_REV_988X(ar) ((ar)->hw_rev == ATH10K_HW_QCA988X) |
|---|
| 393 | 405 | #define QCA_REV_9887(ar) ((ar)->hw_rev == ATH10K_HW_QCA9887) |
|---|
| .. | .. |
|---|
| 501 | 513 | struct ath10k_hw_params { |
|---|
| 502 | 514 | u32 id; |
|---|
| 503 | 515 | u16 dev_id; |
|---|
| 516 | + enum ath10k_bus bus; |
|---|
| 504 | 517 | const char *name; |
|---|
| 505 | 518 | u32 patch_load_addr; |
|---|
| 506 | 519 | int uart_pin; |
|---|
| .. | .. |
|---|
| 539 | 552 | const char *dir; |
|---|
| 540 | 553 | const char *board; |
|---|
| 541 | 554 | size_t board_size; |
|---|
| 555 | + const char *eboard; |
|---|
| 556 | + size_t ext_board_size; |
|---|
| 542 | 557 | size_t board_ext_size; |
|---|
| 543 | 558 | } fw; |
|---|
| 544 | 559 | |
|---|
| .. | .. |
|---|
| 578 | 593 | /* Target rx ring fill level */ |
|---|
| 579 | 594 | u32 rx_ring_fill_level; |
|---|
| 580 | 595 | |
|---|
| 581 | | - /* target supporting per ce IRQ */ |
|---|
| 582 | | - bool per_ce_irq; |
|---|
| 583 | | - |
|---|
| 584 | 596 | /* target supporting shadow register for ce write */ |
|---|
| 585 | 597 | bool shadow_reg_support; |
|---|
| 586 | 598 | |
|---|
| .. | .. |
|---|
| 594 | 606 | * to avoid it sending spurious acks. |
|---|
| 595 | 607 | */ |
|---|
| 596 | 608 | bool hw_filter_reset_required; |
|---|
| 609 | + |
|---|
| 610 | + /* target supporting fw download via diag ce */ |
|---|
| 611 | + bool fw_diag_ce_download; |
|---|
| 612 | + |
|---|
| 613 | + /* target supporting fw download via large size BMI */ |
|---|
| 614 | + bool bmi_large_size_download; |
|---|
| 615 | + |
|---|
| 616 | + /* need to set uart pin if disable uart print, workaround for a |
|---|
| 617 | + * firmware bug |
|---|
| 618 | + */ |
|---|
| 619 | + bool uart_pin_workaround; |
|---|
| 620 | + |
|---|
| 621 | + /* Workaround for the credit size calculation */ |
|---|
| 622 | + bool credit_size_workaround; |
|---|
| 623 | + |
|---|
| 624 | + /* tx stats support over pktlog */ |
|---|
| 625 | + bool tx_stats_over_pktlog; |
|---|
| 626 | + |
|---|
| 627 | + /* provides bitrates for sta_statistics using WMI_TLV_PEER_STATS_INFO_EVENTID */ |
|---|
| 628 | + bool supports_peer_stats_info; |
|---|
| 597 | 629 | }; |
|---|
| 598 | 630 | |
|---|
| 599 | 631 | struct htt_rx_desc; |
|---|
| 632 | +struct htt_resp; |
|---|
| 633 | +struct htt_data_tx_completion_ext; |
|---|
| 600 | 634 | |
|---|
| 601 | 635 | /* Defines needed for Rx descriptor abstraction */ |
|---|
| 602 | 636 | struct ath10k_hw_ops { |
|---|
| 603 | 637 | int (*rx_desc_get_l3_pad_bytes)(struct htt_rx_desc *rxd); |
|---|
| 604 | 638 | void (*set_coverage_class)(struct ath10k *ar, s16 value); |
|---|
| 605 | 639 | int (*enable_pll_clk)(struct ath10k *ar); |
|---|
| 640 | + bool (*rx_desc_get_msdu_limit_error)(struct htt_rx_desc *rxd); |
|---|
| 641 | + int (*tx_data_rssi_pad_bytes)(struct htt_resp *htt); |
|---|
| 642 | + int (*is_rssi_enable)(struct htt_resp *resp); |
|---|
| 606 | 643 | }; |
|---|
| 607 | 644 | |
|---|
| 608 | 645 | extern const struct ath10k_hw_ops qca988x_ops; |
|---|
| 609 | 646 | extern const struct ath10k_hw_ops qca99x0_ops; |
|---|
| 610 | 647 | extern const struct ath10k_hw_ops qca6174_ops; |
|---|
| 648 | +extern const struct ath10k_hw_ops qca6174_sdio_ops; |
|---|
| 611 | 649 | extern const struct ath10k_hw_ops wcn3990_ops; |
|---|
| 612 | 650 | |
|---|
| 613 | 651 | extern const struct ath10k_hw_clk_params qca6174_clk[]; |
|---|
| .. | .. |
|---|
| 618 | 656 | { |
|---|
| 619 | 657 | if (hw->hw_ops->rx_desc_get_l3_pad_bytes) |
|---|
| 620 | 658 | return hw->hw_ops->rx_desc_get_l3_pad_bytes(rxd); |
|---|
| 659 | + return 0; |
|---|
| 660 | +} |
|---|
| 661 | + |
|---|
| 662 | +static inline bool |
|---|
| 663 | +ath10k_rx_desc_msdu_limit_error(struct ath10k_hw_params *hw, |
|---|
| 664 | + struct htt_rx_desc *rxd) |
|---|
| 665 | +{ |
|---|
| 666 | + if (hw->hw_ops->rx_desc_get_msdu_limit_error) |
|---|
| 667 | + return hw->hw_ops->rx_desc_get_msdu_limit_error(rxd); |
|---|
| 668 | + return false; |
|---|
| 669 | +} |
|---|
| 670 | + |
|---|
| 671 | +static inline int |
|---|
| 672 | +ath10k_tx_data_rssi_get_pad_bytes(struct ath10k_hw_params *hw, |
|---|
| 673 | + struct htt_resp *htt) |
|---|
| 674 | +{ |
|---|
| 675 | + if (hw->hw_ops->tx_data_rssi_pad_bytes) |
|---|
| 676 | + return hw->hw_ops->tx_data_rssi_pad_bytes(htt); |
|---|
| 677 | + return 0; |
|---|
| 678 | +} |
|---|
| 679 | + |
|---|
| 680 | +static inline int |
|---|
| 681 | +ath10k_is_rssi_enable(struct ath10k_hw_params *hw, |
|---|
| 682 | + struct htt_resp *resp) |
|---|
| 683 | +{ |
|---|
| 684 | + if (hw->hw_ops->is_rssi_enable) |
|---|
| 685 | + return hw->hw_ops->is_rssi_enable(resp); |
|---|
| 621 | 686 | return 0; |
|---|
| 622 | 687 | } |
|---|
| 623 | 688 | |
|---|
| .. | .. |
|---|
| 703 | 768 | #define TARGET_TLV_NUM_TDLS_VDEVS 1 |
|---|
| 704 | 769 | #define TARGET_TLV_NUM_TIDS ((TARGET_TLV_NUM_PEERS) * 2) |
|---|
| 705 | 770 | #define TARGET_TLV_NUM_MSDU_DESC (1024 + 32) |
|---|
| 771 | +#define TARGET_TLV_NUM_MSDU_DESC_HL 1024 |
|---|
| 706 | 772 | #define TARGET_TLV_NUM_WOW_PATTERNS 22 |
|---|
| 707 | 773 | #define TARGET_TLV_MGMT_NUM_MSDU_DESC (50) |
|---|
| 708 | 774 | |
|---|
| 709 | 775 | /* Target specific defines for WMI-HL-1.0 firmware */ |
|---|
| 710 | | -#define TARGET_HL_10_TLV_NUM_PEERS 14 |
|---|
| 711 | | -#define TARGET_HL_10_TLV_AST_SKID_LIMIT 6 |
|---|
| 712 | | -#define TARGET_HL_10_TLV_NUM_WDS_ENTRIES 2 |
|---|
| 776 | +#define TARGET_HL_TLV_NUM_PEERS 33 |
|---|
| 777 | +#define TARGET_HL_TLV_AST_SKID_LIMIT 16 |
|---|
| 778 | +#define TARGET_HL_TLV_NUM_WDS_ENTRIES 2 |
|---|
| 779 | + |
|---|
| 780 | +/* Target specific defines for QCA9377 high latency firmware */ |
|---|
| 781 | +#define TARGET_QCA9377_HL_NUM_PEERS 15 |
|---|
| 713 | 782 | |
|---|
| 714 | 783 | /* Diagnostic Window */ |
|---|
| 715 | 784 | #define CE_DIAG_PIPE 7 |
|---|
| .. | .. |
|---|
| 1050 | 1119 | #define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS 0x00000819 |
|---|
| 1051 | 1120 | #define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB 0 |
|---|
| 1052 | 1121 | #define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff |
|---|
| 1122 | +#define MBOX_CPU_STATUS_ENABLE_ASSERT_MASK 0x00000001 |
|---|
| 1053 | 1123 | #define MBOX_ERROR_STATUS_ENABLE_ADDRESS 0x0000081a |
|---|
| 1054 | 1124 | #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 |
|---|
| 1055 | 1125 | #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002 |
|---|
| .. | .. |
|---|
| 1129 | 1199 | #define RTC_SYNC_STATUS_PLL_CHANGING_MASK 0x00000020 |
|---|
| 1130 | 1200 | /* qca6174 PLL offset/mask end */ |
|---|
| 1131 | 1201 | |
|---|
| 1202 | +/* CPU_ADDR_MSB is a register, bit[3:0] is to specify which memory |
|---|
| 1203 | + * region is accessed. The memory region size is 1M. |
|---|
| 1204 | + * If host wants to access 0xX12345 at target, then CPU_ADDR_MSB[3:0] |
|---|
| 1205 | + * is 0xX. |
|---|
| 1206 | + * The following MACROs are defined to get the 0xX and the size limit. |
|---|
| 1207 | + */ |
|---|
| 1208 | +#define CPU_ADDR_MSB_REGION_MASK GENMASK(23, 20) |
|---|
| 1209 | +#define CPU_ADDR_MSB_REGION_VAL(X) FIELD_GET(CPU_ADDR_MSB_REGION_MASK, X) |
|---|
| 1210 | +#define REGION_ACCESS_SIZE_LIMIT 0x100000 |
|---|
| 1211 | +#define REGION_ACCESS_SIZE_MASK (REGION_ACCESS_SIZE_LIMIT - 1) |
|---|
| 1212 | + |
|---|
| 1132 | 1213 | #endif /* _HW_H_ */ |
|---|