[PATCH v2 2/2] wifi: ath11k: Implement sram dump interface
Kalle Valo
kvalo at kernel.org
Fri Sep 9 03:48:41 PDT 2022
Baochen Qiang <quic_bqiang at quicinc.com> writes:
> Currently this feature is enabled for QCA6390/WCN6855.
>
> Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
>
> Signed-off-by: Baochen Qiang <quic_bqiang at quicinc.com>
I did quite a few changes to this patch in the pending branch, please
check my changes:
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=074477aacb419493da6fb4d96fa9d12390c3b40e
I improved the commit log.
> --- a/drivers/net/wireless/ath/ath11k/hw.h
> +++ b/drivers/net/wireless/ath/ath11k/hw.h
> @@ -126,6 +126,11 @@ struct ath11k_hw_hal_params {
> enum hal_rx_buf_return_buf_manager rx_buf_rbm;
> };
>
> +struct ath11k_hw_sram_dump {
> + u32 start;
> + u32 end;
> +};
> +
> struct ath11k_hw_params {
> const char *name;
> u16 hw_rev;
> @@ -200,6 +205,7 @@ struct ath11k_hw_params {
> bool hybrid_bus_type;
> bool fixed_fw_mem;
> bool support_off_channel_tx;
> + const struct ath11k_hw_sram_dump *sram_dump;
> };
Instead of separate structures I used inline structures:
.sram_dump = {
.start = 0x01400000,
.end = 0x0177ffff,
},
> --- a/drivers/net/wireless/ath/ath11k/pcic.c
> +++ b/drivers/net/wireless/ath/ath11k/pcic.c
> @@ -203,6 +203,35 @@ u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset)
> }
> EXPORT_SYMBOL(ath11k_pcic_read32);
>
> +int ath11k_pcic_dump_sram(struct ath11k_base *ab, u8 *buf,
> + u32 start, u32 end)
> +{
> + int ret = 0;
> + bool wakeup_required;
> + u32 *data = (u32 *)buf;
I changed buf to a void pointer, then the cast is not needed.
> + u32 i;
> +
> + /* for offset beyond BAR + 4K - 32, may
> + * need to wakeup the device to access.
> + */
> + wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) &&
> + end >= ATH11K_PCI_ACCESS_ALWAYS_OFF;
> + if (wakeup_required && ab->pci.ops->wakeup) {
> + ret = ab->pci.ops->wakeup(ab);
> + if (ret)
> + ath11k_warn(ab, "%s: failed to do wakeup: %d\n", __func__, ret);
> + }
I changed the error handling so that if wakeup() fails we do not
continue and just return an error.
> + for (i = start; i < end + 1; i += 4)
> + *data++ = ath11k_pcic_do_read32(ab, i);
> +
> + if (wakeup_required && !ret && ab->pci.ops->release)
> + ab->pci.ops->release(ab);
At the same time I removed the ret check here.
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(ath11k_pcic_dump_sram);
I renamed this to ath11k_pcic_read() as I feel it's more descriptive
what the function really does. It's not really care is this for sram
dump or something else.
I also renamed hif.h interface to ath11k_hif_read().
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
More information about the ath11k
mailing list