developer | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 1 | From 6256e5a3577ddf726a30774b2366e7ccf098031a Mon Sep 17 00:00:00 2001 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
developer | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 3 | Date: Thu, 30 Mar 2023 15:12:37 +0800 |
developer | 78848c6 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1025/1031] wifi: mt76: mt7915: add E3 re-bonding for low yield |
| 5 | rate issue |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 6 | |
| 7 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 8 | --- |
developer | ae9afc0 | 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 | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 12 | |
| 13 | diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c |
developer | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 14 | index 612be3f..c6d8ca1 100644 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 15 | --- a/mt7915/eeprom.c |
| 16 | +++ b/mt7915/eeprom.c |
developer | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 17 | @@ -239,6 +239,32 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, |
developer | 6a1998b | 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 | ae9afc0 | 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 | 6a1998b | 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 | ae9afc0 | 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 | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 40 | + |
| 41 | + /* E3 re-binding */ |
developer | ae9afc0 | 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 | 6a1998b | 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 | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 50 | @@ -275,6 +301,8 @@ int mt7915_eeprom_init(struct mt7915_dev *dev) |
developer | 6a1998b | 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 | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 59 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 60 | index 73bc030..5999134 100644 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 61 | --- a/mt7915/mt7915.h |
| 62 | +++ b/mt7915/mt7915.h |
developer | b885304 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 63 | @@ -558,6 +558,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id); |
developer | 6a1998b | 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 | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 71 | -- |
developer | ae9afc0 | 2023-04-06 18:07:42 +0800 | [diff] [blame] | 72 | 2.18.0 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 73 | |