15b435de0d786869c95d1962121af0d7df2542009Arend van Spriel/*
25b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * Copyright (c) 2010 Broadcom Corporation
35b435de0d786869c95d1962121af0d7df2542009Arend van Spriel *
45b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * Permission to use, copy, modify, and/or distribute this software for any
55b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * purpose with or without fee is hereby granted, provided that the above
65b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * copyright notice and this permission notice appear in all copies.
75b435de0d786869c95d1962121af0d7df2542009Arend van Spriel *
85b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
95b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
105b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
115b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
125b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
135b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
145b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
155b435de0d786869c95d1962121af0d7df2542009Arend van Spriel */
165b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
175b435de0d786869c95d1962121af0d7df2542009Arend van Spriel/*
185b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * phy_hal.h:  functionality exported from the phy to higher layers
195b435de0d786869c95d1962121af0d7df2542009Arend van Spriel */
205b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
215b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#ifndef _BRCM_PHY_HAL_H_
225b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define _BRCM_PHY_HAL_H_
235b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
245b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#include <brcmu_utils.h>
255b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#include <brcmu_wifi.h>
265b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#include <phy_shim.h>
275b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
285b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_VER_MASK		0x0000000f
295b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_VER_SHIFT	0
305b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_MFG_MASK		0x00000fff
315b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_MFG_SHIFT	0
325b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_ID_MASK		0x0ffff000
335b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_ID_SHIFT		12
345b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_REV_MASK		0xf0000000
355b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	IDCODE_REV_SHIFT	28
365b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
375b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	NORADIO_ID		0xe4f5
385b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	NORADIO_IDCODE		0x4e4f5246
395b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
405b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2055_ID		0x2055
415b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2055_IDCODE		0x02055000
425b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2055A0_IDCODE	0x1205517f
435b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
445b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2056_ID		0x2056
455b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2056_IDCODE		0x02056000
465b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2056A0_IDCODE	0x1205617f
475b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
485b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2057_ID		0x2057
495b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2057_IDCODE		0x02057000
505b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2057A0_IDCODE	0x1205717f
515b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
525b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2064_ID		0x2064
535b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2064_IDCODE		0x02064000
545b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BCM2064A0_IDCODE	0x0206417f
555b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
565b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_TPC_HW_OFF		false
575b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_TPC_HW_ON		true
585b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
595b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_DRIVERUP	1
605b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_WATCHDOG	2
615b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_PHYINIT	3
625b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_JOIN_BSS	4
635b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_START_IBSS	5
645b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_UP_BSS	6
655b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_CHAN	7
665b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_FULLCAL	8
675b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
685b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_DISABLE	0
695b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_SPHASE	1
705b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_MPHASE	2
715b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_PERICAL_MANUAL	3
725b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
735b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_HOLD_FOR_ASSOC	1
745b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_HOLD_FOR_SCAN	2
755b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_HOLD_FOR_RM		4
765b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_HOLD_FOR_PLT	8
775b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_HOLD_FOR_MUTE	16
785b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_HOLD_FOR_NOT_ASSOC 0x20
795b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
805b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_MUTE_FOR_PREISM	1
815b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_MUTE_ALL		0xffffffff
825b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
835b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_NOISE_FIXED_VAL		(-95)
845b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_NOISE_FIXED_VAL_NPHY	(-92)
855b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_NOISE_FIXED_VAL_LCNPHY	(-92)
865b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
875b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_MODE_CAL		0x0002
885b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define PHY_MODE_NOISEM		0x0004
895b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
905b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_TXPWR_DB_FACTOR	4
915b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
925b435de0d786869c95d1962121af0d7df2542009Arend van Spriel/* a large TX Power as an init value to factor out of min() calculations,
935b435de0d786869c95d1962121af0d7df2542009Arend van Spriel * keep low enough to fit in an s8, units are .25 dBm
945b435de0d786869c95d1962121af0d7df2542009Arend van Spriel */
955b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_TXPWR_MAX		(127)	/* ~32 dBm = 1,500 mW */
965b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
975b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_NUM_RATES_CCK           4
985b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_NUM_RATES_OFDM          8
995b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_NUM_RATES_MCS_1_STREAM  8
1005b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_NUM_RATES_MCS_2_STREAM  8
1015b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_NUM_RATES_MCS_3_STREAM  8
1025b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define BRCMS_NUM_RATES_MCS_4_STREAM  8
1035b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1045b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#define	BRCMS_RSSI_INVALID	 0	/* invalid RSSI value */
1055b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1065b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct d11regs;
1075b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct phy_shim_info;
1085b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1095b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct txpwr_limits {
1105b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 cck[BRCMS_NUM_RATES_CCK];
1115b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 ofdm[BRCMS_NUM_RATES_OFDM];
1125b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1135b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 ofdm_cdd[BRCMS_NUM_RATES_OFDM];
1145b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1155b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 ofdm_40_siso[BRCMS_NUM_RATES_OFDM];
1165b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 ofdm_40_cdd[BRCMS_NUM_RATES_OFDM];
1175b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1185b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_20_siso[BRCMS_NUM_RATES_MCS_1_STREAM];
1195b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_20_cdd[BRCMS_NUM_RATES_MCS_1_STREAM];
1205b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_20_stbc[BRCMS_NUM_RATES_MCS_1_STREAM];
1215b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_20_mimo[BRCMS_NUM_RATES_MCS_2_STREAM];
1225b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1235b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_40_siso[BRCMS_NUM_RATES_MCS_1_STREAM];
1245b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_40_cdd[BRCMS_NUM_RATES_MCS_1_STREAM];
1255b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_40_stbc[BRCMS_NUM_RATES_MCS_1_STREAM];
1265b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs_40_mimo[BRCMS_NUM_RATES_MCS_2_STREAM];
1275b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 mcs32;
1285b435de0d786869c95d1962121af0d7df2542009Arend van Spriel};
1295b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1305b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct tx_power {
1315b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u32 flags;
1325b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u16 chanspec;   /* txpwr report for this channel */
1335b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u16 local_chanspec;     /* channel on which we are associated */
1345b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 local_max;   /* local max according to the AP */
1355b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 local_constraint;    /* local constraint according to the AP */
1365b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	s8 antgain[2];  /* Ant gain for each band - from SROM */
1375b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 rf_cores;            /* count of RF Cores being reported */
1385b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 est_Pout[4]; /* Latest tx power out estimate per RF chain */
1395b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 est_Pout_act[4];     /* Latest tx power out estimate per RF chain
1405b435de0d786869c95d1962121af0d7df2542009Arend van Spriel				 * without adjustment */
1415b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 est_Pout_cck;        /* Latest CCK tx power out estimate */
1425b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 tx_power_max[4];     /* Maximum target power among all rates */
1435b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	/* Index of the rate with the max target power */
1445b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 tx_power_max_rate_ind[4];
1455b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	/* User limit */
1465b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 user_limit[WL_TX_POWER_RATES];
1475b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	/* Regulatory power limit */
1485b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 reg_limit[WL_TX_POWER_RATES];
1495b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	/* Max power board can support (SROM) */
1505b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 board_limit[WL_TX_POWER_RATES];
1515b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	/* Latest target power */
1525b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 target[WL_TX_POWER_RATES];
1535b435de0d786869c95d1962121af0d7df2542009Arend van Spriel};
1545b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1555b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct tx_inst_power {
1565b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 txpwr_est_Pout[2];   /* Latest estimate for 2.4 and 5 Ghz */
1575b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 txpwr_est_Pout_gofdm;        /* Pwr estimate for 2.4 OFDM */
1585b435de0d786869c95d1962121af0d7df2542009Arend van Spriel};
1595b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1605b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct brcms_chanvec {
1615b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u8 vec[MAXCHANNEL / NBBY];
1625b435de0d786869c95d1962121af0d7df2542009Arend van Spriel};
1635b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1645b435de0d786869c95d1962121af0d7df2542009Arend van Sprielstruct shared_phy_params {
1655b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	struct si_pub *sih;
1665b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	struct phy_shim_info *physhim;
1675b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint unit;
1685b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint corerev;
1695b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u16 vid;
1705b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u16 did;
1715b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint chip;
1725b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint chiprev;
1735b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint chippkg;
1745b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint sromrev;
1755b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint boardtype;
1765b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	uint boardrev;
1775b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u32 boardflags;
1785b435de0d786869c95d1962121af0d7df2542009Arend van Spriel	u32 boardflags2;
1795b435de0d786869c95d1962121af0d7df2542009Arend van Spriel};
1805b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1815b435de0d786869c95d1962121af0d7df2542009Arend van Spriel
1829bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesstruct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp);
1839bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesstruct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh,
1849bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				     struct bcma_device *d11core, int bandtype,
1859bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				     struct wiphy *wiphy);
1869bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_detach(struct brcms_phy_pub *ppi);
1879bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
1889bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesbool wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype,
1899bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches			    u16 *phyrev, u16 *radioid, u16 *radiover);
1909bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesbool wlc_phy_get_encore(struct brcms_phy_pub *pih);
1919bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih);
1929bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
1939bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_hw_clk_state_upd(struct brcms_phy_pub *ppi, bool newstate);
1949bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_hw_state_upd(struct brcms_phy_pub *ppi, bool newstate);
1959bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_init(struct brcms_phy_pub *ppi, u16 chanspec);
1969bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_watchdog(struct brcms_phy_pub *ppi);
1979bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesint wlc_phy_down(struct brcms_phy_pub *ppi);
1989bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu32 wlc_phy_clk_bwbits(struct brcms_phy_pub *pih);
1999bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_cal_init(struct brcms_phy_pub *ppi);
2009bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_antsel_init(struct brcms_phy_pub *ppi, bool lut_init);
2019bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2029bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_chanspec_set(struct brcms_phy_pub *ppi, u16 chanspec);
2039bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu16 wlc_phy_chanspec_get(struct brcms_phy_pub *ppi);
2049bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, u16 newch);
2059bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi);
2069bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw);
2079bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2089bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesint wlc_phy_rssi_compute(struct brcms_phy_pub *pih, struct d11rxhdr *rxh);
2099bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_por_inform(struct brcms_phy_pub *ppi);
2109bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_noise_sample_intr(struct brcms_phy_pub *ppi);
2119bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesbool wlc_phy_bist_check_phy(struct brcms_phy_pub *ppi);
2129bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2139bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_set_deaf(struct brcms_phy_pub *ppi, bool user_flag);
2149bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2159bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_switch_radio(struct brcms_phy_pub *ppi, bool on);
2169bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_anacore(struct brcms_phy_pub *ppi, bool on);
2179bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2189bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2199bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_BSSinit(struct brcms_phy_pub *ppi, bool bonlyap, int rssi);
2209bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2219bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_chanspec_ch14_widefilter_set(struct brcms_phy_pub *ppi,
2229bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches					  bool wide_filter);
2239bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band,
2249bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				   struct brcms_chanvec *channels);
2259bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band);
2269bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2279bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint chan, u8 *_min_,
2289bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches			       u8 *_max_, int rate);
2299bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_sromlimit_max_get(struct brcms_phy_pub *ppi, uint chan,
2309bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				       u8 *_max_, u8 *_min_);
2319bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_boardlimit_band(struct brcms_phy_pub *ppi, uint band,
2329bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				     s32 *, s32 *, u32 *);
2339bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, struct txpwr_limits *,
2349bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches			       u16 chanspec);
2359bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesint wlc_phy_txpower_get(struct brcms_phy_pub *ppi, uint *qdbm, bool *override);
2369bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesint wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override);
2379bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi,
2389bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				struct txpwr_limits *);
2399bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesbool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi);
2409bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, bool hwpwrctrl);
2419bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu8 wlc_phy_txpower_get_target_min(struct brcms_phy_pub *ppi);
2429bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi);
2439bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesbool wlc_phy_txpower_ipa_ison(struct brcms_phy_pub *pih);
2449bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2459bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain);
2469bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain);
2479bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, u8 *rxchain);
2489bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesu8 wlc_phy_stf_chain_active_get(struct brcms_phy_pub *pih);
2499bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchess8 wlc_phy_stf_ssmode_get(struct brcms_phy_pub *pih, u16 chanspec);
2509bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool val);
2519bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2529bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_cal_perical(struct brcms_phy_pub *ppi, u8 reason);
2539bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_noise_sample_request_external(struct brcms_phy_pub *ppi);
2549bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_edcrs_lock(struct brcms_phy_pub *pih, bool lock);
2559bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_cal_papd_recal(struct brcms_phy_pub *ppi);
2569bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2579bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val);
2589bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_clear_tssi(struct brcms_phy_pub *ppi);
2599bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_hold_upd(struct brcms_phy_pub *ppi, u32 id, bool val);
2609bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_mute_upd(struct brcms_phy_pub *ppi, bool val, u32 flags);
2619bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2629bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_antsel_type_set(struct brcms_phy_pub *ppi, u8 antsel_type);
2639bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2649bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpower_get_current(struct brcms_phy_pub *ppi,
2659bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				 struct tx_power *power, uint channel);
2669bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2679bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_initcal_enable(struct brcms_phy_pub *pih, bool initcal);
2689bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesbool wlc_phy_test_ison(struct brcms_phy_pub *ppi);
2699bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_txpwr_percent_set(struct brcms_phy_pub *ppi, u8 txpwr_percent);
2709bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_ofdm_rateset_war(struct brcms_phy_pub *pih, bool war);
2719bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, bool bf_preempt);
2729bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_machwcap_set(struct brcms_phy_pub *ppi, u32 machwcap);
2739bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2749bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_runbist_config(struct brcms_phy_pub *ppi, bool start_end);
2759bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2769bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_freqtrack_start(struct brcms_phy_pub *ppi);
2779bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesvoid wlc_phy_freqtrack_end(struct brcms_phy_pub *ppi);
2789bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2799bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchesconst u8 *wlc_phy_get_ofdm_rate_lookup(void);
2809bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches
2819bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchess8 wlc_phy_get_tx_power_offset_by_mcs(struct brcms_phy_pub *ppi,
2829bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perches				      u8 mcs_offset);
2839bd91f3c00bd8dd54339499a9253b31c6bac7c7bJoe Perchess8 wlc_phy_get_tx_power_offset(struct brcms_phy_pub *ppi, u8 tbl_offset);
2845b435de0d786869c95d1962121af0d7df2542009Arend van Spriel#endif                          /* _BRCM_PHY_HAL_H_ */
285