From 867f4eeee862d6568a0f142d6a38f8bb724ff80e Mon Sep 17 00:00:00 2001 From: Manikanta Pubbisetty Date: Mon, 25 Jul 2022 20:49:10 +0300 Subject: [PATCH 01/36] wifi: ath11k: Fix register write failure on QCN9074 Commit 56c8ccf331bd ("ath11k: Add register access logic for WCN6750") regressed QCN9074. With the above mentioned commit, writes are failing for some registers on QCN9074 although the device seems to work normally. ath11k_pci 0000:03:00.0: failed to set pcie link register0x01e0e0a8: 0xffffffff != 0x00000010 ath11k_pci 0000:03:00.0: failed to set sysclk: -110 PCIe devices in ath11k (QCA6390, WCN6855, QCN9074, WCN6750) use window concept for register accesses. There are two schemes, dynamic & static window. In dynamic window scheme, a single window(region in the BAR) is mapped either to CE or DP register windows at any give time. QCA6390 & WCN6855 follow this scheme for register accesses. In static window scheme, CE & DP register windows are statically mapped to separate regions with in the BAR so that there is no switching of register windows between CE & DP register accesses. QCN9074 & WCN6750 follow this scheme although the window start offsets are different for QCN9074 & WCN6750. QCN9074 uses 3rd & 2nd window for DP & CE register accesses respectively whereas WCN6750 uses 1st & 2nd window for DP & CE. In QCN9074, along with 2nd & 3rd windows, 1st window is also used for certain configurations which commit 56c8ccf331bd ("ath11k: Add register access logic for WCN6750") did not account for and hence the regression. Fix this by going back to the original way of accessing the registers on QCN9074. Since this diverges from WCN6750 way of accessing registers, it is required to register window_read32/window_write32() pci_ops for WCN6750. We can also get rid of dp_window_idx & ce_window_idx members in hw_params, so remove them. Also add a new API ath11k_pcic_register_pci_ops() for registering pci_ops to the ath11k core. This API checks for mandatory pci_ops() and reports error if those are missing. Also initialize unused pci_ops to NULL. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 Fixes: 56c8ccf331bd ("ath11k: Add register access logic for WCN6750") Reported-by: Maxime Bizon Tested-by: Maxime Bizon Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220608062954.27792-1-quic_mpubbise@quicinc.com --- drivers/net/wireless/ath/ath11k/ahb.c | 52 ++++++++++++++++++- drivers/net/wireless/ath/ath11k/core.c | 14 ------ drivers/net/wireless/ath/ath11k/hw.h | 2 - drivers/net/wireless/ath/ath11k/pci.c | 70 ++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/pcic.c | 57 ++++++++------------- drivers/net/wireless/ath/ath11k/pcic.h | 2 + 6 files changed, 128 insertions(+), 69 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index d7d33d5cdfc5..c47414710138 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -140,8 +140,53 @@ ath11k_ahb_get_msi_irq_wcn6750(struct ath11k_base *ab, unsigned int vector) return ab->pci.msi.irqs[vector]; } +static inline u32 +ath11k_ahb_get_window_start_wcn6750(struct ath11k_base *ab, u32 offset) +{ + u32 window_start = 0; + + /* If offset lies within DP register range, use 1st window */ + if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < ATH11K_PCI_WINDOW_RANGE_MASK) + window_start = ATH11K_PCI_WINDOW_START; + /* If offset lies within CE register range, use 2nd window */ + else if ((offset ^ HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab)) < + ATH11K_PCI_WINDOW_RANGE_MASK) + window_start = 2 * ATH11K_PCI_WINDOW_START; + + return window_start; +} + +static void +ath11k_ahb_window_write32_wcn6750(struct ath11k_base *ab, u32 offset, u32 value) +{ + u32 window_start; + + /* WCN6750 uses static window based register access*/ + window_start = ath11k_ahb_get_window_start_wcn6750(ab, offset); + + iowrite32(value, ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +} + +static u32 ath11k_ahb_window_read32_wcn6750(struct ath11k_base *ab, u32 offset) +{ + u32 window_start; + u32 val; + + /* WCN6750 uses static window based register access */ + window_start = ath11k_ahb_get_window_start_wcn6750(ab, offset); + + val = ioread32(ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + return val; +} + static const struct ath11k_pci_ops ath11k_ahb_pci_ops_wcn6750 = { + .wakeup = NULL, + .release = NULL, .get_msi_irq = ath11k_ahb_get_msi_irq_wcn6750, + .window_write32 = ath11k_ahb_window_write32_wcn6750, + .window_read32 = ath11k_ahb_window_read32_wcn6750, }; static inline u32 ath11k_ahb_read32(struct ath11k_base *ab, u32 offset) @@ -971,11 +1016,16 @@ static int ath11k_ahb_probe(struct platform_device *pdev) } ab->hif.ops = hif_ops; - ab->pci.ops = pci_ops; ab->pdev = pdev; ab->hw_rev = hw_rev; platform_set_drvdata(pdev, ab); + ret = ath11k_pcic_register_pci_ops(ab, pci_ops); + if (ret) { + ath11k_err(ab, "failed to register PCI ops: %d\n", ret); + goto err_core_free; + } + ret = ath11k_core_pre_init(ab); if (ret) goto err_core_free; diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index c8e0bc935838..6ddc698f4a2d 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -107,8 +107,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = true, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = false, }, @@ -183,8 +181,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = true, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = false, }, @@ -258,8 +254,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = true, }, @@ -333,8 +327,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = true, .hybrid_bus_type = false, - .dp_window_idx = 3, - .ce_window_idx = 2, .fixed_fw_mem = false, .support_off_channel_tx = false, }, @@ -408,8 +400,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = true, }, @@ -482,8 +472,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = true, }, @@ -556,8 +544,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = true, .hybrid_bus_type = true, - .dp_window_idx = 1, - .ce_window_idx = 2, .fixed_fw_mem = true, .support_off_channel_tx = false, }, diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h index 77dc5c851c9b..84c284fab5db 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -201,8 +201,6 @@ struct ath11k_hw_params { bool fixed_mem_region; bool static_window_map; bool hybrid_bus_type; - u8 dp_window_idx; - u8 ce_window_idx; bool fixed_fw_mem; bool support_off_channel_tx; }; diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 487a303b3077..5bd34a6273d9 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -50,6 +50,22 @@ static void ath11k_pci_bus_release(struct ath11k_base *ab) mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); } +static u32 ath11k_pci_get_window_start(struct ath11k_base *ab, u32 offset) +{ + if (!ab->hw_params.static_window_map) + return ATH11K_PCI_WINDOW_START; + + if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < ATH11K_PCI_WINDOW_RANGE_MASK) + /* if offset lies within DP register range, use 3rd window */ + return 3 * ATH11K_PCI_WINDOW_START; + else if ((offset ^ HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab)) < + ATH11K_PCI_WINDOW_RANGE_MASK) + /* if offset lies within CE register range, use 2nd window */ + return 2 * ATH11K_PCI_WINDOW_START; + else + return ATH11K_PCI_WINDOW_START; +} + static inline void ath11k_pci_select_window(struct ath11k_pci *ab_pci, u32 offset) { struct ath11k_base *ab = ab_pci->ab; @@ -70,26 +86,39 @@ static void ath11k_pci_window_write32(struct ath11k_base *ab, u32 offset, u32 value) { struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); - u32 window_start = ATH11K_PCI_WINDOW_START; + u32 window_start; - spin_lock_bh(&ab_pci->window_lock); - ath11k_pci_select_window(ab_pci, offset); - iowrite32(value, ab->mem + window_start + - (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); - spin_unlock_bh(&ab_pci->window_lock); + window_start = ath11k_pci_get_window_start(ab, offset); + + if (window_start == ATH11K_PCI_WINDOW_START) { + spin_lock_bh(&ab_pci->window_lock); + ath11k_pci_select_window(ab_pci, offset); + iowrite32(value, ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + spin_unlock_bh(&ab_pci->window_lock); + } else { + iowrite32(value, ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + } } static u32 ath11k_pci_window_read32(struct ath11k_base *ab, u32 offset) { struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); - u32 window_start = ATH11K_PCI_WINDOW_START; - u32 val; + u32 window_start, val; - spin_lock_bh(&ab_pci->window_lock); - ath11k_pci_select_window(ab_pci, offset); - val = ioread32(ab->mem + window_start + - (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); - spin_unlock_bh(&ab_pci->window_lock); + window_start = ath11k_pci_get_window_start(ab, offset); + + if (window_start == ATH11K_PCI_WINDOW_START) { + spin_lock_bh(&ab_pci->window_lock); + ath11k_pci_select_window(ab_pci, offset); + val = ioread32(ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + spin_unlock_bh(&ab_pci->window_lock); + } else { + val = ioread32(ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + } return val; } @@ -110,6 +139,8 @@ static const struct ath11k_pci_ops ath11k_pci_ops_qca6390 = { }; static const struct ath11k_pci_ops ath11k_pci_ops_qcn9074 = { + .wakeup = NULL, + .release = NULL, .get_msi_irq = ath11k_pci_get_msi_irq, .window_write32 = ath11k_pci_window_write32, .window_read32 = ath11k_pci_window_read32, @@ -697,6 +728,7 @@ static int ath11k_pci_probe(struct pci_dev *pdev, struct ath11k_base *ab; struct ath11k_pci *ab_pci; u32 soc_hw_version_major, soc_hw_version_minor, addr; + const struct ath11k_pci_ops *pci_ops; int ret; ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI); @@ -754,10 +786,10 @@ static int ath11k_pci_probe(struct pci_dev *pdev, goto err_pci_free_region; } - ab->pci.ops = &ath11k_pci_ops_qca6390; + pci_ops = &ath11k_pci_ops_qca6390; break; case QCN9074_DEVICE_ID: - ab->pci.ops = &ath11k_pci_ops_qcn9074; + pci_ops = &ath11k_pci_ops_qcn9074; ab->hw_rev = ATH11K_HW_QCN9074_HW10; break; case WCN6855_DEVICE_ID: @@ -787,7 +819,7 @@ unsupported_wcn6855_soc: goto err_pci_free_region; } - ab->pci.ops = &ath11k_pci_ops_qca6390; + pci_ops = &ath11k_pci_ops_qca6390; break; default: dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", @@ -796,6 +828,12 @@ unsupported_wcn6855_soc: goto err_pci_free_region; } + ret = ath11k_pcic_register_pci_ops(ab, pci_ops); + if (ret) { + ath11k_err(ab, "failed to register PCI ops: %d\n", ret); + goto err_pci_free_region; + } + ret = ath11k_pcic_init_msi_config(ab); if (ret) { ath11k_err(ab, "failed to init msi config: %d\n", ret); diff --git a/drivers/net/wireless/ath/ath11k/pcic.c b/drivers/net/wireless/ath/ath11k/pcic.c index cf12b98c480d..1adf20ebef27 100644 --- a/drivers/net/wireless/ath/ath11k/pcic.c +++ b/drivers/net/wireless/ath/ath11k/pcic.c @@ -140,23 +140,8 @@ int ath11k_pcic_init_msi_config(struct ath11k_base *ab) } EXPORT_SYMBOL(ath11k_pcic_init_msi_config); -static inline u32 ath11k_pcic_get_window_start(struct ath11k_base *ab, - u32 offset) -{ - u32 window_start = 0; - - if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < ATH11K_PCI_WINDOW_RANGE_MASK) - window_start = ab->hw_params.dp_window_idx * ATH11K_PCI_WINDOW_START; - else if ((offset ^ HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab)) < - ATH11K_PCI_WINDOW_RANGE_MASK) - window_start = ab->hw_params.ce_window_idx * ATH11K_PCI_WINDOW_START; - - return window_start; -} - void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) { - u32 window_start; int ret = 0; /* for offset beyond BAR + 4K - 32, may @@ -166,15 +151,10 @@ void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->wakeup) ret = ab->pci.ops->wakeup(ab); - if (offset < ATH11K_PCI_WINDOW_START) { + if (offset < ATH11K_PCI_WINDOW_START) iowrite32(value, ab->mem + offset); - } else if (ab->hw_params.static_window_map) { - window_start = ath11k_pcic_get_window_start(ab, offset); - iowrite32(value, ab->mem + window_start + - (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); - } else if (ab->pci.ops->window_write32) { + else ab->pci.ops->window_write32(ab, offset, value); - } if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->release && @@ -185,9 +165,8 @@ EXPORT_SYMBOL(ath11k_pcic_write32); u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) { - u32 val = 0; - u32 window_start; int ret = 0; + u32 val; /* for offset beyond BAR + 4K - 32, may * need to wakeup the device to access. @@ -196,15 +175,10 @@ u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->wakeup) ret = ab->pci.ops->wakeup(ab); - if (offset < ATH11K_PCI_WINDOW_START) { + if (offset < ATH11K_PCI_WINDOW_START) val = ioread32(ab->mem + offset); - } else if (ab->hw_params.static_window_map) { - window_start = ath11k_pcic_get_window_start(ab, offset); - val = ioread32(ab->mem + window_start + - (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); - } else if (ab->pci.ops->window_read32) { + else val = ab->pci.ops->window_read32(ab, offset); - } if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->release && @@ -516,11 +490,6 @@ static irqreturn_t ath11k_pcic_ext_interrupt_handler(int irq, void *arg) static int ath11k_pcic_get_msi_irq(struct ath11k_base *ab, unsigned int vector) { - if (!ab->pci.ops->get_msi_irq) { - WARN_ONCE(1, "get_msi_irq pci op not defined"); - return -EOPNOTSUPP; - } - return ab->pci.ops->get_msi_irq(ab, vector); } @@ -746,3 +715,19 @@ int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, return 0; } EXPORT_SYMBOL(ath11k_pcic_map_service_to_pipe); + +int ath11k_pcic_register_pci_ops(struct ath11k_base *ab, + const struct ath11k_pci_ops *pci_ops) +{ + if (!pci_ops) + return 0; + + /* Return error if mandatory pci_ops callbacks are missing */ + if (!pci_ops->get_msi_irq || !pci_ops->window_write32 || + !pci_ops->window_read32) + return -EINVAL; + + ab->pci.ops = pci_ops; + return 0; +} +EXPORT_SYMBOL(ath11k_pcic_register_pci_ops); diff --git a/drivers/net/wireless/ath/ath11k/pcic.h b/drivers/net/wireless/ath/ath11k/pcic.h index c53d86289a8e..0afbb34510db 100644 --- a/drivers/net/wireless/ath/ath11k/pcic.h +++ b/drivers/net/wireless/ath/ath11k/pcic.h @@ -43,4 +43,6 @@ int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab); void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab); int ath11k_pcic_init_msi_config(struct ath11k_base *ab); +int ath11k_pcic_register_pci_ops(struct ath11k_base *ab, + const struct ath11k_pci_ops *pci_ops); #endif From 169ede1f594809d1f0f46d95c071d672dbfc0eb1 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Mon, 25 Jul 2022 20:49:10 +0300 Subject: [PATCH 02/36] Revert "ath11k: add support for hardware rfkill for QCA6390" This reverts commit ec038c6127fa772d2c5604e329f22371830d5fa6. Tyler reported that on L390 Yoga Thinkpad with QCA6390 the suspend was failing because of this commit. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.9 Link: https://bugzilla.kernel.org/show_bug.cgi?id=215881 Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220708164656.29549-1-kvalo@kernel.org --- drivers/net/wireless/ath/ath11k/core.c | 73 -------------------------- drivers/net/wireless/ath/ath11k/core.h | 4 -- drivers/net/wireless/ath/ath11k/hw.h | 3 -- drivers/net/wireless/ath/ath11k/mac.c | 58 -------------------- drivers/net/wireless/ath/ath11k/mac.h | 2 - drivers/net/wireless/ath/ath11k/wmi.c | 41 --------------- drivers/net/wireless/ath/ath11k/wmi.h | 25 --------- 7 files changed, 206 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 6ddc698f4a2d..c3e9e4f7bc24 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -54,9 +54,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 11, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq8074, .svc_to_ce_map_len = 21, - .rfkill_pin = 0, - .rfkill_cfg = 0, - .rfkill_on_level = 0, .single_pdev_only = false, .rxdma1_enable = true, .num_rxmda_per_pdev = 1, @@ -131,9 +128,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 11, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq6018, .svc_to_ce_map_len = 19, - .rfkill_pin = 0, - .rfkill_cfg = 0, - .rfkill_on_level = 0, .single_pdev_only = false, .rxdma1_enable = true, .num_rxmda_per_pdev = 1, @@ -205,9 +199,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 9, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, .svc_to_ce_map_len = 14, - .rfkill_pin = 48, - .rfkill_cfg = 0, - .rfkill_on_level = 1, .single_pdev_only = true, .rxdma1_enable = false, .num_rxmda_per_pdev = 2, @@ -278,9 +269,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 9, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qcn9074, .svc_to_ce_map_len = 18, - .rfkill_pin = 0, - .rfkill_cfg = 0, - .rfkill_on_level = 0, .rxdma1_enable = true, .num_rxmda_per_pdev = 1, .rx_mac_buf_ring = false, @@ -351,9 +339,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 9, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, .svc_to_ce_map_len = 14, - .rfkill_pin = 0, - .rfkill_cfg = 0, - .rfkill_on_level = 0, .single_pdev_only = true, .rxdma1_enable = false, .num_rxmda_per_pdev = 2, @@ -424,9 +409,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 9, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, .svc_to_ce_map_len = 14, - .rfkill_pin = 0, - .rfkill_cfg = 0, - .rfkill_on_level = 0, .single_pdev_only = true, .rxdma1_enable = false, .num_rxmda_per_pdev = 2, @@ -496,9 +478,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .target_ce_count = 9, .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, .svc_to_ce_map_len = 14, - .rfkill_pin = 0, - .rfkill_cfg = 0, - .rfkill_on_level = 0, .single_pdev_only = true, .rxdma1_enable = false, .num_rxmda_per_pdev = 1, @@ -1388,27 +1367,6 @@ static int ath11k_core_start_firmware(struct ath11k_base *ab, return ret; } -static int ath11k_core_rfkill_config(struct ath11k_base *ab) -{ - struct ath11k *ar; - int ret = 0, i; - - if (!(ab->target_caps.sys_cap_info & WMI_SYS_CAP_INFO_RFKILL)) - return 0; - - for (i = 0; i < ab->num_radios; i++) { - ar = ab->pdevs[i].ar; - - ret = ath11k_mac_rfkill_config(ar); - if (ret && ret != -EOPNOTSUPP) { - ath11k_warn(ab, "failed to configure rfkill: %d", ret); - return ret; - } - } - - return ret; -} - int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab) { int ret; @@ -1461,13 +1419,6 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab) goto err_core_stop; } ath11k_hif_irq_enable(ab); - - ret = ath11k_core_rfkill_config(ab); - if (ret && ret != -EOPNOTSUPP) { - ath11k_err(ab, "failed to config rfkill: %d\n", ret); - goto err_core_stop; - } - mutex_unlock(&ab->core_lock); return 0; @@ -1536,7 +1487,6 @@ void ath11k_core_halt(struct ath11k *ar) cancel_delayed_work_sync(&ar->scan.timeout); cancel_work_sync(&ar->regd_update_work); cancel_work_sync(&ab->update_11d_work); - cancel_work_sync(&ab->rfkill_work); rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL); synchronize_rcu(); @@ -1544,28 +1494,6 @@ void ath11k_core_halt(struct ath11k *ar) idr_init(&ar->txmgmt_idr); } -static void ath11k_rfkill_work(struct work_struct *work) -{ - struct ath11k_base *ab = container_of(work, struct ath11k_base, rfkill_work); - struct ath11k *ar; - bool rfkill_radio_on; - int i; - - spin_lock_bh(&ab->base_lock); - rfkill_radio_on = ab->rfkill_radio_on; - spin_unlock_bh(&ab->base_lock); - - for (i = 0; i < ab->num_radios; i++) { - ar = ab->pdevs[i].ar; - if (!ar) - continue; - - /* notify cfg80211 radio state change */ - ath11k_mac_rfkill_enable_radio(ar, rfkill_radio_on); - wiphy_rfkill_set_hw_state(ar->hw->wiphy, !rfkill_radio_on); - } -} - static void ath11k_update_11d(struct work_struct *work) { struct ath11k_base *ab = container_of(work, struct ath11k_base, update_11d_work); @@ -1877,7 +1805,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size, init_waitqueue_head(&ab->qmi.cold_boot_waitq); INIT_WORK(&ab->restart_work, ath11k_core_restart); INIT_WORK(&ab->update_11d_work, ath11k_update_11d); - INIT_WORK(&ab->rfkill_work, ath11k_rfkill_work); INIT_WORK(&ab->reset_work, ath11k_core_reset); timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0); init_completion(&ab->htc_suspend); diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 2bd5eb9df4d4..afad8f55e433 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -929,10 +929,6 @@ struct ath11k_base { struct ath11k_dbring_cap *db_caps; u32 num_db_cap; - struct work_struct rfkill_work; - - /* true means radio is on */ - bool rfkill_radio_on; /* To synchronize 11d scan vdev id */ struct mutex vdev_id_11d_lock; diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h index 84c284fab5db..bb5ac940e470 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -153,9 +153,6 @@ struct ath11k_hw_params { u32 svc_to_ce_map_len; bool single_pdev_only; - u32 rfkill_pin; - u32 rfkill_cfg; - u32 rfkill_on_level; bool rxdma1_enable; int num_rxmda_per_pdev; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index d83d3c944594..7e91e347c9ff 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -5611,63 +5611,6 @@ static int ath11k_mac_mgmt_tx(struct ath11k *ar, struct sk_buff *skb, return 0; } -int ath11k_mac_rfkill_config(struct ath11k *ar) -{ - struct ath11k_base *ab = ar->ab; - u32 param; - int ret; - - if (ab->hw_params.rfkill_pin == 0) - return -EOPNOTSUPP; - - ath11k_dbg(ab, ATH11K_DBG_MAC, - "mac rfkill_pin %d rfkill_cfg %d rfkill_on_level %d", - ab->hw_params.rfkill_pin, ab->hw_params.rfkill_cfg, - ab->hw_params.rfkill_on_level); - - param = FIELD_PREP(WMI_RFKILL_CFG_RADIO_LEVEL, - ab->hw_params.rfkill_on_level) | - FIELD_PREP(WMI_RFKILL_CFG_GPIO_PIN_NUM, - ab->hw_params.rfkill_pin) | - FIELD_PREP(WMI_RFKILL_CFG_PIN_AS_GPIO, - ab->hw_params.rfkill_cfg); - - ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_HW_RFKILL_CONFIG, - param, ar->pdev->pdev_id); - if (ret) { - ath11k_warn(ab, - "failed to set rfkill config 0x%x: %d\n", - param, ret); - return ret; - } - - return 0; -} - -int ath11k_mac_rfkill_enable_radio(struct ath11k *ar, bool enable) -{ - enum wmi_rfkill_enable_radio param; - int ret; - - if (enable) - param = WMI_RFKILL_ENABLE_RADIO_ON; - else - param = WMI_RFKILL_ENABLE_RADIO_OFF; - - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac %d rfkill enable %d", - ar->pdev_idx, param); - - ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_RFKILL_ENABLE, - param, ar->pdev->pdev_id); - if (ret) { - ath11k_warn(ar->ab, "failed to set rfkill enable param %d: %d\n", - param, ret); - return ret; - } - - return 0; -} - static void ath11k_mac_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb) @@ -5922,7 +5865,6 @@ static void ath11k_mac_op_stop(struct ieee80211_hw *hw) cancel_delayed_work_sync(&ar->scan.timeout); cancel_work_sync(&ar->regd_update_work); cancel_work_sync(&ar->ab->update_11d_work); - cancel_work_sync(&ar->ab->rfkill_work); if (ar->state_11d == ATH11K_11D_PREPARING) { ar->state_11d = ATH11K_11D_IDLE; diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/ath/ath11k/mac.h index 57ebfc592b00..2a0d3afb0c99 100644 --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h @@ -148,8 +148,6 @@ u8 ath11k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband, void __ath11k_mac_scan_finish(struct ath11k *ar); void ath11k_mac_scan_finish(struct ath11k *ar); -int ath11k_mac_rfkill_enable_radio(struct ath11k *ar, bool enable); -int ath11k_mac_rfkill_config(struct ath11k *ar); struct ath11k_vif *ath11k_mac_get_arvif(struct ath11k *ar, u32 vdev_id); struct ath11k_vif *ath11k_mac_get_arvif_by_vdev_id(struct ath11k_base *ab, diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 5d9437ea92cf..88ee4f9d19da 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -129,8 +129,6 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = { = { .min_len = sizeof(struct wmi_peer_assoc_conf_event) }, [WMI_TAG_STATS_EVENT] = { .min_len = sizeof(struct wmi_stats_event) }, - [WMI_TAG_RFKILL_EVENT] = { - .min_len = sizeof(struct wmi_rfkill_state_change_ev) }, [WMI_TAG_PDEV_CTL_FAILSAFE_CHECK_EVENT] = { .min_len = sizeof(struct wmi_pdev_ctl_failsafe_chk_event) }, [WMI_TAG_HOST_SWFDA_EVENT] = { @@ -533,8 +531,6 @@ static int ath11k_pull_service_ready_tlv(struct ath11k_base *ab, cap->default_dbs_hw_mode_index = ev->default_dbs_hw_mode_index; cap->num_msdu_desc = ev->num_msdu_desc; - ath11k_dbg(ab, ATH11K_DBG_WMI, "wmi sys cap info 0x%x\n", cap->sys_cap_info); - return 0; } @@ -7566,40 +7562,6 @@ exit: kfree(tb); } -static void ath11k_rfkill_state_change_event(struct ath11k_base *ab, - struct sk_buff *skb) -{ - const struct wmi_rfkill_state_change_ev *ev; - const void **tb; - int ret; - - tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); - if (IS_ERR(tb)) { - ret = PTR_ERR(tb); - ath11k_warn(ab, "failed to parse tlv: %d\n", ret); - return; - } - - ev = tb[WMI_TAG_RFKILL_EVENT]; - if (!ev) { - kfree(tb); - return; - } - - ath11k_dbg(ab, ATH11K_DBG_MAC, - "wmi tlv rfkill state change gpio %d type %d radio_state %d\n", - ev->gpio_pin_num, - ev->int_type, - ev->radio_state); - - spin_lock_bh(&ab->base_lock); - ab->rfkill_radio_on = (ev->radio_state == WMI_RFKILL_RADIO_STATE_ON); - spin_unlock_bh(&ab->base_lock); - - queue_work(ab->workqueue, &ab->rfkill_work); - kfree(tb); -} - static void ath11k_wmi_pdev_temperature_event(struct ath11k_base *ab, struct sk_buff *skb) @@ -7995,9 +7957,6 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) case WMI_11D_NEW_COUNTRY_EVENTID: ath11k_reg_11d_new_cc_event(ab, skb); break; - case WMI_RFKILL_STATE_CHANGE_EVENTID: - ath11k_rfkill_state_change_event(ab, skb); - break; case WMI_DIAG_EVENTID: ath11k_wmi_diag_event(ab, skb); break; diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index b1fad4707dc6..4da248ffa318 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -5328,31 +5328,6 @@ struct target_resource_config { u32 twt_ap_sta_count; }; -enum wmi_sys_cap_info_flags { - WMI_SYS_CAP_INFO_RXTX_LED = BIT(0), - WMI_SYS_CAP_INFO_RFKILL = BIT(1), -}; - -#define WMI_RFKILL_CFG_GPIO_PIN_NUM GENMASK(5, 0) -#define WMI_RFKILL_CFG_RADIO_LEVEL BIT(6) -#define WMI_RFKILL_CFG_PIN_AS_GPIO GENMASK(10, 7) - -enum wmi_rfkill_enable_radio { - WMI_RFKILL_ENABLE_RADIO_ON = 0, - WMI_RFKILL_ENABLE_RADIO_OFF = 1, -}; - -enum wmi_rfkill_radio_state { - WMI_RFKILL_RADIO_STATE_OFF = 1, - WMI_RFKILL_RADIO_STATE_ON = 2, -}; - -struct wmi_rfkill_state_change_ev { - u32 gpio_pin_num; - u32 int_type; - u32 radio_state; -} __packed; - enum wmi_debug_log_param { WMI_DEBUG_LOG_PARAM_LOG_LEVEL = 0x1, WMI_DEBUG_LOG_PARAM_VDEV_ENABLE, From d578e0af3a003736f6c440188b156483d451b329 Mon Sep 17 00:00:00 2001 From: Ammar Faizi Date: Mon, 25 Jul 2022 20:49:11 +0300 Subject: [PATCH 03/36] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user() but it forgets to change the value to be returned that came from simple_write_to_buffer() call. It results in the following warning: warning: variable 'rc' is uninitialized when used here [-Wuninitialized] return rc; ^~ Remove rc variable and just return the passed in length if the memdup_user() succeeds. Cc: Dan Carpenter Reported-by: kernel test robot Fixes: 7a4836560a6198d245d5732e26f94898b12eb760 ("wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()") Fixes: ff974e4083341383d3dd4079e52ed30f57f376f0 ("wil6210: debugfs interface to send raw WMI command") Signed-off-by: Ammar Faizi Reviewed-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220724202452.61846-1-ammar.faizi@intel.com --- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index fe84362718de..04d1aa0e2d35 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1010,7 +1010,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, void *cmd; int cmdlen = len - sizeof(struct wmi_cmd_hdr); u16 cmdid; - int rc, rc1; + int rc1; if (cmdlen < 0 || *ppos != 0) return -EINVAL; @@ -1027,7 +1027,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1); - return rc; + return len; } static const struct file_operations fops_wmi = { From 7819b3d1dab585602905b7a213ad17ec6de6b005 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Mon, 11 Jul 2022 15:29:19 -0700 Subject: [PATCH 04/36] wifi: iwlwifi: mvm: fix clang -Wformat warnings When building with Clang we encounter these warnings: | drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1108:47: error: | format specifies type 'unsigned char' but the argument has type 's16' | (aka 'short') [-Werror,-Wformat] IWL_DEBUG_INFO(mvm, "\tburst index: | %hhu\n", res->ftm.burst_index); - | drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1111:47: error: | format specifies type 'unsigned char' but the argument has type 's32' | (aka 'int') [-Werror,-Wformat] IWL_DEBUG_INFO(mvm, "\trssi spread: | %hhu\n", res->ftm.rssi_spread); The previous format specifier `%hhu` describes a u8 but our arguments are wider than this which means bits are potentially being lost. Variadic functions (printf-like) undergo default argument promotion. Documentation/core-api/printk-formats.rst specifically recommends using the promoted-to-type's format flag. As per C11 6.3.1.1: (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) `If an int can represent all values of the original type ..., the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions.` Thus it makes sense to change `%hhu` to `%d` for both instances of the warning. Link: https://github.com/ClangBuiltLinux/linux/issues/378 Signed-off-by: Justin Stitt Reviewed-by: Nick Desaulniers Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220711222919.2043613-1-justinstitt@google.com --- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index 777c568f35a5..8c5b97fb1941 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -1105,10 +1105,10 @@ static void iwl_mvm_debug_range_resp(struct iwl_mvm *mvm, u8 index, IWL_DEBUG_INFO(mvm, "\tstatus: %d\n", res->status); IWL_DEBUG_INFO(mvm, "\tBSSID: %pM\n", res->addr); IWL_DEBUG_INFO(mvm, "\thost time: %llu\n", res->host_time); - IWL_DEBUG_INFO(mvm, "\tburst index: %hhu\n", res->ftm.burst_index); + IWL_DEBUG_INFO(mvm, "\tburst index: %d\n", res->ftm.burst_index); IWL_DEBUG_INFO(mvm, "\tsuccess num: %u\n", res->ftm.num_ftmr_successes); IWL_DEBUG_INFO(mvm, "\trssi: %d\n", res->ftm.rssi_avg); - IWL_DEBUG_INFO(mvm, "\trssi spread: %hhu\n", res->ftm.rssi_spread); + IWL_DEBUG_INFO(mvm, "\trssi spread: %d\n", res->ftm.rssi_spread); IWL_DEBUG_INFO(mvm, "\trtt: %lld\n", res->ftm.rtt_avg); IWL_DEBUG_INFO(mvm, "\trtt var: %llu\n", res->ftm.rtt_variance); IWL_DEBUG_INFO(mvm, "\trtt spread: %llu\n", res->ftm.rtt_spread); From 14a3aacf517a9de725dd3219dbbcf741e31763c4 Mon Sep 17 00:00:00 2001 From: Jose Ignacio Tornos Martinez Date: Tue, 19 Jul 2022 17:35:42 +0200 Subject: [PATCH 05/36] wifi: iwlwifi: mvm: fix double list_add at iwl_mvm_mac_wake_tx_queue After successfull station association, if station queues are disabled for some reason, the related lists are not emptied. So if some new element is added to the list in iwl_mvm_mac_wake_tx_queue, it can match with the old one and produce a BUG like this: [ 46.535263] list_add corruption. prev->next should be next (ffff94c1c318a360), but was 0000000000000000. (prev=ffff94c1d02d3388). [ 46.535283] ------------[ cut here ]------------ [ 46.535284] kernel BUG at lib/list_debug.c:26! [ 46.535290] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 46.585304] CPU: 0 PID: 623 Comm: wpa_supplicant Not tainted 5.19.0-rc3+ #1 [ 46.592380] Hardware name: Dell Inc. Inspiron 660s/0478VN , BIOS A07 08/24/2012 [ 46.600336] RIP: 0010:__list_add_valid.cold+0x3d/0x3f [ 46.605475] Code: f2 4c 89 c1 48 89 fe 48 c7 c7 c8 40 67 93 e8 20 cc fd ff 0f 0b 48 89 d1 4c 89 c6 4c 89 ca 48 c7 c7 70 40 67 93 e8 09 cc fd ff <0f> 0b 48 89 fe 48 c7 c7 00 41 67 93 e8 f8 cb fd ff 0f 0b 48 89 d1 [ 46.624469] RSP: 0018:ffffb20800ab76d8 EFLAGS: 00010286 [ 46.629854] RAX: 0000000000000075 RBX: ffff94c1c318a0e0 RCX: 0000000000000000 [ 46.637105] RDX: 0000000000000201 RSI: ffffffff9365e100 RDI: 00000000ffffffff [ 46.644356] RBP: ffff94c1c5f43370 R08: 0000000000000075 R09: 3064316334396666 [ 46.651607] R10: 3364323064316334 R11: 39666666663d7665 R12: ffff94c1c5f43388 [ 46.658857] R13: ffff94c1d02d3388 R14: ffff94c1c318a360 R15: ffff94c1cf2289c0 [ 46.666108] FS: 00007f65634ff7c0(0000) GS:ffff94c1da200000(0000) knlGS:0000000000000000 [ 46.674331] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 46.680170] CR2: 00007f7dfe984460 CR3: 000000010e894003 CR4: 00000000000606f0 [ 46.687422] Call Trace: [ 46.689906] [ 46.691950] iwl_mvm_mac_wake_tx_queue+0xec/0x15c [iwlmvm] [ 46.697601] ieee80211_queue_skb+0x4b3/0x720 [mac80211] [ 46.702973] ? sta_info_get+0x46/0x60 [mac80211] [ 46.707703] ieee80211_tx+0xad/0x110 [mac80211] [ 46.712355] __ieee80211_tx_skb_tid_band+0x71/0x90 [mac80211] ... In order to avoid this problem, we must also remove the related lists when station queues are disabled. Fixes: cfbc6c4c5b91c ("iwlwifi: mvm: support mac80211 TXQs model") Reported-by: Takayuki Nagata Reported-by: Petr Stourac Tested-by: Petr Stourac Signed-off-by: Jose Ignacio Tornos Martinez Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220719153542.81466-1-jtornosm@redhat.com --- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index b296f4965895..ff0d3b3df140 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -1861,6 +1861,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm, iwl_mvm_txq_from_mac80211(sta->txq[i]); mvmtxq->txq_id = IWL_MVM_INVALID_QUEUE; + list_del_init(&mvmtxq->list); } } From c2ce2145f7f3c1e92b9adceb729756a8be7ca145 Mon Sep 17 00:00:00 2001 From: Li Qiong Date: Mon, 6 Jun 2022 21:54:49 +0800 Subject: [PATCH 06/36] wifi: mwl8k: use time_after to replace "jiffies > a" time_after deals with timer wrapping correctly. Signed-off-by: Li Qiong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220606135449.23256-1-liqiong@nfschina.com Link: https://lore.kernel.org/r/20220618131305.13101-1-wangxiang@cdjrlc.com Link: https://lore.kernel.org/r/20220715050016.24164-1-wangborong@cdjrlc.com --- drivers/net/wireless/marvell/mwl8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c index c1bf8998109c..4dc7e2e53b81 100644 --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c @@ -1880,7 +1880,7 @@ static inline void mwl8k_tx_count_packet(struct ieee80211_sta *sta, u8 tid) * packets ever exceeds the ampdu_min_traffic threshold, we will allow * an ampdu stream to be started. */ - if (jiffies - tx_stats->start_time > HZ) { + if (time_after(jiffies, (unsigned long)tx_stats->start_time + HZ)) { tx_stats->pkts = 0; tx_stats->start_time = 0; } else From 08df8fbeb24114eaa9aa0f55b3555f7b2b9cefff Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Fri, 15 Jul 2022 13:00:53 +0800 Subject: [PATCH 07/36] wifi: mwifiex: Fix comment typo The double `the' is duplicated in line 1540, remove one. Signed-off-by: Jason Wang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220715050053.24382-1-wangborong@cdjrlc.com Link: https://lore.kernel.org/r/20220722083031.74847-1-slark_xiao@163.com Link: https://lore.kernel.org/r/20220722084158.75647-1-slark_xiao@163.com Link: https://lore.kernel.org/r/20220722084833.76159-1-slark_xiao@163.com --- drivers/net/wireless/marvell/mwifiex/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 76004bda0c02..9b91580c4f92 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -1549,7 +1549,7 @@ done: /* * This function decode sdio aggreation pkt. * - * Based on the the data block size and pkt_len, + * Based on the data block size and pkt_len, * skb data will be decoded to few packets. */ static void mwifiex_deaggr_sdio_pkt(struct mwifiex_adapter *adapter, From 8a7a5c0251e19ae7a288c94ab8de8d6302b98927 Mon Sep 17 00:00:00 2001 From: Zhang Jiaming Date: Wed, 22 Jun 2022 16:25:24 +0800 Subject: [PATCH 08/36] wifi: rtlwifi: Remove duplicate word and Fix typo Remove duplicate 'in'. Change 'entrys' to 'entries'. Signed-off-by: Zhang Jiaming Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220622082524.21304-1-jiaming@nfschina.com --- drivers/net/wireless/realtek/rtlwifi/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 837febe4dfa4..ca01270944fe 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -1703,7 +1703,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, rtlpriv->sec.key_len[key_idx] = 0; eth_zero_addr(mac_addr); /* - *mac80211 will delete entrys one by one, + *mac80211 will delete entries one by one, *so don't use rtl_cam_reset_all_entry *or clear all entry here. */ From 06ce07860b3237296da299dede242b114d184849 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Wed, 15 Jun 2022 08:53:16 +0800 Subject: [PATCH 09/36] wifi: mwifiex: clean up one inconsistent indenting Eliminate the follow smatch warning: drivers/net/wireless/marvell/mwifiex/pcie.c:3364 mwifiex_unregister_dev() warn: inconsistent indenting Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220615005316.9596-1-yang.lee@linux.alibaba.com --- drivers/net/wireless/marvell/mwifiex/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index d5fb29400bad..43bdcbc9ef39 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -3373,7 +3373,7 @@ static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) } else { mwifiex_dbg(adapter, INFO, "%s(): calling free_irq()\n", __func__); - free_irq(card->dev->irq, &card->share_irq_ctx); + free_irq(card->dev->irq, &card->share_irq_ctx); if (card->msi_enable) pci_disable_msi(pdev); From 6fd57e1d120bf13d4dc6c200a7cf914e6347a316 Mon Sep 17 00:00:00 2001 From: Hangyu Hua Date: Mon, 20 Jun 2022 17:23:50 +0800 Subject: [PATCH 10/36] wifi: libertas: Fix possible refcount leak in if_usb_probe() usb_get_dev will be called before lbs_get_firmware_async which means that usb_put_dev need to be called when lbs_get_firmware_async fails. Fixes: ce84bb69f50e ("libertas USB: convert to asynchronous firmware loading") Signed-off-by: Hangyu Hua Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220620092350.39960-1-hbh25y@gmail.com Link: https://lore.kernel.org/r/20220622113402.16969-1-colin.i.king@gmail.com --- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c index 5d6dc1dd050d..32fdc4150b60 100644 --- a/drivers/net/wireless/marvell/libertas/if_usb.c +++ b/drivers/net/wireless/marvell/libertas/if_usb.c @@ -287,6 +287,7 @@ static int if_usb_probe(struct usb_interface *intf, return 0; err_get_fw: + usb_put_dev(udev); lbs_remove_card(priv); err_add_card: if_usb_reset_device(cardp); From 69ddcea564437ce4b0d5143f37a9154fcef8d3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 16 Jul 2022 00:46:19 +0200 Subject: [PATCH 11/36] wifi: wl12xx: Drop if with an always false condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The remove callback is only called after probe completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument (in wlcore_probe()) and so wl is never NULL. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220715224619.ht7bbzzrmysielm7@pengutronix.de --- drivers/net/wireless/ti/wl12xx/main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index c6da0cfb4afb..d06a2c419447 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c @@ -1924,13 +1924,10 @@ static int wl12xx_remove(struct platform_device *pdev) struct wl1271 *wl = platform_get_drvdata(pdev); struct wl12xx_priv *priv; - if (!wl) - goto out; priv = wl->priv; kfree(priv->rx_mem_addr); -out: return wlcore_remove(pdev); } From 13876f2a087ad352bf640a7a0a4a4229ea6e9e4f Mon Sep 17 00:00:00 2001 From: Zheyu Ma Date: Sat, 16 Jul 2022 21:04:44 +0800 Subject: [PATCH 12/36] wifi: rtl8xxxu: Fix the error handling of the probe function When the driver fails at ieee80211_alloc_hw() at the probe time, the driver will free the 'hw' which is not allocated, causing a bug. The following log can reveal it: [ 15.981294] BUG: KASAN: user-memory-access in mutex_is_locked+0xe/0x40 [ 15.981558] Read of size 8 at addr 0000000000001ab0 by task modprobe/373 [ 15.982583] Call Trace: [ 15.984282] ieee80211_free_hw+0x22/0x390 [ 15.984446] rtl8xxxu_probe+0x3a1/0xab30 [rtl8xxxu] Fix the bug by changing the order of the error handling. Signed-off-by: Zheyu Ma Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220716130444.2950690-1-zheyuma97@gmail.com --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 33a1d9143038..c66f0726b253 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -6658,7 +6658,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface, if (!hw) { ret = -ENOMEM; priv = NULL; - goto exit; + goto err_put_dev; } priv = hw->priv; @@ -6680,24 +6680,24 @@ static int rtl8xxxu_probe(struct usb_interface *interface, ret = rtl8xxxu_parse_usb(priv, interface); if (ret) - goto exit; + goto err_set_intfdata; ret = rtl8xxxu_identify_chip(priv); if (ret) { dev_err(&udev->dev, "Fatal - failed to identify chip\n"); - goto exit; + goto err_set_intfdata; } ret = rtl8xxxu_read_efuse(priv); if (ret) { dev_err(&udev->dev, "Fatal - failed to read EFuse\n"); - goto exit; + goto err_set_intfdata; } ret = priv->fops->parse_efuse(priv); if (ret) { dev_err(&udev->dev, "Fatal - failed to parse EFuse\n"); - goto exit; + goto err_set_intfdata; } rtl8xxxu_print_chipinfo(priv); @@ -6705,12 +6705,12 @@ static int rtl8xxxu_probe(struct usb_interface *interface, ret = priv->fops->load_firmware(priv); if (ret) { dev_err(&udev->dev, "Fatal - failed to load firmware\n"); - goto exit; + goto err_set_intfdata; } ret = rtl8xxxu_init_device(hw); if (ret) - goto exit; + goto err_set_intfdata; hw->wiphy->max_scan_ssids = 1; hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; @@ -6760,12 +6760,12 @@ static int rtl8xxxu_probe(struct usb_interface *interface, if (ret) { dev_err(&udev->dev, "%s: Failed to register: %i\n", __func__, ret); - goto exit; + goto err_set_intfdata; } return 0; -exit: +err_set_intfdata: usb_set_intfdata(interface, NULL); if (priv) { @@ -6773,9 +6773,10 @@ exit: mutex_destroy(&priv->usb_buf_mutex); mutex_destroy(&priv->h2c_mutex); } - usb_put_dev(udev); ieee80211_free_hw(hw); +err_put_dev: + usb_put_dev(udev); return ret; } From 7d13c0ae38a62835ead261527727a9f9bf949d43 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Tue, 19 Jul 2022 15:56:37 +0800 Subject: [PATCH 13/36] wifi: b43legacy: clean up one inconsistent indenting Eliminate the follow smatch warning: drivers/net/wireless/broadcom/b43legacy/main.c:2947 b43legacy_wireless_core_stop() warn: inconsistent indenting Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220719075637.111716-1-yang.lee@linux.alibaba.com --- drivers/net/wireless/broadcom/b43legacy/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c index cbc21c7c3138..4022c544aefe 100644 --- a/drivers/net/wireless/broadcom/b43legacy/main.c +++ b/drivers/net/wireless/broadcom/b43legacy/main.c @@ -2944,7 +2944,7 @@ static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev) dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num])); } -b43legacy_mac_suspend(dev); + b43legacy_mac_suspend(dev); free_irq(dev->dev->irq, dev); b43legacydbg(wl, "Wireless interface stopped\n"); } From dbf8cd368a4786d7a6a3a4c842d083a4924658f5 Mon Sep 17 00:00:00 2001 From: Xin Gao Date: Thu, 21 Jul 2022 03:42:45 +0800 Subject: [PATCH 14/36] wifi: b43: do not initialise static variable to 0 No need to initialise static variables to zero. Signed-off-by: Xin Gao Acked-by: Larry Finger [kvalo@kernel.org: improve commit log] Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720194245.8442-1-gaoxin@cdjrlc.com --- drivers/net/wireless/broadcom/b43/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c index 008ee1f98af4..b2539a916fd0 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -105,7 +105,7 @@ int b43_modparam_verbose = B43_VERBOSITY_DEFAULT; module_param_named(verbose, b43_modparam_verbose, int, 0644); MODULE_PARM_DESC(verbose, "Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug"); -static int b43_modparam_pio = 0; +static int b43_modparam_pio; module_param_named(pio, b43_modparam_pio, int, 0644); MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO"); From 2f6e44ee6e969ea22d330c2810d7c891e63e6a08 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:03 +0000 Subject: [PATCH 15/36] wifi: wilc1000: add WID_TX_POWER WID in g_cfg_byte array WID_TX_POWER WID value is fetched from the firmware so it should be added in'g_cfg_byte' array to store the data which is received from firmware. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-2-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/wlan_cfg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c index dba301378b7f..60eaf62fd164 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c @@ -22,6 +22,7 @@ static const struct wilc_cfg_byte g_cfg_byte[] = { {WID_STATUS, 0}, {WID_RSSI, 0}, {WID_LINKSPEED, 0}, + {WID_TX_POWER, 0}, {WID_WOWLAN_TRIGGER, 0}, {WID_NIL, 0} }; From f589b5d941c712d982868fd548a000e07fc5cf59 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:03 +0000 Subject: [PATCH 16/36] wifi: wilc1000: set correct value of 'close' variable in failure case Set 'close' variable to '1' to indicate closing operation when initialisation fails during wlan_initialize_threads() call. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-3-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index fcc4e61592ee..7879446f282f 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -472,7 +472,7 @@ static int wlan_initialize_threads(struct net_device *dev) "%s-tx", dev->name); if (IS_ERR(wilc->txq_thread)) { netdev_err(dev, "couldn't create TXQ thread\n"); - wilc->close = 0; + wilc->close = 1; return PTR_ERR(wilc->txq_thread); } wait_for_completion(&wilc->txq_thread_started); From 33d4a577c7b184bac755deb68fe6e84ae009d70f Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:04 +0000 Subject: [PATCH 17/36] wifi: wilc1000: set station_info flag only when signal value is valid Set station_info->filled to indicate signal level only when its value is received successfully using wilc_get_rssi(). Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-4-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index 5c2c7f1dbffd..3ac373d29d93 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -1312,12 +1312,11 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, if (idx != 0) return -ENOENT; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); - ret = wilc_get_rssi(vif, &sinfo->signal); if (ret) return ret; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); memcpy(mac, vif->priv.associated_bss, ETH_ALEN); return 0; } From 12fb1ae537a416b77ac9cbaefa6dd9dacaa27ed0 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:04 +0000 Subject: [PATCH 18/36] wifi: wilc1000: get correct length of string WID from received config packet For string type WID packet, the data length is received as 16-bit value so use 'get_unaligned_le16' conversion API to extract the correct length. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-5-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/wlan_cfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c index 60eaf62fd164..131388886acb 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c @@ -181,9 +181,10 @@ static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size) i++; if (cfg->s[i].id == wid) - memcpy(cfg->s[i].str, &info[2], info[2] + 2); + memcpy(cfg->s[i].str, &info[2], + get_unaligned_le16(&info[2]) + 2); - len = 2 + info[2]; + len = 2 + get_unaligned_le16(&info[2]); break; default: From ad3e683ae4dc311baea7a8724315b6d8d9a7aaa9 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:05 +0000 Subject: [PATCH 19/36] wifi: wilc1000: cancel the connect operation during interface down Cancel the ongoing connection request to avoid any issue if the interface is set down before the connection request is completed. host_int_handle_disconnect was already available, so renamed it and used the same API for 'ndio_close' cb. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-6-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/hif.c | 6 ++---- drivers/net/wireless/microchip/wilc1000/hif.h | 1 + drivers/net/wireless/microchip/wilc1000/netdev.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c index 021e0db80bd2..b89519ab9205 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.c +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -635,7 +635,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, conn_info->req_ies_len = 0; } -static inline void host_int_handle_disconnect(struct wilc_vif *vif) +inline void wilc_handle_disconnect(struct wilc_vif *vif) { struct host_if_drv *hif_drv = vif->hif_drv; @@ -647,8 +647,6 @@ static inline void host_int_handle_disconnect(struct wilc_vif *vif) if (hif_drv->conn_info.conn_result) hif_drv->conn_info.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, 0, hif_drv->conn_info.arg); - else - netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__); eth_zero_addr(hif_drv->assoc_bssid); @@ -684,7 +682,7 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work) host_int_parse_assoc_resp_info(vif, mac_info->status); } else if (mac_info->status == WILC_MAC_STATUS_DISCONNECTED) { if (hif_drv->hif_state == HOST_IF_CONNECTED) { - host_int_handle_disconnect(vif); + wilc_handle_disconnect(vif); } else if (hif_drv->usr_scan_req.scan_result) { del_timer(&hif_drv->scan_timer); handle_scan_done(vif, SCAN_EVENT_ABORTED); diff --git a/drivers/net/wireless/microchip/wilc1000/hif.h b/drivers/net/wireless/microchip/wilc1000/hif.h index d8dd94dcfe14..69ba1d469e9f 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.h +++ b/drivers/net/wireless/microchip/wilc1000/hif.h @@ -215,4 +215,5 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length); void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, struct cfg80211_crypto_settings *crypto); int wilc_set_default_mgmt_key_index(struct wilc_vif *vif, u8 index); +inline void wilc_handle_disconnect(struct wilc_vif *vif); #endif diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 7879446f282f..2de5838a4426 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -780,6 +780,7 @@ static int wilc_mac_close(struct net_device *ndev) if (vif->ndev) { netif_stop_queue(vif->ndev); + wilc_handle_disconnect(vif); wilc_deinit_host_int(vif->ndev); } From 39d0f1b0bf914885880d73f89e1eb1508d5eaa16 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:05 +0000 Subject: [PATCH 20/36] wifi: wilc1000: add 'isinit' flag for SDIO bus similar to SPI Similar to SPI priv data, add 'isinit' variable in SDIO priv. Make use of the state to invoke hif_init() once, and acquire the lock before accessing hif function. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-7-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/sdio.c | 13 +++++++++++++ drivers/net/wireless/microchip/wilc1000/spi.c | 8 ++++++++ drivers/net/wireless/microchip/wilc1000/wlan.c | 9 ++++++--- drivers/net/wireless/microchip/wilc1000/wlan.h | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c index 7962c11cfe84..600cc57e9da2 100644 --- a/drivers/net/wireless/microchip/wilc1000/sdio.c +++ b/drivers/net/wireless/microchip/wilc1000/sdio.c @@ -26,6 +26,7 @@ static const struct sdio_device_id wilc_sdio_ids[] = { struct wilc_sdio { bool irq_gpio; u32 block_size; + bool isinit; int has_thrpt_enh3; }; @@ -193,6 +194,13 @@ static int wilc_sdio_reset(struct wilc *wilc) return 0; } +static bool wilc_sdio_is_init(struct wilc *wilc) +{ + struct wilc_sdio *sdio_priv = wilc->bus_data; + + return sdio_priv->isinit; +} + static int wilc_sdio_suspend(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); @@ -581,6 +589,9 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) static int wilc_sdio_deinit(struct wilc *wilc) { + struct wilc_sdio *sdio_priv = wilc->bus_data; + + sdio_priv->isinit = false; return 0; } @@ -700,6 +711,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume) sdio_priv->has_thrpt_enh3); } + sdio_priv->isinit = true; return 0; } @@ -981,6 +993,7 @@ static const struct wilc_hif_func wilc_hif_sdio = { .enable_interrupt = wilc_sdio_enable_interrupt, .disable_interrupt = wilc_sdio_disable_interrupt, .hif_reset = wilc_sdio_reset, + .hif_is_init = wilc_sdio_is_init, }; static int wilc_sdio_resume(struct device *dev) diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c index 2ae8dd3411ac..b0fc5e68feec 100644 --- a/drivers/net/wireless/microchip/wilc1000/spi.c +++ b/drivers/net/wireless/microchip/wilc1000/spi.c @@ -1029,6 +1029,13 @@ static int wilc_spi_reset(struct wilc *wilc) return result; } +static bool wilc_spi_is_init(struct wilc *wilc) +{ + struct wilc_spi *spi_priv = wilc->bus_data; + + return spi_priv->isinit; +} + static int wilc_spi_deinit(struct wilc *wilc) { struct wilc_spi *spi_priv = wilc->bus_data; @@ -1250,4 +1257,5 @@ static const struct wilc_hif_func wilc_hif_spi = { .hif_block_rx_ext = wilc_spi_read, .hif_sync_ext = wilc_spi_sync_ext, .hif_reset = wilc_spi_reset, + .hif_is_init = wilc_spi_is_init, }; diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index f3f504d12873..947d9a0a494e 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -1481,9 +1481,12 @@ int wilc_wlan_init(struct net_device *dev) wilc->quit = 0; - if (wilc->hif_func->hif_init(wilc, false)) { - ret = -EIO; - goto fail; + if (!wilc->hif_func->hif_is_init(wilc)) { + acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY); + ret = wilc->hif_func->hif_init(wilc, false); + release_bus(wilc, WILC_BUS_RELEASE_ONLY); + if (ret) + goto fail; } if (!wilc->tx_buffer) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h index b45e72789a0e..a72cd5cac81d 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.h +++ b/drivers/net/wireless/microchip/wilc1000/wlan.h @@ -373,6 +373,7 @@ struct wilc_hif_func { int (*enable_interrupt)(struct wilc *nic); void (*disable_interrupt)(struct wilc *nic); int (*hif_reset)(struct wilc *wilc); + bool (*hif_is_init)(struct wilc *wilc); }; #define WILC_MAX_CFG_FRAME_SIZE 1468 From 4c2742146de06a39d24e91155e3deec278e11932 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Wed, 20 Jul 2022 16:03:06 +0000 Subject: [PATCH 21/36] wifi: wilc1000: use existing iftype variable to store the interface type For consistency, use an existing 'iftype' element which was already having the interface type. Replace 'mode' with 'iftype' as it was used for the same purpose. Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720160302.231516-8-ajay.kathat@microchip.com --- drivers/net/wireless/microchip/wilc1000/netdev.c | 6 +++--- drivers/net/wireless/microchip/wilc1000/netdev.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 2de5838a4426..9b319a455b96 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -97,12 +97,12 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) struct ieee80211_hdr *h = (struct ieee80211_hdr *)mac_header; list_for_each_entry_rcu(vif, &wilc->vif_list, list) { - if (vif->mode == WILC_STATION_MODE) + if (vif->iftype == WILC_STATION_MODE) if (ether_addr_equal_unaligned(h->addr2, vif->bssid)) { ndev = vif->ndev; goto out; } - if (vif->mode == WILC_AP_MODE) + if (vif->iftype == WILC_AP_MODE) if (ether_addr_equal_unaligned(h->addr1, vif->bssid)) { ndev = vif->ndev; goto out; @@ -122,7 +122,7 @@ void wilc_wlan_set_bssid(struct net_device *wilc_netdev, const u8 *bssid, else eth_zero_addr(vif->bssid); - vif->mode = mode; + vif->iftype = mode; } int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h index 822e65d00f53..43c085c74b7a 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.h +++ b/drivers/net/wireless/microchip/wilc1000/netdev.h @@ -177,7 +177,6 @@ struct wilc_vif { u8 bssid[ETH_ALEN]; struct host_if_drv *hif_drv; struct net_device *ndev; - u8 mode; struct timer_list during_ip_timer; struct timer_list periodic_rssi; struct rf_info periodic_stat; From 70c898d4bad1a21e0889ae12f355ff8c68ce5b9f Mon Sep 17 00:00:00 2001 From: Xu Qiang Date: Fri, 1 Jul 2022 08:29:35 +0000 Subject: [PATCH 22/36] wifi: plfxlc: Use eth_zero_addr() to assign zero address Using eth_zero_addr() to assign zero address instead of memset(). Reported-by: Hulk Robot Signed-off-by: Xu Qiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220701082935.110924-1-xuqiang36@huawei.com --- drivers/net/wireless/purelifi/plfxlc/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c index 8519cf0adfff..39e54b3787d6 100644 --- a/drivers/net/wireless/purelifi/plfxlc/usb.c +++ b/drivers/net/wireless/purelifi/plfxlc/usb.c @@ -562,7 +562,7 @@ static void sta_queue_cleanup_timer_callb(struct timer_list *t) if (tx->station[sidx].flag & STATION_HEARTBEAT_FLAG) { tx->station[sidx].flag ^= STATION_HEARTBEAT_FLAG; } else { - memset(tx->station[sidx].mac, 0, ETH_ALEN); + eth_zero_addr(tx->station[sidx].mac); tx->station[sidx].flag = 0; } } From bef11f1edc40cee156c60f9dbbbd9725a56b3639 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 16 Jun 2022 10:54:24 +0300 Subject: [PATCH 23/36] wifi: brcmfmac: use strreplace() in brcmf_of_probe() The for loop in brcmf_of_probe() would ideally end with something like "i <= strlen(board_type)" instead of "i < board_type[i]". But fortunately, the two are equivalent. Anyway, it's simpler to use strreplace() instead. Signed-off-by: Dan Carpenter Suggested-by: Johannes Berg Reviewed-by: Linus Walleij Acked-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YqrhsKcjEA7B2pC4@kili --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index 083ac58f466d..811bd55f0d62 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -72,7 +72,6 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, /* Set board-type to the first string of the machine compatible prop */ root = of_find_node_by_path("/"); if (root) { - int i; char *board_type; const char *tmp; @@ -84,10 +83,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, of_node_put(root); return; } - for (i = 0; i < board_type[i]; i++) { - if (board_type[i] == '/') - board_type[i] = '-'; - } + strreplace(board_type, '/', '-'); settings->board_type = board_type; of_node_put(root); From 02a186f1e96bfca8fd19862dad14ea011712ce9d Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 27 Jun 2022 20:37:01 +0100 Subject: [PATCH 24/36] wifi: brcmfmac: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Some other functions not directly called by the .suspend/.resume callbacks, but still related to PM were also taken outside #ifdef guards. The advantage is then that these functions are now always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220627193701.31074-1-paul@crapouillou.net --- .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 36 +++++++------------ .../broadcom/brcm80211/brcmfmac/sdio.c | 5 ++- .../broadcom/brcm80211/brcmfmac/sdio.h | 16 --------- 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 9c598ea97499..62d5c5f5fbc8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -784,9 +784,11 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) sdiodev->txglomsz = sdiodev->settings->bus.sdio.txglomsz; } -#ifdef CONFIG_PM_SLEEP static int brcmf_sdiod_freezer_attach(struct brcmf_sdio_dev *sdiodev) { + if (!IS_ENABLED(CONFIG_PM_SLEEP)) + return 0; + sdiodev->freezer = kzalloc(sizeof(*sdiodev->freezer), GFP_KERNEL); if (!sdiodev->freezer) return -ENOMEM; @@ -833,7 +835,8 @@ static void brcmf_sdiod_freezer_off(struct brcmf_sdio_dev *sdiodev) bool brcmf_sdiod_freezing(struct brcmf_sdio_dev *sdiodev) { - return atomic_read(&sdiodev->freezer->freezing); + return IS_ENABLED(CONFIG_PM_SLEEP) && + atomic_read(&sdiodev->freezer->freezing); } void brcmf_sdiod_try_freeze(struct brcmf_sdio_dev *sdiodev) @@ -847,23 +850,15 @@ void brcmf_sdiod_try_freeze(struct brcmf_sdio_dev *sdiodev) void brcmf_sdiod_freezer_count(struct brcmf_sdio_dev *sdiodev) { - atomic_inc(&sdiodev->freezer->thread_count); + if (IS_ENABLED(CONFIG_PM_SLEEP)) + atomic_inc(&sdiodev->freezer->thread_count); } void brcmf_sdiod_freezer_uncount(struct brcmf_sdio_dev *sdiodev) { - atomic_dec(&sdiodev->freezer->thread_count); + if (IS_ENABLED(CONFIG_PM_SLEEP)) + atomic_dec(&sdiodev->freezer->thread_count); } -#else -static int brcmf_sdiod_freezer_attach(struct brcmf_sdio_dev *sdiodev) -{ - return 0; -} - -static void brcmf_sdiod_freezer_detach(struct brcmf_sdio_dev *sdiodev) -{ -} -#endif /* CONFIG_PM_SLEEP */ int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev) { @@ -1136,7 +1131,6 @@ notsup: brcmf_dbg(SDIO, "WOWL not supported\n"); } -#ifdef CONFIG_PM_SLEEP static int brcmf_ops_sdio_suspend(struct device *dev) { struct sdio_func *func; @@ -1204,11 +1198,9 @@ static int brcmf_ops_sdio_resume(struct device *dev) return ret; } -static const struct dev_pm_ops brcmf_sdio_pm_ops = { - .suspend = brcmf_ops_sdio_suspend, - .resume = brcmf_ops_sdio_resume, -}; -#endif /* CONFIG_PM_SLEEP */ +static DEFINE_SIMPLE_DEV_PM_OPS(brcmf_sdio_pm_ops, + brcmf_ops_sdio_suspend, + brcmf_ops_sdio_resume); static struct sdio_driver brcmf_sdmmc_driver = { .probe = brcmf_ops_sdio_probe, @@ -1217,9 +1209,7 @@ static struct sdio_driver brcmf_sdmmc_driver = { .id_table = brcmf_sdmmc_ids, .drv = { .owner = THIS_MODULE, -#ifdef CONFIG_PM_SLEEP - .pm = &brcmf_sdio_pm_ops, -#endif /* CONFIG_PM_SLEEP */ + .pm = pm_sleep_ptr(&brcmf_sdio_pm_ops), .coredump = brcmf_dev_coredump, }, }; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 2136c3c434ae..762e887e8ea4 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4020,15 +4020,14 @@ brcmf_sdio_probe_attach(struct brcmf_sdio *bus) */ brcmf_sdiod_sgtable_alloc(sdiodev); -#ifdef CONFIG_PM_SLEEP /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ * is true or when platform data OOB irq is true). */ - if ((sdio_get_host_pm_caps(sdiodev->func1) & MMC_PM_KEEP_POWER) && + if (IS_ENABLED(CONFIG_PM_SLEEP) && + (sdio_get_host_pm_caps(sdiodev->func1) & MMC_PM_KEEP_POWER) && ((sdio_get_host_pm_caps(sdiodev->func1) & MMC_PM_WAKE_SDIO_IRQ) || (sdiodev->settings->bus.sdio.oob_irq_supported))) sdiodev->bus_if->wowl_supported = true; -#endif if (brcmf_sdio_kso_init(bus)) { brcmf_err("error enabling KSO\n"); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h index 15d2c02fa3ec..47351ff458ca 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h @@ -346,26 +346,10 @@ int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, struct sdio_func *func); void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev); void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev, enum brcmf_sdiod_state state); -#ifdef CONFIG_PM_SLEEP bool brcmf_sdiod_freezing(struct brcmf_sdio_dev *sdiodev); void brcmf_sdiod_try_freeze(struct brcmf_sdio_dev *sdiodev); void brcmf_sdiod_freezer_count(struct brcmf_sdio_dev *sdiodev); void brcmf_sdiod_freezer_uncount(struct brcmf_sdio_dev *sdiodev); -#else -static inline bool brcmf_sdiod_freezing(struct brcmf_sdio_dev *sdiodev) -{ - return false; -} -static inline void brcmf_sdiod_try_freeze(struct brcmf_sdio_dev *sdiodev) -{ -} -static inline void brcmf_sdiod_freezer_count(struct brcmf_sdio_dev *sdiodev) -{ -} -static inline void brcmf_sdiod_freezer_uncount(struct brcmf_sdio_dev *sdiodev) -{ -} -#endif /* CONFIG_PM_SLEEP */ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev); int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev); From cf1239e5b7bf3db82cb54dc754fca5b5d4a6b3eb Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 8 Jul 2022 15:37:11 +0200 Subject: [PATCH 25/36] wifi: brcmfmac: Add brcmf_c_set_cur_etheraddr() helper Add a little helper to send "cur_etheraddr" commands to the interface and to handle the error reporting of it in a single place. Signed-off-by: Hans de Goede Acked-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220708133712.102179-1-hdegoede@redhat.com --- .../broadcom/brcm80211/brcmfmac/common.c | 18 +++++++++++++----- .../broadcom/brcm80211/brcmfmac/common.h | 1 + .../broadcom/brcm80211/brcmfmac/core.c | 8 ++------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index fe01da9e620d..dccd8f4ca1d0 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -190,6 +190,17 @@ done: return err; } +int brcmf_c_set_cur_etheraddr(struct brcmf_if *ifp, const u8 *addr) +{ + s32 err; + + err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", addr, ETH_ALEN); + if (err < 0) + bphy_err(ifp->drvr, "Setting cur_etheraddr failed, %d\n", err); + + return err; +} + int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) { struct brcmf_pub *drvr = ifp->drvr; @@ -204,12 +215,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) if (is_valid_ether_addr(ifp->mac_addr)) { /* set mac address */ - err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, - ETH_ALEN); - if (err < 0) { - bphy_err(ifp->drvr, "Setting cur_etheraddr failed, %d\n", err); + err = brcmf_c_set_cur_etheraddr(ifp, ifp->mac_addr); + if (err < 0) goto done; - } } else { /* retrieve mac address */ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h index 15accc88d5c0..7329eb751945 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h @@ -65,6 +65,7 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param); /* Sets dongle media info (drv_version, mac address). */ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); +int brcmf_c_set_cur_etheraddr(struct brcmf_if *ifp, const u8 *addr); #ifdef CONFIG_DMI void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 87aef211b35f..bd164a0821f9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -233,16 +233,12 @@ static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr) { struct brcmf_if *ifp = netdev_priv(ndev); struct sockaddr *sa = (struct sockaddr *)addr; - struct brcmf_pub *drvr = ifp->drvr; int err; brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); - err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data, - ETH_ALEN); - if (err < 0) { - bphy_err(drvr, "Setting cur_etheraddr failed, %d\n", err); - } else { + err = brcmf_c_set_cur_etheraddr(ifp, sa->sa_data); + if (err >= 0) { brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data); memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN); eth_hw_addr_set(ifp->ndev, ifp->mac_addr); From 4af4c0b93c15ece3732dee5e5dbcf0a01904413a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 8 Jul 2022 15:37:12 +0200 Subject: [PATCH 26/36] wifi: brcmfmac: Replace default (not configured) MAC with a random MAC On some boards there is no eeprom to hold the nvram, in this case instead a board specific nvram is loaded from /lib/firmware. On most boards the macaddr=... setting in the /lib/firmware nvram file is ignored because the wifi/bt chip has a unique MAC programmed into the chip itself. But in some cases the actual MAC from the /lib/firmware nvram file gets used, leading to MAC conflicts. The MAC addresses in the troublesome nvram files seem to all come from the same nvram file template, so we can detect this by checking for the template nvram file MAC. Detect that the default MAC address is being used and replace it with a random MAC address to avoid MAC address conflicts. Note that udev will detect this is a random MAC based on /sys/class/net/wlan0/addr_assign_type and then replace this with a MAC based on hashing the netdev-name + the machine-id. So that the MAC address is both guaranteed to be unique per machine while it is still the same/persistent at each boot (assuming the default Link.MACAddressPolicy=persistent udev setting). Signed-off-by: Hans de Goede Reviewed-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220708133712.102179-2-hdegoede@redhat.com --- .../broadcom/brcm80211/brcmfmac/common.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index dccd8f4ca1d0..7485e784be2a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -201,6 +201,20 @@ int brcmf_c_set_cur_etheraddr(struct brcmf_if *ifp, const u8 *addr) return err; } +/* On some boards there is no eeprom to hold the nvram, in this case instead + * a board specific nvram is loaded from /lib/firmware. On most boards the + * macaddr setting in the /lib/firmware nvram file is ignored because the + * wifibt chip has a unique MAC programmed into the chip itself. + * But in some cases the actual MAC from the /lib/firmware nvram file gets + * used, leading to MAC conflicts. + * The MAC addresses in the troublesome nvram files seem to all come from + * the same nvram file template, so we only need to check for 1 known + * address to detect this. + */ +static const u8 brcmf_default_mac_address[ETH_ALEN] = { + 0x00, 0x90, 0x4c, 0xc5, 0x12, 0x38 +}; + int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) { struct brcmf_pub *drvr = ifp->drvr; @@ -226,6 +240,15 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); goto done; } + + if (ether_addr_equal_unaligned(ifp->mac_addr, brcmf_default_mac_address)) { + bphy_err(drvr, "Default MAC is used, replacing with random MAC to avoid conflicts\n"); + eth_random_addr(ifp->mac_addr); + ifp->ndev->addr_assign_type = NET_ADDR_RANDOM; + err = brcmf_c_set_cur_etheraddr(ifp, ifp->mac_addr); + if (err < 0) + goto done; + } } memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); From 8406993a891f39a0c7062bf071f7591bacb800bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= Date: Mon, 11 Jul 2022 14:30:03 +0200 Subject: [PATCH 27/36] dt-bindings: bcm4329-fmac: add optional brcm,ccode-map-trivial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bindings already offer a brcm,ccode-map property to describe the mapping between the kernel's ISO3166 alpha 2 country code string and the firmware's country code string and revision number. This is a board-specific property and determined by the CLM blob firmware provided by the hardware vendor. However, in some cases the firmware will also use ISO3166 country codes internally, and the revision will always be zero. This implies a trivial mapping: cc -> { cc, 0 }. For such cases, add an optional property brcm,ccode-map-trivial which obviates the need to describe every trivial country code mapping in the device tree with the existing brcm,ccode-map property. The new property is subordinate to the more explicit brcm,ccode-map property. Signed-off-by: Alvin Šipraga Reviewed-by: Ahmad Fatoum Acked-by: Rob Herring Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220711123005.3055300-2-alvin@pqrs.dk --- .../bindings/net/wireless/brcm,bcm4329-fmac.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml b/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml index c11f23b20c4c..53b4153d9bfc 100644 --- a/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml +++ b/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml @@ -75,6 +75,16 @@ properties: items: pattern: '^[A-Z][A-Z]-[A-Z][0-9A-Z]-[0-9]+$' + brcm,ccode-map-trivial: + description: | + Use a trivial mapping of ISO3166 country codes to brcmfmac firmware + country code and revision: cc -> { cc, 0 }. In other words, assume that + the CLM blob firmware uses ISO3166 country codes as well, and that all + revisions are zero. This property is mutually exclusive with + brcm,ccode-map. If both properties are specified, then brcm,ccode-map + takes precedence. + type: boolean + required: - compatible - reg From 5c54ab24377b999c7f1c30b41218e6490cd4ac80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= Date: Mon, 11 Jul 2022 14:30:04 +0200 Subject: [PATCH 28/36] wifi: brcmfmac: support brcm,ccode-map-trivial DT property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit a21bf90e927f ("brcmfmac: use ISO3166 country code and 0 rev as fallback on some devices") introduced a fallback mechanism whereby a trivial mapping from ISO3166 country codes to firmware country code and revision is used on some devices. This fallback operates on the device level, so it is enabled only for certain supported chipsets. In general though, the firmware country codes are determined by the CLM blob, which is board-specific and may vary despite the underlying chipset being the same. The aforementioned commit is actually a refinement of a previous commit that was reverted in commit 151a7c12c4fc ("Revert "brcmfmac: use ISO3166 country code and 0 rev as fallback"") due to regressions with a BCM4359 device. The refinement restricted the fallback mechanism to specific chipsets such as the BCM4345. We use a chipset - CYW88359 - that the driver identifies as a BCM4359 too. But in our case, the CLM blob uses ISO3166 country codes internally, and all with revision 0. So the trivial mapping is exactly what is needed in order for the driver to sync the kernel regulatory domain to the firmware. This is just a matter of how the CLM blob was prepared by the hardware vendor. The same could hold for other boards too. Although the brcm,ccode-map device tree property is useful for cases where the mapping is more complex, the trivial case invites a much simpler specification. This patch adds support for parsing the brcm,ccode-map-trivial device tree property. Subordinate to the more specific brcm,ccode-map property, this new proprety simply informs the driver that the fallback method should be used in every case. In the absence of the new property in the device tree, expect no functional change. Signed-off-by: Alvin Šipraga Reviewed-by: Ahmad Fatoum Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220711123005.3055300-3-alvin@pqrs.dk --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 3ae6779fe153..db45da33adfd 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -7481,6 +7481,9 @@ int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg, static bool brmcf_use_iso3166_ccode_fallback(struct brcmf_pub *drvr) { + if (drvr->settings->trivial_ccode_map) + return true; + switch (drvr->bus_if->chip) { case BRCM_CC_4345_CHIP_ID: case BRCM_CC_43602_CHIP_ID: diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h index 7329eb751945..6c5a22a32a96 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h @@ -38,6 +38,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global; * @fcmode: FWS flow control. * @roamoff: Firmware roaming off? * @ignore_probe_fail: Ignore probe failure. + * @trivial_ccode_map: Assume firmware uses ISO3166 country codes with rev 0 * @country_codes: If available, pointer to struct for translating country codes * @bus: Bus specific platform data. Only SDIO at the mmoment. */ @@ -48,6 +49,7 @@ struct brcmf_mp_device { bool roamoff; bool iapp; bool ignore_probe_fail; + bool trivial_ccode_map; struct brcmfmac_pd_cc *country_codes; const char *board_type; unsigned char mac[ETH_ALEN]; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index 811bd55f0d62..79388d49c256 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -24,6 +24,12 @@ static int brcmf_of_get_country_codes(struct device *dev, count = of_property_count_strings(np, "brcm,ccode-map"); if (count < 0) { + /* If no explicit country code map is specified, check whether + * the trivial map should be used. + */ + settings->trivial_ccode_map = + of_property_read_bool(np, "brcm,ccode-map-trivial"); + /* The property is optional, so return success if it doesn't * exist. Otherwise propagate the error code. */ From cb774bd35318c1b4cb61f6f2caac85537d07fbde Mon Sep 17 00:00:00 2001 From: Danny van Heumen Date: Mon, 11 Jul 2022 23:21:16 +0000 Subject: [PATCH 29/36] wifi: brcmfmac: prevent double-free on hardware-reset In case of buggy firmware, brcmfmac may perform a hardware reset. If during reset and subsequent probing an early failure occurs, a memory region is accidentally double-freed. With hardened memory allocation enabled, this error will be detected. - return early where appropriate to skip unnecessary clean-up. - set '.freezer' pointer to NULL to prevent double-freeing under possible other circumstances and to re-align result under various different behaviors of memory allocation freeing. - correctly claim host on func1 for disabling func2. - after reset, do not initiate probing immediately, but rely on events. Given a firmware crash, function 'brcmf_sdio_bus_reset' is called. It calls 'brcmf_sdiod_remove', then follows up with 'brcmf_sdiod_probe' to reinitialize the hardware. If 'brcmf_sdiod_probe' fails to "set F1 blocksize", it exits early, which includes calling 'brcmf_sdiod_remove'. In both cases 'brcmf_sdiod_freezer_detach' is called to free allocated '.freezer', which has not yet been re-allocated the second time. Stacktrace of (failing) hardware reset after firmware-crash: Code: b9402b82 8b0202c0 eb1a02df 54000041 (d4210000) ret_from_fork+0x10/0x20 kthread+0x154/0x160 worker_thread+0x188/0x504 process_one_work+0x1f4/0x490 brcmf_core_bus_reset+0x34/0x44 [brcmfmac] brcmf_sdio_bus_reset+0x68/0xc0 [brcmfmac] brcmf_sdiod_probe+0x170/0x21c [brcmfmac] brcmf_sdiod_remove+0x48/0xc0 [brcmfmac] kfree+0x210/0x220 __slab_free+0x58/0x40c Call trace: x2 : 0000000000000040 x1 : fffffc00002d2b80 x0 : ffff00000b4aee40 x5 : ffff8000013fa728 x4 : 0000000000000001 x3 : ffff00000b4aee00 x8 : ffff800009967ce0 x7 : ffff8000099bfce0 x6 : 00000006f8005d01 x11: ffff8000099bfce0 x10: 00000000fffff000 x9 : ffff8000083401d0 x14: 0000000000000000 x13: 657a69736b636f6c x12: 6220314620746573 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000030 x20: fffffc00002d2ba0 x19: fffffc00002d2b80 x18: 0000000000000000 x23: ffff00000b4aee00 x22: ffff00000b4aee00 x21: 0000000000000001 x26: ffff00000b4aee00 x25: ffff0000f7753705 x24: 000000000001288a x29: ffff80000a22bbf0 x28: ffff000000401200 x27: 000000008020001a sp : ffff80000a22bbf0 lr : kfree+0x210/0x220 pc : __slab_free+0x58/0x40c pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) Workqueue: events brcmf_core_bus_reset [brcmfmac] Hardware name: Pine64 Pinebook Pro (DT) CPU: 2 PID: 639 Comm: kworker/2:2 Tainted: G C 5.16.0-0.bpo.4-arm64 #1 Debian 5.16.12-1~bpo11+1 nvmem_rockchip_efuse industrialio_triggered_buffer videodev snd_soc_core snd_pcm_dmaengine kfifo_buf snd_pcm io_domain mc industrialio mt> Modules linked in: snd_seq_dummy snd_hrtimer snd_seq snd_seq_device nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reje> Internal error: Oops - BUG: 0 [#1] SMP kernel BUG at mm/slub.c:379! Signed-off-by: Danny van Heumen Reviewed-by: Arend van Spriel Reviewed-by: Ulf Hansson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/id1HN6qCMAirApBzTA6fT7ZFWBBGCJhULpflxQ7NT6cgCboVnn3RHpiOFjA9SbRqzBRFLk9ES0C4FNvO6fUQsNg7pqF6ZSNAYUo99nHy8PY=@dannyvanheumen.nl --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 13 +++++-------- .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 +--------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 62d5c5f5fbc8..d639bb8b51ae 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -804,6 +804,7 @@ static void brcmf_sdiod_freezer_detach(struct brcmf_sdio_dev *sdiodev) if (sdiodev->freezer) { WARN_ON(atomic_read(&sdiodev->freezer->freezing)); kfree(sdiodev->freezer); + sdiodev->freezer = NULL; } } @@ -870,13 +871,9 @@ int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev) brcmf_sdiod_freezer_detach(sdiodev); - /* Disable Function 2 */ - sdio_claim_host(sdiodev->func2); - sdio_disable_func(sdiodev->func2); - sdio_release_host(sdiodev->func2); - - /* Disable Function 1 */ + /* Disable functions 2 then 1. */ sdio_claim_host(sdiodev->func1); + sdio_disable_func(sdiodev->func2); sdio_disable_func(sdiodev->func1); sdio_release_host(sdiodev->func1); @@ -906,7 +903,7 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) if (ret) { brcmf_err("Failed to set F1 blocksize\n"); sdio_release_host(sdiodev->func1); - goto out; + return ret; } switch (sdiodev->func2->device) { case SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373: @@ -928,7 +925,7 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) if (ret) { brcmf_err("Failed to set F2 blocksize\n"); sdio_release_host(sdiodev->func1); - goto out; + return ret; } else { brcmf_dbg(SDIO, "set F2 blocksize to %d\n", f2_blksz); } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 762e887e8ea4..8968809399c7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4151,7 +4151,6 @@ int brcmf_sdio_get_fwname(struct device *dev, const char *ext, u8 *fw_name) static int brcmf_sdio_bus_reset(struct device *dev) { - int ret = 0; struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; @@ -4168,14 +4167,7 @@ static int brcmf_sdio_bus_reset(struct device *dev) sdio_release_host(sdiodev->func1); brcmf_bus_change_state(sdiodev->bus_if, BRCMF_BUS_DOWN); - - ret = brcmf_sdiod_probe(sdiodev); - if (ret) { - brcmf_err("Failed to probe after sdio device reset: ret %d\n", - ret); - } - - return ret; + return 0; } static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { From 5b7fc772e657824455507fc97f6b92287075a237 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Wed, 27 Jul 2022 17:16:52 +0100 Subject: [PATCH 30/36] wifi: wcn36xx: Rename clunky firmware feature bit enum The enum name "place_holder_in_cap_bitmap" is self descriptively asking to be changed to something else. Rename place_holder_in_cap_bitmap to wcn36xx_firmware_feat_caps so that the contents and intent of the enum is obvious. Reviewed-by: Loic Poulain Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220727161655.2286867-2-bryan.odonoghue@linaro.org --- drivers/net/wireless/ath/wcn36xx/hal.h | 2 +- drivers/net/wireless/ath/wcn36xx/main.c | 2 +- drivers/net/wireless/ath/wcn36xx/smd.c | 6 +++--- drivers/net/wireless/ath/wcn36xx/smd.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index a1afe1f85f0e..555226a440f8 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4760,7 +4760,7 @@ struct wcn36xx_hal_set_power_params_resp { /* Capability bitmap exchange definitions and macros starts */ -enum place_holder_in_cap_bitmap { +enum wcn36xx_firmware_feat_caps { MCC = 0, P2P = 1, DOT11AC = 2, diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index dc59cafd29e3..e7c3cef060b8 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -260,7 +260,7 @@ static const char * const wcn36xx_caps_names[] = { #undef DEFINE -static const char *wcn36xx_get_cap_name(enum place_holder_in_cap_bitmap x) +static const char *wcn36xx_get_cap_name(enum wcn36xx_firmware_feat_caps x) { if (x >= ARRAY_SIZE(wcn36xx_caps_names)) return "UNKNOWN"; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 46ab21824d63..c9e9dd011e71 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2431,7 +2431,7 @@ out: return ret; } -void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) +void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { int arr_idx, bit_idx; @@ -2445,7 +2445,7 @@ void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) bitmap[arr_idx] |= (1 << bit_idx); } -int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) +int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { int arr_idx, bit_idx; @@ -2460,7 +2460,7 @@ int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0; } -void clear_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) +void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { int arr_idx, bit_idx; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 3fd598ac2a27..186dad4fe80e 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -125,9 +125,9 @@ int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn); -void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); -int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); -void clear_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); +void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); +int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); +void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn, struct ieee80211_sta *sta, From 37de943d01539a0b36ab52cf73c1dfad140f697a Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Wed, 27 Jul 2022 17:16:53 +0100 Subject: [PATCH 31/36] wifi: wcn36xx: Move firmware feature bit storage to dedicated firmware.c file The naming of the get/set/clear firmware feature capability bits doesn't really follow the established namespace pattern of wcn36xx_logicalblock_do_something(); The feature bits are accessed by smd.c and main.c. It would be nice to display the found feature bits in debugfs. To do so though we should tidy up the namespace a bit. Move the firmware feature exchange API to its own file - firmware.c giving us the opportunity to functionally decompose other firmware related accessors as appropriate in future. Reviewed-by: Loic Poulain Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220727161655.2286867-3-bryan.odonoghue@linaro.org --- drivers/net/wireless/ath/wcn36xx/Makefile | 3 +- drivers/net/wireless/ath/wcn36xx/firmware.c | 50 +++++++++++++ drivers/net/wireless/ath/wcn36xx/firmware.h | 82 +++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/hal.h | 68 ----------------- drivers/net/wireless/ath/wcn36xx/main.c | 7 +- drivers/net/wireless/ath/wcn36xx/smd.c | 57 ++------------ drivers/net/wireless/ath/wcn36xx/smd.h | 3 - 7 files changed, 146 insertions(+), 124 deletions(-) create mode 100644 drivers/net/wireless/ath/wcn36xx/firmware.c create mode 100644 drivers/net/wireless/ath/wcn36xx/firmware.h diff --git a/drivers/net/wireless/ath/wcn36xx/Makefile b/drivers/net/wireless/ath/wcn36xx/Makefile index 27413703ad69..26bec795b372 100644 --- a/drivers/net/wireless/ath/wcn36xx/Makefile +++ b/drivers/net/wireless/ath/wcn36xx/Makefile @@ -5,6 +5,7 @@ wcn36xx-y += main.o \ txrx.o \ smd.o \ pmc.o \ - debug.o + debug.o \ + firmware.o wcn36xx-$(CONFIG_NL80211_TESTMODE) += testmode.o diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.c b/drivers/net/wireless/ath/wcn36xx/firmware.c new file mode 100644 index 000000000000..03b93d2bdcf9 --- /dev/null +++ b/drivers/net/wireless/ath/wcn36xx/firmware.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "wcn36xx.h" +#include "firmware.h" + +void wcn36xx_firmware_set_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap) +{ + int arr_idx, bit_idx; + + if (cap < 0 || cap > 127) { + wcn36xx_warn("error cap idx %d\n", cap); + return; + } + + arr_idx = cap / 32; + bit_idx = cap % 32; + bitmap[arr_idx] |= (1 << bit_idx); +} + +int wcn36xx_firmware_get_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap) +{ + int arr_idx, bit_idx; + + if (cap < 0 || cap > 127) { + wcn36xx_warn("error cap idx %d\n", cap); + return -EINVAL; + } + + arr_idx = cap / 32; + bit_idx = cap % 32; + + return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0; +} + +void wcn36xx_firmware_clear_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap) +{ + int arr_idx, bit_idx; + + if (cap < 0 || cap > 127) { + wcn36xx_warn("error cap idx %d\n", cap); + return; + } + + arr_idx = cap / 32; + bit_idx = cap % 32; + bitmap[arr_idx] &= ~(1 << bit_idx); +} diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.h b/drivers/net/wireless/ath/wcn36xx/firmware.h new file mode 100644 index 000000000000..552c0e9325e1 --- /dev/null +++ b/drivers/net/wireless/ath/wcn36xx/firmware.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _FIRMWARE_H_ +#define _FIRMWARE_H_ + +/* Capability bitmap exchange definitions and macros starts */ + +enum wcn36xx_firmware_feat_caps { + MCC = 0, + P2P = 1, + DOT11AC = 2, + SLM_SESSIONIZATION = 3, + DOT11AC_OPMODE = 4, + SAP32STA = 5, + TDLS = 6, + P2P_GO_NOA_DECOUPLE_INIT_SCAN = 7, + WLANACTIVE_OFFLOAD = 8, + BEACON_OFFLOAD = 9, + SCAN_OFFLOAD = 10, + ROAM_OFFLOAD = 11, + BCN_MISS_OFFLOAD = 12, + STA_POWERSAVE = 13, + STA_ADVANCED_PWRSAVE = 14, + AP_UAPSD = 15, + AP_DFS = 16, + BLOCKACK = 17, + PHY_ERR = 18, + BCN_FILTER = 19, + RTT = 20, + RATECTRL = 21, + WOW = 22, + WLAN_ROAM_SCAN_OFFLOAD = 23, + SPECULATIVE_PS_POLL = 24, + SCAN_SCH = 25, + IBSS_HEARTBEAT_OFFLOAD = 26, + WLAN_SCAN_OFFLOAD = 27, + WLAN_PERIODIC_TX_PTRN = 28, + ADVANCE_TDLS = 29, + BATCH_SCAN = 30, + FW_IN_TX_PATH = 31, + EXTENDED_NSOFFLOAD_SLOT = 32, + CH_SWITCH_V1 = 33, + HT40_OBSS_SCAN = 34, + UPDATE_CHANNEL_LIST = 35, + WLAN_MCADDR_FLT = 36, + WLAN_CH144 = 37, + NAN = 38, + TDLS_SCAN_COEXISTENCE = 39, + LINK_LAYER_STATS_MEAS = 40, + MU_MIMO = 41, + EXTENDED_SCAN = 42, + DYNAMIC_WMM_PS = 43, + MAC_SPOOFED_SCAN = 44, + BMU_ERROR_GENERIC_RECOVERY = 45, + DISA = 46, + FW_STATS = 47, + WPS_PRBRSP_TMPL = 48, + BCN_IE_FLT_DELTA = 49, + TDLS_OFF_CHANNEL = 51, + RTT3 = 52, + MGMT_FRAME_LOGGING = 53, + ENHANCED_TXBD_COMPLETION = 54, + LOGGING_ENHANCEMENT = 55, + EXT_SCAN_ENHANCED = 56, + MEMORY_DUMP_SUPPORTED = 57, + PER_PKT_STATS_SUPPORTED = 58, + EXT_LL_STAT = 60, + WIFI_CONFIG = 61, + ANTENNA_DIVERSITY_SELECTION = 62, + + MAX_FEATURE_SUPPORTED = 128, +}; + +void wcn36xx_firmware_set_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap); +int wcn36xx_firmware_get_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap); +void wcn36xx_firmware_clear_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap); + +#endif /* _FIRMWARE_H_ */ + diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 555226a440f8..f1a43fd1d957 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4758,74 +4758,6 @@ struct wcn36xx_hal_set_power_params_resp { u32 status; } __packed; -/* Capability bitmap exchange definitions and macros starts */ - -enum wcn36xx_firmware_feat_caps { - MCC = 0, - P2P = 1, - DOT11AC = 2, - SLM_SESSIONIZATION = 3, - DOT11AC_OPMODE = 4, - SAP32STA = 5, - TDLS = 6, - P2P_GO_NOA_DECOUPLE_INIT_SCAN = 7, - WLANACTIVE_OFFLOAD = 8, - BEACON_OFFLOAD = 9, - SCAN_OFFLOAD = 10, - ROAM_OFFLOAD = 11, - BCN_MISS_OFFLOAD = 12, - STA_POWERSAVE = 13, - STA_ADVANCED_PWRSAVE = 14, - AP_UAPSD = 15, - AP_DFS = 16, - BLOCKACK = 17, - PHY_ERR = 18, - BCN_FILTER = 19, - RTT = 20, - RATECTRL = 21, - WOW = 22, - WLAN_ROAM_SCAN_OFFLOAD = 23, - SPECULATIVE_PS_POLL = 24, - SCAN_SCH = 25, - IBSS_HEARTBEAT_OFFLOAD = 26, - WLAN_SCAN_OFFLOAD = 27, - WLAN_PERIODIC_TX_PTRN = 28, - ADVANCE_TDLS = 29, - BATCH_SCAN = 30, - FW_IN_TX_PATH = 31, - EXTENDED_NSOFFLOAD_SLOT = 32, - CH_SWITCH_V1 = 33, - HT40_OBSS_SCAN = 34, - UPDATE_CHANNEL_LIST = 35, - WLAN_MCADDR_FLT = 36, - WLAN_CH144 = 37, - NAN = 38, - TDLS_SCAN_COEXISTENCE = 39, - LINK_LAYER_STATS_MEAS = 40, - MU_MIMO = 41, - EXTENDED_SCAN = 42, - DYNAMIC_WMM_PS = 43, - MAC_SPOOFED_SCAN = 44, - BMU_ERROR_GENERIC_RECOVERY = 45, - DISA = 46, - FW_STATS = 47, - WPS_PRBRSP_TMPL = 48, - BCN_IE_FLT_DELTA = 49, - TDLS_OFF_CHANNEL = 51, - RTT3 = 52, - MGMT_FRAME_LOGGING = 53, - ENHANCED_TXBD_COMPLETION = 54, - LOGGING_ENHANCEMENT = 55, - EXT_SCAN_ENHANCED = 56, - MEMORY_DUMP_SUPPORTED = 57, - PER_PKT_STATS_SUPPORTED = 58, - EXT_LL_STAT = 60, - WIFI_CONFIG = 61, - ANTENNA_DIVERSITY_SELECTION = 62, - - MAX_FEATURE_SUPPORTED = 128, -}; - #define WCN36XX_HAL_CAPS_SIZE 4 struct wcn36xx_hal_feat_caps_msg { diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index e7c3cef060b8..da56ac1c2d9e 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -28,6 +28,7 @@ #include #include "wcn36xx.h" #include "testmode.h" +#include "firmware.h" unsigned int wcn36xx_dbg_mask; module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644); @@ -272,7 +273,7 @@ static void wcn36xx_feat_caps_info(struct wcn36xx *wcn) int i; for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) { - if (get_feat_caps(wcn->fw_feat_caps, i)) + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) wcn36xx_dbg(WCN36XX_DBG_MAC, "FW Cap %s\n", wcn36xx_get_cap_name(i)); } } @@ -705,7 +706,7 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw, { struct wcn36xx *wcn = hw->priv; - if (!get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { + if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { /* fallback to mac80211 software scan */ return 1; } @@ -743,7 +744,7 @@ static void wcn36xx_cancel_hw_scan(struct ieee80211_hw *hw, wcn->scan_aborted = true; mutex_unlock(&wcn->scan_lock); - if (get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { /* ieee80211_scan_completed will be called on FW scan * indication */ wcn36xx_smd_stop_hw_scan(wcn); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index c9e9dd011e71..566f0b9c1584 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -22,6 +22,7 @@ #include #include #include "smd.h" +#include "firmware.h" struct wcn36xx_cfg_val { u32 cfg_id; @@ -295,7 +296,7 @@ static void wcn36xx_smd_set_sta_vht_params(struct wcn36xx *wcn, sta_params->vht_capable = sta->deflink.vht_cap.vht_supported; sta_params->vht_ldpc_enabled = is_cap_supported(caps, IEEE80211_VHT_CAP_RXLDPC); - if (get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) { + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) { sta_params->vht_tx_mu_beamformee_capable = is_cap_supported(caps, IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); if (sta_params->vht_tx_mu_beamformee_capable) @@ -2431,49 +2432,6 @@ out: return ret; } -void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) -{ - int arr_idx, bit_idx; - - if (cap < 0 || cap > 127) { - wcn36xx_warn("error cap idx %d\n", cap); - return; - } - - arr_idx = cap / 32; - bit_idx = cap % 32; - bitmap[arr_idx] |= (1 << bit_idx); -} - -int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) -{ - int arr_idx, bit_idx; - - if (cap < 0 || cap > 127) { - wcn36xx_warn("error cap idx %d\n", cap); - return -EINVAL; - } - - arr_idx = cap / 32; - bit_idx = cap % 32; - - return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0; -} - -void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) -{ - int arr_idx, bit_idx; - - if (cap < 0 || cap > 127) { - wcn36xx_warn("error cap idx %d\n", cap); - return; - } - - arr_idx = cap / 32; - bit_idx = cap % 32; - bitmap[arr_idx] &= ~(1 << bit_idx); -} - int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn) { struct wcn36xx_hal_feat_caps_msg msg_body, *rsp; @@ -2482,11 +2440,12 @@ int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn) mutex_lock(&wcn->hal_mutex); INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ); - set_feat_caps(msg_body.feat_caps, STA_POWERSAVE); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, STA_POWERSAVE); if (wcn->rf_id == RF_IRIS_WCN3680) { - set_feat_caps(msg_body.feat_caps, DOT11AC); - set_feat_caps(msg_body.feat_caps, WLAN_CH144); - set_feat_caps(msg_body.feat_caps, ANTENNA_DIVERSITY_SELECTION); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, DOT11AC); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, WLAN_CH144); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, + ANTENNA_DIVERSITY_SELECTION); } PREPARE_HAL_BUF(wcn->hal_buf, msg_body); @@ -3300,7 +3259,7 @@ int wcn36xx_smd_add_beacon_filter(struct wcn36xx *wcn, size_t payload_size; int ret; - if (!get_feat_caps(wcn->fw_feat_caps, BCN_FILTER)) + if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, BCN_FILTER)) return -EOPNOTSUPP; mutex_lock(&wcn->hal_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 186dad4fe80e..cf15cde2a364 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -125,9 +125,6 @@ int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn); -void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); -int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); -void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn, struct ieee80211_sta *sta, From 75072b2970a8f806595017a57ad7daf4b67533f1 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Wed, 27 Jul 2022 17:16:54 +0100 Subject: [PATCH 32/36] wifi: wcn36xx: Move capability bitmap to string translation function to firmware.c Move wcn36xx_get_cap_name() function in main.c into firmware.c as wcn36xx_firmware_get_cap_name(). Reviewed-by: Loic Poulain Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220727161655.2286867-4-bryan.odonoghue@linaro.org --- drivers/net/wireless/ath/wcn36xx/firmware.c | 75 +++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/firmware.h | 2 + drivers/net/wireless/ath/wcn36xx/main.c | 81 +-------------------- 3 files changed, 81 insertions(+), 77 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.c b/drivers/net/wireless/ath/wcn36xx/firmware.c index 03b93d2bdcf9..4b7f439e4db5 100644 --- a/drivers/net/wireless/ath/wcn36xx/firmware.c +++ b/drivers/net/wireless/ath/wcn36xx/firmware.c @@ -3,6 +3,81 @@ #include "wcn36xx.h" #include "firmware.h" +#define DEFINE(s)[s] = #s + +static const char * const wcn36xx_firmware_caps_names[] = { + DEFINE(MCC), + DEFINE(P2P), + DEFINE(DOT11AC), + DEFINE(SLM_SESSIONIZATION), + DEFINE(DOT11AC_OPMODE), + DEFINE(SAP32STA), + DEFINE(TDLS), + DEFINE(P2P_GO_NOA_DECOUPLE_INIT_SCAN), + DEFINE(WLANACTIVE_OFFLOAD), + DEFINE(BEACON_OFFLOAD), + DEFINE(SCAN_OFFLOAD), + DEFINE(ROAM_OFFLOAD), + DEFINE(BCN_MISS_OFFLOAD), + DEFINE(STA_POWERSAVE), + DEFINE(STA_ADVANCED_PWRSAVE), + DEFINE(AP_UAPSD), + DEFINE(AP_DFS), + DEFINE(BLOCKACK), + DEFINE(PHY_ERR), + DEFINE(BCN_FILTER), + DEFINE(RTT), + DEFINE(RATECTRL), + DEFINE(WOW), + DEFINE(WLAN_ROAM_SCAN_OFFLOAD), + DEFINE(SPECULATIVE_PS_POLL), + DEFINE(SCAN_SCH), + DEFINE(IBSS_HEARTBEAT_OFFLOAD), + DEFINE(WLAN_SCAN_OFFLOAD), + DEFINE(WLAN_PERIODIC_TX_PTRN), + DEFINE(ADVANCE_TDLS), + DEFINE(BATCH_SCAN), + DEFINE(FW_IN_TX_PATH), + DEFINE(EXTENDED_NSOFFLOAD_SLOT), + DEFINE(CH_SWITCH_V1), + DEFINE(HT40_OBSS_SCAN), + DEFINE(UPDATE_CHANNEL_LIST), + DEFINE(WLAN_MCADDR_FLT), + DEFINE(WLAN_CH144), + DEFINE(NAN), + DEFINE(TDLS_SCAN_COEXISTENCE), + DEFINE(LINK_LAYER_STATS_MEAS), + DEFINE(MU_MIMO), + DEFINE(EXTENDED_SCAN), + DEFINE(DYNAMIC_WMM_PS), + DEFINE(MAC_SPOOFED_SCAN), + DEFINE(BMU_ERROR_GENERIC_RECOVERY), + DEFINE(DISA), + DEFINE(FW_STATS), + DEFINE(WPS_PRBRSP_TMPL), + DEFINE(BCN_IE_FLT_DELTA), + DEFINE(TDLS_OFF_CHANNEL), + DEFINE(RTT3), + DEFINE(MGMT_FRAME_LOGGING), + DEFINE(ENHANCED_TXBD_COMPLETION), + DEFINE(LOGGING_ENHANCEMENT), + DEFINE(EXT_SCAN_ENHANCED), + DEFINE(MEMORY_DUMP_SUPPORTED), + DEFINE(PER_PKT_STATS_SUPPORTED), + DEFINE(EXT_LL_STAT), + DEFINE(WIFI_CONFIG), + DEFINE(ANTENNA_DIVERSITY_SELECTION), +}; + +#undef DEFINE + +const char *wcn36xx_firmware_get_cap_name(enum wcn36xx_firmware_feat_caps x) +{ + if (x >= ARRAY_SIZE(wcn36xx_firmware_caps_names)) + return "UNKNOWN"; + return wcn36xx_firmware_caps_names[x]; +} + void wcn36xx_firmware_set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.h b/drivers/net/wireless/ath/wcn36xx/firmware.h index 552c0e9325e1..f991cf959f82 100644 --- a/drivers/net/wireless/ath/wcn36xx/firmware.h +++ b/drivers/net/wireless/ath/wcn36xx/firmware.h @@ -78,5 +78,7 @@ int wcn36xx_firmware_get_feat_caps(u32 *bitmap, void wcn36xx_firmware_clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); +const char *wcn36xx_firmware_get_cap_name(enum wcn36xx_firmware_feat_caps x); + #endif /* _FIRMWARE_H_ */ diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index da56ac1c2d9e..6b8d2889d73f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -193,88 +193,15 @@ static inline u8 get_sta_index(struct ieee80211_vif *vif, sta_priv->sta_index; } -#define DEFINE(s) [s] = #s - -static const char * const wcn36xx_caps_names[] = { - DEFINE(MCC), - DEFINE(P2P), - DEFINE(DOT11AC), - DEFINE(SLM_SESSIONIZATION), - DEFINE(DOT11AC_OPMODE), - DEFINE(SAP32STA), - DEFINE(TDLS), - DEFINE(P2P_GO_NOA_DECOUPLE_INIT_SCAN), - DEFINE(WLANACTIVE_OFFLOAD), - DEFINE(BEACON_OFFLOAD), - DEFINE(SCAN_OFFLOAD), - DEFINE(ROAM_OFFLOAD), - DEFINE(BCN_MISS_OFFLOAD), - DEFINE(STA_POWERSAVE), - DEFINE(STA_ADVANCED_PWRSAVE), - DEFINE(AP_UAPSD), - DEFINE(AP_DFS), - DEFINE(BLOCKACK), - DEFINE(PHY_ERR), - DEFINE(BCN_FILTER), - DEFINE(RTT), - DEFINE(RATECTRL), - DEFINE(WOW), - DEFINE(WLAN_ROAM_SCAN_OFFLOAD), - DEFINE(SPECULATIVE_PS_POLL), - DEFINE(SCAN_SCH), - DEFINE(IBSS_HEARTBEAT_OFFLOAD), - DEFINE(WLAN_SCAN_OFFLOAD), - DEFINE(WLAN_PERIODIC_TX_PTRN), - DEFINE(ADVANCE_TDLS), - DEFINE(BATCH_SCAN), - DEFINE(FW_IN_TX_PATH), - DEFINE(EXTENDED_NSOFFLOAD_SLOT), - DEFINE(CH_SWITCH_V1), - DEFINE(HT40_OBSS_SCAN), - DEFINE(UPDATE_CHANNEL_LIST), - DEFINE(WLAN_MCADDR_FLT), - DEFINE(WLAN_CH144), - DEFINE(NAN), - DEFINE(TDLS_SCAN_COEXISTENCE), - DEFINE(LINK_LAYER_STATS_MEAS), - DEFINE(MU_MIMO), - DEFINE(EXTENDED_SCAN), - DEFINE(DYNAMIC_WMM_PS), - DEFINE(MAC_SPOOFED_SCAN), - DEFINE(BMU_ERROR_GENERIC_RECOVERY), - DEFINE(DISA), - DEFINE(FW_STATS), - DEFINE(WPS_PRBRSP_TMPL), - DEFINE(BCN_IE_FLT_DELTA), - DEFINE(TDLS_OFF_CHANNEL), - DEFINE(RTT3), - DEFINE(MGMT_FRAME_LOGGING), - DEFINE(ENHANCED_TXBD_COMPLETION), - DEFINE(LOGGING_ENHANCEMENT), - DEFINE(EXT_SCAN_ENHANCED), - DEFINE(MEMORY_DUMP_SUPPORTED), - DEFINE(PER_PKT_STATS_SUPPORTED), - DEFINE(EXT_LL_STAT), - DEFINE(WIFI_CONFIG), - DEFINE(ANTENNA_DIVERSITY_SELECTION), -}; - -#undef DEFINE - -static const char *wcn36xx_get_cap_name(enum wcn36xx_firmware_feat_caps x) -{ - if (x >= ARRAY_SIZE(wcn36xx_caps_names)) - return "UNKNOWN"; - return wcn36xx_caps_names[x]; -} - static void wcn36xx_feat_caps_info(struct wcn36xx *wcn) { int i; for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) { - if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) - wcn36xx_dbg(WCN36XX_DBG_MAC, "FW Cap %s\n", wcn36xx_get_cap_name(i)); + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) { + wcn36xx_dbg(WCN36XX_DBG_MAC, "FW Cap %s\n", + wcn36xx_firmware_get_cap_name(i)); + } } } From 5cc8cc4406edee1bc22991c23d38efbbb797aa6d Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Wed, 27 Jul 2022 17:16:55 +0100 Subject: [PATCH 33/36] wifi: wcn36xx: Add debugfs entry to read firmware feature strings Add in the ability to easily find the firmware feature bits reported in the get feature exchange without having to compile-in debug prints. root@linaro-alip:~# cat /sys/kernel/debug/ieee80211/phy0/wcn36xx/firmware_feat_caps MCC P2P DOT11AC SLM_SESSIONIZATION DOT11AC_OPMODE SAP32STA TDLS P2P_GO_NOA_DECOUPLE_INIT_SCAN WLANACTIVE_OFFLOAD BEACON_OFFLOAD SCAN_OFFLOAD BCN_MISS_OFFLOAD STA_POWERSAVE STA_ADVANCED_PWRSAVE BCN_FILTER RTT RATECTRL WOW WLAN_ROAM_SCAN_OFFLOAD SPECULATIVE_PS_POLL IBSS_HEARTBEAT_OFFLOAD WLAN_SCAN_OFFLOAD WLAN_PERIODIC_TX_PTRN ADVANCE_TDLS BATCH_SCAN FW_IN_TX_PATH EXTENDED_NSOFFLOAD_SLOT CH_SWITCH_V1 HT40_OBSS_SCAN UPDATE_CHANNEL_LIST WLAN_MCADDR_FLT WLAN_CH144 TDLS_SCAN_COEXISTENCE LINK_LAYER_STATS_MEAS MU_MIMO EXTENDED_SCAN DYNAMIC_WMM_PS MAC_SPOOFED_SCAN FW_STATS WPS_PRBRSP_TMPL BCN_IE_FLT_DELTA Signed-off-by: Bryan O'Donoghue Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220727161655.2286867-5-bryan.odonoghue@linaro.org --- drivers/net/wireless/ath/wcn36xx/debug.c | 39 ++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/debug.h | 1 + 2 files changed, 40 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c index 6af306ae41ad..58b3c0501bfd 100644 --- a/drivers/net/wireless/ath/wcn36xx/debug.c +++ b/drivers/net/wireless/ath/wcn36xx/debug.c @@ -21,6 +21,7 @@ #include "wcn36xx.h" #include "debug.h" #include "pmc.h" +#include "firmware.h" #ifdef CONFIG_WCN36XX_DEBUGFS @@ -136,6 +137,42 @@ static const struct file_operations fops_wcn36xx_dump = { .write = write_file_dump, }; +static ssize_t read_file_firmware_feature_caps(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct wcn36xx *wcn = file->private_data; + size_t len = 0, buf_len = 2048; + char *buf; + int i; + int ret; + + buf = kzalloc(buf_len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + mutex_lock(&wcn->hal_mutex); + for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) { + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) { + len += scnprintf(buf + len, buf_len - len, "%s\n", + wcn36xx_firmware_get_cap_name(i)); + } + if (len >= buf_len) + break; + } + mutex_unlock(&wcn->hal_mutex); + + ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); + kfree(buf); + + return ret; +} + +static const struct file_operations fops_wcn36xx_firmware_feat_caps = { + .open = simple_open, + .read = read_file_firmware_feature_caps, +}; + #define ADD_FILE(name, mode, fop, priv_data) \ do { \ struct dentry *d; \ @@ -163,6 +200,8 @@ void wcn36xx_debugfs_init(struct wcn36xx *wcn) ADD_FILE(bmps_switcher, 0600, &fops_wcn36xx_bmps, wcn); ADD_FILE(dump, 0200, &fops_wcn36xx_dump, wcn); + ADD_FILE(firmware_feat_caps, 0200, + &fops_wcn36xx_firmware_feat_caps, wcn); } void wcn36xx_debugfs_exit(struct wcn36xx *wcn) diff --git a/drivers/net/wireless/ath/wcn36xx/debug.h b/drivers/net/wireless/ath/wcn36xx/debug.h index 46307aa562d3..7116d96e0543 100644 --- a/drivers/net/wireless/ath/wcn36xx/debug.h +++ b/drivers/net/wireless/ath/wcn36xx/debug.h @@ -31,6 +31,7 @@ struct wcn36xx_dfs_entry { struct dentry *rootdir; struct wcn36xx_dfs_file file_bmps_switcher; struct wcn36xx_dfs_file file_dump; + struct wcn36xx_dfs_file file_firmware_feat_caps; }; void wcn36xx_debugfs_init(struct wcn36xx *wcn); From 87de35cbf65cdb5b059dc30801aa63cdec3c7c2a Mon Sep 17 00:00:00 2001 From: Ping-Ke Shih Date: Wed, 22 Jun 2022 17:19:37 +0800 Subject: [PATCH 34/36] wifi: rtw89: 8852a: update RF radio A/B R56 Update to internal tag HALRF_027_00_060. Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220622091937.11325-1-pkshih@realtek.com --- .../wireless/realtek/rtw89/rtw8852a_table.c | 896 +++++++++--------- 1 file changed, 446 insertions(+), 450 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_table.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_table.c index 99479bbb0939..320bcd4852c6 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852a_table.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_table.c @@ -1281,7 +1281,6 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x018, 0x00011124}, {0x000, 0x00033C00}, {0x01A, 0x00040004}, - {0x0FE, 0x00000000}, {0x055, 0x00080000}, {0x056, 0x0008FFF0}, {0x057, 0x0000C485}, @@ -20496,7 +20495,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20516,7 +20515,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20542,7 +20541,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20562,7 +20561,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20588,7 +20587,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20608,7 +20607,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20622,17 +20621,17 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0xB0000000, 0x00000000}, {0x033, 0x0000002E}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20644,15 +20643,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20664,21 +20663,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000002F}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20690,15 +20689,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20710,21 +20709,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000030}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20736,15 +20735,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20756,21 +20755,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000031}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20782,15 +20781,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20802,21 +20801,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000032}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20828,15 +20827,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20848,21 +20847,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000033}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20874,15 +20873,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20894,21 +20893,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000034}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20920,15 +20919,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20940,21 +20939,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000035}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -20966,15 +20965,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -20986,21 +20985,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000036}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21012,15 +21011,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21032,21 +21031,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000037}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21058,15 +21057,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21078,21 +21077,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000038}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21104,15 +21103,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21124,21 +21123,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000039}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21150,15 +21149,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21170,21 +21169,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003A}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21196,15 +21195,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21216,21 +21215,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003B}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21242,15 +21241,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21262,21 +21261,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003C}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21288,15 +21287,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21308,21 +21307,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003D}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21334,15 +21333,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21354,21 +21353,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003E}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21380,15 +21379,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21400,21 +21399,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003F}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -21426,15 +21425,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -21446,7 +21445,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x0EF, 0x00000000}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, @@ -21596,8 +21595,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radioa_regs[] = { {0x087, 0x00000427}, {0xB0000000, 0x00000000}, {0x002, 0x00000000}, - {0x067, 0x00000052}, - + {0x067, 0x00000056}, }; static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { @@ -21671,7 +21669,6 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x018, 0x00011124}, {0x000, 0x00033C00}, {0x01A, 0x00040004}, - {0x0FE, 0x00000000}, {0x055, 0x00080000}, {0x056, 0x0008FFF0}, {0x057, 0x0000C485}, @@ -41142,7 +41139,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41162,7 +41159,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41188,7 +41185,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41208,7 +41205,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41234,7 +41231,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41254,7 +41251,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x000001FF}, + {0x03F, 0x000001FB}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x000001FF}, {0x90340002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41268,17 +41265,17 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0xB0000000, 0x00000000}, {0x033, 0x0000002E}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41290,15 +41287,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41310,21 +41307,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000002F}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41336,15 +41333,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41356,21 +41353,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000030}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41382,15 +41379,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41402,21 +41399,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000031}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41428,15 +41425,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41448,21 +41445,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000032}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41474,15 +41471,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41494,21 +41491,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000033}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41520,15 +41517,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41540,21 +41537,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000034}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41566,15 +41563,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41586,21 +41583,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000035}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41612,15 +41609,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41632,21 +41629,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000036}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41658,15 +41655,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41678,21 +41675,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000037}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41704,15 +41701,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41724,21 +41721,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000038}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41750,15 +41747,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41770,21 +41767,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x00000039}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41796,15 +41793,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41816,21 +41813,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003A}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41842,15 +41839,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41862,21 +41859,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003B}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41888,15 +41885,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41908,21 +41905,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003C}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41934,15 +41931,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -41954,21 +41951,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003D}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -41980,15 +41977,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -42000,21 +41997,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003E}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -42026,15 +42023,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -42046,21 +42043,21 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x033, 0x0000003F}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90010001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260001, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330001, 0x00000000}, {0x40000000, 0x00000000}, @@ -42072,15 +42069,15 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360001, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0x90010002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90020002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90030002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90250002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90260002, 0x00000000}, {0x40000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0x90320002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003B}, {0x90330002, 0x00000000}, {0x40000000, 0x00000000}, @@ -42092,7 +42089,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x90360002, 0x00000000}, {0x40000000, 0x00000000}, {0x03F, 0x0000003F}, {0xA0000000, 0x00000000}, - {0x03F, 0x0000003F}, + {0x03F, 0x000000EB}, {0xB0000000, 0x00000000}, {0x0EF, 0x00000000}, {0x80010000, 0x00000000}, {0x40000000, 0x00000000}, @@ -42243,8 +42240,7 @@ static const struct rtw89_reg2_def rtw89_8852a_phy_radiob_regs[] = { {0x087, 0x00000427}, {0xB0000000, 0x00000000}, {0x002, 0x00000000}, - {0x067, 0x00000052}, - + {0x067, 0x00000056}, }; static const struct rtw89_reg2_def rtw89_8852a_phy_nctl_regs[] = { From 334facd651b98f2e6c6bb699405f8b7421b9b40c Mon Sep 17 00:00:00 2001 From: Zong-Zhe Yang Date: Thu, 21 Jul 2022 15:49:52 +0800 Subject: [PATCH 35/36] wifi: rtw89: 8852a: adjust IMR for SER L1 SER (system error recovery) L1 (level 1) has a step-by-step handshake process with FW. These handshakes still rely on B_AX_HS0ISR_IND_INT_EN. So, even already during recovery, we enable this bit in IMR. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220721074952.19676-1-pkshih@realtek.com --- drivers/net/wireless/realtek/rtw89/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index 73b3b7e9fe6f..c68fec9eb5a6 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -3111,7 +3111,7 @@ void rtw89_pci_config_intr_mask(struct rtw89_dev *rtwdev) rtwpci->halt_c2h_intrs = B_AX_HALT_C2H_INT_EN | 0; if (rtwpci->under_recovery) { - rtwpci->intrs[0] = 0; + rtwpci->intrs[0] = B_AX_HS0ISR_IND_INT_EN; rtwpci->intrs[1] = 0; } else { rtwpci->intrs[0] = B_AX_TXDMA_STUCK_INT_EN | From 42bbf810e155efc6129a3a648ae5300f00b79d7b Mon Sep 17 00:00:00 2001 From: William Dean Date: Sat, 23 Jul 2022 14:37:56 +0800 Subject: [PATCH 36/36] wifi: rtw88: check the return value of alloc_workqueue() The function alloc_workqueue() in rtw_core_init() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code. Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue") Reported-by: Hacash Robot Signed-off-by: William Dean Reviewed-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220723063756.2956189-1-williamsukatube@163.com --- drivers/net/wireless/realtek/rtw88/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 985ee36efc0f..76dc9da88f6c 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1992,6 +1992,10 @@ int rtw_core_init(struct rtw_dev *rtwdev) timer_setup(&rtwdev->tx_report.purge_timer, rtw_tx_report_purge_timer, 0); rtwdev->tx_wq = alloc_workqueue("rtw_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!rtwdev->tx_wq) { + rtw_warn(rtwdev, "alloc_workqueue rtw_tx_wq failed\n"); + return -ENOMEM; + } INIT_DELAYED_WORK(&rtwdev->watch_dog_work, rtw_watch_dog_work); INIT_DELAYED_WORK(&coex->bt_relink_work, rtw_coex_bt_relink_work);