All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mt76: use mt76_poll_msec routine in mt76pci_load_firmware()
       [not found] <cover.1521128408.git.lorenzo.bianconi@redhat.com>
@ 2018-03-15 17:24 ` Lorenzo Bianconi
  2018-03-27  9:10   ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2018-03-15 17:24 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless

Use mt76_poll_msec() in mt76pci_load_firmware to check if the firmware
has been started instead of explicitly poll MCU running register

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c
index 15820b11f9db..dfd36d736b06 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c
@@ -187,7 +187,7 @@ mt76pci_load_firmware(struct mt76x2_dev *dev)
 {
 	const struct firmware *fw;
 	const struct mt76x2_fw_header *hdr;
-	int i, len, ret;
+	int len, ret;
 	__le32 *cur;
 	u32 offset, val;
 
@@ -240,16 +240,7 @@ mt76pci_load_firmware(struct mt76x2_dev *dev)
 
 	/* trigger firmware */
 	mt76_wr(dev, MT_MCU_INT_LEVEL, 2);
-	for (i = 200; i > 0; i--) {
-		val = mt76_rr(dev, MT_MCU_COM_REG0);
-
-		if (val & 1)
-			break;
-
-		msleep(10);
-	}
-
-	if (!i) {
+	if (!mt76_poll_msec(dev, MT_MCU_COM_REG0, 1, 1, 200)) {
 		dev_err(dev->mt76.dev, "Firmware failed to start\n");
 		release_firmware(fw);
 		return -ETIMEDOUT;
-- 
2.14.3

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

* Re: mt76: use mt76_poll_msec routine in mt76pci_load_firmware()
  2018-03-15 17:24 ` [PATCH] mt76: use mt76_poll_msec routine in mt76pci_load_firmware() Lorenzo Bianconi
@ 2018-03-27  9:10   ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2018-03-27  9:10 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, linux-wireless

Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> Use mt76_poll_msec() in mt76pci_load_firmware to check if the firmware
> has been started instead of explicitly poll MCU running register
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Patch applied to wireless-drivers-next.git, thanks.

db2ad7c25a9a mt76: use mt76_poll_msec routine in mt76pci_load_firmware()

-- 
https://patchwork.kernel.org/patch/10285377/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2018-03-27  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1521128408.git.lorenzo.bianconi@redhat.com>
2018-03-15 17:24 ` [PATCH] mt76: use mt76_poll_msec routine in mt76pci_load_firmware() Lorenzo Bianconi
2018-03-27  9:10   ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.