ath10k: fix reading sram contents for QCA4019
PATCH 1/1 ath10k: fix reading sram contents for QCA4019
With QCA4019 platform, SRAM address can be accessed directly from host but currently, we are assuming sram addresses cannot be accessed directly and hence we convert the addresses.
While there, clean up growing hw checks during conversion of target CPU address to CE address. Now we have function pointer pertaining to different chips.
--- drivers/net/wireless/ath/ath10k/ahb.c | 23 ++++++++++++++++ drivers/net/wireless/ath/ath10k/pci.c | 51 ++++++++++++++++++++++------------- drivers/net/wireless/ath/ath10k/pci.h | 5 ++++ 3 files changed, 60 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath10k/ahb.c +23 -0
@@ -33,6 +33,9 @@MODULE_DEVICE_TABLE (of, ath10k_ahb_of_match); +#define QCA4019_SRAM_ADDR 0x000C0000 +#define QCA4019_SRAM_LEN 0x00040000/* 256 kb */ +static inline struct ath10k_ahb *ath10k_ahb_priv (struct ath10k *ar) {return &((struct ath10k_pci *)ar->drv_priv)->ahb[0 ];
@@ -699,6 +702,25 @@ static int ath10k_ahb_hif_power_up(struct ath10k *ar)return ret; } +static u32 ath10k_ahb_qca4019_targ_cpu_to_ce_addr (struct ath10k *ar,u32 addr) +{ +u32 val =0 , region = addr &0xfffff ; + + val =ath10k_pci_read32 (ar,PCIE_BAR_REG_ADDRESS ); + +if (region >=QCA4019_SRAM_ADDR && region <= + (QCA4019_SRAM_ADDR +QCA4019_SRAM_LEN )) { +/* SRAM contents for QCA4019 can be directly accessed and +* no conversions are required +*/ + val |= region; + }else { + val |=0x100000 | region; + } + +return val; +} +static const struct ath10k_hif_ops ath10k_ahb_hif_ops = { .tx_sg = ath10k_pci_hif_tx_sg, .diag_read = ath10k_pci_hif_diag_read,
@@ -766,6 +788,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev) ar_pci->mem_len = ar_ahb->mem_len; ar_pci->ar = ar; ar_pci->bus_ops = &ath10k_ahb_bus_ops; + ar_pci->targ_cpu_to_ce_addr = ath10k_ahb_qca4019_targ_cpu_to_ce_addr; ret =ath10k_pci_setup_resource (ar);if (ret) {
drivers/net/wireless/ath/ath10k/pci.c +32 -19
117 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/pci.h +5 -0
@@ -233,6 +233,11 @@ struct ath10k_pci {/* Chip specific pci full reset function */ int (*pci_hard_reset)(struct ath10k *ar); +/* chip specific methods for converting target CPU virtual address +* space to CE address space +*/ +u32 (*targ_cpu_to_ce_addr)(struct ath10k *ar,u32 addr); +/* Keep this entry in the last, memory for struct ath10k_ahb is * allocated (ahb support enabled case) in the continuation of * this struct.
Signature · 1 line
1.9.1
Quoted 9 lines · Ashok Raj Nagarajan
With QCA4019 platform, SRAM address can be accessed directly from host but currently, we are assuming sram addresses cannot be accessed directly and hence we convert the addresses.
While there, clean up growing hw checks during conversion of target CPU address to CE address. Now we have function pointer pertaining to different chips.
Signed-off-by Ashok Raj Nagarajan <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
7f622593cc5a ath10k: fix reading sram contents for QCA4019
Signature · 6 lines
https://patchwork.kernel.org/patch/9548043/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches