mt76: mt7915: update mt7986 patch in mt7986_wmac_adie_patch_7976()

Update mt7976 adie patch for different adie version.

Reviewed-by: Ryder Lee <[email protected]>
Reviewed-by: Shayne Chen <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Peter Chiu
2022-05-05 12:52:34 +02:00
committed by Felix Fietkau
parent 747c70fc6c
commit e98f588150
2 changed files with 18 additions and 2 deletions
+1
View File
@@ -810,6 +810,7 @@ enum offs_rev {
/* ADIE */
#define MT_ADIE_CHIP_ID 0x02c
#define MT_ADIE_VERSION_MASK GENMASK(15, 0)
#define MT_ADIE_CHIP_ID_MASK GENMASK(31, 16)
#define MT_ADIE_IDX0 GENMASK(15, 0)
#define MT_ADIE_IDX1 GENMASK(31, 16)
+17 -2
View File
@@ -470,17 +470,32 @@ static int mt7986_wmac_adie_xtal_trim_7976(struct mt7915_dev *dev, u8 adie)
static int mt7986_wmac_adie_patch_7976(struct mt7915_dev *dev, u8 adie)
{
u32 id, version, rg_xo_01, rg_xo_03;
int ret;
ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_CHIP_ID, &id);
if (ret)
return ret;
version = FIELD_GET(MT_ADIE_VERSION_MASK, id);
ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_TOP_THADC, 0x4a563b00);
if (ret)
return ret;
ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_01, 0x1d59080f);
if (version == 0x8a00 || version == 0x8a10 || version == 0x8b00) {
rg_xo_01 = 0x1d59080f;
rg_xo_03 = 0x34c00fe0;
} else {
rg_xo_01 = 0x1959f80f;
rg_xo_03 = 0x34d00fe0;
}
ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_01, rg_xo_01);
if (ret)
return ret;
return mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_03, 0x34c00fe0);
return mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_03, rg_xo_03);
}
static int