Skip to contentSkip to conversation

mt76: use mt76_poll_msec routine in mt76pci_load_firmware()

PATCH In review Lorenzo Bianconi 2 participants 2 messages Mar 15, 2018 – Mar 27, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 mt76: use mt76_poll_msec routine in mt76pci_load_firmware()

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

---
 drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c +2 -11
index 15820b11f9db..dfd36d736b06 100644
@@ -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;
Signature · 1 line
2.14.3
#2 lore raw
Quoted 4 lines · Lorenzo Bianconi

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

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

db2ad7c25a9a mt76: use mt76_poll_msec routine in mt76pci_load_firmware()

Signature · 3 lines
https://patchwork.kernel.org/patch/10285377/

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