linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Baochen Qiang <quic_bqiang@quicinc.com>
Cc: <ath11k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] wifi: ath11k: Implement sram dump interface
Date: Fri, 09 Sep 2022 13:48:41 +0300	[thread overview]
Message-ID: <87fsh0962e.fsf@kernel.org> (raw)
In-Reply-To: <20220802075533.1744-3-quic_bqiang@quicinc.com> (Baochen Qiang's message of "Tue, 2 Aug 2022 15:55:33 +0800")

Baochen Qiang <quic_bqiang@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@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

  reply	other threads:[~2022-09-09 10:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  7:55 [PATCH v2 0/2] wifi: ath11k: Add support for sram dump Baochen Qiang
2022-08-02  7:55 ` [PATCH v2 1/2] wifi: ath11k: Split PCI write/read functions Baochen Qiang
2022-09-09 10:42   ` Kalle Valo
2022-09-10  6:26   ` Kalle Valo
2022-08-02  7:55 ` [PATCH v2 2/2] wifi: ath11k: Implement sram dump interface Baochen Qiang
2022-09-09 10:48   ` Kalle Valo [this message]
2022-09-13  3:06     ` Baochen Qiang
2022-09-13  7:14       ` Kalle Valo
2022-09-13  7:32         ` Baochen Qiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsh0962e.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=ath11k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_bqiang@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).