Lines Matching refs:adie

42 mt76_wmac_spi_read(struct mt7915_dev *dev, u8 adie, u32 addr, u32 *val)  in mt76_wmac_spi_read()  argument
49 dev, MT_TOP_SPI_BUSY_CR(adie)); in mt76_wmac_spi_read()
53 mt76_wr(dev, MT_TOP_SPI_ADDR_CR(adie), in mt76_wmac_spi_read()
55 mt76_wr(dev, MT_TOP_SPI_WRITE_DATA_CR(adie), 0); in mt76_wmac_spi_read()
59 dev, MT_TOP_SPI_BUSY_CR(adie)); in mt76_wmac_spi_read()
63 *val = mt76_rr(dev, MT_TOP_SPI_READ_DATA_CR(adie)); in mt76_wmac_spi_read()
69 mt76_wmac_spi_write(struct mt7915_dev *dev, u8 adie, u32 addr, u32 val) in mt76_wmac_spi_write() argument
76 dev, MT_TOP_SPI_BUSY_CR(adie)); in mt76_wmac_spi_write()
80 mt76_wr(dev, MT_TOP_SPI_ADDR_CR(adie), in mt76_wmac_spi_write()
82 mt76_wr(dev, MT_TOP_SPI_WRITE_DATA_CR(adie), val); in mt76_wmac_spi_write()
86 dev, MT_TOP_SPI_BUSY_CR(adie)); in mt76_wmac_spi_write()
90 mt76_wmac_spi_rmw(struct mt7915_dev *dev, u8 adie, in mt76_wmac_spi_rmw() argument
95 ret = mt76_wmac_spi_read(dev, adie, addr, &cur); in mt76_wmac_spi_rmw()
102 return mt76_wmac_spi_write(dev, adie, addr, cur); in mt76_wmac_spi_rmw()
106 mt7986_wmac_adie_efuse_read(struct mt7915_dev *dev, u8 adie, in mt7986_wmac_adie_efuse_read() argument
112 ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_EFUSE_CFG, in mt7986_wmac_adie_efuse_read()
117 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_EFUSE2_CTRL, BIT(30), 0x0); in mt7986_wmac_adie_efuse_read()
126 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_EFUSE2_CTRL, mask, val); in mt7986_wmac_adie_efuse_read()
133 dev, adie, MT_ADIE_EFUSE2_CTRL, &val); in mt7986_wmac_adie_efuse_read()
137 ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_EFUSE2_CTRL, &val); in mt7986_wmac_adie_efuse_read()
142 ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_EFUSE_RDATA0, in mt7986_wmac_adie_efuse_read()
367 static inline u16 mt7986_adie_idx(u8 adie, u32 adie_type) in mt7986_adie_idx() argument
369 if (adie == 0) in mt7986_adie_idx()
375 static inline bool is_7975(struct mt7915_dev *dev, u8 adie, u32 adie_type) in is_7975() argument
377 return mt7986_adie_idx(adie, adie_type) == 0x7975; in is_7975()
380 static inline bool is_7976(struct mt7915_dev *dev, u8 adie, u32 adie_type) in is_7976() argument
382 return mt7986_adie_idx(adie, adie_type) == 0x7976; in is_7976()
385 static int mt7986_wmac_adie_thermal_cal(struct mt7915_dev *dev, u8 adie) in mt7986_wmac_adie_thermal_cal() argument
390 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_THADC_ANALOG, in mt7986_wmac_adie_thermal_cal()
394 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC_BG, in mt7986_wmac_adie_thermal_cal()
401 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC, in mt7986_wmac_adie_thermal_cal()
408 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_THADC_SLOP, in mt7986_wmac_adie_thermal_cal()
413 return mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC, in mt7986_wmac_adie_thermal_cal()
422 mt7986_read_efuse_xo_trim_7976(struct mt7915_dev *dev, u8 adie, in mt7986_read_efuse_xo_trim_7976() argument
429 ret = mt7986_wmac_adie_efuse_read(dev, adie, addr, &data); in mt7986_read_efuse_xo_trim_7976()
439 ret = mt7986_wmac_adie_efuse_read(dev, adie, addr, &data); in mt7986_read_efuse_xo_trim_7976()
455 static int mt7986_wmac_adie_xtal_trim_7976(struct mt7915_dev *dev, u8 adie) in mt7986_wmac_adie_xtal_trim_7976() argument
460 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_XO_TRIM_FLOW, in mt7986_wmac_adie_xtal_trim_7976()
465 ret = mt7986_read_efuse_xo_trim_7976(dev, adie, false, &trim_80m); in mt7986_wmac_adie_xtal_trim_7976()
469 ret = mt7986_read_efuse_xo_trim_7976(dev, adie, true, &trim_40m); in mt7986_wmac_adie_xtal_trim_7976()
473 ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_RG_STRAP_PIN_IN, &val); in mt7986_wmac_adie_xtal_trim_7976()
479 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_XTAL_C1, in mt7986_wmac_adie_xtal_trim_7976()
485 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_XTAL_C2, in mt7986_wmac_adie_xtal_trim_7976()
489 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_XTAL_C1, in mt7986_wmac_adie_xtal_trim_7976()
495 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_XTAL_C2, in mt7986_wmac_adie_xtal_trim_7976()
503 static int mt798x_wmac_adie_patch_7976(struct mt7915_dev *dev, u8 adie) in mt798x_wmac_adie_patch_7976() argument
508 ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_CHIP_ID, &id); in mt798x_wmac_adie_patch_7976()
514 ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_TOP_THADC, 0x4a563b00); in mt798x_wmac_adie_patch_7976()
534 ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_01, rg_xo_01); in mt798x_wmac_adie_patch_7976()
538 return mt76_wmac_spi_write(dev, adie, MT_ADIE_RG_XO_03, rg_xo_03); in mt798x_wmac_adie_patch_7976()
542 mt7986_read_efuse_xo_trim_7975(struct mt7915_dev *dev, u8 adie, in mt7986_read_efuse_xo_trim_7975() argument
548 ret = mt7986_wmac_adie_efuse_read(dev, adie, addr, &data); in mt7986_read_efuse_xo_trim_7975()
564 static int mt7986_wmac_adie_xtal_trim_7975(struct mt7915_dev *dev, u8 adie) in mt7986_wmac_adie_xtal_trim_7975() argument
569 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_7975_XTAL_EN, in mt7986_wmac_adie_xtal_trim_7975()
574 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_7975_XTAL_CAL, in mt7986_wmac_adie_xtal_trim_7975()
582 ret = mt7986_read_efuse_xo_trim_7975(dev, adie, MT_ADIE_7975_XO_TRIM2, in mt7986_wmac_adie_xtal_trim_7975()
587 ret = mt7986_read_efuse_xo_trim_7975(dev, adie, MT_ADIE_7975_XO_TRIM3, in mt7986_wmac_adie_xtal_trim_7975()
592 ret = mt7986_read_efuse_xo_trim_7975(dev, adie, MT_ADIE_7975_XO_TRIM4, in mt7986_wmac_adie_xtal_trim_7975()
600 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_7975_XO_CTRL2, in mt7986_wmac_adie_xtal_trim_7975()
605 ret = mt76_wmac_spi_read(dev, adie, MT_ADIE_7975_XTAL, &value); in mt7986_wmac_adie_xtal_trim_7975()
610 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_7975_XO_2, in mt7986_wmac_adie_xtal_trim_7975()
616 return mt76_wmac_spi_rmw(dev, adie, MT_ADIE_7975_XO_CTRL6, in mt7986_wmac_adie_xtal_trim_7975()
620 static int mt7986_wmac_adie_patch_7975(struct mt7915_dev *dev, u8 adie) in mt7986_wmac_adie_patch_7975() argument
625 ret = mt76_wmac_spi_write(dev, adie, 0x348, 0x00000002); in mt7986_wmac_adie_patch_7975()
629 ret = mt76_wmac_spi_write(dev, adie, 0x378, 0x00000002); in mt7986_wmac_adie_patch_7975()
633 ret = mt76_wmac_spi_write(dev, adie, 0x3a8, 0x00000002); in mt7986_wmac_adie_patch_7975()
637 ret = mt76_wmac_spi_write(dev, adie, 0x3d8, 0x00000002); in mt7986_wmac_adie_patch_7975()
642 ret = mt76_wmac_spi_write(dev, adie, 0xa1c, 0x30000aaa); in mt7986_wmac_adie_patch_7975()
647 ret = mt76_wmac_spi_write(dev, adie, 0xa84, 0x8470008a); in mt7986_wmac_adie_patch_7975()
653 ret = mt76_wmac_spi_write(dev, adie, 0x074, 0x00000007); in mt7986_wmac_adie_patch_7975()
655 ret = mt76_wmac_spi_write(dev, adie, 0x074, 0x00000002); in mt7986_wmac_adie_patch_7975()
665 ret = mt76_wmac_spi_write(dev, adie, 0xaa4, 0x01001fc0); in mt7986_wmac_adie_patch_7975()
670 ret = mt76_wmac_spi_write(dev, adie, 0x070, 0x00000005); in mt7986_wmac_adie_patch_7975()
675 ret = mt76_wmac_spi_write(dev, adie, 0x344, 0x00000088); in mt7986_wmac_adie_patch_7975()
679 ret = mt76_wmac_spi_write(dev, adie, 0x374, 0x00000088); in mt7986_wmac_adie_patch_7975()
683 ret = mt76_wmac_spi_write(dev, adie, 0x3a4, 0x00000088); in mt7986_wmac_adie_patch_7975()
687 ret = mt76_wmac_spi_write(dev, adie, 0x3d4, 0x00000088); in mt7986_wmac_adie_patch_7975()
692 ret = mt76_wmac_spi_write(dev, adie, 0xa80, 0x44d07000); in mt7986_wmac_adie_patch_7975()
697 ret = mt76_wmac_spi_write(dev, adie, 0xa88, 0x3900aaaa); in mt7986_wmac_adie_patch_7975()
702 ret = mt76_wmac_spi_write(dev, adie, 0x2c4, 0x00000000); in mt7986_wmac_adie_patch_7975()
708 return mt76_wmac_spi_write(dev, adie, 0x2c8, 0x00000072); in mt7986_wmac_adie_patch_7975()
713 static int mt7986_wmac_adie_cfg(struct mt7915_dev *dev, u8 adie, u32 adie_type) in mt7986_wmac_adie_cfg() argument
718 ret = mt76_wmac_spi_write(dev, adie, MT_ADIE_CLK_EN, ~0); in mt7986_wmac_adie_cfg()
722 if (is_7975(dev, adie, adie_type)) { in mt7986_wmac_adie_cfg()
723 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_7975_COCLK, in mt7986_wmac_adie_cfg()
728 ret = mt7986_wmac_adie_thermal_cal(dev, adie); in mt7986_wmac_adie_cfg()
732 ret = mt7986_wmac_adie_xtal_trim_7975(dev, adie); in mt7986_wmac_adie_cfg()
736 ret = mt7986_wmac_adie_patch_7975(dev, adie); in mt7986_wmac_adie_cfg()
737 } else if (is_7976(dev, adie, adie_type)) { in mt7986_wmac_adie_cfg()
739 ret = mt76_wmac_spi_write(dev, adie, in mt7986_wmac_adie_cfg()
745 ret = mt7986_wmac_adie_thermal_cal(dev, adie); in mt7986_wmac_adie_cfg()
749 ret = mt7986_wmac_adie_xtal_trim_7976(dev, adie); in mt7986_wmac_adie_cfg()
753 ret = mt798x_wmac_adie_patch_7976(dev, adie); in mt7986_wmac_adie_cfg()
762 mt7986_wmac_afe_cal(struct mt7915_dev *dev, u8 adie, bool dbdc, u32 adie_type) in mt7986_wmac_afe_cal() argument
769 if (is_7975(dev, adie, adie_type)) in mt7986_wmac_afe_cal()
770 ret = mt76_wmac_spi_write(dev, adie, in mt7986_wmac_afe_cal()
774 ret = mt76_wmac_spi_write(dev, adie, in mt7986_wmac_afe_cal()
780 idx = dbdc ? ADIE_DBDC : adie; in mt7986_wmac_afe_cal()
812 ret = mt76_wmac_spi_write(dev, adie, MT_AFE_RG_ENCAL_WBTAC_IF_SW, in mt7986_wmac_afe_cal()
1051 mt7986_wmac_adie_setup(struct mt7915_dev *dev, u8 adie, u32 adie_type) in mt7986_wmac_adie_setup() argument
1055 if (!(is_7975(dev, adie, adie_type) || is_7976(dev, adie, adie_type))) in mt7986_wmac_adie_setup()
1058 ret = mt7986_wmac_adie_cfg(dev, adie, adie_type); in mt7986_wmac_adie_setup()
1062 ret = mt7986_wmac_afe_cal(dev, adie, false, adie_type); in mt7986_wmac_adie_setup()
1066 if (!adie && (mt798x_wmac_check_adie_type(dev) == ADIE_DBDC)) in mt7986_wmac_adie_setup()
1067 ret = mt7986_wmac_afe_cal(dev, adie, true, adie_type); in mt7986_wmac_adie_setup()