Skip to content

Commit f39af96

Browse files
author
Kalle Valo
committed
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
ath.git patches for v5.19. Major changes: ath11k * support setting Specific Absorption Rate (SAR) for WCN6855 * read country code from SMBIOS for WCN6855/QCA6390 * support for WCN6750
2 parents da4cea1 + 54a6f29 commit f39af96

File tree

36 files changed

+1410
-358
lines changed

36 files changed

+1410
-358
lines changed

Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml

Lines changed: 252 additions & 109 deletions
Large diffs are not rendered by default.

drivers/net/wireless/ath/ath10k/core.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
#define ATH10K_KEEPALIVE_MAX_IDLE 3895
6060
#define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
6161

62-
/* NAPI poll budget */
63-
#define ATH10K_NAPI_BUDGET 64
64-
6562
/* SMBIOS type containing Board Data File Name Extension */
6663
#define ATH10K_SMBIOS_BDF_EXT_TYPE 0xF8
6764

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,11 +4119,10 @@ void ath10k_offchan_tx_work(struct work_struct *work)
41194119
peer = ath10k_peer_find(ar, vdev_id, peer_addr);
41204120
spin_unlock_bh(&ar->data_lock);
41214121

4122-
if (peer)
4122+
if (peer) {
41234123
ath10k_warn(ar, "peer %pM on vdev %d already present\n",
41244124
peer_addr, vdev_id);
4125-
4126-
if (!peer) {
4125+
} else {
41274126
ret = ath10k_peer_create(ar, NULL, NULL, vdev_id,
41284127
peer_addr,
41294128
WMI_PEER_TYPE_DEFAULT);
@@ -5340,13 +5339,29 @@ static int ath10k_start(struct ieee80211_hw *hw)
53405339
static void ath10k_stop(struct ieee80211_hw *hw)
53415340
{
53425341
struct ath10k *ar = hw->priv;
5342+
u32 opt;
53435343

53445344
ath10k_drain_tx(ar);
53455345

53465346
mutex_lock(&ar->conf_mutex);
53475347
if (ar->state != ATH10K_STATE_OFF) {
5348-
if (!ar->hw_rfkill_on)
5349-
ath10k_halt(ar);
5348+
if (!ar->hw_rfkill_on) {
5349+
/* If the current driver state is RESTARTING but not yet
5350+
* fully RESTARTED because of incoming suspend event,
5351+
* then ath10k_halt() is already called via
5352+
* ath10k_core_restart() and should not be called here.
5353+
*/
5354+
if (ar->state != ATH10K_STATE_RESTARTING) {
5355+
ath10k_halt(ar);
5356+
} else {
5357+
/* Suspending here, because when in RESTARTING
5358+
* state, ath10k_core_stop() skips
5359+
* ath10k_wait_for_suspend().
5360+
*/
5361+
opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR;
5362+
ath10k_wait_for_suspend(ar, opt);
5363+
}
5364+
}
53505365
ar->state = ATH10K_STATE_OFF;
53515366
}
53525367
mutex_unlock(&ar->conf_mutex);

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3216,7 +3216,7 @@ static void ath10k_pci_free_irq(struct ath10k *ar)
32163216
void ath10k_pci_init_napi(struct ath10k *ar)
32173217
{
32183218
netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
3219-
ATH10K_NAPI_BUDGET);
3219+
NAPI_POLL_WEIGHT);
32203220
}
32213221

32223222
static int ath10k_pci_init_irq(struct ath10k *ar)

drivers/net/wireless/ath/ath10k/sdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ static int ath10k_sdio_probe(struct sdio_func *func,
25322532
}
25332533

25342534
netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_sdio_napi_poll,
2535-
ATH10K_NAPI_BUDGET);
2535+
NAPI_POLL_WEIGHT);
25362536

25372537
ath10k_dbg(ar, ATH10K_DBG_BOOT,
25382538
"sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n",

drivers/net/wireless/ath/ath10k/snoc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget)
12431243
static void ath10k_snoc_init_napi(struct ath10k *ar)
12441244
{
12451245
netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll,
1246-
ATH10K_NAPI_BUDGET);
1246+
NAPI_POLL_WEIGHT);
12471247
}
12481248

12491249
static int ath10k_snoc_request_irq(struct ath10k *ar)

drivers/net/wireless/ath/ath10k/usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ static int ath10k_usb_probe(struct usb_interface *interface,
10151015
}
10161016

10171017
netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_usb_napi_poll,
1018-
ATH10K_NAPI_BUDGET);
1018+
NAPI_POLL_WEIGHT);
10191019

10201020
usb_get_dev(dev);
10211021
vendor_id = le16_to_cpu(dev->descriptor.idVendor);

drivers/net/wireless/ath/ath11k/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ ath11k-y += core.o \
1616
ce.o \
1717
peer.o \
1818
dbring.o \
19-
hw.o
19+
hw.o \
20+
pcic.o
2021

2122
ath11k-$(CONFIG_ATH11K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o
2223
ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
@@ -29,7 +30,7 @@ obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
2930
ath11k_ahb-y += ahb.o
3031

3132
obj-$(CONFIG_ATH11K_PCI) += ath11k_pci.o
32-
ath11k_pci-y += mhi.o pci.o pcic.o
33+
ath11k_pci-y += mhi.o pci.o
3334

3435
# for tracing framework to find trace.h
3536
CFLAGS_trace.o := -I$(src)

drivers/net/wireless/ath/ath11k/ahb.c

Lines changed: 133 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: BSD-3-Clause-Clear
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4+
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
45
*/
56

67
#include <linux/module.h>
@@ -12,6 +13,7 @@
1213
#include "debug.h"
1314
#include "hif.h"
1415
#include <linux/remoteproc.h>
16+
#include "pcic.h"
1517

1618
static const struct of_device_id ath11k_ahb_of_match[] = {
1719
/* TODO: Should we change the compatible string to something similar
@@ -23,18 +25,14 @@ static const struct of_device_id ath11k_ahb_of_match[] = {
2325
{ .compatible = "qcom,ipq6018-wifi",
2426
.data = (void *)ATH11K_HW_IPQ6018_HW10,
2527
},
28+
{ .compatible = "qcom,wcn6750-wifi",
29+
.data = (void *)ATH11K_HW_WCN6750_HW10,
30+
},
2631
{ }
2732
};
2833

2934
MODULE_DEVICE_TABLE(of, ath11k_ahb_of_match);
3035

31-
static const struct ath11k_bus_params ath11k_ahb_bus_params = {
32-
.mhi_support = false,
33-
.m3_fw_support = false,
34-
.fixed_bdf_addr = true,
35-
.fixed_mem_region = true,
36-
};
37-
3836
#define ATH11K_IRQ_CE0_OFFSET 4
3937

4038
static const char *irq_name[ATH11K_IRQ_NUM_MAX] = {
@@ -134,6 +132,16 @@ enum ext_irq_num {
134132
tcl2host_status_ring,
135133
};
136134

135+
static int
136+
ath11k_ahb_get_msi_irq_wcn6750(struct ath11k_base *ab, unsigned int vector)
137+
{
138+
return ab->pci.msi.irqs[vector];
139+
}
140+
141+
static const struct ath11k_pci_ops ath11k_ahb_pci_ops_wcn6750 = {
142+
.get_msi_irq = ath11k_ahb_get_msi_irq_wcn6750,
143+
};
144+
137145
static inline u32 ath11k_ahb_read32(struct ath11k_base *ab, u32 offset)
138146
{
139147
return ioread32(ab->mem + offset);
@@ -401,6 +409,9 @@ static void ath11k_ahb_free_irq(struct ath11k_base *ab)
401409
int irq_idx;
402410
int i;
403411

412+
if (ab->hw_params.hybrid_bus_type)
413+
return ath11k_pcic_free_irq(ab);
414+
404415
for (i = 0; i < ab->hw_params.ce_count; i++) {
405416
if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR)
406417
continue;
@@ -555,6 +566,9 @@ static int ath11k_ahb_config_irq(struct ath11k_base *ab)
555566
int irq, irq_idx, i;
556567
int ret;
557568

569+
if (ab->hw_params.hybrid_bus_type)
570+
return ath11k_pcic_config_irq(ab);
571+
558572
/* Configure CE irqs */
559573
for (i = 0; i < ab->hw_params.ce_count; i++) {
560574
struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i];
@@ -624,7 +638,7 @@ static int ath11k_ahb_map_service_to_pipe(struct ath11k_base *ab, u16 service_id
624638
return 0;
625639
}
626640

627-
static const struct ath11k_hif_ops ath11k_ahb_hif_ops = {
641+
static const struct ath11k_hif_ops ath11k_ahb_hif_ops_ipq8074 = {
628642
.start = ath11k_ahb_start,
629643
.stop = ath11k_ahb_stop,
630644
.read32 = ath11k_ahb_read32,
@@ -636,6 +650,20 @@ static const struct ath11k_hif_ops ath11k_ahb_hif_ops = {
636650
.power_up = ath11k_ahb_power_up,
637651
};
638652

653+
static const struct ath11k_hif_ops ath11k_ahb_hif_ops_wcn6750 = {
654+
.start = ath11k_pcic_start,
655+
.stop = ath11k_pcic_stop,
656+
.read32 = ath11k_pcic_read32,
657+
.write32 = ath11k_pcic_write32,
658+
.irq_enable = ath11k_pcic_ext_irq_enable,
659+
.irq_disable = ath11k_pcic_ext_irq_disable,
660+
.get_msi_address = ath11k_pcic_get_msi_address,
661+
.get_user_msi_vector = ath11k_pcic_get_user_msi_assignment,
662+
.map_service_to_pipe = ath11k_pcic_map_service_to_pipe,
663+
.power_down = ath11k_ahb_power_down,
664+
.power_up = ath11k_ahb_power_up,
665+
};
666+
639667
static int ath11k_core_get_rproc(struct ath11k_base *ab)
640668
{
641669
struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab);
@@ -658,12 +686,84 @@ static int ath11k_core_get_rproc(struct ath11k_base *ab)
658686
return 0;
659687
}
660688

689+
static int ath11k_ahb_setup_msi_resources(struct ath11k_base *ab)
690+
{
691+
struct platform_device *pdev = ab->pdev;
692+
phys_addr_t msi_addr_pa;
693+
dma_addr_t msi_addr_iova;
694+
struct resource *res;
695+
int int_prop;
696+
int ret;
697+
int i;
698+
699+
ret = ath11k_pcic_init_msi_config(ab);
700+
if (ret) {
701+
ath11k_err(ab, "failed to init msi config: %d\n", ret);
702+
return ret;
703+
}
704+
705+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
706+
if (!res) {
707+
ath11k_err(ab, "failed to fetch msi_addr\n");
708+
return -ENOENT;
709+
}
710+
711+
msi_addr_pa = res->start;
712+
msi_addr_iova = dma_map_resource(ab->dev, msi_addr_pa, PAGE_SIZE,
713+
DMA_FROM_DEVICE, 0);
714+
if (dma_mapping_error(ab->dev, msi_addr_iova))
715+
return -ENOMEM;
716+
717+
ab->pci.msi.addr_lo = lower_32_bits(msi_addr_iova);
718+
ab->pci.msi.addr_hi = upper_32_bits(msi_addr_iova);
719+
720+
ret = of_property_read_u32_index(ab->dev->of_node, "interrupts", 1, &int_prop);
721+
if (ret)
722+
return ret;
723+
724+
ab->pci.msi.ep_base_data = int_prop + 32;
725+
726+
for (i = 0; i < ab->pci.msi.config->total_vectors; i++) {
727+
res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
728+
if (!res)
729+
return -ENODEV;
730+
731+
ab->pci.msi.irqs[i] = res->start;
732+
}
733+
734+
set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags);
735+
736+
return 0;
737+
}
738+
739+
static int ath11k_ahb_setup_resources(struct ath11k_base *ab)
740+
{
741+
struct platform_device *pdev = ab->pdev;
742+
struct resource *mem_res;
743+
void __iomem *mem;
744+
745+
if (ab->hw_params.hybrid_bus_type)
746+
return ath11k_ahb_setup_msi_resources(ab);
747+
748+
mem = devm_platform_get_and_ioremap_resource(pdev, 0, &mem_res);
749+
if (IS_ERR(mem)) {
750+
dev_err(&pdev->dev, "ioremap error\n");
751+
return PTR_ERR(mem);
752+
}
753+
754+
ab->mem = mem;
755+
ab->mem_len = resource_size(mem_res);
756+
757+
return 0;
758+
}
759+
661760
static int ath11k_ahb_probe(struct platform_device *pdev)
662761
{
663762
struct ath11k_base *ab;
664763
const struct of_device_id *of_id;
665-
struct resource *mem_res;
666-
void __iomem *mem;
764+
const struct ath11k_hif_ops *hif_ops;
765+
const struct ath11k_pci_ops *pci_ops;
766+
enum ath11k_hw_rev hw_rev;
667767
int ret;
668768

669769
of_id = of_match_device(ath11k_ahb_of_match, &pdev->dev);
@@ -672,10 +772,21 @@ static int ath11k_ahb_probe(struct platform_device *pdev)
672772
return -EINVAL;
673773
}
674774

675-
mem = devm_platform_get_and_ioremap_resource(pdev, 0, &mem_res);
676-
if (IS_ERR(mem)) {
677-
dev_err(&pdev->dev, "ioremap error\n");
678-
return PTR_ERR(mem);
775+
hw_rev = (enum ath11k_hw_rev)of_id->data;
776+
777+
switch (hw_rev) {
778+
case ATH11K_HW_IPQ8074:
779+
case ATH11K_HW_IPQ6018_HW10:
780+
hif_ops = &ath11k_ahb_hif_ops_ipq8074;
781+
pci_ops = NULL;
782+
break;
783+
case ATH11K_HW_WCN6750_HW10:
784+
hif_ops = &ath11k_ahb_hif_ops_wcn6750;
785+
pci_ops = &ath11k_ahb_pci_ops_wcn6750;
786+
break;
787+
default:
788+
dev_err(&pdev->dev, "unsupported device type %d\n", hw_rev);
789+
return -EOPNOTSUPP;
679790
}
680791

681792
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
@@ -685,20 +796,22 @@ static int ath11k_ahb_probe(struct platform_device *pdev)
685796
}
686797

687798
ab = ath11k_core_alloc(&pdev->dev, sizeof(struct ath11k_ahb),
688-
ATH11K_BUS_AHB,
689-
&ath11k_ahb_bus_params);
799+
ATH11K_BUS_AHB);
690800
if (!ab) {
691801
dev_err(&pdev->dev, "failed to allocate ath11k base\n");
692802
return -ENOMEM;
693803
}
694804

695-
ab->hif.ops = &ath11k_ahb_hif_ops;
805+
ab->hif.ops = hif_ops;
806+
ab->pci.ops = pci_ops;
696807
ab->pdev = pdev;
697-
ab->hw_rev = (enum ath11k_hw_rev)of_id->data;
698-
ab->mem = mem;
699-
ab->mem_len = resource_size(mem_res);
808+
ab->hw_rev = hw_rev;
700809
platform_set_drvdata(pdev, ab);
701810

811+
ret = ath11k_ahb_setup_resources(ab);
812+
if (ret)
813+
goto err_core_free;
814+
702815
ret = ath11k_core_pre_init(ab);
703816
if (ret)
704817
goto err_core_free;

drivers/net/wireless/ath/ath11k/ce.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: BSD-3-Clause-Clear
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4+
* Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
45
*/
56

67
#include "dp_rx.h"
@@ -918,9 +919,6 @@ int ath11k_ce_init_pipes(struct ath11k_base *ab)
918919
int i;
919920
int ret;
920921

921-
ath11k_ce_get_shadow_config(ab, &ab->qmi.ce_cfg.shadow_reg_v2,
922-
&ab->qmi.ce_cfg.shadow_reg_v2_len);
923-
924922
for (i = 0; i < ab->hw_params.ce_count; i++) {
925923
pipe = &ab->ce.ce_pipe[i];
926924

0 commit comments

Comments
 (0)