diff options
author | Davide Caratti <dcaratti@redhat.com> | 2018-09-20 15:30:56 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-10-01 13:34:11 +0300 |
commit | 22509324c51404658a2a6fcd4af5ef263ae45801 (patch) | |
tree | 427a6492e3ee1477e764c2cab79d4545d200f71e /drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c | |
parent | db6bb5c6c19451faa935934e6b45416fd7dd777a (diff) | |
download | linux-22509324c51404658a2a6fcd4af5ef263ae45801.tar.xz |
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 <sidhayn@gmail.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c index 5a2fba3462fd..6d565133b7af 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c @@ -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); |