// SPDX-License-Identifier: GPL-2.0 /****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * ******************************************************************************/ #include <drv_types.h> #include <rtw_debug.h> #include <rtl8723b_hal.h> /** * phy_CalculateBitShift - Get shifted position of the BitMask. * @BitMask: Bitmask. * * Return: Return the shift bit position of the mask */ static u32 phy_CalculateBitShift(u32 BitMask) { … } /** * PHY_QueryBBReg_8723B - Read "specific bits" from BB register. * @Adapter: * @RegAddr: The target address to be readback * @BitMask: The target bit position in the target address * to be readback * * Return: The readback register value * * .. Note:: This function is equal to "GetRegSetting" in PHY programming * guide */ u32 PHY_QueryBBReg_8723B(struct adapter *Adapter, u32 RegAddr, u32 BitMask) { … } /** * PHY_SetBBReg_8723B - Write "Specific bits" to BB register (page 8~). * @Adapter: * @RegAddr: The target address to be modified * @BitMask: The target bit position in the target address * to be modified * @Data: The new register value in the target bit position * of the target address * * .. Note:: This function is equal to "PutRegSetting" in PHY programming * guide */ void PHY_SetBBReg_8723B( struct adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data ) { … } /* */ /* 2. RF register R/W API */ /* */ static u32 phy_RFSerialRead_8723B( struct adapter *Adapter, enum rf_path eRFPath, u32 Offset ) { … } /** * phy_RFSerialWrite_8723B - Write data to RF register (page 8~). * @Adapter: * @eRFPath: Radio path of A/B/C/D * @Offset: The target address to be read * @Data: The new register Data in the target bit position * of the target to be read * * .. Note:: There are three types of serial operations: * 1. Software serial write * 2. Hardware LSSI-Low Speed Serial Interface * 3. Hardware HSSI-High speed * serial write. Driver need to implement (1) and (2). * This function is equal to the combination of RF_ReadReg() and RFLSSIRead() * * .. Note:: For RF8256 only * The total count of RTL8256(Zebra4) register is around 36 bit it only employs * 4-bit RF address. RTL8256 uses "register mode control bit" (Reg00[12], Reg00[10]) * to access register address bigger than 0xf. See "Appendix-4 in PHY Configuration * programming guide" for more details. * Thus, we define a sub-finction for RTL8526 register address conversion * =========================================================== * Register Mode RegCTL[1] RegCTL[0] Note * (Reg00[12]) (Reg00[10]) * =========================================================== * Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf) * ------------------------------------------------------------------ * Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf) * ------------------------------------------------------------------ * Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf) * ------------------------------------------------------------------ * *2008/09/02 MH Add 92S RF definition * * * */ static void phy_RFSerialWrite_8723B( struct adapter *Adapter, enum rf_path eRFPath, u32 Offset, u32 Data ) { … } /** * PHY_QueryRFReg_8723B - Query "Specific bits" to RF register (page 8~). * @Adapter: * @eRFPath: Radio path of A/B/C/D * @RegAddr: The target address to be read * @BitMask: The target bit position in the target address * to be read * * Return: Readback value * * .. Note:: This function is equal to "GetRFRegSetting" in PHY * programming guide */ u32 PHY_QueryRFReg_8723B( struct adapter *Adapter, u8 eRFPath, u32 RegAddr, u32 BitMask ) { … } /** * PHY_SetRFReg_8723B - Write "Specific bits" to RF register (page 8~). * @Adapter: * @eRFPath: Radio path of A/B/C/D * @RegAddr: The target address to be modified * @BitMask: The target bit position in the target address * to be modified * @Data: The new register Data in the target bit position * of the target address * * .. Note:: This function is equal to "PutRFRegSetting" in PHY * programming guide. */ void PHY_SetRFReg_8723B( struct adapter *Adapter, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data ) { … } /* */ /* 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt. */ /* */ /*----------------------------------------------------------------------------- * PHY_MACConfig8192C - Config MAC by header file or parameter file. * * Revised History: * When Who Remark * 08/12/2008 MHC Create Version 0. * *--------------------------------------------------------------------------- */ s32 PHY_MACConfig8723B(struct adapter *Adapter) { … } /** * phy_InitBBRFRegisterDefinition - Initialize Register definition offset for * Radio Path A/B/C/D * @Adapter: * * .. Note:: The initialization value is constant and it should never be changes */ static void phy_InitBBRFRegisterDefinition(struct adapter *Adapter) { … } static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter) { … } int PHY_BBConfig8723B(struct adapter *Adapter) { … } static void phy_LCK_8723B(struct adapter *Adapter) { … } int PHY_RFConfig8723B(struct adapter *Adapter) { … } /************************************************************************************************************** * Description: * The low-level interface to set TxAGC , called by both MP and Normal Driver. * * <20120830, Kordan> **************************************************************************************************************/ void PHY_SetTxPowerIndex( struct adapter *Adapter, u32 PowerIndex, u8 RFPath, u8 Rate ) { … } u8 PHY_GetTxPowerIndex( struct adapter *padapter, u8 RFPath, u8 Rate, enum channel_width BandWidth, u8 Channel ) { … } void PHY_SetTxPowerLevel8723B(struct adapter *Adapter, u8 Channel) { … } void PHY_GetTxPowerLevel8723B(struct adapter *Adapter, s32 *powerlevel) { … } static void phy_SetRegBW_8723B( struct adapter *Adapter, enum channel_width CurrentBW ) { … } static u8 phy_GetSecondaryChnl_8723B(struct adapter *Adapter) { … } static void phy_PostSetBwMode8723B(struct adapter *Adapter) { … } static void phy_SwChnl8723B(struct adapter *padapter) { … } static void phy_SwChnlAndSetBwMode8723B(struct adapter *Adapter) { … } static void PHY_HandleSwChnlAndSetBW8723B( struct adapter *Adapter, bool bSwitchChannel, bool bSetBandWidth, u8 ChannelNum, enum channel_width ChnlWidth, enum extchnl_offset ExtChnlOffsetOf40MHz, enum extchnl_offset ExtChnlOffsetOf80MHz, u8 CenterFrequencyIndex1 ) { … } void PHY_SetBWMode8723B( struct adapter *Adapter, enum channel_width Bandwidth, /* 20M or 40M */ unsigned char Offset /* Upper, Lower, or Don't care */ ) { … } /* Call after initialization */ void PHY_SwChnl8723B(struct adapter *Adapter, u8 channel) { … } void PHY_SetSwChnlBWMode8723B( struct adapter *Adapter, u8 channel, enum channel_width Bandwidth, u8 Offset40, u8 Offset80 ) { … }