developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 1 | From 81ddde34a61e2a320cf1af73cc91e0465e92cad8 Mon Sep 17 00:00:00 2001 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
developer | c9333e1 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 3 | Date: Thu, 30 Mar 2023 15:12:37 +0800 |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1023/1040] wifi: mt76: mt7915: add E3 re-bonding for low yield |
developer | da18a74 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 5 | rate issue |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 6 | |
| 7 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 8 | --- |
developer | c9333e1 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 9 | mt7915/eeprom.c | 28 ++++++++++++++++++++++++++++ |
| 10 | mt7915/mt7915.h | 1 + |
| 11 | 2 files changed, 29 insertions(+) |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 12 | |
| 13 | diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 14 | index fd08d42..3b44a9d 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 15 | --- a/mt7915/eeprom.c |
| 16 | +++ b/mt7915/eeprom.c |
developer | 7af0f76 | 2023-05-22 15:16:16 +0800 | [diff] [blame] | 17 | @@ -244,6 +244,32 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 18 | dev->chainshift = hweight8(dev->mphy.chainmask); |
| 19 | } |
| 20 | |
| 21 | +void mt7915_eeprom_rebonding(struct mt7915_dev *dev) |
| 22 | +{ |
| 23 | +#define MT7976_ADIE_MASK BIT(1) |
| 24 | +#define MT7986_ADIE1_EFFUSE_OFFSET 0x1000 |
| 25 | +#define MT7986_ADIE1_MT7976C_OFFSET 0x270 |
| 26 | +#define MT7986_ADIE1_E3_OFFSET 0x271 |
developer | c9333e1 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 27 | + u32 adie_offset, offset, sku = mt7915_check_adie(dev, true); |
| 28 | + u8 read_buf[MT7915_EEPROM_BLOCK_SIZE], *eeprom = dev->mt76.eeprom.data; |
| 29 | + |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 30 | + |
| 31 | + if (!(sku & MT7976_ADIE_MASK)) |
| 32 | + return; |
| 33 | + |
| 34 | + adie_offset = (sku == MT7976_DUAL_ADIE) ? MT7986_ADIE1_EFFUSE_OFFSET : 0; |
| 35 | + |
| 36 | + /* 7976 A-Die, To identify MT7976C */ |
developer | c9333e1 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 37 | + offset = MT7986_ADIE1_MT7976C_OFFSET + adie_offset; |
| 38 | + mt7915_mcu_get_eeprom(dev, offset, read_buf); |
| 39 | + eeprom[MT7986_ADIE1_MT7976C_OFFSET] = read_buf[offset % MT7915_EEPROM_BLOCK_SIZE]; |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 40 | + |
| 41 | + /* E3 re-binding */ |
developer | c9333e1 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 42 | + offset = MT7986_ADIE1_E3_OFFSET + adie_offset; |
| 43 | + mt7915_mcu_get_eeprom(dev, offset, read_buf); |
| 44 | + eeprom[MT7986_ADIE1_E3_OFFSET] = read_buf[offset % MT7915_EEPROM_BLOCK_SIZE]; |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 45 | +} |
| 46 | + |
| 47 | int mt7915_eeprom_init(struct mt7915_dev *dev) |
| 48 | { |
| 49 | int ret; |
developer | 7af0f76 | 2023-05-22 15:16:16 +0800 | [diff] [blame] | 50 | @@ -280,6 +306,8 @@ int mt7915_eeprom_init(struct mt7915_dev *dev) |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 51 | return ret; |
| 52 | } |
| 53 | |
| 54 | + mt7915_eeprom_rebonding(dev); |
| 55 | + |
| 56 | ret = mt7915_eeprom_load_precal(dev); |
| 57 | if (ret) |
| 58 | return ret; |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 59 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 60 | index febe070..a3d7b4b 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 61 | --- a/mt7915/mt7915.h |
| 62 | +++ b/mt7915/mt7915.h |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 63 | @@ -506,6 +506,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id); |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 64 | |
| 65 | int mt7915_register_device(struct mt7915_dev *dev); |
| 66 | void mt7915_unregister_device(struct mt7915_dev *dev); |
| 67 | +void mt7915_eeprom_rebonding(struct mt7915_dev *dev); |
| 68 | int mt7915_eeprom_init(struct mt7915_dev *dev); |
| 69 | void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, |
| 70 | struct mt7915_phy *phy); |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 71 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 72 | 2.18.0 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 73 | |