cxgb4: halt chip before flashing PHY firmware image

[ Upstream commit 6d297540f75d759489054e8b07932208fc4db2cb ]

When using firmware-assisted PHY firmware image write to flash,
halt the chip before beginning the flash write operation to allow
the running firmware to store the image persistently. Otherwise,
the running firmware will only store the PHY image in local on-chip
RAM, which will be lost after next reset.

Fixes: 4ee339e1e9 ("cxgb4: add support to flash PHY image")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Rahul Lakkireddy
2021-06-11 12:17:47 +05:30
committed by Greg Kroah-Hartman
parent b38ec782d0
commit 6392ed82ad

View File

@@ -1337,11 +1337,27 @@ static int cxgb4_ethtool_flash_phy(struct net_device *netdev,
return ret; return ret;
} }
ret = t4_load_phy_fw(adap, MEMWIN_NIC, NULL, data, size); /* We have to RESET the chip/firmware because we need the
if (ret) * chip in uninitialized state for loading new PHY image.
dev_err(adap->pdev_dev, "Failed to load PHY FW\n"); * Otherwise, the running firmware will only store the PHY
* image in local RAM which will be lost after next reset.
*/
ret = t4_fw_reset(adap, adap->mbox, PIORSTMODE_F | PIORST_F);
if (ret < 0) {
dev_err(adap->pdev_dev,
"Set FW to RESET for flashing PHY FW failed. ret: %d\n",
ret);
return ret;
}
return ret; ret = t4_load_phy_fw(adap, MEMWIN_NIC, NULL, data, size);
if (ret < 0) {
dev_err(adap->pdev_dev, "Failed to load PHY FW. ret: %d\n",
ret);
return ret;
}
return 0;
} }
static int cxgb4_ethtool_flash_fw(struct net_device *netdev, static int cxgb4_ethtool_flash_fw(struct net_device *netdev,