// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * Purpose: Implement functions to access baseband * * Author: Kyle Hsu * * Date: Aug.22, 2002 * * Functions: * bb_get_frame_time - Calculate data frame transmitting time * bb_read_embedded - Embedded read baseband register via MAC * bb_write_embedded - Embedded write baseband register via MAC * bb_vt3253_init - VIA VT3253 baseband chip init code * * Revision History: * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec. * 08-07-2003 Bryan YC Fan: Add MAXIM2827/2825 and RFMD2959 support. * 08-26-2003 Kyle Hsu : Modify BBuGetFrameTime() and * BBvCalculateParameter(). * cancel the setting of MAC_REG_SOFTPWRCTL on * BBbVT3253Init(). * Add the comments. * 09-01-2003 Bryan YC Fan: RF & BB tables updated. * Modified BBvLoopbackOn & BBvLoopbackOff(). * * */ #include "mac.h" #include "baseband.h" #include "srom.h" #include "rf.h" /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ /*--------------------- Static Definitions -------------------------*/ /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ #define CB_VT3253_INIT_FOR_RFMD … static const unsigned char by_vt3253_init_tab_rfmd[CB_VT3253_INIT_FOR_RFMD][2] = …; #define CB_VT3253B0_INIT_FOR_RFMD … static const unsigned char vt3253b0_rfmd[CB_VT3253B0_INIT_FOR_RFMD][2] = …; #define CB_VT3253B0_AGC_FOR_RFMD2959 … /* For RFMD2959 */ static unsigned char vt3253b0_agc4_rfmd2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = …; #define CB_VT3253B0_INIT_FOR_AIROHA2230 … /* For AIROHA */ static unsigned char vt3253b0_airoha2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = …; #define CB_VT3253B0_INIT_FOR_UW2451 … /* For UW2451 */ static unsigned char vt3253b0_uw2451[CB_VT3253B0_INIT_FOR_UW2451][2] = …; #define CB_VT3253B0_AGC … /* For AIROHA */ static unsigned char vt3253b0_agc[CB_VT3253B0_AGC][2] = …; static const unsigned short awc_frame_time[MAX_RATE] = …; /*--------------------- Export Variables --------------------------*/ /* * Description: Calculate data frame transmitting time * * Parameters: * In: * preamble_type - Preamble Type * by_pkt_type - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA * cb_frame_length - Baseband Type * tx_rate - Tx Rate * Out: * * Return Value: FrameTime * */ unsigned int bb_get_frame_time(unsigned char preamble_type, unsigned char by_pkt_type, unsigned int cb_frame_length, unsigned short tx_rate) { … } /* * Description: Calculate Length, Service, and Signal fields of Phy for Tx * * Parameters: * In: * priv - Device Structure * frame_length - Tx Frame Length * tx_rate - Tx Rate * Out: * struct vnt_phy_field *phy * - pointer to Phy Length field * - pointer to Phy Service field * - pointer to Phy Signal field * * Return Value: none * */ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy) { … } /* * Description: Read a byte from BASEBAND, by embedded programming * * Parameters: * In: * iobase - I/O base address * by_bb_addr - address of register in Baseband * Out: * pby_data - data read * * Return Value: true if succeeded; false if failed. * */ bool bb_read_embedded(struct vnt_private *priv, unsigned char by_bb_addr, unsigned char *pby_data) { … } /* * Description: Write a Byte to BASEBAND, by embedded programming * * Parameters: * In: * iobase - I/O base address * by_bb_addr - address of register in Baseband * by_data - data to write * Out: * none * * Return Value: true if succeeded; false if failed. * */ bool bb_write_embedded(struct vnt_private *priv, unsigned char by_bb_addr, unsigned char by_data) { … } /* * Description: VIA VT3253 Baseband chip init function * * Parameters: * In: * iobase - I/O base address * byRevId - Revision ID * rf_type - RF type * Out: * none * * Return Value: true if succeeded; false if failed. * */ bool bb_vt3253_init(struct vnt_private *priv) { … } /* * Description: Set ShortSlotTime mode * * Parameters: * In: * priv - Device Structure * Out: * none * * Return Value: none * */ void bb_set_short_slot_time(struct vnt_private *priv) { … } void bb_set_vga_gain_offset(struct vnt_private *priv, unsigned char by_data) { … } /* * Description: Baseband SoftwareReset * * Parameters: * In: * iobase - I/O base address * Out: * none * * Return Value: none * */ void bb_software_reset(struct vnt_private *priv) { … } /* * Description: Set Tx Antenna mode * * Parameters: * In: * priv - Device Structure * by_antenna_mode - Antenna Mode * Out: * none * * Return Value: none * */ void bb_set_tx_antenna_mode(struct vnt_private *priv, unsigned char by_antenna_mode) { … } /* * Description: Set Rx Antenna mode * * Parameters: * In: * priv - Device Structure * by_antenna_mode - Antenna Mode * Out: * none * * Return Value: none * */ void bb_set_rx_antenna_mode(struct vnt_private *priv, unsigned char by_antenna_mode) { … } /* * Description: bb_set_deep_sleep * * Parameters: * In: * priv - Device Structure * Out: * none * * Return Value: none * */ void bb_set_deep_sleep(struct vnt_private *priv, unsigned char by_local_id) { … }