linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sean.wang@mediatek.com
Cc: ryder.lee@mediatek.com, Sean Wang <objelf@gmail.com>,
	linux-wireless@vger.kernel.org, YN Chen <YN.Chen@mediatek.com>,
	linux-mediatek@lists.infradead.org, lorenzo.bianconi@redhat.com,
	nbd@nbd.name
Subject: Re: [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd
Date: Fri, 16 Oct 2020 17:45:56 +0200	[thread overview]
Message-ID: <20201016154556.GA700952@lore-desk> (raw)
In-Reply-To: <267346a9a9c5f71caec03292b6c33b39864b38c5.1602807276.git.objelf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1647 bytes --]

> From: Sean Wang <objelf@gmail.com>
> 
> Just follow up vendor driver to retry a few times obtaining patch
> semaphore when the event is PATCH_NOT_DL_SEM_FAIL. That usually
> happens in Bluetooth and Wifi driver contends to download patch
> simultaneously.
> 
> Co-developed-by: YN Chen <YN.Chen@mediatek.com>
> Signed-off-by: YN Chen <YN.Chen@mediatek.com>
> Signed-off-by:  Sean Wang <sean.wang@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 2b17bd1c2a32..c990ccd6f472 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -1945,14 +1945,21 @@ static int mt7615_load_patch(struct mt7615_dev *dev, u32 addr, const char *name)
>  {
>  	const struct mt7615_patch_hdr *hdr;
>  	const struct firmware *fw = NULL;
> -	int len, ret, sem;
> +	int len, ret, sem, c = 50;
>  
> +retry:
>  	sem = mt7615_mcu_patch_sem_ctrl(dev, 1);
>  	switch (sem) {
>  	case PATCH_IS_DL:
>  		return 0;
>  	case PATCH_NOT_DL_SEM_SUCCESS:
>  		break;
> +	case PATCH_NOT_DL_SEM_FAIL:
> +		if (is_mt7663(&dev->mt76) && c--) {
> +			msleep(100);
> +			goto retry;
> +		}
> +		fallthrough;

I guess it is more clear to have a dedicated routine for this. E.g:

int mt7615_mcu_get_patch_semaphore()
{
	....
}

Regards,
Lorenzo

>  	default:
>  		dev_err(dev->mt76.dev, "Failed to get patch semaphore\n");
>  		return -EAGAIN;
> -- 
> 2.25.1

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  parent reply	other threads:[~2020-10-16 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16  0:26 [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd sean.wang
2020-10-16  0:26 ` [PATCH 2/2] mt76: mt7663s: introduce WoW support via GPIO sean.wang
2020-10-16 15:45 ` Lorenzo Bianconi [this message]
2020-10-16 23:14 ` [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd Ryder Lee

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=20201016154556.GA700952@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=YN.Chen@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=objelf@gmail.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.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).