developer | efb40c1 | 2022-12-21 18:05:47 +0800 | [diff] [blame] | 1 | From 6d47538ac0b3e34f8cda287e9666fc15842f1d0b Mon Sep 17 00:00:00 2001 |
developer | 2aa1e64 | 2022-12-19 11:33:22 +0800 | [diff] [blame] | 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Thu, 8 Dec 2022 15:54:19 +0800 |
| 4 | Subject: [PATCH 6/6] wifi: mt76: mt7915: add chip id condition in |
| 5 | mt7915_check_eeprom() |
| 6 | |
| 7 | When flash mode is enabled, and the eeprom data in the flash is not for |
| 8 | the current chipset, it'll still be checked valid, and the default |
| 9 | eeprom bin won't be loaded. |
| 10 | (e.g., mt7915 NIC inserted with mt7916 eeprom data in the flash.) |
| 11 | |
| 12 | Fix this kind of case by adding chip id into consideration in |
| 13 | mt7915_check_eeprom(). |
| 14 | |
| 15 | Reported-by: Cheng-Ji Li <cheng-ji.li@mediatek.com> |
| 16 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 17 | --- |
| 18 | mt7915/eeprom.c | 5 ++++- |
| 19 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 20 | |
| 21 | diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c |
| 22 | index 24efa28..a796289 100644 |
| 23 | --- a/mt7915/eeprom.c |
| 24 | +++ b/mt7915/eeprom.c |
| 25 | @@ -33,11 +33,14 @@ static int mt7915_check_eeprom(struct mt7915_dev *dev) |
| 26 | u8 *eeprom = dev->mt76.eeprom.data; |
| 27 | u16 val = get_unaligned_le16(eeprom); |
| 28 | |
| 29 | +#define CHECK_EEPROM_ERR(match) (match ? 0 : -EINVAL) |
| 30 | switch (val) { |
| 31 | case 0x7915: |
| 32 | + return CHECK_EEPROM_ERR(is_mt7915(&dev->mt76)); |
| 33 | case 0x7916: |
| 34 | + return CHECK_EEPROM_ERR(is_mt7916(&dev->mt76)); |
| 35 | case 0x7986: |
| 36 | - return 0; |
| 37 | + return CHECK_EEPROM_ERR(is_mt7986(&dev->mt76)); |
| 38 | default: |
| 39 | return -EINVAL; |
| 40 | } |
| 41 | -- |
| 42 | 2.36.1 |
| 43 | |