#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/bitops.h>
#include <brcm_hw_ids.h>
#include <chipcommon.h>
#include <aiutils.h>
#include <d11.h>
#include <phy_shim.h>
#include "phy_hal.h"
#include "phy_int.h"
#include "phy_radio.h"
#include "phy_lcn.h"
#include "phyreg_n.h"
#define VALID_N_RADIO(radioid) …
#define VALID_LCN_RADIO(radioid) …
#define VALID_RADIO(pi, radioid) …
#define MUX(pred, true, false) …
#define MODINC(x, bound) …
#define MODDEC_POW2(x, bound) …
#define MODINC_POW2(x, bound) …
struct chan_info_basic { … };
static const struct chan_info_basic chan_info_all[] = …;
static const u8 ofdm_rate_lookup[] = …;
#define PHY_WREG_LIMIT …
void wlc_phyreg_enter(struct brcms_phy_pub *pih)
{ … }
void wlc_phyreg_exit(struct brcms_phy_pub *pih)
{ … }
void wlc_radioreg_enter(struct brcms_phy_pub *pih)
{ … }
void wlc_radioreg_exit(struct brcms_phy_pub *pih)
{ … }
u16 read_radio_reg(struct brcms_phy *pi, u16 addr)
{ … }
void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
{ … }
static u32 read_radio_id(struct brcms_phy *pi)
{ … }
void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
{ … }
void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
{ … }
void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask)
{ … }
void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val)
{ … }
void write_phy_channel_reg(struct brcms_phy *pi, uint val)
{ … }
u16 read_phy_reg(struct brcms_phy *pi, u16 addr)
{ … }
void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
{ … }
void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
{ … }
void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
{ … }
void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val)
{ … }
static void wlc_set_phy_uninitted(struct brcms_phy *pi)
{ … }
struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
{ … }
static void wlc_phy_timercb_phycal(void *ptr)
{ … }
static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi)
{ … }
struct brcms_phy_pub *
wlc_phy_attach(struct shared_phy *sh, struct bcma_device *d11core,
int bandtype, struct wiphy *wiphy)
{ … }
void wlc_phy_detach(struct brcms_phy_pub *pih)
{ … }
bool
wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype, u16 *phyrev,
u16 *radioid, u16 *radiover)
{ … }
bool wlc_phy_get_encore(struct brcms_phy_pub *pih)
{ … }
u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih)
{ … }
void wlc_phy_anacore(struct brcms_phy_pub *pih, bool on)
{ … }
u32 wlc_phy_clk_bwbits(struct brcms_phy_pub *pih)
{ … }
void wlc_phy_por_inform(struct brcms_phy_pub *ppi)
{ … }
void wlc_phy_edcrs_lock(struct brcms_phy_pub *pih, bool lock)
{ … }
void wlc_phy_initcal_enable(struct brcms_phy_pub *pih, bool initcal)
{ … }
void wlc_phy_hw_clk_state_upd(struct brcms_phy_pub *pih, bool newstate)
{ … }
void wlc_phy_hw_state_upd(struct brcms_phy_pub *pih, bool newstate)
{ … }
void wlc_phy_init(struct brcms_phy_pub *pih, u16 chanspec)
{ … }
void wlc_phy_cal_init(struct brcms_phy_pub *pih)
{ … }
int wlc_phy_down(struct brcms_phy_pub *pih)
{ … }
void
wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
u16 tblAddr, u16 tblDataHi, u16 tblDataLo)
{ … }
void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val)
{ … }
void
wlc_phy_write_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
u16 tblAddr, u16 tblDataHi, u16 tblDataLo)
{ … }
void
wlc_phy_read_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
u16 tblAddr, u16 tblDataHi, u16 tblDataLo)
{ … }
uint
wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi,
struct radio_20xx_regs *radioregs)
{ … }
uint
wlc_phy_init_radio_regs(struct brcms_phy *pi,
const struct radio_regs *radioregs,
u16 core_offset)
{ … }
void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on)
{ … }
void wlc_phy_hold_upd(struct brcms_phy_pub *pih, u32 id, bool set)
{ … }
void wlc_phy_mute_upd(struct brcms_phy_pub *pih, bool mute, u32 flags)
{ … }
void wlc_phy_clear_tssi(struct brcms_phy_pub *pih)
{ … }
static bool wlc_phy_cal_txpower_recalc_sw(struct brcms_phy *pi)
{ … }
void wlc_phy_switch_radio(struct brcms_phy_pub *pih, bool on)
{ … }
u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi)
{ … }
void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw)
{ … }
void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, u16 newch)
{ … }
u16 wlc_phy_chanspec_get(struct brcms_phy_pub *ppi)
{ … }
void wlc_phy_chanspec_set(struct brcms_phy_pub *ppi, u16 chanspec)
{ … }
int wlc_phy_chanspec_freq2bandrange_lpssn(uint freq)
{ … }
int wlc_phy_chanspec_bandrange_get(struct brcms_phy *pi, u16 chanspec)
{ … }
void wlc_phy_chanspec_ch14_widefilter_set(struct brcms_phy_pub *ppi,
bool wide_filter)
{ … }
int wlc_phy_channel2freq(uint channel)
{ … }
void
wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band,
struct brcms_chanvec *channels)
{ … }
u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band)
{ … }
int wlc_phy_txpower_get(struct brcms_phy_pub *ppi, uint *qdbm, bool *override)
{ … }
void wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi,
struct txpwr_limits *txpwr)
{ … }
int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override)
{ … }
void
wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint channel, u8 *min_pwr,
u8 *max_pwr, int txp_rate_idx)
{ … }
void
wlc_phy_txpower_sromlimit_max_get(struct brcms_phy_pub *ppi, uint chan,
u8 *max_txpwr, u8 *min_txpwr)
{ … }
void
wlc_phy_txpower_boardlimit_band(struct brcms_phy_pub *ppi, uint bandunit,
s32 *max_pwr, s32 *min_pwr, u32 *step_pwr)
{ … }
u8 wlc_phy_txpower_get_target_min(struct brcms_phy_pub *ppi)
{ … }
u8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi)
{ … }
static s8 wlc_phy_env_measure_vbat(struct brcms_phy *pi)
{ … }
static s8 wlc_phy_env_measure_temperature(struct brcms_phy *pi)
{ … }
static void wlc_phy_upd_env_txpwr_rate_limits(struct brcms_phy *pi, u32 band)
{ … }
static s8
wlc_user_txpwr_antport_to_rfport(struct brcms_phy *pi, uint chan, u32 band,
u8 rate)
{ … }
void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
{ … }
static void
wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr,
u16 chanspec)
{ … }
void wlc_phy_txpwr_percent_set(struct brcms_phy_pub *ppi, u8 txpwr_percent)
{ … }
void wlc_phy_machwcap_set(struct brcms_phy_pub *ppi, u32 machwcap)
{ … }
void wlc_phy_runbist_config(struct brcms_phy_pub *ppi, bool start_end)
{ … }
void
wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, struct txpwr_limits *txpwr,
u16 chanspec)
{ … }
void wlc_phy_ofdm_rateset_war(struct brcms_phy_pub *pih, bool war)
{ … }
void wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, bool bf_preempt)
{ … }
void wlc_phy_txpower_update_shm(struct brcms_phy *pi)
{ … }
bool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi)
{ … }
void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, bool hwpwrctrl)
{ … }
void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi)
{ … }
static u32 wlc_phy_txpower_est_power_nphy(struct brcms_phy *pi)
{ … }
void
wlc_phy_txpower_get_current(struct brcms_phy_pub *ppi, struct tx_power *power,
uint channel)
{ … }
void wlc_phy_antsel_type_set(struct brcms_phy_pub *ppi, u8 antsel_type)
{ … }
bool wlc_phy_test_ison(struct brcms_phy_pub *ppi)
{ … }
void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val)
{ … }
static bool
wlc_phy_noise_calc_phy(struct brcms_phy *pi, u32 *cmplx_pwr, s8 *pwr_ant)
{ … }
static void wlc_phy_noise_cb(struct brcms_phy *pi, u8 channel, s8 noise_dbm)
{ … }
static s8 wlc_phy_noise_read_shmem(struct brcms_phy *pi)
{ … }
void wlc_phy_noise_sample_intr(struct brcms_phy_pub *pih)
{ … }
static void
wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason, u8 ch)
{ … }
void wlc_phy_noise_sample_request_external(struct brcms_phy_pub *pih)
{ … }
static const s8 lcnphy_gain_index_offset_for_pkt_rssi[] = …;
void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core)
{ … }
int wlc_phy_rssi_compute(struct brcms_phy_pub *pih,
struct d11rxhdr *rxh)
{ … }
void wlc_phy_freqtrack_start(struct brcms_phy_pub *pih)
{ … }
void wlc_phy_freqtrack_end(struct brcms_phy_pub *pih)
{ … }
void wlc_phy_set_deaf(struct brcms_phy_pub *ppi, bool user_flag)
{ … }
void wlc_phy_watchdog(struct brcms_phy_pub *pih)
{ … }
void wlc_phy_BSSinit(struct brcms_phy_pub *pih, bool bonlyap, int rssi)
{ … }
void
wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, s32 *eps_imag)
{ … }
void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi)
{ … }
static void
wlc_phy_cal_perical_mphase_schedule(struct brcms_phy *pi, uint delay)
{ … }
void wlc_phy_cal_perical(struct brcms_phy_pub *pih, u8 reason)
{ … }
void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi)
{ … }
u8 wlc_phy_nbits(s32 value)
{ … }
void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
{ … }
void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
{ … }
void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, u8 *rxchain)
{ … }
u8 wlc_phy_stf_chain_active_get(struct brcms_phy_pub *pih)
{ … }
s8 wlc_phy_stf_ssmode_get(struct brcms_phy_pub *pih, u16 chanspec)
{ … }
const u8 *wlc_phy_get_ofdm_rate_lookup(void)
{ … }
void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)
{ … }
void wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool ldpc)
{ … }
void
wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset, s8 *ofdmoffset)
{ … }
s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi, u16 chanspec)
{ … }
bool wlc_phy_txpower_ipa_ison(struct brcms_phy_pub *ppi)
{ … }