linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd
@ 2020-10-16  0:26 sean.wang
  2020-10-16  0:26 ` [PATCH 2/2] mt76: mt7663s: introduce WoW support via GPIO sean.wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sean.wang @ 2020-10-16  0:26 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: ryder.lee, Sean Wang, sean.wang, linux-wireless, YN Chen, linux-mediatek

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-16 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd Lorenzo Bianconi
2020-10-16 23:14 ` Ryder Lee

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).