Path: blob/main/sys/contrib/dev/broadcom/brcm80211/brcmsmac/phy_shim.h
178665 views
/*1* Copyright (c) 2010 Broadcom Corporation2*3* Permission to use, copy, modify, and/or distribute this software for any4* purpose with or without fee is hereby granted, provided that the above5* copyright notice and this permission notice appear in all copies.6*7* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES8* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF9* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY10* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES11* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION12* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN13* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14*/1516/*17* phy_shim.h: stuff defined in phy_shim.c and included only by the phy18*/1920#ifndef _BRCM_PHY_SHIM_H_21#define _BRCM_PHY_SHIM_H_2223#include "types.h"2425#define RADAR_TYPE_NONE 0 /* Radar type None */26#define RADAR_TYPE_ETSI_1 1 /* ETSI 1 Radar type */27#define RADAR_TYPE_ETSI_2 2 /* ETSI 2 Radar type */28#define RADAR_TYPE_ETSI_3 3 /* ETSI 3 Radar type */29#define RADAR_TYPE_ITU_E 4 /* ITU E Radar type */30#define RADAR_TYPE_ITU_K 5 /* ITU K Radar type */31#define RADAR_TYPE_UNCLASSIFIED 6 /* Unclassified Radar type */32#define RADAR_TYPE_BIN5 7 /* long pulse radar type */33#define RADAR_TYPE_STG2 8 /* staggered-2 radar */34#define RADAR_TYPE_STG3 9 /* staggered-3 radar */35#define RADAR_TYPE_FRA 10 /* French radar */3637/* French radar pulse widths */38#define FRA_T1_20MHZ 5277039#define FRA_T2_20MHZ 6153840#define FRA_T3_20MHZ 6600241#define FRA_T1_40MHZ 10554142#define FRA_T2_40MHZ 12307743#define FRA_T3_40MHZ 13200444#define FRA_ERR_20MHZ 6045#define FRA_ERR_40MHZ 1204647#define ANTSEL_NA 0 /* No boardlevel selection available */48#define ANTSEL_2x4 1 /* 2x4 boardlevel selection available */49#define ANTSEL_2x3 2 /* 2x3 CB2 boardlevel selection available */5051/* Rx Antenna diversity control values */52#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */53#define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */54#define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */55#define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */56#define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */57#define ANT_RX_DIV_DEF ANT_RX_DIV_START_0 /* default antdiv setting */5859#define WL_ANT_RX_MAX 2 /* max 2 receive antennas */60#define WL_ANT_HT_RX_MAX 3 /* max 3 receive antennas/cores */61#define WL_ANT_IDX_1 0 /* antenna index 1 */62#define WL_ANT_IDX_2 1 /* antenna index 2 */6364/* values for n_preamble_type */65#define BRCMS_N_PREAMBLE_MIXEDMODE 066#define BRCMS_N_PREAMBLE_GF 167#define BRCMS_N_PREAMBLE_GF_BRCM 26869#define WL_TX_POWER_RATES_LEGACY 4570#define WL_TX_POWER_MCS20_FIRST 1271#define WL_TX_POWER_MCS20_NUM 1672#define WL_TX_POWER_MCS40_FIRST 2873#define WL_TX_POWER_MCS40_NUM 17747576#define WL_TX_POWER_RATES 10177#define WL_TX_POWER_CCK_FIRST 078#define WL_TX_POWER_CCK_NUM 479/* Index for first 20MHz OFDM SISO rate */80#define WL_TX_POWER_OFDM_FIRST 481/* Index for first 20MHz OFDM CDD rate */82#define WL_TX_POWER_OFDM20_CDD_FIRST 1283/* Index for first 40MHz OFDM SISO rate */84#define WL_TX_POWER_OFDM40_SISO_FIRST 5285/* Index for first 40MHz OFDM CDD rate */86#define WL_TX_POWER_OFDM40_CDD_FIRST 6087#define WL_TX_POWER_OFDM_NUM 888/* Index for first 20MHz MCS SISO rate */89#define WL_TX_POWER_MCS20_SISO_FIRST 2090/* Index for first 20MHz MCS CDD rate */91#define WL_TX_POWER_MCS20_CDD_FIRST 2892/* Index for first 20MHz MCS STBC rate */93#define WL_TX_POWER_MCS20_STBC_FIRST 3694/* Index for first 20MHz MCS SDM rate */95#define WL_TX_POWER_MCS20_SDM_FIRST 4496/* Index for first 40MHz MCS SISO rate */97#define WL_TX_POWER_MCS40_SISO_FIRST 6898/* Index for first 40MHz MCS CDD rate */99#define WL_TX_POWER_MCS40_CDD_FIRST 76100/* Index for first 40MHz MCS STBC rate */101#define WL_TX_POWER_MCS40_STBC_FIRST 84102/* Index for first 40MHz MCS SDM rate */103#define WL_TX_POWER_MCS40_SDM_FIRST 92104#define WL_TX_POWER_MCS_1_STREAM_NUM 8105#define WL_TX_POWER_MCS_2_STREAM_NUM 8106/* Index for 40MHz rate MCS 32 */107#define WL_TX_POWER_MCS_32 100108#define WL_TX_POWER_MCS_32_NUM 1109110/* sslpnphy specifics */111/* Index for first 20MHz MCS SISO rate */112#define WL_TX_POWER_MCS20_SISO_FIRST_SSN 12113114/* struct tx_power::flags bits */115#define WL_TX_POWER_F_ENABLED 1116#define WL_TX_POWER_F_HW 2117#define WL_TX_POWER_F_MIMO 4118#define WL_TX_POWER_F_SISO 8119120/* values to force tx/rx chain */121#define BRCMS_N_TXRX_CHAIN0 0122#define BRCMS_N_TXRX_CHAIN1 1123124struct brcms_phy;125126struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,127struct brcms_info *wl,128struct brcms_c_info *wlc);129void wlc_phy_shim_detach(struct phy_shim_info *physhim);130131/* PHY to WL utility functions */132struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,133void (*fn)(void *pi),134void *arg, const char *name);135void wlapi_free_timer(struct wlapi_timer *t);136void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic);137bool wlapi_del_timer(struct wlapi_timer *t);138void wlapi_intrson(struct phy_shim_info *physhim);139u32 wlapi_intrsoff(struct phy_shim_info *physhim);140void wlapi_intrsrestore(struct phy_shim_info *physhim, u32 macintmask);141142void wlapi_bmac_write_shm(struct phy_shim_info *physhim, uint offset, u16 v);143u16 wlapi_bmac_read_shm(struct phy_shim_info *physhim, uint offset);144void wlapi_bmac_mhf(struct phy_shim_info *physhim, u8 idx, u16 mask, u16 val,145int bands);146void wlapi_bmac_corereset(struct phy_shim_info *physhim, u32 flags);147void wlapi_suspend_mac_and_wait(struct phy_shim_info *physhim);148void wlapi_switch_macfreq(struct phy_shim_info *physhim, u8 spurmode);149void wlapi_enable_mac(struct phy_shim_info *physhim);150void wlapi_bmac_mctrl(struct phy_shim_info *physhim, u32 mask, u32 val);151void wlapi_bmac_phy_reset(struct phy_shim_info *physhim);152void wlapi_bmac_bw_set(struct phy_shim_info *physhim, u16 bw);153void wlapi_bmac_phyclk_fgc(struct phy_shim_info *physhim, bool clk);154void wlapi_bmac_macphyclk_set(struct phy_shim_info *physhim, bool clk);155void wlapi_bmac_core_phypll_ctl(struct phy_shim_info *physhim, bool on);156void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim);157void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info *physhim);158void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info *physhim);159void wlapi_bmac_write_template_ram(struct phy_shim_info *physhim, int o,160int len, void *buf);161u16 wlapi_bmac_rate_shm_offset(struct phy_shim_info *physhim, u8 rate);162void wlapi_ucode_sample_init(struct phy_shim_info *physhim);163void wlapi_copyfrom_objmem(struct phy_shim_info *physhim, uint, void *buf,164int, u32 sel);165void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, const void *buf,166int, u32);167168void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, u32 phy_mode);169u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim);170171#endif /* _BRCM_PHY_SHIM_H_ */172173174