#include <wlc_cfg.h>
-#include <typedefs.h>
-#include <osl.h>
#include <linux/kernel.h>
#include <linux/string.h>
-#include <linuxver.h>
+#include <bcmdefs.h>
+#include <osl.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/pci.h>
#include <bcmendian.h>
#include <bcmnvram.h>
#include <sbchipc.h>
+#include <bcmdevs.h>
+#include <sbhndpio.h>
+#include <sbhnddma.h>
#include <wlc_phy_int.h>
#include <wlc_phyreg_n.h>
return NULL;
for (s = vars; s && *s;) {
- if ((bcmp(s, name, len) == 0) && (s[len] == '='))
+ if ((memcmp(s, name, len) == 0) && (s[len] == '='))
return &s[len + 1];
while (*s++)
phy_info_t *pi = (phy_info_t *) pih;
wlapi_bmac_mctrl(pi->sh->physhim, MCTL_LOCK_RADIO, MCTL_LOCK_RADIO);
- OSL_DELAY(10);
+ udelay(10);
}
void wlc_radioreg_exit(wlc_phy_t *pih)
void write_radio_reg(phy_info_t *pi, u16 addr, u16 val)
{
- osl_t *osh;
+ struct osl_info *osh;
if (NORADIO_ENAB(pi->pubpi))
return;
W_REG(osh, &pi->regs->phy4wdatalo, val);
}
- if (BUSTYPE(pi->sh->bustype) == PCI_BUS) {
+ if (pi->sh->bustype == PCI_BUS) {
if (++pi->phy_wreg >= pi->phy_wreg_limit) {
(void)R_REG(osh, &pi->regs->maccontrol);
pi->phy_wreg = 0;
u16 read_phy_reg(phy_info_t *pi, u16 addr)
{
- osl_t *osh;
+ struct osl_info *osh;
d11regs_t *regs;
osh = pi->sh->osh;
void write_phy_reg(phy_info_t *pi, u16 addr, u16 val)
{
- osl_t *osh;
+ struct osl_info *osh;
d11regs_t *regs;
osh = pi->sh->osh;
if (addr == 0x72)
(void)R_REG(osh, ®s->phyregdata);
#else
- W_REG(osh, (volatile u32 *)(uintptr) (®s->phyregaddr),
+ W_REG(osh, (volatile u32 *)(®s->phyregaddr),
addr | (val << 16));
- if (BUSTYPE(pi->sh->bustype) == PCI_BUS) {
+ if (pi->sh->bustype == PCI_BUS) {
if (++pi->phy_wreg >= pi->phy_wreg_limit) {
pi->phy_wreg = 0;
(void)R_REG(osh, ®s->phyversion);
void and_phy_reg(phy_info_t *pi, u16 addr, u16 val)
{
- osl_t *osh;
+ struct osl_info *osh;
d11regs_t *regs;
osh = pi->sh->osh;
void or_phy_reg(phy_info_t *pi, u16 addr, u16 val)
{
- osl_t *osh;
+ struct osl_info *osh;
d11regs_t *regs;
osh = pi->sh->osh;
void mod_phy_reg(phy_info_t *pi, u16 addr, u16 mask, u16 val)
{
- osl_t *osh;
+ struct osl_info *osh;
d11regs_t *regs;
osh = pi->sh->osh;
{
int i, j;
- pi->initialized = FALSE;
+ pi->initialized = false;
pi->tx_vos = 0xffff;
pi->nrssi_table_delta = 0x7fffffff;
}
}
-shared_phy_t *BCMATTACHFN(wlc_phy_shared_attach) (shared_phy_params_t *shp)
+shared_phy_t *wlc_phy_shared_attach(shared_phy_params_t *shp)
{
shared_phy_t *sh;
- sh = (shared_phy_t *) MALLOC(shp->osh, sizeof(shared_phy_t));
+ sh = kzalloc(sizeof(shared_phy_t), GFP_ATOMIC);
if (sh == NULL) {
return NULL;
}
- bzero((char *)sh, sizeof(shared_phy_t));
sh->osh = shp->osh;
sh->sih = shp->sih;
return sh;
}
-void BCMATTACHFN(wlc_phy_shared_detach) (shared_phy_t *phy_sh)
+void wlc_phy_shared_detach(shared_phy_t *phy_sh)
{
- osl_t *osh;
+ struct osl_info *osh;
if (phy_sh) {
osh = phy_sh->osh;
if (phy_sh->phy_head) {
ASSERT(!phy_sh->phy_head);
}
- MFREE(osh, phy_sh, sizeof(shared_phy_t));
+ kfree(phy_sh);
}
}
-wlc_phy_t *BCMATTACHFN(wlc_phy_attach) (shared_phy_t *sh, void *regs,
- int bandtype, char *vars) {
+wlc_phy_t *wlc_phy_attach(shared_phy_t *sh, void *regs, int bandtype, char *vars)
+{
phy_info_t *pi;
u32 sflags = 0;
uint phyversion;
int i;
- osl_t *osh;
+ struct osl_info *osh;
osh = sh->osh;
return &pi->pubpi_ro;
}
- pi = (phy_info_t *) MALLOC(osh, sizeof(phy_info_t));
+ pi = kzalloc(sizeof(phy_info_t), GFP_ATOMIC);
if (pi == NULL) {
return NULL;
}
- bzero((char *)pi, sizeof(phy_info_t));
pi->regs = (d11regs_t *) regs;
pi->sh = sh;
- pi->phy_init_por = TRUE;
+ pi->phy_init_por = true;
pi->phy_wreg_limit = PHY_WREG_LIMIT;
pi->vars = vars;
pi->txpwr_percent = 100;
- pi->do_initcal = TRUE;
+ pi->do_initcal = true;
pi->phycal_tempdelta = 0;
pi->rxiq_samps = PHY_NOISE_SAMPLE_LOG_NUM_NPHY;
pi->rxiq_antsel = ANT_RX_DIV_DEF;
- pi->watchdog_override = TRUE;
+ pi->watchdog_override = true;
pi->cal_type_override = PHY_PERICAL_AUTO;
pi->phy_txcore_enable_temp =
PHY_CHAIN_TX_DISABLE_TEMP - PHY_HYSTERESIS_DELTATEMP;
pi->phy_tempsense_offset = 0;
- pi->phy_txcore_heatedup = FALSE;
+ pi->phy_txcore_heatedup = false;
pi->nphy_lastcal_temp = -50;
- pi->phynoise_polling = TRUE;
+ pi->phynoise_polling = true;
if (ISNPHY(pi) || ISLCNPHY(pi))
- pi->phynoise_polling = FALSE;
+ pi->phynoise_polling = false;
for (i = 0; i < TXP_NUM_RATES; i++) {
pi->txpwr_limit[i] = WLC_TXPWR_MAX;
pi->radiopwr_override = RADIOPWR_OVERRIDE_DEF;
- pi->user_txpwr_at_rfport = FALSE;
+ pi->user_txpwr_at_rfport = false;
if (ISNPHY(pi)) {
err:
if (pi)
- MFREE(sh->osh, pi, sizeof(phy_info_t));
+ kfree(pi);
return NULL;
}
-void BCMATTACHFN(wlc_phy_detach) (wlc_phy_t *pih)
+void wlc_phy_detach(wlc_phy_t *pih)
{
phy_info_t *pi = (phy_info_t *) pih;
if (pi->pi_fptr.detach)
(pi->pi_fptr.detach) (pi);
- MFREE(pi->sh->osh, pi, sizeof(phy_info_t));
+ kfree(pi);
}
}
*radioid = pi->pubpi.radioid;
*radiover = pi->pubpi.radiorev;
- return TRUE;
+ return true;
}
bool wlc_phy_get_encore(wlc_phy_t *pih)
{
phy_info_t *pi = (phy_info_t *) ppi;
- pi->phy_init_por = TRUE;
+ pi->phy_init_por = true;
}
void wlc_phy_edcrs_lock(wlc_phy_t *pih, bool lock)
if (pi->init_in_progress)
return;
- pi->init_in_progress = TRUE;
+ pi->init_in_progress = true;
pi->radio_chanspec = chanspec;
wlapi_bmac_bw_set(pi->sh->physhim,
CHSPEC_BW(pi->radio_chanspec));
- pi->nphy_gain_boost = TRUE;
+ pi->nphy_gain_boost = true;
wlc_phy_switch_radio((wlc_phy_t *) pi, ON);
(*phy_init) (pi);
- pi->phy_init_por = FALSE;
+ pi->phy_init_por = false;
if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12))
- wlc_phy_do_dummy_tx(pi, TRUE, OFF);
+ wlc_phy_do_dummy_tx(pi, true, OFF);
if (!(ISNPHY(pi)))
wlc_phy_txpower_update_shm(pi);
wlc_phy_ant_rxdiv_set((wlc_phy_t *) pi, pi->sh->rx_antdiv);
- pi->init_in_progress = FALSE;
+ pi->init_in_progress = false;
}
-void BCMINITFN(wlc_phy_cal_init) (wlc_phy_t *pih)
+void wlc_phy_cal_init(wlc_phy_t *pih)
{
phy_info_t *pi = (phy_info_t *) pih;
initfn_t cal_init = NULL;
if (cal_init)
(*cal_init) (pi);
- pi->initialized = TRUE;
+ pi->initialized = true;
}
}
-int BCMUNINITFN(wlc_phy_down) (wlc_phy_t *pih)
+int wlc_phy_down(wlc_phy_t *pih)
{
phy_info_t *pi = (phy_info_t *) pih;
int callbacks = 0;
- ASSERT(pi->phytest_on == FALSE);
+ ASSERT(pi->phytest_on == false);
if (pi->phycal_timer
&& !wlapi_del_timer(pi->sh->physhim, pi->phycal_timer))
uint tbl_id = ptbl_info->tbl_id;
uint tbl_offset = ptbl_info->tbl_offset;
uint tbl_width = ptbl_info->tbl_width;
- u8 *ptbl_8b = (u8 *) (uintptr) ptbl_info->tbl_ptr;
- u16 *ptbl_16b = (u16 *) (uintptr) ptbl_info->tbl_ptr;
- u32 *ptbl_32b = (u32 *) (uintptr) ptbl_info->tbl_ptr;
+ u8 *ptbl_8b = (u8 *)ptbl_info->tbl_ptr;
+ u16 *ptbl_16b = (u16 *)ptbl_info->tbl_ptr;
+ u32 *ptbl_32b = (u32 *)ptbl_info->tbl_ptr;
ASSERT((tbl_width == 8) || (tbl_width == 16) || (tbl_width == 32));
while ((i++ < count)
&& (R_REG(pi->sh->osh, ®s->txe_status) & (1 << 7))) {
- OSL_DELAY(10);
+ udelay(10);
}
i = 0;
while ((i++ < 10)
&& ((R_REG(pi->sh->osh, ®s->txe_status) & (1 << 10)) == 0)) {
- OSL_DELAY(10);
+ udelay(10);
}
i = 0;
while ((i++ < 10) && ((R_REG(pi->sh->osh, ®s->ifsstat) & (1 << 8)))) {
- OSL_DELAY(10);
+ udelay(10);
}
if (!pa_on) {
if (ISNPHY(pi))
static bool wlc_phy_cal_txpower_recalc_sw(phy_info_t *pi)
{
- return FALSE;
+ return false;
}
void wlc_phy_switch_radio(wlc_phy_t *pih, bool on)
ASSERT((band == WLC_BAND_2G) || (band == WLC_BAND_5G));
- bzero(channels, sizeof(chanvec_t));
+ memset(channels, 0, sizeof(chanvec_t));
for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) {
channel = chan_info_all[i].chan;
void wlc_phy_txpower_target_set(wlc_phy_t *ppi, struct txpwr_limits *txpwr)
{
- bool mac_enabled = FALSE;
+ bool mac_enabled = false;
phy_info_t *pi = (phy_info_t *) ppi;
bcopy(&txpwr->cck[0], &pi->tx_user_target[TXP_FIRST_CCK],
WLC_NUM_RATES_MCS_2_STREAM);
if (R_REG(pi->sh->osh, &pi->regs->maccontrol) & MCTL_EN_MAC)
- mac_enabled = TRUE;
+ mac_enabled = true;
if (mac_enabled)
wlapi_suspend_mac_and_wait(pi->sh->physhim);
for (i = 0; i < TXP_NUM_RATES; i++)
pi->tx_user_target[i] = (u8) qdbm;
- pi->txpwroverride = FALSE;
+ pi->txpwroverride = false;
if (pi->sh->up) {
if (!SCAN_INPROG_PHY(pi)) {
tx_pwr_min = min(tx_pwr_min, tx_pwr_target[rate]);
}
- bzero(pi->tx_power_offset, sizeof(pi->tx_power_offset));
+ memset(pi->tx_power_offset, 0, sizeof(pi->tx_power_offset));
pi->tx_power_max = tx_pwr_max;
pi->tx_power_min = tx_pwr_min;
pi->tx_power_max_rate_ind = tx_pwr_max_rate_ind;
for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++)
pi->tx_power_offset[i] =
- (u8) ROUNDUP(pi->tx_power_offset[i], 8);
+ (u8) roundup(pi->tx_power_offset[i], 8);
wlapi_bmac_write_shm(pi->sh->physhim, M_OFDM_OFFSET,
(u16) ((pi->
tx_power_offset[TXP_FIRST_OFDM]
pi->ipa2g_on = (pi->srom_fem2g.extpagain == 2);
pi->ipa5g_on = (pi->srom_fem5g.extpagain == 2);
} else {
- pi->ipa2g_on = FALSE;
- pi->ipa5g_on = FALSE;
+ pi->ipa2g_on = false;
+ pi->ipa5g_on = false;
}
}
bool wlc_phy_ant_rxdiv_get(wlc_phy_t *ppi, u8 *pval)
{
phy_info_t *pi = (phy_info_t *) ppi;
- bool ret = TRUE;
+ bool ret = true;
wlc_phyreg_enter(ppi);
if (ISNPHY(pi)) {
- ret = FALSE;
+ ret = false;
} else if (ISLCNPHY(pi)) {
u16 crsctrl = read_phy_reg(pi, 0x410);
u16 div = crsctrl & (0x1 << 1);
s8 cmplx_pwr_dbm[PHY_CORE_MAX];
u8 i;
- bzero((u8 *) cmplx_pwr_dbm, sizeof(cmplx_pwr_dbm));
+ memset((u8 *) cmplx_pwr_dbm, 0, sizeof(cmplx_pwr_dbm));
ASSERT(pi->pubpi.phy_corenum <= PHY_CORE_MAX);
wlc_phy_compute_dB(cmplx_pwr, cmplx_pwr_dbm, pi->pubpi.phy_corenum);
}
pi->nphy_noise_index =
MODINC_POW2(pi->nphy_noise_index, PHY_NOISE_WINDOW_SZ);
- return TRUE;
+ return true;
}
static void
phy_info_t *pi = (phy_info_t *) pih;
s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY;
bool sampling_in_progress = (pi->phynoise_state != 0);
- bool wait_for_intr = TRUE;
+ bool wait_for_intr = true;
if (NORADIO_ENAB(pi->pubpi)) {
return;
noise_dbm = PHY_NOISE_FIXED_VAL;
}
- wait_for_intr = FALSE;
+ wait_for_intr = false;
goto done;
}
noise_dbm = (s8) wlc_lcnphy_rx_signal_power(pi, 20);
wlc_lcnphy_deaf_mode(pi, (bool) 1);
wlapi_enable_mac(pi->sh->physhim);
- wait_for_intr = FALSE;
+ wait_for_intr = false;
}
} else if (ISNPHY(pi)) {
if (!pi->phynoise_polling
u8 wait_crs = 0;
u8 i;
- bzero((u8 *) est, sizeof(est));
- bzero((u8 *) cmplx_pwr, sizeof(cmplx_pwr));
- bzero((u8 *) noise_dbm_ant, sizeof(noise_dbm_ant));
+ memset((u8 *) est, 0, sizeof(est));
+ memset((u8 *) cmplx_pwr, 0, sizeof(cmplx_pwr));
+ memset((u8 *) noise_dbm_ant, 0, sizeof(noise_dbm_ant));
log_num_samps = PHY_NOISE_SAMPLE_LOG_NUM_NPHY;
num_samps = 1 << log_num_samps;
pi->nphy_noise_index = MODINC_POW2(pi->nphy_noise_index,
PHY_NOISE_WINDOW_SZ);
- wait_for_intr = FALSE;
+ wait_for_intr = false;
}
}
u8 idx, core;
ASSERT(pi->pubpi.phy_corenum <= PHY_CORE_MAX);
- bzero((u8 *) cmplx_pwr, sizeof(cmplx_pwr));
- bzero((u8 *) noise_dbm_ant, sizeof(noise_dbm_ant));
+ memset((u8 *) cmplx_pwr, 0, sizeof(cmplx_pwr));
+ memset((u8 *) noise_dbm_ant, 0, sizeof(noise_dbm_ant));
for (idx = 0, core = 0; core < pi->pubpi.phy_corenum; idx += 2, core++) {
lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP(idx));
pi = (phy_info_t *) ppi;
if (ISLCNPHY(pi))
- wlc_lcnphy_deaf_mode(pi, TRUE);
+ wlc_lcnphy_deaf_mode(pi, true);
else if (ISNPHY(pi))
- wlc_nphy_deaf_mode(pi, TRUE);
+ wlc_nphy_deaf_mode(pi, true);
else {
ASSERT(0);
}
void wlc_phy_watchdog(wlc_phy_t *pih)
{
phy_info_t *pi = (phy_info_t *) pih;
- bool delay_phy_cal = FALSE;
+ bool delay_phy_cal = false;
pi->sh->now++;
if (!pi->watchdog_override)
(SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi)
|| ASSOC_INPROG_PHY(pi)
|| pi->carrier_suppr_disable
- || pi->pkteng_in_progress || pi->disable_percal))
+ || pi->disable_percal))
wlc_lcnphy_calib_modes(pi,
PHY_PERICAL_WATCHDOG);
}
{
s16 nphy_currtemp = 0;
s16 delta_temp = 0;
- bool do_periodic_cal = TRUE;
+ bool do_periodic_cal = true;
phy_info_t *pi = (phy_info_t *) pih;
if (!ISNPHY(pi))
wlc_phy_cal_perical_mphase_reset(pi);
}
- pi->first_cal_after_assoc = TRUE;
+ pi->first_cal_after_assoc = true;
pi->cal_type_override = PHY_PERICAL_FULL;
if ((delta_temp < (s16) pi->phycal_tempdelta) &&
(pi->nphy_txiqlocal_chanspec ==
pi->radio_chanspec)) {
- do_periodic_cal = FALSE;
+ do_periodic_cal = false;
} else {
pi->nphy_lastcal_temp = nphy_currtemp;
}
if (!pi->phy_txcore_heatedup) {
if (nphy_currtemp >= pi->phy_txcore_disable_temp) {
active_bitmap &= 0xFD;
- pi->phy_txcore_heatedup = TRUE;
+ pi->phy_txcore_heatedup = true;
}
} else {
if (nphy_currtemp <= pi->phy_txcore_enable_temp) {
active_bitmap |= 0x2;
- pi->phy_txcore_heatedup = FALSE;
+ pi->phy_txcore_heatedup = false;
}
}
}