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

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;
 	default:
 		dev_err(dev->mt76.dev, "Failed to get patch semaphore\n");
 		return -EAGAIN;
-- 
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

             reply	other threads:[~2020-10-16  0:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16  0:26 sean.wang [this message]
2020-10-16  0:26 ` [PATCH 2/2] mt76: mt7663s: introduce WoW support via GPIO sean.wang
2020-10-16 15:45 ` [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd Lorenzo Bianconi
2020-10-16 23:14 ` 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=267346a9a9c5f71caec03292b6c33b39864b38c5.1602807276.git.objelf@gmail.com \
    --to=sean.wang@mediatek.com \
    --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 \
    /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).