developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From 90dfcdd20e564dc3b82342141dfd6917899b7b66 Mon Sep 17 00:00:00 2001 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 2 | From: "Henry.Yen" <henry.yen@mediatek.com> |
| 3 | Date: Mon, 11 Dec 2023 16:01:55 +0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 1039/1052] wifi: mt76: mt7915 add mt7981 efuse variants |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 5 | support |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 6 | |
| 7 | --- |
| 8 | mt7915/eeprom.c | 22 ++++++++++++++++++++++ |
| 9 | mt7915/mt7915.h | 7 ++++++- |
| 10 | 2 files changed, 28 insertions(+), 1 deletion(-) |
| 11 | |
| 12 | diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 13 | index 6133c200..df5e396c 100644 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 14 | --- a/mt7915/eeprom.c |
| 15 | +++ b/mt7915/eeprom.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 16 | @@ -193,6 +193,21 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev) |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 17 | return mt7915_check_eeprom(dev); |
| 18 | } |
| 19 | |
| 20 | +static int mt7915_eeprom_parse_efuse_hw_cap(struct mt7915_dev *dev) |
| 21 | +{ |
| 22 | +#define WTBL_SIZE_GROUP GENMASK(1, 0) |
| 23 | + u32 buf; |
| 24 | + int ret; |
| 25 | + |
| 26 | + ret = mt76_get_of_data_from_nvmem(&dev->mt76, &buf, "variant", 4); |
| 27 | + if (ret) |
| 28 | + return ret; |
| 29 | + |
| 30 | + dev->limited_wtbl_size = buf & WTBL_SIZE_GROUP; |
| 31 | + |
| 32 | + return 0; |
| 33 | +} |
| 34 | + |
| 35 | static void mt7915_eeprom_parse_band_config(struct mt7915_phy *phy) |
| 36 | { |
| 37 | struct mt7915_dev *dev = phy->dev; |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 38 | @@ -243,6 +258,13 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 39 | u8 path, nss, nss_max = 4, *eeprom = dev->mt76.eeprom.data; |
| 40 | struct mt76_phy *mphy = phy->mt76; |
| 41 | u8 band = phy->mt76->band_idx; |
| 42 | + int ret; |
| 43 | + |
| 44 | + if (is_mt7981(&dev->mt76)) { |
| 45 | + ret = mt7915_eeprom_parse_efuse_hw_cap(dev); |
| 46 | + if (ret) |
| 47 | + dev->limited_wtbl_size = true; |
| 48 | + } |
| 49 | |
| 50 | mt7915_eeprom_parse_band_config(phy); |
| 51 | |
| 52 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 53 | index 183d59da..c8f9ed52 100644 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 54 | --- a/mt7915/mt7915.h |
| 55 | +++ b/mt7915/mt7915.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 56 | @@ -424,6 +424,7 @@ struct mt7915_dev { |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 57 | |
| 58 | u32 hw_pattern; |
| 59 | |
| 60 | + bool limited_wtbl_size; |
| 61 | bool dbdc_support; |
| 62 | bool flash_mode; |
| 63 | bool bin_file_mode; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 64 | @@ -698,7 +699,11 @@ void mt7915_tm_rf_test_event(struct mt7915_dev *dev, struct sk_buff *skb); |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 65 | |
| 66 | static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev) |
| 67 | { |
| 68 | - return is_mt7915(&dev->mt76) ? MT7915_WTBL_SIZE : MT7916_WTBL_SIZE; |
| 69 | + if (is_mt7915(&dev->mt76) || |
| 70 | + (is_mt7981(&dev->mt76) && dev->limited_wtbl_size)) |
| 71 | + return MT7915_WTBL_SIZE; |
| 72 | + |
| 73 | + return MT7916_WTBL_SIZE; |
| 74 | } |
| 75 | |
| 76 | static inline u16 mt7915_eeprom_size(struct mt7915_dev *dev) |
| 77 | -- |
| 78 | 2.18.0 |
| 79 | |