ath11k: add support for WCN6855
authorBaochen Qiang <bqiang@codeaurora.org>
Mon, 31 May 2021 14:41:28 +0000 (17:41 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 12 Jun 2021 10:31:05 +0000 (13:31 +0300)
This patch is to add support for WCN6855. For station mode,
WCN6855 is able to connect to an AP, and ping works well.
For AP mode, hostapd is able to bringup an SAP interface with
WCN6855, a normal station can connect to this AP and
ping works well.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1

Signed-off-by: Baochen Qiang <bqiang@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210511162214.29475-7-jouni@codeaurora.org
drivers/net/wireless/ath/ath11k/core.c
drivers/net/wireless/ath/ath11k/core.h
drivers/net/wireless/ath/ath11k/mhi.c
drivers/net/wireless/ath/ath11k/pci.c

index 77ce334..fd89419 100644 (file)
@@ -187,6 +187,45 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .supports_suspend = false,
                .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
        },
+       {
+               .name = "wcn6855 hw2.0",
+               .hw_rev = ATH11K_HW_WCN6855_HW20,
+               .fw = {
+                       .dir = "WCN6855/hw2.0",
+                       .board_size = 256 * 1024,
+                       .cal_size = 256 * 1024,
+               },
+               .max_radios = 3,
+               .bdf_addr = 0x4B0C0000,
+               .hw_ops = &wcn6855_ops,
+               .ring_mask = &ath11k_hw_ring_mask_qca6390,
+               .internal_sleep_clock = true,
+               .regs = &wcn6855_regs,
+               .qmi_service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_QCA6390,
+               .host_ce_config = ath11k_host_ce_config_qca6390,
+               .ce_count = 9,
+               .target_ce_config = ath11k_target_ce_config_wlan_qca6390,
+               .target_ce_count = 9,
+               .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390,
+               .svc_to_ce_map_len = 14,
+               .single_pdev_only = true,
+               .rxdma1_enable = false,
+               .num_rxmda_per_pdev = 2,
+               .rx_mac_buf_ring = true,
+               .vdev_start_delay = true,
+               .htt_peer_map_v2 = false,
+               .tcl_0_only = true,
+               .spectral_fft_sz = 0,
+
+               .interface_modes = BIT(NL80211_IFTYPE_STATION) |
+                                       BIT(NL80211_IFTYPE_AP),
+               .supports_monitor = false,
+               .supports_shadow_regs = true,
+               .idle_ps = true,
+               .cold_boot_calib = false,
+               .supports_suspend = true,
+               .hal_desc_sz = sizeof(struct hal_rx_desc_wcn6855),
+       },
 };
 
 int ath11k_core_suspend(struct ath11k_base *ab)
index 382df53..018fb23 100644 (file)
@@ -107,6 +107,7 @@ enum ath11k_hw_rev {
        ATH11K_HW_QCA6390_HW20,
        ATH11K_HW_IPQ6018_HW10,
        ATH11K_HW_QCN9074_HW10,
+       ATH11K_HW_WCN6855_HW20,
 };
 
 enum ath11k_firmware_mode {
index 27b394d..75cc2d8 100644 (file)
@@ -354,6 +354,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
                ath11k_mhi_config = &ath11k_mhi_config_qcn9074;
                break;
        case ATH11K_HW_QCA6390_HW20:
+       case ATH11K_HW_WCN6855_HW20:
                ath11k_mhi_config = &ath11k_mhi_config_qca6390;
                break;
        default:
index 0f31eb5..a4688b6 100644 (file)
 
 #define QCA6390_DEVICE_ID              0x1101
 #define QCN9074_DEVICE_ID              0x1104
+#define WCN6855_DEVICE_ID              0x1103
 
 static const struct pci_device_id ath11k_pci_id_table[] = {
        { PCI_VDEVICE(QCOM, QCA6390_DEVICE_ID) },
+       { PCI_VDEVICE(QCOM, WCN6855_DEVICE_ID) },
        /* TODO: add QCN9074_DEVICE_ID) once firmware issues are resolved */
        {0}
 };
@@ -1176,12 +1178,26 @@ static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
        .get_ce_msi_idx = ath11k_pci_get_ce_msi_idx,
 };
 
+static void ath11k_pci_read_hw_version(struct ath11k_base *ab, u32 *major, u32 *minor)
+{
+       u32 soc_hw_version;
+
+       soc_hw_version = ath11k_pci_read32(ab, TCSR_SOC_HW_VERSION);
+       *major = FIELD_GET(TCSR_SOC_HW_VERSION_MAJOR_MASK,
+                          soc_hw_version);
+       *minor = FIELD_GET(TCSR_SOC_HW_VERSION_MINOR_MASK,
+                          soc_hw_version);
+
+       ath11k_dbg(ab, ATH11K_DBG_PCI, "pci tcsr_soc_hw_version major %d minor %d\n",
+                  *major, *minor);
+}
+
 static int ath11k_pci_probe(struct pci_dev *pdev,
                            const struct pci_device_id *pci_dev)
 {
        struct ath11k_base *ab;
        struct ath11k_pci *ab_pci;
-       u32 soc_hw_version, soc_hw_version_major, soc_hw_version_minor;
+       u32 soc_hw_version_major, soc_hw_version_minor;
        int ret;
 
        ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI,
@@ -1209,15 +1225,8 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 
        switch (pci_dev->device) {
        case QCA6390_DEVICE_ID:
-               soc_hw_version = ath11k_pci_read32(ab, TCSR_SOC_HW_VERSION);
-               soc_hw_version_major = FIELD_GET(TCSR_SOC_HW_VERSION_MAJOR_MASK,
-                                                soc_hw_version);
-               soc_hw_version_minor = FIELD_GET(TCSR_SOC_HW_VERSION_MINOR_MASK,
-                                                soc_hw_version);
-
-               ath11k_dbg(ab, ATH11K_DBG_PCI, "pci tcsr_soc_hw_version major %d minor %d\n",
-                          soc_hw_version_major, soc_hw_version_minor);
-
+               ath11k_pci_read_hw_version(ab, &soc_hw_version_major,
+                                          &soc_hw_version_minor);
                switch (soc_hw_version_major) {
                case 2:
                        ab->hw_rev = ATH11K_HW_QCA6390_HW20;
@@ -1235,6 +1244,21 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
                ab->bus_params.static_window_map = true;
                ab->hw_rev = ATH11K_HW_QCN9074_HW10;
                break;
+       case WCN6855_DEVICE_ID:
+               ath11k_pci_read_hw_version(ab, &soc_hw_version_major,
+                                          &soc_hw_version_minor);
+               switch (soc_hw_version_major) {
+               case 2:
+                       ab->hw_rev = ATH11K_HW_WCN6855_HW20;
+                       break;
+               default:
+                       dev_err(&pdev->dev, "Unsupported WCN6855 SOC hardware version: %d %d\n",
+                               soc_hw_version_major, soc_hw_version_minor);
+                       ret = -EOPNOTSUPP;
+                       goto err_pci_free_region;
+               }
+               ab_pci->msi_config = &ath11k_msi_config[0];
+               break;
        default:
                dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n",
                        pci_dev->device);