Restart the MCU and poll FW state to ensure correct MCU status
before downloading the ROM patch.
This is a prerequisite for enabling MT7902 PCIe and has been
validated on MT7921 and MT7925 since they share the common code path.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-7-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
{
int ret;
+ mt76_connac_mcu_restart(&dev->mt76);
+
+ if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC_FW_STATE,
+ MT_TOP_MISC2_FW_PWR_ON, 1000))
+ dev_warn(dev->mt76.dev,
+ "MCU is not ready for firmware download\n");
+
ret = mt76_connac2_load_patch(&dev->mt76, mt792x_patch_name(dev));
if (ret)
return ret;