18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * (c) Copyright 2002-2010, Ralink Technology, Inc. 48c2ecf20Sopenharmony_ci * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef _MT76X0_PHY_H_ 78c2ecf20Sopenharmony_ci#define _MT76X0_PHY_H_ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define RF_G_BAND 0x0100 108c2ecf20Sopenharmony_ci#define RF_A_BAND 0x0200 118c2ecf20Sopenharmony_ci#define RF_A_BAND_LB 0x0400 128c2ecf20Sopenharmony_ci#define RF_A_BAND_MB 0x0800 138c2ecf20Sopenharmony_ci#define RF_A_BAND_HB 0x1000 148c2ecf20Sopenharmony_ci#define RF_A_BAND_11J 0x2000 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define RF_BW_20 1 178c2ecf20Sopenharmony_ci#define RF_BW_40 2 188c2ecf20Sopenharmony_ci#define RF_BW_10 4 198c2ecf20Sopenharmony_ci#define RF_BW_80 8 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define MT_RF(bank, reg) ((bank) << 16 | (reg)) 228c2ecf20Sopenharmony_ci#define MT_RF_BANK(offset) ((offset) >> 16) 238c2ecf20Sopenharmony_ci#define MT_RF_REG(offset) ((offset) & 0xff) 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define MT_RF_VCO_BP_CLOSE_LOOP BIT(3) 268c2ecf20Sopenharmony_ci#define MT_RF_VCO_BP_CLOSE_LOOP_MASK GENMASK(3, 0) 278c2ecf20Sopenharmony_ci#define MT_RF_VCO_CAL_MASK GENMASK(2, 0) 288c2ecf20Sopenharmony_ci#define MT_RF_START_TIME 0x3 298c2ecf20Sopenharmony_ci#define MT_RF_START_TIME_MASK GENMASK(2, 0) 308c2ecf20Sopenharmony_ci#define MT_RF_SETTLE_TIME_MASK GENMASK(6, 4) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define MT_RF_PLL_DEN_MASK GENMASK(4, 0) 338c2ecf20Sopenharmony_ci#define MT_RF_PLL_K_MASK GENMASK(4, 0) 348c2ecf20Sopenharmony_ci#define MT_RF_SDM_RESET_MASK BIT(7) 358c2ecf20Sopenharmony_ci#define MT_RF_SDM_MASH_PRBS_MASK GENMASK(6, 2) 368c2ecf20Sopenharmony_ci#define MT_RF_SDM_BP_MASK BIT(1) 378c2ecf20Sopenharmony_ci#define MT_RF_ISI_ISO_MASK GENMASK(7, 6) 388c2ecf20Sopenharmony_ci#define MT_RF_PFD_DLY_MASK GENMASK(5, 4) 398c2ecf20Sopenharmony_ci#define MT_RF_CLK_SEL_MASK GENMASK(3, 2) 408c2ecf20Sopenharmony_ci#define MT_RF_XO_DIV_MASK GENMASK(1, 0) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistruct mt76x0_bbp_switch_item { 438c2ecf20Sopenharmony_ci u16 bw_band; 448c2ecf20Sopenharmony_ci struct mt76_reg_pair reg_pair; 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct mt76x0_rf_switch_item { 488c2ecf20Sopenharmony_ci u32 rf_bank_reg; 498c2ecf20Sopenharmony_ci u16 bw_band; 508c2ecf20Sopenharmony_ci u8 value; 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistruct mt76x0_freq_item { 548c2ecf20Sopenharmony_ci u8 channel; 558c2ecf20Sopenharmony_ci u32 band; 568c2ecf20Sopenharmony_ci u8 pllR37; 578c2ecf20Sopenharmony_ci u8 pllR36; 588c2ecf20Sopenharmony_ci u8 pllR35; 598c2ecf20Sopenharmony_ci u8 pllR34; 608c2ecf20Sopenharmony_ci u8 pllR33; 618c2ecf20Sopenharmony_ci u8 pllR32_b7b5; 628c2ecf20Sopenharmony_ci u8 pllR32_b4b0; /* PLL_DEN (Denomina - 8) */ 638c2ecf20Sopenharmony_ci u8 pllR31_b7b5; 648c2ecf20Sopenharmony_ci u8 pllR31_b4b0; /* PLL_K (Nominator *)*/ 658c2ecf20Sopenharmony_ci u8 pllR30_b7; /* sdm_reset_n */ 668c2ecf20Sopenharmony_ci u8 pllR30_b6b2; /* sdmmash_prbs,sin */ 678c2ecf20Sopenharmony_ci u8 pllR30_b1; /* sdm_bp */ 688c2ecf20Sopenharmony_ci u16 pll_n; /* R30<0>, R29<7:0> (hex) */ 698c2ecf20Sopenharmony_ci u8 pllR28_b7b6; /* isi,iso */ 708c2ecf20Sopenharmony_ci u8 pllR28_b5b4; /* pfd_dly */ 718c2ecf20Sopenharmony_ci u8 pllR28_b3b2; /* clksel option */ 728c2ecf20Sopenharmony_ci u32 pll_sdm_k; /* R28<1:0>, R27<7:0>, R26<7:0> (hex) SDM_k */ 738c2ecf20Sopenharmony_ci u8 pllR24_b1b0; /* xo_div */ 748c2ecf20Sopenharmony_ci}; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_cistruct mt76x0_rate_pwr_item { 778c2ecf20Sopenharmony_ci s8 mcs_power; 788c2ecf20Sopenharmony_ci u8 rf_pa_mode; 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistruct mt76x0_rate_pwr_tab { 828c2ecf20Sopenharmony_ci struct mt76x0_rate_pwr_item cck[4]; 838c2ecf20Sopenharmony_ci struct mt76x0_rate_pwr_item ofdm[8]; 848c2ecf20Sopenharmony_ci struct mt76x0_rate_pwr_item ht[8]; 858c2ecf20Sopenharmony_ci struct mt76x0_rate_pwr_item vht[10]; 868c2ecf20Sopenharmony_ci struct mt76x0_rate_pwr_item stbc[8]; 878c2ecf20Sopenharmony_ci struct mt76x0_rate_pwr_item mcs32; 888c2ecf20Sopenharmony_ci}; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#endif /* _MT76X0_PHY_H_ */ 91