mt76: report firmware version using ethtool

print fw_ver and build_ver members of struct mt76x02_fw_header, similarly
to what appears in the output of 'dmesg' when the MCU firmware is loaded.

Reported-by: Sid Hayn <[email protected]>
Signed-off-by: Davide Caratti <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Davide Caratti
2018-09-26 22:04:27 +02:00
committed by Felix Fietkau
parent 8cd4ecfa0e
commit 4f346379b3
5 changed files with 18 additions and 0 deletions
+13
View File
@@ -211,3 +211,16 @@ int mt76x02_mcu_cleanup(struct mt76_dev *dev)
return 0;
}
EXPORT_SYMBOL_GPL(mt76x02_mcu_cleanup);
void mt76x02_set_ethtool_fwver(struct mt76_dev *dev,
const struct mt76x02_fw_header *h)
{
u16 bld = le16_to_cpu(h->build_ver);
u16 ver = le16_to_cpu(h->fw_ver);
snprintf(dev->hw->wiphy->fw_version,
sizeof(dev->hw->wiphy->fw_version),
"%d.%d.%02d-b%x",
(ver >> 12) & 0xf, (ver >> 8) & 0xf, ver & 0xf, bld);
}
EXPORT_SYMBOL_GPL(mt76x02_set_ethtool_fwver);