提交 938a0447 编写于 作者: P Ping-Ke Shih 提交者: Greg Kroah-Hartman

staging: r8822be: Add code for halmac sub-driver

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

New Realtek devices implement a common sub-driver to control the MAC
layer. The RTL8822BE is the first of these devices, thus its introduction
involves some extra code. In the wireless tree, this will be a separate
module; however, it is compiled into the 8822be driver here.
Signed-off-by: NPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: NLarry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b53b764b
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_2_PLATFORM_H_
#define _HALMAC_2_PLATFORM_H_
#include "../wifi.h"
#include <asm/byteorder.h>
#define HALMAC_PLATFORM_LITTLE_ENDIAN 1
#define HALMAC_PLATFORM_BIG_ENDIAN 0
/* Note : Named HALMAC_PLATFORM_LITTLE_ENDIAN / HALMAC_PLATFORM_BIG_ENDIAN
* is not mandatory. But Little endian must be '1'. Big endian must be '0'
*/
#if defined(__LITTLE_ENDIAN)
#define HALMAC_SYSTEM_ENDIAN HALMAC_PLATFORM_LITTLE_ENDIAN
#elif defined(__BIG_ENDIAN)
#define HALMAC_SYSTEM_ENDIAN HALMAC_PLATFORM_BIG_ENDIAN
#else
#error
#endif
/* define the Platform SDIO Bus CLK */
#define PLATFORM_SD_CLK 50000000 /*50MHz*/
/* define the Rx FIFO expanding mode packet size unit for 8821C and 8822B */
/* Should be 8 Byte alignment */
#define HALMAC_RX_FIFO_EXPANDING_MODE_PKT_SIZE 16 /*Bytes*/
#endif /* _HALMAC_2_PLATFORM_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_8822B_CFG_H_
#define _HALMAC_8822B_CFG_H_
#include "halmac_8822b_pwr_seq.h"
#include "halmac_api_8822b.h"
#include "halmac_api_8822b_usb.h"
#include "halmac_api_8822b_sdio.h"
#include "halmac_api_8822b_pcie.h"
#include "../../halmac_bit2.h"
#include "../../halmac_reg2.h"
#include "../../halmac_api.h"
#define HALMAC_TX_FIFO_SIZE_8822B 262144 /* 256k */
#define HALMAC_TX_FIFO_SIZE_LA_8822B 131072 /* 128k */
#define HALMAC_RX_FIFO_SIZE_8822B 24576 /* 24k */
#define HALMAC_TX_PAGE_SIZE_8822B 128 /* PageSize 128Byte */
#define HALMAC_TX_ALIGN_SIZE_8822B 8
#define HALMAC_TX_PAGE_SIZE_2_POWER_8822B 7 /* 128 = 2^7 */
#define HALMAC_SECURITY_CAM_ENTRY_NUM_8822B 64 /* CAM Entry size */
#define HALMAC_TX_AGG_ALIGNMENT_SIZE_8822B 8
#define HALMAC_TX_DESC_SIZE_8822B 48
#define HALMAC_RX_DESC_SIZE_8822B 24
#define HALMAC_RX_DESC_DUMMY_SIZE_MAX_8822B 120
#define HALMAC_C2H_PKT_BUF_8822B 256
#define HALMAC_RX_FIFO_EXPANDING_MODE_PKT_SIZE_MAX_8822B 80 /* align 8 Byte*/
#define HALMAC_RX_FIFO_EXPANDING_UNIT_8822B \
(HALMAC_RX_DESC_SIZE_8822B + HALMAC_RX_DESC_DUMMY_SIZE_MAX_8822B + \
HALMAC_RX_FIFO_EXPANDING_MODE_PKT_SIZE) /* align 8 Byte*/
#define HALMAC_RX_FIFO_EXPANDING_UNIT_MAX_8822B \
(HALMAC_RX_DESC_SIZE_8822B + HALMAC_RX_DESC_DUMMY_SIZE_MAX_8822B + \
HALMAC_RX_FIFO_EXPANDING_MODE_PKT_SIZE_MAX_8822B) /* align 8 Byte*/
#define HALMAC_TX_FIFO_SIZE_EX_1_BLK_8822B 196608 /* 192k */
#define HALMAC_RX_FIFO_SIZE_EX_1_BLK_8822B \
((((HALMAC_RX_FIFO_EXPANDING_UNIT_8822B << 8) - 1) >> 10) \
<< 10) /* < 56k*/
#define HALMAC_RX_FIFO_SIZE_EX_1_BLK_MAX_8822B \
((((HALMAC_RX_FIFO_EXPANDING_UNIT_MAX_8822B << 8) - 1) >> 10) \
<< 10) /* 55k*/
#define HALMAC_TX_FIFO_SIZE_EX_2_BLK_8822B 131072 /* 128k */
#define HALMAC_RX_FIFO_SIZE_EX_2_BLK_8822B 155648 /* 152k */
#define HALMAC_TX_FIFO_SIZE_EX_3_BLK_8822B 65536 /* 64k */
#define HALMAC_RX_FIFO_SIZE_EX_3_BLK_8822B 221184 /* 216k */
/* TXFIFO LAYOUT
* HIGH_QUEUE
* NORMAL_QUEUE
* LOW_QUEUE
* EXTRA_QUEUE
* PUBLIC_QUEUE -- decided after all other queue are defined
* GAP_QUEUE -- Used to separate AC queue and Rsvd page
*
* RSVD_DRIVER -- Driver used rsvd page area
* RSVD_H2C_EXTRAINFO -- Extra Information for h2c
* RSVD_H2C_QUEUE -- h2c queue in rsvd page
* RSVD_CPU_INSTRUCTION -- extend fw code
* RSVD_FW_TXBUFF -- fw used this area to send packet
*
* Symbol: HALMAC_MODE_QUEUE_UNIT_CHIP, ex: HALMAC_LB_2BULKOUT_FWCMD_PGNUM_8822B
*/
#define HALMAC_EXTRA_INFO_BUFF_SIZE_FULL_FIFO_8822B \
16384 /*16K, only used in init case*/
#define HALMAC_RSVD_DRV_PGNUM_8822B 16 /*2048*/
#define HALMAC_RSVD_H2C_EXTRAINFO_PGNUM_8822B 32 /*4096*/
#define HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B 8 /*1024*/
#define HALMAC_RSVD_CPU_INSTRUCTION_PGNUM_8822B 0 /*0*/
#define HALMAC_RSVD_FW_TXBUFF_PGNUM_8822B 4 /*512*/
#define HALMAC_EFUSE_SIZE_8822B 1024 /* 0x400 */
#define HALMAC_BT_EFUSE_SIZE_8822B 128 /* 0x80 */
#define HALMAC_EEPROM_SIZE_8822B 0x300
#define HALMAC_CR_TRX_ENABLE_8822B \
(BIT_HCI_TXDMA_EN | BIT_HCI_RXDMA_EN | BIT_TXDMA_EN | BIT_RXDMA_EN | \
BIT_PROTOCOL_EN | BIT_SCHEDULE_EN | BIT_MACTXEN | BIT_MACRXEN)
#define HALMAC_BLK_DESC_NUM_8822B 0x3 /* Only for USB */
/* AMPDU max time (unit : 32us) */
#define HALMAC_AMPDU_MAX_TIME_8822B 0x70
/* Protect mode control */
#define HALMAC_PROT_RTS_LEN_TH_8822B 0xFF
#define HALMAC_PROT_RTS_TX_TIME_TH_8822B 0x08
#define HALMAC_PROT_MAX_AGG_PKT_LIMIT_8822B 0x20
#define HALMAC_PROT_RTS_MAX_AGG_PKT_LIMIT_8822B 0x20
/* Fast EDCA setting */
#define HALMAC_FAST_EDCA_VO_TH_8822B 0x06
#define HALMAC_FAST_EDCA_VI_TH_8822B 0x06
#define HALMAC_FAST_EDCA_BE_TH_8822B 0x06
#define HALMAC_FAST_EDCA_BK_TH_8822B 0x06
/* BAR setting */
#define HALMAC_BAR_RETRY_LIMIT_8822B 0x01
#define HALMAC_RA_TRY_RATE_AGG_LIMIT_8822B 0x08
enum halmac_normal_rxagg_th_to_8822b {
HALMAC_NORMAL_RXAGG_THRESHOLD_8822B = 0xFF,
HALMAC_NORMAL_RXAGG_TIMEOUT_8822B = 0x01,
};
enum halmac_loopback_rxagg_th_to_8822b {
HALMAC_LOOPBACK_RXAGG_THRESHOLD_8822B = 0xFF,
HALMAC_LOOPBACK_RXAGG_TIMEOUT_8822B = 0x01,
};
#endif
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "../halmac_88xx_cfg.h"
#include "halmac_8822b_cfg.h"
/**
* ============ip sel item list============
* HALMAC_IP_SEL_INTF_PHY
* USB2 : usb2 phy, 1byte value
* USB3 : usb3 phy, 2byte value
* PCIE1 : pcie gen1 mdio, 2byte value
* PCIE2 : pcie gen2 mdio, 2byte value
* HALMAC_IP_SEL_MAC
* USB2, USB3, PCIE1, PCIE2 : mac ip, 1byte value
* HALMAC_IP_SEL_PCIE_DBI
* USB2 USB3 : none
* PCIE1, PCIE2 : pcie dbi, 1byte value
*/
struct halmac_intf_phy_para_ HALMAC_RTL8822B_USB2_PHY[] = {
/* {offset, value, ip sel, cut mask, platform mask} */
{0xFFFF, 0x00, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL},
};
struct halmac_intf_phy_para_ HALMAC_RTL8822B_USB3_PHY[] = {
/* {offset, value, ip sel, cut mask, platform mask} */
{0x0001, 0xA841, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_D,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0xFFFF, 0x0000, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL},
};
struct halmac_intf_phy_para_ HALMAC_RTL8822B_PCIE_PHY_GEN1[] = {
/* {offset, value, ip sel, cut mask, platform mask} */
{0x0001, 0xA841, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0002, 0x60C6, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0008, 0x3596, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0009, 0x321C, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x000A, 0x9623, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0020, 0x94FF, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0021, 0xFFCF, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0026, 0xC006, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0029, 0xFF0E, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x002A, 0x1840, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0xFFFF, 0x0000, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL},
};
struct halmac_intf_phy_para_ HALMAC_RTL8822B_PCIE_PHY_GEN2[] = {
/* {offset, value, ip sel, cut mask, platform mask} */
{0x0001, 0xA841, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0002, 0x60C6, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0008, 0x3597, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0009, 0x321C, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x000A, 0x9623, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0020, 0x94FF, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0021, 0xFFCF, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0026, 0xC006, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x0029, 0xFF0E, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0x002A, 0x3040, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_C,
HALMAC_INTF_PHY_PLATFORM_ALL},
{0xFFFF, 0x0000, HALMAC_IP_SEL_INTF_PHY, HALMAC_INTF_PHY_CUT_ALL,
HALMAC_INTF_PHY_PLATFORM_ALL},
};
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef HALMAC_POWER_SEQUENCE_8822B
#define HALMAC_POWER_SEQUENCE_8822B
#include "../../halmac_pwr_seq_cmd.h"
#define HALMAC_8822B_PWR_SEQ_VER "V17"
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_card_disable_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_card_enable_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_suspend_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_resume_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_hwpdn_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_enter_lps_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_enter_deep_lps_flow[];
extern struct halmac_wl_pwr_cfg_ *halmac_8822b_leave_lps_flow[];
#endif
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "halmac_8822b_cfg.h"
#include "halmac_func_8822b.h"
#include "../halmac_func_88xx.h"
/**
* halmac_mount_api_8822b() - attach functions to function pointer
* @halmac_adapter
*
* SD1 internal use
*
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
*/
enum halmac_ret_status
halmac_mount_api_8822b(struct halmac_adapter *halmac_adapter)
{
struct halmac_api *halmac_api =
(struct halmac_api *)halmac_adapter->halmac_api;
halmac_adapter->chip_id = HALMAC_CHIP_ID_8822B;
halmac_adapter->hw_config_info.efuse_size = HALMAC_EFUSE_SIZE_8822B;
halmac_adapter->hw_config_info.eeprom_size = HALMAC_EEPROM_SIZE_8822B;
halmac_adapter->hw_config_info.bt_efuse_size =
HALMAC_BT_EFUSE_SIZE_8822B;
halmac_adapter->hw_config_info.cam_entry_num =
HALMAC_SECURITY_CAM_ENTRY_NUM_8822B;
halmac_adapter->hw_config_info.txdesc_size = HALMAC_TX_DESC_SIZE_8822B;
halmac_adapter->hw_config_info.rxdesc_size = HALMAC_RX_DESC_SIZE_8822B;
halmac_adapter->hw_config_info.tx_fifo_size = HALMAC_TX_FIFO_SIZE_8822B;
halmac_adapter->hw_config_info.rx_fifo_size = HALMAC_RX_FIFO_SIZE_8822B;
halmac_adapter->hw_config_info.page_size = HALMAC_TX_PAGE_SIZE_8822B;
halmac_adapter->hw_config_info.tx_align_size =
HALMAC_TX_ALIGN_SIZE_8822B;
halmac_adapter->hw_config_info.page_size_2_power =
HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
halmac_adapter->txff_allocation.rsvd_drv_pg_num =
HALMAC_RSVD_DRV_PGNUM_8822B;
halmac_api->halmac_init_trx_cfg = halmac_init_trx_cfg_8822b;
halmac_api->halmac_init_protocol_cfg = halmac_init_protocol_cfg_8822b;
halmac_api->halmac_init_h2c = halmac_init_h2c_8822b;
if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_SDIO) {
halmac_api->halmac_tx_allowed_sdio =
halmac_tx_allowed_sdio_88xx;
halmac_api->halmac_cfg_tx_agg_align =
halmac_cfg_tx_agg_align_sdio_not_support_88xx;
halmac_api->halmac_mac_power_switch =
halmac_mac_power_switch_8822b_sdio;
halmac_api->halmac_phy_cfg = halmac_phy_cfg_8822b_sdio;
halmac_api->halmac_interface_integration_tuning =
halmac_interface_integration_tuning_8822b_sdio;
} else if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_USB) {
halmac_api->halmac_mac_power_switch =
halmac_mac_power_switch_8822b_usb;
halmac_api->halmac_cfg_tx_agg_align =
halmac_cfg_tx_agg_align_usb_not_support_88xx;
halmac_api->halmac_phy_cfg = halmac_phy_cfg_8822b_usb;
halmac_api->halmac_interface_integration_tuning =
halmac_interface_integration_tuning_8822b_usb;
} else if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_PCIE) {
halmac_api->halmac_mac_power_switch =
halmac_mac_power_switch_8822b_pcie;
halmac_api->halmac_cfg_tx_agg_align =
halmac_cfg_tx_agg_align_pcie_not_support_88xx;
halmac_api->halmac_pcie_switch = halmac_pcie_switch_8822b;
halmac_api->halmac_phy_cfg = halmac_phy_cfg_8822b_pcie;
halmac_api->halmac_interface_integration_tuning =
halmac_interface_integration_tuning_8822b_pcie;
} else {
halmac_api->halmac_pcie_switch = halmac_pcie_switch_8822b_nc;
}
return HALMAC_RET_SUCCESS;
}
/**
* halmac_init_trx_cfg_8822b() - config trx dma register
* @halmac_adapter : the adapter of halmac
* @halmac_trx_mode : trx mode selection
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_init_trx_cfg_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode)
{
u8 value8;
u32 value32;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_INIT_TRX_CFG);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
halmac_adapter->trx_mode = halmac_trx_mode;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"halmac_init_trx_cfg ==========>halmac_trx_mode = %d\n",
halmac_trx_mode);
status = halmac_txdma_queue_mapping_8822b(halmac_adapter,
halmac_trx_mode);
if (status != HALMAC_RET_SUCCESS) {
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"halmac_txdma_queue_mapping fail!\n");
return status;
}
value8 = 0;
HALMAC_REG_WRITE_8(halmac_adapter, REG_CR, value8);
value8 = HALMAC_CR_TRX_ENABLE_8822B;
HALMAC_REG_WRITE_8(halmac_adapter, REG_CR, value8);
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2CQ_CSR, BIT(31));
status = halmac_priority_queue_config_8822b(halmac_adapter,
halmac_trx_mode);
if (halmac_adapter->txff_allocation.rx_fifo_expanding_mode !=
HALMAC_RX_FIFO_EXPANDING_MODE_DISABLE)
HALMAC_REG_WRITE_8(halmac_adapter, REG_RX_DRVINFO_SZ, 0xF);
if (status != HALMAC_RET_SUCCESS) {
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"halmac_txdma_queue_mapping fail!\n");
return status;
}
/* Config H2C packet buffer */
value32 = HALMAC_REG_READ_32(halmac_adapter, REG_H2C_HEAD);
value32 = (value32 & 0xFFFC0000) |
(halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B);
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2C_HEAD, value32);
value32 = HALMAC_REG_READ_32(halmac_adapter, REG_H2C_READ_ADDR);
value32 = (value32 & 0xFFFC0000) |
(halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B);
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2C_READ_ADDR, value32);
value32 = HALMAC_REG_READ_32(halmac_adapter, REG_H2C_TAIL);
value32 = (value32 & 0xFFFC0000) |
((halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B) +
(HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B));
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2C_TAIL, value32);
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_H2C_INFO);
value8 = (u8)((value8 & 0xFC) | 0x01);
HALMAC_REG_WRITE_8(halmac_adapter, REG_H2C_INFO, value8);
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_H2C_INFO);
value8 = (u8)((value8 & 0xFB) | 0x04);
HALMAC_REG_WRITE_8(halmac_adapter, REG_H2C_INFO, value8);
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_TXDMA_OFFSET_CHK + 1);
value8 = (u8)((value8 & 0x7f) | 0x80);
HALMAC_REG_WRITE_8(halmac_adapter, REG_TXDMA_OFFSET_CHK + 1, value8);
halmac_adapter->h2c_buff_size = HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
halmac_get_h2c_buff_free_space_88xx(halmac_adapter);
if (halmac_adapter->h2c_buff_size !=
halmac_adapter->h2c_buf_free_space) {
pr_err("get h2c free space error!\n");
return HALMAC_RET_GET_H2C_SPACE_ERR;
}
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"halmac_init_trx_cfg <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_init_protocol_cfg_8822b() - config protocol register
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_init_protocol_cfg_8822b(struct halmac_adapter *halmac_adapter)
{
u32 value32;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_INIT_PROTOCOL_CFG);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"[TRACE]%s ==========>\n", __func__);
HALMAC_REG_WRITE_8(halmac_adapter, REG_AMPDU_MAX_TIME_V1,
HALMAC_AMPDU_MAX_TIME_8822B);
HALMAC_REG_WRITE_8(halmac_adapter, REG_TX_HANG_CTRL, BIT_EN_EOF_V1);
value32 = HALMAC_PROT_RTS_LEN_TH_8822B |
(HALMAC_PROT_RTS_TX_TIME_TH_8822B << 8) |
(HALMAC_PROT_MAX_AGG_PKT_LIMIT_8822B << 16) |
(HALMAC_PROT_RTS_MAX_AGG_PKT_LIMIT_8822B << 24);
HALMAC_REG_WRITE_32(halmac_adapter, REG_PROT_MODE_CTRL, value32);
HALMAC_REG_WRITE_16(halmac_adapter, REG_BAR_MODE_CTRL + 2,
HALMAC_BAR_RETRY_LIMIT_8822B |
HALMAC_RA_TRY_RATE_AGG_LIMIT_8822B << 8);
HALMAC_REG_WRITE_8(halmac_adapter, REG_FAST_EDCA_VOVI_SETTING,
HALMAC_FAST_EDCA_VO_TH_8822B);
HALMAC_REG_WRITE_8(halmac_adapter, REG_FAST_EDCA_VOVI_SETTING + 2,
HALMAC_FAST_EDCA_VI_TH_8822B);
HALMAC_REG_WRITE_8(halmac_adapter, REG_FAST_EDCA_BEBK_SETTING,
HALMAC_FAST_EDCA_BE_TH_8822B);
HALMAC_REG_WRITE_8(halmac_adapter, REG_FAST_EDCA_BEBK_SETTING + 2,
HALMAC_FAST_EDCA_BK_TH_8822B);
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"[TRACE]%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_init_h2c_8822b() - config h2c packet buffer
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_init_h2c_8822b(struct halmac_adapter *halmac_adapter)
{
u8 value8;
u32 value32;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
value8 = 0;
HALMAC_REG_WRITE_8(halmac_adapter, REG_CR, value8);
value8 = HALMAC_CR_TRX_ENABLE_8822B;
HALMAC_REG_WRITE_8(halmac_adapter, REG_CR, value8);
value32 = HALMAC_REG_READ_32(halmac_adapter, REG_H2C_HEAD);
value32 = (value32 & 0xFFFC0000) |
(halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B);
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2C_HEAD, value32);
value32 = HALMAC_REG_READ_32(halmac_adapter, REG_H2C_READ_ADDR);
value32 = (value32 & 0xFFFC0000) |
(halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B);
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2C_READ_ADDR, value32);
value32 = HALMAC_REG_READ_32(halmac_adapter, REG_H2C_TAIL);
value32 = (value32 & 0xFFFC0000) |
((halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B) +
(HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B));
HALMAC_REG_WRITE_32(halmac_adapter, REG_H2C_TAIL, value32);
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_H2C_INFO);
value8 = (u8)((value8 & 0xFC) | 0x01);
HALMAC_REG_WRITE_8(halmac_adapter, REG_H2C_INFO, value8);
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_H2C_INFO);
value8 = (u8)((value8 & 0xFB) | 0x04);
HALMAC_REG_WRITE_8(halmac_adapter, REG_H2C_INFO, value8);
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_TXDMA_OFFSET_CHK + 1);
value8 = (u8)((value8 & 0x7f) | 0x80);
HALMAC_REG_WRITE_8(halmac_adapter, REG_TXDMA_OFFSET_CHK + 1, value8);
halmac_adapter->h2c_buff_size = HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B
<< HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
halmac_get_h2c_buff_free_space_88xx(halmac_adapter);
if (halmac_adapter->h2c_buff_size !=
halmac_adapter->h2c_buf_free_space) {
pr_err("get h2c free space error!\n");
return HALMAC_RET_GET_H2C_SPACE_ERR;
}
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"h2c free space : %d\n",
halmac_adapter->h2c_buf_free_space);
return HALMAC_RET_SUCCESS;
}
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_8822B_H_
#define _HALMAC_API_8822B_H_
#include "../../halmac_2_platform.h"
#include "../../halmac_type.h"
enum halmac_ret_status
halmac_mount_api_8822b(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_init_trx_cfg_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode);
enum halmac_ret_status
halmac_init_protocol_cfg_8822b(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_init_h2c_8822b(struct halmac_adapter *halmac_adapter);
#endif /* _HALMAC_API_8822B_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "../halmac_88xx_cfg.h"
#include "../halmac_api_88xx_pcie.h"
#include "halmac_8822b_cfg.h"
/**
* halmac_mac_power_switch_8822b_pcie() - switch mac power
* @halmac_adapter : the adapter of halmac
* @halmac_power : power state
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_mac_power_switch_8822b_pcie(struct halmac_adapter *halmac_adapter,
enum halmac_mac_power halmac_power)
{
u8 interface_mask;
u8 value8;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_MAC_POWER_SWITCH);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_mac_power_switch_88xx_pcie halmac_power = %x ==========>\n",
halmac_power);
interface_mask = HALMAC_PWR_INTF_PCI_MSK;
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_CR);
if (value8 == 0xEA)
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_OFF;
else
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_ON;
/* Check if power switch is needed */
if (halmac_power == HALMAC_MAC_POWER_ON &&
halmac_adapter->halmac_state.mac_power == HALMAC_MAC_POWER_ON) {
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_WARNING,
"halmac_mac_power_switch power state unchange!\n");
return HALMAC_RET_PWR_UNCHANGE;
}
if (halmac_power == HALMAC_MAC_POWER_OFF) {
if (halmac_pwr_seq_parser_88xx(
halmac_adapter, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_FAB_TSMC_MSK, interface_mask,
halmac_8822b_card_disable_flow) !=
HALMAC_RET_SUCCESS) {
pr_err("Handle power off cmd error\n");
return HALMAC_RET_POWER_OFF_FAIL;
}
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_OFF;
halmac_adapter->halmac_state.ps_state =
HALMAC_PS_STATE_UNDEFINE;
halmac_adapter->halmac_state.dlfw_state = HALMAC_DLFW_NONE;
halmac_init_adapter_dynamic_para_88xx(halmac_adapter);
} else {
if (halmac_pwr_seq_parser_88xx(
halmac_adapter, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_FAB_TSMC_MSK, interface_mask,
halmac_8822b_card_enable_flow) !=
HALMAC_RET_SUCCESS) {
pr_err("Handle power on cmd error\n");
return HALMAC_RET_POWER_ON_FAIL;
}
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_ON;
halmac_adapter->halmac_state.ps_state = HALMAC_PS_STATE_ACT;
}
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_mac_power_switch_88xx_pcie <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_pcie_switch_8822b() - pcie gen1/gen2 switch
* @halmac_adapter : the adapter of halmac
* @pcie_cfg : gen1/gen2 selection
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_pcie_switch_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_pcie_cfg pcie_cfg)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
u8 current_link_speed = 0;
u32 count = 0;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_PCIE_SWITCH);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"%s ==========>\n", __func__);
/* Link Control 2 Register[3:0] Target Link Speed
* Defined encodings are:
* 0001b Target Link 2.5 GT/s
* 0010b Target Link 5.0 GT/s
* 0100b Target Link 8.0 GT/s
*/
if (pcie_cfg == HALMAC_PCIE_GEN1) {
/* cfg 0xA0[3:0]=4'b0001 */
halmac_dbi_write8_88xx(
halmac_adapter, LINK_CTRL2_REG_OFFSET,
(halmac_dbi_read8_88xx(halmac_adapter,
LINK_CTRL2_REG_OFFSET) &
0xF0) | BIT(0));
/* cfg 0x80C[17]=1 //PCIe DesignWave */
halmac_dbi_write32_88xx(
halmac_adapter, GEN2_CTRL_OFFSET,
halmac_dbi_read32_88xx(halmac_adapter,
GEN2_CTRL_OFFSET) |
BIT(17));
/* check link speed if GEN1 */
/* cfg 0x82[3:0]=4'b0001 */
current_link_speed =
halmac_dbi_read8_88xx(halmac_adapter,
LINK_STATUS_REG_OFFSET) &
0x0F;
count = 2000;
while (current_link_speed != GEN1_SPEED && count != 0) {
usleep_range(50, 60);
current_link_speed =
halmac_dbi_read8_88xx(halmac_adapter,
LINK_STATUS_REG_OFFSET) &
0x0F;
count--;
}
if (current_link_speed != GEN1_SPEED) {
pr_err("Speed change to GEN1 fail !\n");
return HALMAC_RET_FAIL;
}
} else if (pcie_cfg == HALMAC_PCIE_GEN2) {
/* cfg 0xA0[3:0]=4'b0010 */
halmac_dbi_write8_88xx(
halmac_adapter, LINK_CTRL2_REG_OFFSET,
(halmac_dbi_read8_88xx(halmac_adapter,
LINK_CTRL2_REG_OFFSET) &
0xF0) | BIT(1));
/* cfg 0x80C[17]=1 //PCIe DesignWave */
halmac_dbi_write32_88xx(
halmac_adapter, GEN2_CTRL_OFFSET,
halmac_dbi_read32_88xx(halmac_adapter,
GEN2_CTRL_OFFSET) |
BIT(17));
/* check link speed if GEN2 */
/* cfg 0x82[3:0]=4'b0010 */
current_link_speed =
halmac_dbi_read8_88xx(halmac_adapter,
LINK_STATUS_REG_OFFSET) &
0x0F;
count = 2000;
while (current_link_speed != GEN2_SPEED && count != 0) {
usleep_range(50, 60);
current_link_speed =
halmac_dbi_read8_88xx(halmac_adapter,
LINK_STATUS_REG_OFFSET) &
0x0F;
count--;
}
if (current_link_speed != GEN2_SPEED) {
pr_err("Speed change to GEN1 fail !\n");
return HALMAC_RET_FAIL;
}
} else {
pr_err("Error Speed !\n");
return HALMAC_RET_FAIL;
}
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
enum halmac_ret_status
halmac_pcie_switch_8822b_nc(struct halmac_adapter *halmac_adapter,
enum halmac_pcie_cfg pcie_cfg)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_PCIE_SWITCH);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"%s ==========>\n", __func__);
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_phy_cfg_8822b_pcie() - phy config
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_phy_cfg_8822b_pcie(struct halmac_adapter *halmac_adapter,
enum halmac_intf_phy_platform platform)
{
void *driver_adapter = NULL;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_PHY_CFG);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_phy_cfg ==========>\n");
status = halmac_parse_intf_phy_88xx(halmac_adapter,
HALMAC_RTL8822B_PCIE_PHY_GEN1,
platform, HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
status = halmac_parse_intf_phy_88xx(halmac_adapter,
HALMAC_RTL8822B_PCIE_PHY_GEN2,
platform, HAL_INTF_PHY_PCIE_GEN2);
if (status != HALMAC_RET_SUCCESS)
return status;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_phy_cfg <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_interface_integration_tuning_8822b_pcie() - pcie interface fine tuning
* @halmac_adapter : the adapter of halmac
* Author : Rick Liu
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status halmac_interface_integration_tuning_8822b_pcie(
struct halmac_adapter *halmac_adapter)
{
return HALMAC_RET_SUCCESS;
}
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_8822B_PCIE_H_
#define _HALMAC_API_8822B_PCIE_H_
#include "../../halmac_2_platform.h"
#include "../../halmac_type.h"
extern struct halmac_intf_phy_para_ HALMAC_RTL8822B_PCIE_PHY_GEN1[];
extern struct halmac_intf_phy_para_ HALMAC_RTL8822B_PCIE_PHY_GEN2[];
enum halmac_ret_status
halmac_mac_power_switch_8822b_pcie(struct halmac_adapter *halmac_adapter,
enum halmac_mac_power halmac_power);
enum halmac_ret_status
halmac_pcie_switch_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_pcie_cfg pcie_cfg);
enum halmac_ret_status
halmac_pcie_switch_8822b_nc(struct halmac_adapter *halmac_adapter,
enum halmac_pcie_cfg pcie_cfg);
enum halmac_ret_status
halmac_phy_cfg_8822b_pcie(struct halmac_adapter *halmac_adapter,
enum halmac_intf_phy_platform platform);
enum halmac_ret_status halmac_interface_integration_tuning_8822b_pcie(
struct halmac_adapter *halmac_adapter);
#endif /* _HALMAC_API_8822B_PCIE_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "halmac_8822b_cfg.h"
/**
* halmac_mac_power_switch_8822b_sdio() - switch mac power
* @halmac_adapter : the adapter of halmac
* @halmac_power : power state
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_mac_power_switch_8822b_sdio(struct halmac_adapter *halmac_adapter,
enum halmac_mac_power halmac_power)
{
u8 interface_mask;
u8 value8;
u8 rpwm;
u32 imr_backup;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"[TRACE]halmac_mac_power_switch_88xx_sdio==========>\n");
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"[TRACE]halmac_power = %x ==========>\n", halmac_power);
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"[TRACE]8822B pwr seq ver = %s\n",
HALMAC_8822B_PWR_SEQ_VER);
interface_mask = HALMAC_PWR_INTF_SDIO_MSK;
halmac_adapter->rpwm_record =
HALMAC_REG_READ_8(halmac_adapter, REG_SDIO_HRPWM1);
/* Check FW still exist or not */
if (HALMAC_REG_READ_16(halmac_adapter, REG_MCUFW_CTRL) == 0xC078) {
/* Leave 32K */
rpwm = (u8)((halmac_adapter->rpwm_record ^ BIT(7)) & 0x80);
HALMAC_REG_WRITE_8(halmac_adapter, REG_SDIO_HRPWM1, rpwm);
}
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_CR);
if (value8 == 0xEA)
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_OFF;
else
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_ON;
/*Check if power switch is needed*/
if (halmac_power == HALMAC_MAC_POWER_ON &&
halmac_adapter->halmac_state.mac_power == HALMAC_MAC_POWER_ON) {
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_WARNING,
"[WARN]halmac_mac_power_switch power state unchange!\n");
return HALMAC_RET_PWR_UNCHANGE;
}
imr_backup = HALMAC_REG_READ_32(halmac_adapter, REG_SDIO_HIMR);
HALMAC_REG_WRITE_32(halmac_adapter, REG_SDIO_HIMR, 0);
if (halmac_power == HALMAC_MAC_POWER_OFF) {
if (halmac_pwr_seq_parser_88xx(
halmac_adapter, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_FAB_TSMC_MSK, interface_mask,
halmac_8822b_card_disable_flow) !=
HALMAC_RET_SUCCESS) {
pr_err("[ERR]Handle power off cmd error\n");
HALMAC_REG_WRITE_32(halmac_adapter, REG_SDIO_HIMR,
imr_backup);
return HALMAC_RET_POWER_OFF_FAIL;
}
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_OFF;
halmac_adapter->halmac_state.ps_state =
HALMAC_PS_STATE_UNDEFINE;
halmac_adapter->halmac_state.dlfw_state = HALMAC_DLFW_NONE;
halmac_init_adapter_dynamic_para_88xx(halmac_adapter);
} else {
if (halmac_pwr_seq_parser_88xx(
halmac_adapter, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_FAB_TSMC_MSK, interface_mask,
halmac_8822b_card_enable_flow) !=
HALMAC_RET_SUCCESS) {
pr_err("[ERR]Handle power on cmd error\n");
HALMAC_REG_WRITE_32(halmac_adapter, REG_SDIO_HIMR,
imr_backup);
return HALMAC_RET_POWER_ON_FAIL;
}
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_ON;
halmac_adapter->halmac_state.ps_state = HALMAC_PS_STATE_ACT;
}
HALMAC_REG_WRITE_32(halmac_adapter, REG_SDIO_HIMR, imr_backup);
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"[TRACE]halmac_mac_power_switch_88xx_sdio <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_phy_cfg_8822b_sdio() - phy config
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_phy_cfg_8822b_sdio(struct halmac_adapter *halmac_adapter,
enum halmac_intf_phy_platform platform)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_PHY_CFG);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_phy_cfg ==========>\n");
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"sdio no phy\n");
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_phy_cfg <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_interface_integration_tuning_8822b_sdio() - sdio interface fine tuning
* @halmac_adapter : the adapter of halmac
* Author : Ivan
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status halmac_interface_integration_tuning_8822b_sdio(
struct halmac_adapter *halmac_adapter)
{
return HALMAC_RET_SUCCESS;
}
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_8822B_SDIO_H_
#define _HALMAC_API_8822B_SDIO_H_
#include "../../halmac_2_platform.h"
#include "../../halmac_type.h"
enum halmac_ret_status
halmac_mac_power_switch_8822b_sdio(struct halmac_adapter *halmac_adapter,
enum halmac_mac_power halmac_power);
enum halmac_ret_status
halmac_phy_cfg_8822b_sdio(struct halmac_adapter *halmac_adapter,
enum halmac_intf_phy_platform platform);
enum halmac_ret_status halmac_interface_integration_tuning_8822b_sdio(
struct halmac_adapter *halmac_adapter);
#endif /* _HALMAC_API_8822B_SDIO_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "../halmac_88xx_cfg.h"
#include "halmac_8822b_cfg.h"
/**
* halmac_mac_power_switch_8822b_usb() - switch mac power
* @halmac_adapter : the adapter of halmac
* @halmac_power : power state
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_mac_power_switch_8822b_usb(struct halmac_adapter *halmac_adapter,
enum halmac_mac_power halmac_power)
{
u8 interface_mask;
u8 value8;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_MAC_POWER_SWITCH);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_mac_power_switch_88xx_usb halmac_power = %x ==========>\n",
halmac_power);
interface_mask = HALMAC_PWR_INTF_USB_MSK;
value8 = HALMAC_REG_READ_8(halmac_adapter, REG_CR);
if (value8 == 0xEA) {
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_OFF;
} else {
if (BIT(0) ==
(HALMAC_REG_READ_8(halmac_adapter, REG_SYS_STATUS1 + 1) &
BIT(0)))
halmac_adapter->halmac_state.mac_power =
HALMAC_MAC_POWER_OFF;
else
halmac_adapter->halmac_state.mac_power =
HALMAC_MAC_POWER_ON;
}
/*Check if power switch is needed*/
if (halmac_power == HALMAC_MAC_POWER_ON &&
halmac_adapter->halmac_state.mac_power == HALMAC_MAC_POWER_ON) {
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_PWR, DBG_WARNING,
"halmac_mac_power_switch power state unchange!\n");
return HALMAC_RET_PWR_UNCHANGE;
}
if (halmac_power == HALMAC_MAC_POWER_OFF) {
if (halmac_pwr_seq_parser_88xx(
halmac_adapter, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_FAB_TSMC_MSK, interface_mask,
halmac_8822b_card_disable_flow) !=
HALMAC_RET_SUCCESS) {
pr_err("Handle power off cmd error\n");
return HALMAC_RET_POWER_OFF_FAIL;
}
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_OFF;
halmac_adapter->halmac_state.ps_state =
HALMAC_PS_STATE_UNDEFINE;
halmac_adapter->halmac_state.dlfw_state = HALMAC_DLFW_NONE;
halmac_init_adapter_dynamic_para_88xx(halmac_adapter);
} else {
if (halmac_pwr_seq_parser_88xx(
halmac_adapter, HALMAC_PWR_CUT_ALL_MSK,
HALMAC_PWR_FAB_TSMC_MSK, interface_mask,
halmac_8822b_card_enable_flow) !=
HALMAC_RET_SUCCESS) {
pr_err("Handle power on cmd error\n");
return HALMAC_RET_POWER_ON_FAIL;
}
HALMAC_REG_WRITE_8(
halmac_adapter, REG_SYS_STATUS1 + 1,
HALMAC_REG_READ_8(halmac_adapter, REG_SYS_STATUS1 + 1) &
~(BIT(0)));
halmac_adapter->halmac_state.mac_power = HALMAC_MAC_POWER_ON;
halmac_adapter->halmac_state.ps_state = HALMAC_PS_STATE_ACT;
}
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_mac_power_switch_88xx_usb <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_phy_cfg_8822b_usb() - phy config
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_phy_cfg_8822b_usb(struct halmac_adapter *halmac_adapter,
enum halmac_intf_phy_platform platform)
{
void *driver_adapter = NULL;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_PHY_CFG);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_phy_cfg ==========>\n");
status = halmac_parse_intf_phy_88xx(halmac_adapter,
HALMAC_RTL8822B_USB2_PHY, platform,
HAL_INTF_PHY_USB2);
if (status != HALMAC_RET_SUCCESS)
return status;
status = halmac_parse_intf_phy_88xx(halmac_adapter,
HALMAC_RTL8822B_USB3_PHY, platform,
HAL_INTF_PHY_USB3);
if (status != HALMAC_RET_SUCCESS)
return status;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_PWR, DBG_DMESG,
"halmac_phy_cfg <==========\n");
return HALMAC_RET_SUCCESS;
}
/**
* halmac_interface_integration_tuning_8822b_usb() - usb interface fine tuning
* @halmac_adapter : the adapter of halmac
* Author : Ivan
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status halmac_interface_integration_tuning_8822b_usb(
struct halmac_adapter *halmac_adapter)
{
return HALMAC_RET_SUCCESS;
}
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_8822B_USB_H_
#define _HALMAC_API_8822B_USB_H_
extern struct halmac_intf_phy_para_ HALMAC_RTL8822B_USB2_PHY[];
extern struct halmac_intf_phy_para_ HALMAC_RTL8822B_USB3_PHY[];
#include "../../halmac_2_platform.h"
#include "../../halmac_type.h"
enum halmac_ret_status
halmac_mac_power_switch_8822b_usb(struct halmac_adapter *halmac_adapter,
enum halmac_mac_power halmac_power);
enum halmac_ret_status
halmac_phy_cfg_8822b_usb(struct halmac_adapter *halmac_adapter,
enum halmac_intf_phy_platform platform);
enum halmac_ret_status halmac_interface_integration_tuning_8822b_usb(
struct halmac_adapter *halmac_adapter);
#endif /* _HALMAC_API_8822B_USB_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "halmac_8822b_cfg.h"
#include "halmac_func_8822b.h"
/*SDIO RQPN Mapping*/
static struct halmac_rqpn_ HALMAC_RQPN_SDIO_8822B[] = {
/* { mode, vo_map, vi_map, be_map, bk_map, mg_map, hi_map } */
{HALMAC_TRX_MODE_NORMAL, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_TRXSHARE, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_WMM, HALMAC_MAP2_HQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_P2P, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_LOOPBACK, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
};
/*PCIE RQPN Mapping*/
static struct halmac_rqpn_ HALMAC_RQPN_PCIE_8822B[] = {
/* { mode, vo_map, vi_map, be_map, bk_map, mg_map, hi_map } */
{HALMAC_TRX_MODE_NORMAL, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_TRXSHARE, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_WMM, HALMAC_MAP2_HQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_P2P, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_LOOPBACK, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
};
/*USB 2 Bulkout RQPN Mapping*/
static struct halmac_rqpn_ HALMAC_RQPN_2BULKOUT_8822B[] = {
/* { mode, vo_map, vi_map, be_map, bk_map, mg_map, hi_map } */
{HALMAC_TRX_MODE_NORMAL, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_HQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_TRXSHARE, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_WMM, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_HQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_P2P, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_LOOPBACK, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ,
HALMAC_MAP2_HQ, HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ,
HALMAC_MAP2_HQ, HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
};
/*USB 3 Bulkout RQPN Mapping*/
static struct halmac_rqpn_ HALMAC_RQPN_3BULKOUT_8822B[] = {
/* { mode, vo_map, vi_map, be_map, bk_map, mg_map, hi_map } */
{HALMAC_TRX_MODE_NORMAL, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_TRXSHARE, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_WMM, HALMAC_MAP2_HQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_P2P, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_LOOPBACK, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_NQ, HALMAC_MAP2_HQ, HALMAC_MAP2_HQ},
};
/*USB 4 Bulkout RQPN Mapping*/
static struct halmac_rqpn_ HALMAC_RQPN_4BULKOUT_8822B[] = {
/* { mode, vo_map, vi_map, be_map, bk_map, mg_map, hi_map } */
{HALMAC_TRX_MODE_NORMAL, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_TRXSHARE, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_WMM, HALMAC_MAP2_HQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_NQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_P2P, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ, HALMAC_MAP2_LQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_LOOPBACK, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, HALMAC_MAP2_NQ, HALMAC_MAP2_NQ,
HALMAC_MAP2_LQ, HALMAC_MAP2_LQ, HALMAC_MAP2_EXQ, HALMAC_MAP2_HQ},
};
/*SDIO Page Number*/
static struct halmac_pg_num_ HALMAC_PG_NUM_SDIO_8822B[] = {
/* { mode, hq_num, nq_num, lq_num, exq_num, gap_num} */
{HALMAC_TRX_MODE_NORMAL, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_TRXSHARE, 32, 32, 32, 32, 1},
{HALMAC_TRX_MODE_WMM, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_P2P, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_LOOPBACK, 64, 64, 64, 64, 640},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, 64, 64, 64, 64, 640},
};
/*PCIE Page Number*/
static struct halmac_pg_num_ HALMAC_PG_NUM_PCIE_8822B[] = {
/* { mode, hq_num, nq_num, lq_num, exq_num, gap_num} */
{HALMAC_TRX_MODE_NORMAL, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_TRXSHARE, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_WMM, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_P2P, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_LOOPBACK, 64, 64, 64, 64, 640},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, 64, 64, 64, 64, 640},
};
/*USB 2 Bulkout Page Number*/
static struct halmac_pg_num_ HALMAC_PG_NUM_2BULKOUT_8822B[] = {
/* { mode, hq_num, nq_num, lq_num, exq_num, gap_num} */
{HALMAC_TRX_MODE_NORMAL, 64, 64, 0, 0, 1},
{HALMAC_TRX_MODE_TRXSHARE, 64, 64, 0, 0, 1},
{HALMAC_TRX_MODE_WMM, 64, 64, 0, 0, 1},
{HALMAC_TRX_MODE_P2P, 64, 64, 0, 0, 1},
{HALMAC_TRX_MODE_LOOPBACK, 64, 64, 0, 0, 1024},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, 64, 64, 0, 0, 1024},
};
/*USB 3 Bulkout Page Number*/
static struct halmac_pg_num_ HALMAC_PG_NUM_3BULKOUT_8822B[] = {
/* { mode, hq_num, nq_num, lq_num, exq_num, gap_num} */
{HALMAC_TRX_MODE_NORMAL, 64, 64, 64, 0, 1},
{HALMAC_TRX_MODE_TRXSHARE, 64, 64, 64, 0, 1},
{HALMAC_TRX_MODE_WMM, 64, 64, 64, 0, 1},
{HALMAC_TRX_MODE_P2P, 64, 64, 64, 0, 1},
{HALMAC_TRX_MODE_LOOPBACK, 64, 64, 64, 0, 1024},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, 64, 64, 64, 0, 1024},
};
/*USB 4 Bulkout Page Number*/
static struct halmac_pg_num_ HALMAC_PG_NUM_4BULKOUT_8822B[] = {
/* { mode, hq_num, nq_num, lq_num, exq_num, gap_num} */
{HALMAC_TRX_MODE_NORMAL, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_TRXSHARE, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_WMM, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_P2P, 64, 64, 64, 64, 1},
{HALMAC_TRX_MODE_LOOPBACK, 64, 64, 64, 64, 640},
{HALMAC_TRX_MODE_DELAY_LOOPBACK, 64, 64, 64, 64, 640},
};
enum halmac_ret_status
halmac_txdma_queue_mapping_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode)
{
u16 value16;
void *driver_adapter = NULL;
struct halmac_rqpn_ *curr_rqpn_sel = NULL;
enum halmac_ret_status status;
struct halmac_api *halmac_api;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_SDIO) {
curr_rqpn_sel = HALMAC_RQPN_SDIO_8822B;
} else if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_PCIE) {
curr_rqpn_sel = HALMAC_RQPN_PCIE_8822B;
} else if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_USB) {
if (halmac_adapter->halmac_bulkout_num == 2) {
curr_rqpn_sel = HALMAC_RQPN_2BULKOUT_8822B;
} else if (halmac_adapter->halmac_bulkout_num == 3) {
curr_rqpn_sel = HALMAC_RQPN_3BULKOUT_8822B;
} else if (halmac_adapter->halmac_bulkout_num == 4) {
curr_rqpn_sel = HALMAC_RQPN_4BULKOUT_8822B;
} else {
pr_err("[ERR]interface not support\n");
return HALMAC_RET_NOT_SUPPORT;
}
} else {
return HALMAC_RET_NOT_SUPPORT;
}
status = halmac_rqpn_parser_88xx(halmac_adapter, halmac_trx_mode,
curr_rqpn_sel);
if (status != HALMAC_RET_SUCCESS)
return status;
value16 = 0;
value16 |= BIT_TXDMA_HIQ_MAP(
halmac_adapter->halmac_ptcl_queue[HALMAC_PTCL_QUEUE_HI]);
value16 |= BIT_TXDMA_MGQ_MAP(
halmac_adapter->halmac_ptcl_queue[HALMAC_PTCL_QUEUE_MG]);
value16 |= BIT_TXDMA_BKQ_MAP(
halmac_adapter->halmac_ptcl_queue[HALMAC_PTCL_QUEUE_BK]);
value16 |= BIT_TXDMA_BEQ_MAP(
halmac_adapter->halmac_ptcl_queue[HALMAC_PTCL_QUEUE_BE]);
value16 |= BIT_TXDMA_VIQ_MAP(
halmac_adapter->halmac_ptcl_queue[HALMAC_PTCL_QUEUE_VI]);
value16 |= BIT_TXDMA_VOQ_MAP(
halmac_adapter->halmac_ptcl_queue[HALMAC_PTCL_QUEUE_VO]);
HALMAC_REG_WRITE_16(halmac_adapter, REG_TXDMA_PQ_MAP, value16);
return HALMAC_RET_SUCCESS;
}
enum halmac_ret_status
halmac_priority_queue_config_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode)
{
u8 transfer_mode = 0;
u8 value8;
u32 counter;
enum halmac_ret_status status;
struct halmac_pg_num_ *curr_pg_num = NULL;
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
if (halmac_adapter->txff_allocation.la_mode == HALMAC_LA_MODE_DISABLE) {
if (halmac_adapter->txff_allocation.rx_fifo_expanding_mode ==
HALMAC_RX_FIFO_EXPANDING_MODE_DISABLE) {
halmac_adapter->txff_allocation.tx_fifo_pg_num =
HALMAC_TX_FIFO_SIZE_8822B >>
HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
} else if (halmac_adapter->txff_allocation
.rx_fifo_expanding_mode ==
HALMAC_RX_FIFO_EXPANDING_MODE_1_BLOCK) {
halmac_adapter->txff_allocation.tx_fifo_pg_num =
HALMAC_TX_FIFO_SIZE_EX_1_BLK_8822B >>
HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
halmac_adapter->hw_config_info.tx_fifo_size =
HALMAC_TX_FIFO_SIZE_EX_1_BLK_8822B;
if (HALMAC_RX_FIFO_SIZE_EX_1_BLK_8822B <=
HALMAC_RX_FIFO_SIZE_EX_1_BLK_MAX_8822B)
halmac_adapter->hw_config_info.rx_fifo_size =
HALMAC_RX_FIFO_SIZE_EX_1_BLK_8822B;
else
halmac_adapter->hw_config_info.rx_fifo_size =
HALMAC_RX_FIFO_SIZE_EX_1_BLK_MAX_8822B;
} else {
halmac_adapter->txff_allocation.tx_fifo_pg_num =
HALMAC_TX_FIFO_SIZE_8822B >>
HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
pr_err("[ERR]rx_fifo_expanding_mode = %d not support\n",
halmac_adapter->txff_allocation
.rx_fifo_expanding_mode);
}
} else {
halmac_adapter->txff_allocation.tx_fifo_pg_num =
HALMAC_TX_FIFO_SIZE_LA_8822B >>
HALMAC_TX_PAGE_SIZE_2_POWER_8822B;
}
halmac_adapter->txff_allocation.rsvd_pg_num =
(halmac_adapter->txff_allocation.rsvd_drv_pg_num +
HALMAC_RSVD_H2C_EXTRAINFO_PGNUM_8822B +
HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B +
HALMAC_RSVD_CPU_INSTRUCTION_PGNUM_8822B +
HALMAC_RSVD_FW_TXBUFF_PGNUM_8822B);
if (halmac_adapter->txff_allocation.rsvd_pg_num >
halmac_adapter->txff_allocation.tx_fifo_pg_num)
return HALMAC_RET_CFG_TXFIFO_PAGE_FAIL;
halmac_adapter->txff_allocation.ac_q_pg_num =
halmac_adapter->txff_allocation.tx_fifo_pg_num -
halmac_adapter->txff_allocation.rsvd_pg_num;
halmac_adapter->txff_allocation.rsvd_pg_bndy =
halmac_adapter->txff_allocation.tx_fifo_pg_num -
halmac_adapter->txff_allocation.rsvd_pg_num;
halmac_adapter->txff_allocation.rsvd_fw_txbuff_pg_bndy =
halmac_adapter->txff_allocation.tx_fifo_pg_num -
HALMAC_RSVD_FW_TXBUFF_PGNUM_8822B;
halmac_adapter->txff_allocation.rsvd_cpu_instr_pg_bndy =
halmac_adapter->txff_allocation.rsvd_fw_txbuff_pg_bndy -
HALMAC_RSVD_CPU_INSTRUCTION_PGNUM_8822B;
halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy =
halmac_adapter->txff_allocation.rsvd_cpu_instr_pg_bndy -
HALMAC_RSVD_H2C_QUEUE_PGNUM_8822B;
halmac_adapter->txff_allocation.rsvd_h2c_extra_info_pg_bndy =
halmac_adapter->txff_allocation.rsvd_h2c_queue_pg_bndy -
HALMAC_RSVD_H2C_EXTRAINFO_PGNUM_8822B;
halmac_adapter->txff_allocation.rsvd_drv_pg_bndy =
halmac_adapter->txff_allocation.rsvd_h2c_extra_info_pg_bndy -
halmac_adapter->txff_allocation.rsvd_drv_pg_num;
if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_SDIO) {
curr_pg_num = HALMAC_PG_NUM_SDIO_8822B;
} else if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_PCIE) {
curr_pg_num = HALMAC_PG_NUM_PCIE_8822B;
} else if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_USB) {
if (halmac_adapter->halmac_bulkout_num == 2) {
curr_pg_num = HALMAC_PG_NUM_2BULKOUT_8822B;
} else if (halmac_adapter->halmac_bulkout_num == 3) {
curr_pg_num = HALMAC_PG_NUM_3BULKOUT_8822B;
} else if (halmac_adapter->halmac_bulkout_num == 4) {
curr_pg_num = HALMAC_PG_NUM_4BULKOUT_8822B;
} else {
pr_err("[ERR]interface not support\n");
return HALMAC_RET_NOT_SUPPORT;
}
} else {
return HALMAC_RET_NOT_SUPPORT;
}
status = halmac_pg_num_parser_88xx(halmac_adapter, halmac_trx_mode,
curr_pg_num);
if (status != HALMAC_RET_SUCCESS)
return status;
HALMAC_REG_WRITE_16(halmac_adapter, REG_FIFOPAGE_INFO_1,
halmac_adapter->txff_allocation.high_queue_pg_num);
HALMAC_REG_WRITE_16(halmac_adapter, REG_FIFOPAGE_INFO_2,
halmac_adapter->txff_allocation.low_queue_pg_num);
HALMAC_REG_WRITE_16(
halmac_adapter, REG_FIFOPAGE_INFO_3,
halmac_adapter->txff_allocation.normal_queue_pg_num);
HALMAC_REG_WRITE_16(halmac_adapter, REG_FIFOPAGE_INFO_4,
halmac_adapter->txff_allocation.extra_queue_pg_num);
HALMAC_REG_WRITE_16(halmac_adapter, REG_FIFOPAGE_INFO_5,
halmac_adapter->txff_allocation.pub_queue_pg_num);
halmac_adapter->sdio_free_space.high_queue_number =
halmac_adapter->txff_allocation.high_queue_pg_num;
halmac_adapter->sdio_free_space.normal_queue_number =
halmac_adapter->txff_allocation.normal_queue_pg_num;
halmac_adapter->sdio_free_space.low_queue_number =
halmac_adapter->txff_allocation.low_queue_pg_num;
halmac_adapter->sdio_free_space.public_queue_number =
halmac_adapter->txff_allocation.pub_queue_pg_num;
halmac_adapter->sdio_free_space.extra_queue_number =
halmac_adapter->txff_allocation.extra_queue_pg_num;
HALMAC_REG_WRITE_32(
halmac_adapter, REG_RQPN_CTRL_2,
HALMAC_REG_READ_32(halmac_adapter, REG_RQPN_CTRL_2) | BIT(31));
HALMAC_REG_WRITE_16(halmac_adapter, REG_FIFOPAGE_CTRL_2,
(u16)(halmac_adapter->txff_allocation.rsvd_pg_bndy &
BIT_MASK_BCN_HEAD_1_V1));
HALMAC_REG_WRITE_16(halmac_adapter, REG_BCNQ_BDNY_V1,
(u16)(halmac_adapter->txff_allocation.rsvd_pg_bndy &
BIT_MASK_BCNQ_PGBNDY_V1));
HALMAC_REG_WRITE_16(halmac_adapter, REG_FIFOPAGE_CTRL_2 + 2,
(u16)(halmac_adapter->txff_allocation.rsvd_pg_bndy &
BIT_MASK_BCN_HEAD_1_V1));
HALMAC_REG_WRITE_16(halmac_adapter, REG_BCNQ1_BDNY_V1,
(u16)(halmac_adapter->txff_allocation.rsvd_pg_bndy &
BIT_MASK_BCNQ_PGBNDY_V1));
HALMAC_REG_WRITE_32(halmac_adapter, REG_RXFF_BNDY,
halmac_adapter->hw_config_info.rx_fifo_size -
HALMAC_C2H_PKT_BUF_8822B - 1);
if (halmac_adapter->halmac_interface == HALMAC_INTERFACE_USB) {
value8 = (u8)(
HALMAC_REG_READ_8(halmac_adapter, REG_AUTO_LLT_V1) &
~(BIT_MASK_BLK_DESC_NUM << BIT_SHIFT_BLK_DESC_NUM));
value8 = (u8)(value8 | (HALMAC_BLK_DESC_NUM_8822B
<< BIT_SHIFT_BLK_DESC_NUM));
HALMAC_REG_WRITE_8(halmac_adapter, REG_AUTO_LLT_V1, value8);
HALMAC_REG_WRITE_8(halmac_adapter, REG_AUTO_LLT_V1 + 3,
HALMAC_BLK_DESC_NUM_8822B);
HALMAC_REG_WRITE_8(halmac_adapter, REG_TXDMA_OFFSET_CHK + 1,
HALMAC_REG_READ_8(halmac_adapter,
REG_TXDMA_OFFSET_CHK + 1) |
BIT(1));
}
HALMAC_REG_WRITE_8(
halmac_adapter, REG_AUTO_LLT_V1,
(u8)(HALMAC_REG_READ_8(halmac_adapter, REG_AUTO_LLT_V1) |
BIT_AUTO_INIT_LLT_V1));
counter = 1000;
while (HALMAC_REG_READ_8(halmac_adapter, REG_AUTO_LLT_V1) &
BIT_AUTO_INIT_LLT_V1) {
counter--;
if (counter == 0)
return HALMAC_RET_INIT_LLT_FAIL;
}
if (halmac_trx_mode == HALMAC_TRX_MODE_DELAY_LOOPBACK) {
transfer_mode = HALMAC_TRNSFER_LOOPBACK_DELAY;
HALMAC_REG_WRITE_16(
halmac_adapter, REG_WMAC_LBK_BUF_HD_V1,
(u16)halmac_adapter->txff_allocation.rsvd_pg_bndy);
} else if (halmac_trx_mode == HALMAC_TRX_MODE_LOOPBACK) {
transfer_mode = HALMAC_TRNSFER_LOOPBACK_DIRECT;
} else {
transfer_mode = HALMAC_TRNSFER_NORMAL;
}
HALMAC_REG_WRITE_8(halmac_adapter, REG_CR + 3, (u8)transfer_mode);
return HALMAC_RET_SUCCESS;
}
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_FUNC_8822B_H_
#define _HALMAC_FUNC_8822B_H_
#include "../../halmac_type.h"
enum halmac_ret_status
halmac_txdma_queue_mapping_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode);
enum halmac_ret_status
halmac_priority_queue_config_8822b(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode);
#endif /* _HALMAC_FUNC_8822B_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_88XX_CFG_H_
#define _HALMAC_88XX_CFG_H_
#include "../halmac_2_platform.h"
#include "../halmac_type.h"
#include "../halmac_api.h"
#include "../halmac_bit2.h"
#include "../halmac_reg2.h"
#include "../halmac_pwr_seq_cmd.h"
#include "halmac_func_88xx.h"
#include "halmac_api_88xx.h"
#include "halmac_api_88xx_usb.h"
#include "halmac_api_88xx_pcie.h"
#include "halmac_api_88xx_sdio.h"
#define HALMAC_SVN_VER_88XX "13359M"
#define HALMAC_MAJOR_VER_88XX 0x0001 /* major version, ver_1 for async_api */
/* For halmac_api num change or prototype change, increment prototype version.
* Otherwise, increase minor version
*/
#define HALMAC_PROTOTYPE_VER_88XX 0x0003 /* prototype version */
#define HALMAC_MINOR_VER_88XX 0x0005 /* minor version */
#define HALMAC_PATCH_VER_88XX 0x0000 /* patch version */
#define HALMAC_C2H_DATA_OFFSET_88XX 10
#define HALMAC_RX_AGG_ALIGNMENT_SIZE_88XX 8
#define HALMAC_TX_AGG_ALIGNMENT_SIZE_88XX 8
#define HALMAC_TX_AGG_BUFF_SIZE_88XX 32768
#define HALMAC_EXTRA_INFO_BUFF_SIZE_88XX 4096 /*4K*/
#define HALMAC_EXTRA_INFO_BUFF_SIZE_FULL_FIFO_88XX 16384 /*16K*/
#define HALMAC_FW_OFFLOAD_CMD_SIZE_88XX \
12 /*Fw config parameter cmd size, each 12 byte*/
#define HALMAC_H2C_CMD_ORIGINAL_SIZE_88XX 8
#define HALMAC_H2C_CMD_SIZE_UNIT_88XX 32 /* Only support 32 byte packet now */
#define HALMAC_NLO_INFO_SIZE_88XX 1024
/* Download FW */
#define HALMAC_FW_SIZE_MAX_88XX 0x40000
#define HALMAC_FWHDR_SIZE_88XX 64
#define HALMAC_FW_CHKSUM_DUMMY_SIZE_88XX 8
#define HALMAC_FW_MAX_DL_SIZE_88XX 0x2000 /* need power of 2 */
/* Max dlfw size can not over 31K, because SDIO HW restriction */
#define HALMAC_FW_CFG_MAX_DL_SIZE_MAX_88XX 0x7C00
#define DLFW_RESTORE_REG_NUM_88XX 9
#define ID_INFORM_DLEMEM_RDY 0x80
/* FW header information */
#define HALMAC_FWHDR_OFFSET_VERSION_88XX 4
#define HALMAC_FWHDR_OFFSET_SUBVERSION_88XX 6
#define HALMAC_FWHDR_OFFSET_SUBINDEX_88XX 7
#define HALMAC_FWHDR_OFFSET_MEM_USAGE_88XX 24
#define HALMAC_FWHDR_OFFSET_H2C_FORMAT_VER_88XX 28
#define HALMAC_FWHDR_OFFSET_DMEM_ADDR_88XX 32
#define HALMAC_FWHDR_OFFSET_DMEM_SIZE_88XX 36
#define HALMAC_FWHDR_OFFSET_IRAM_SIZE_88XX 48
#define HALMAC_FWHDR_OFFSET_ERAM_SIZE_88XX 52
#define HALMAC_FWHDR_OFFSET_EMEM_ADDR_88XX 56
#define HALMAC_FWHDR_OFFSET_IRAM_ADDR_88XX 60
/* HW memory address */
#define HALMAC_OCPBASE_TXBUF_88XX 0x18780000
#define HALMAC_OCPBASE_DMEM_88XX 0x00200000
#define HALMAC_OCPBASE_IMEM_88XX 0x00000000
/* define the SDIO Bus CLK threshold, for avoiding CMD53 fails that
* result from SDIO CLK sync to ana_clk fail
*/
#define HALMAC_SD_CLK_THRESHOLD_88XX 150000000 /* 150MHz */
/* MAC clock */
#define HALMAC_MAC_CLOCK_88XX 80 /* 80M */
/* H2C/C2H*/
#define HALMAC_H2C_CMD_SIZE_88XX 32
#define HALMAC_H2C_CMD_HDR_SIZE_88XX 8
#define HALMAC_PROTECTED_EFUSE_SIZE_88XX 0x60
/* Function enable */
#define HALMAC_FUNCTION_ENABLE_88XX 0xDC
/* FIFO size & packet size */
/* #define HALMAC_WOWLAN_PATTERN_SIZE 256 */
/* CFEND rate */
#define HALMAC_BASIC_CFEND_RATE_88XX 0x5
#define HALMAC_STBC_CFEND_RATE_88XX 0xF
/* Response rate */
#define HALMAC_RESPONSE_RATE_BITMAP_ALL_88XX 0xFFFFF
#define HALMAC_RESPONSE_RATE_88XX HALMAC_RESPONSE_RATE_BITMAP_ALL_88XX
/* Spec SIFS */
#define HALMAC_SIFS_CCK_PTCL_88XX 16
#define HALMAC_SIFS_OFDM_PTCL_88XX 16
/* Retry limit */
#define HALMAC_LONG_RETRY_LIMIT_88XX 8
#define HALMAC_SHORT_RETRY_LIMIT_88XX 7
/* Slot, SIFS, PIFS time */
#define HALMAC_SLOT_TIME_88XX 0x05
#define HALMAC_PIFS_TIME_88XX 0x19
#define HALMAC_SIFS_CCK_CTX_88XX 0xA
#define HALMAC_SIFS_OFDM_CTX_88XX 0xA
#define HALMAC_SIFS_CCK_TRX_88XX 0x10
#define HALMAC_SIFS_OFDM_TRX_88XX 0x10
/* TXOP limit */
#define HALMAC_VO_TXOP_LIMIT_88XX 0x186
#define HALMAC_VI_TXOP_LIMIT_88XX 0x3BC
/* NAV */
#define HALMAC_RDG_NAV_88XX 0x05
#define HALMAC_TXOP_NAV_88XX 0x1B
/* TSF */
#define HALMAC_CCK_RX_TSF_88XX 0x30
#define HALMAC_OFDM_RX_TSF_88XX 0x30
/* Send beacon related */
#define HALMAC_TBTT_PROHIBIT_88XX 0x04
#define HALMAC_TBTT_HOLD_TIME_88XX 0x064
#define HALMAC_DRIVER_EARLY_INT_88XX 0x04
#define HALMAC_BEACON_DMA_TIM_88XX 0x02
/* RX filter */
#define HALMAC_RX_FILTER0_RECIVE_ALL_88XX 0xFFFFFFF
#define HALMAC_RX_FILTER0_88XX HALMAC_RX_FILTER0_RECIVE_ALL_88XX
#define HALMAC_RX_FILTER_RECIVE_ALL_88XX 0xFFFF
#define HALMAC_RX_FILTER_88XX HALMAC_RX_FILTER_RECIVE_ALL_88XX
/* RCR */
#define HALMAC_RCR_CONFIG_88XX 0xE400631E
/* Security config */
#define HALMAC_SECURITY_CONFIG_88XX 0x01CC
/* CCK rate ACK timeout */
#define HALMAC_ACK_TO_CCK_88XX 0x40
#endif
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_88XX_H_
#define _HALMAC_API_88XX_H_
#include "../halmac_2_platform.h"
#include "../halmac_type.h"
void halmac_init_state_machine_88xx(struct halmac_adapter *halmac_adapter);
void halmac_init_adapter_para_88xx(struct halmac_adapter *halmac_adapter);
void halmac_init_adapter_dynamic_para_88xx(
struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_mount_api_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_download_firmware_88xx(struct halmac_adapter *halmac_adapter,
u8 *hamacl_fw, u32 halmac_fw_size);
enum halmac_ret_status
halmac_free_download_firmware_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_dlfw_mem dlfw_mem, u8 *hamacl_fw,
u32 halmac_fw_size);
enum halmac_ret_status
halmac_get_fw_version_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_fw_version *fw_version);
enum halmac_ret_status
halmac_cfg_mac_addr_88xx(struct halmac_adapter *halmac_adapter, u8 halmac_port,
union halmac_wlan_addr *hal_address);
enum halmac_ret_status
halmac_cfg_bssid_88xx(struct halmac_adapter *halmac_adapter, u8 halmac_port,
union halmac_wlan_addr *hal_address);
enum halmac_ret_status
halmac_cfg_multicast_addr_88xx(struct halmac_adapter *halmac_adapter,
union halmac_wlan_addr *hal_address);
enum halmac_ret_status
halmac_pre_init_system_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_init_system_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_cfg_rx_aggregation_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_rxagg_cfg halmac_rxagg_cfg);
enum halmac_ret_status
halmac_init_edca_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_cfg_operation_mode_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_wireless_mode wireless_mode);
enum halmac_ret_status
halmac_cfg_ch_bw_88xx(struct halmac_adapter *halmac_adapter, u8 channel,
enum halmac_pri_ch_idx pri_ch_idx, enum halmac_bw bw);
enum halmac_ret_status halmac_cfg_ch_88xx(struct halmac_adapter *halmac_adapter,
u8 channel);
enum halmac_ret_status
halmac_cfg_pri_ch_idx_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_pri_ch_idx pri_ch_idx);
enum halmac_ret_status halmac_cfg_bw_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_bw bw);
enum halmac_ret_status
halmac_init_wmac_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_init_mac_cfg_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode mode);
enum halmac_ret_status
halmac_dump_efuse_map_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status
halmac_dump_efuse_map_bt_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_efuse_bank halmac_efuse_bank,
u32 bt_efuse_map_size, u8 *bt_efuse_map);
enum halmac_ret_status
halmac_write_efuse_bt_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 halmac_value,
enum halmac_efuse_bank halmac_efuse_bank);
enum halmac_ret_status
halmac_pg_efuse_by_map_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_pg_efuse_info *pg_efuse_info,
enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status
halmac_get_efuse_size_88xx(struct halmac_adapter *halmac_adapter,
u32 *halmac_size);
enum halmac_ret_status
halmac_get_efuse_available_size_88xx(struct halmac_adapter *halmac_adapter,
u32 *halmac_size);
enum halmac_ret_status
halmac_get_c2h_info_88xx(struct halmac_adapter *halmac_adapter, u8 *halmac_buf,
u32 halmac_size);
enum halmac_ret_status
halmac_get_logical_efuse_size_88xx(struct halmac_adapter *halmac_adapter,
u32 *halmac_size);
enum halmac_ret_status
halmac_dump_logical_efuse_map_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status
halmac_write_logical_efuse_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 halmac_value);
enum halmac_ret_status
halmac_read_logical_efuse_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 *value);
enum halmac_ret_status
halmac_cfg_fwlps_option_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_fwlps_option *lps_option);
enum halmac_ret_status
halmac_cfg_fwips_option_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_fwips_option *ips_option);
enum halmac_ret_status
halmac_enter_wowlan_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_wowlan_option *wowlan_option);
enum halmac_ret_status
halmac_leave_wowlan_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_enter_ps_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_ps_state ps_state);
enum halmac_ret_status
halmac_leave_ps_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_h2c_lb_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status halmac_debug_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_cfg_parameter_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_phy_parameter_info *para_info,
u8 full_fifo);
enum halmac_ret_status
halmac_update_packet_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_packet_id pkt_id, u8 *pkt, u32 pkt_size);
enum halmac_ret_status
halmac_bcn_ie_filter_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_bcn_ie_info *bcn_ie_info);
enum halmac_ret_status
halmac_send_original_h2c_88xx(struct halmac_adapter *halmac_adapter,
u8 *original_h2c, u16 *seq, u8 ack);
enum halmac_ret_status
halmac_update_datapack_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_data_type halmac_data_type,
struct halmac_phy_parameter_info *para_info);
enum halmac_ret_status
halmac_run_datapack_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_data_type halmac_data_type);
enum halmac_ret_status
halmac_cfg_drv_info_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_drv_info halmac_drv_info);
enum halmac_ret_status
halmac_send_bt_coex_88xx(struct halmac_adapter *halmac_adapter, u8 *bt_buf,
u32 bt_size, u8 ack);
enum halmac_ret_status
halmac_verify_platform_api_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_timer_2s_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_fill_txdesc_check_sum_88xx(struct halmac_adapter *halmac_adapter,
u8 *cur_desc);
enum halmac_ret_status
halmac_dump_fifo_88xx(struct halmac_adapter *halmac_adapter,
enum hal_fifo_sel halmac_fifo_sel, u32 halmac_start_addr,
u32 halmac_fifo_dump_size, u8 *fifo_map);
u32 halmac_get_fifo_size_88xx(struct halmac_adapter *halmac_adapter,
enum hal_fifo_sel halmac_fifo_sel);
enum halmac_ret_status
halmac_cfg_txbf_88xx(struct halmac_adapter *halmac_adapter, u8 userid,
enum halmac_bw bw, u8 txbf_en);
enum halmac_ret_status
halmac_cfg_mumimo_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_cfg_mumimo_para *cfgmu);
enum halmac_ret_status
halmac_cfg_sounding_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_snd_role role,
enum halmac_data_rate datarate);
enum halmac_ret_status
halmac_del_sounding_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_snd_role role);
enum halmac_ret_status
halmac_su_bfee_entry_init_88xx(struct halmac_adapter *halmac_adapter, u8 userid,
u16 paid);
enum halmac_ret_status
halmac_su_bfer_entry_init_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_su_bfer_init_para *su_bfer_init);
enum halmac_ret_status
halmac_mu_bfee_entry_init_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_mu_bfee_init_para *mu_bfee_init);
enum halmac_ret_status
halmac_mu_bfer_entry_init_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_mu_bfer_init_para *mu_bfer_init);
enum halmac_ret_status
halmac_su_bfee_entry_del_88xx(struct halmac_adapter *halmac_adapter, u8 userid);
enum halmac_ret_status
halmac_su_bfer_entry_del_88xx(struct halmac_adapter *halmac_adapter, u8 userid);
enum halmac_ret_status
halmac_mu_bfee_entry_del_88xx(struct halmac_adapter *halmac_adapter, u8 userid);
enum halmac_ret_status
halmac_mu_bfer_entry_del_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_add_ch_info_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_ch_info *ch_info);
enum halmac_ret_status
halmac_add_extra_ch_info_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_ch_extra_info *ch_extra_info);
enum halmac_ret_status
halmac_ctrl_ch_switch_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_ch_switch_option *cs_option);
enum halmac_ret_status halmac_p2pps_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_p2pps *p2p_ps);
enum halmac_ret_status
halmac_func_p2pps_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_p2pps *p2p_ps);
enum halmac_ret_status
halmac_clear_ch_info_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_send_general_info_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_general_info *general_info);
enum halmac_ret_status
halmac_start_iqk_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_iqk_para_ *iqk_para);
enum halmac_ret_status halmac_ctrl_pwr_tracking_88xx(
struct halmac_adapter *halmac_adapter,
struct halmac_pwr_tracking_option *pwr_tracking_opt);
enum halmac_ret_status
halmac_query_status_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_feature_id feature_id,
enum halmac_cmd_process_status *process_status,
u8 *data, u32 *size);
enum halmac_ret_status
halmac_reset_feature_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_feature_id feature_id);
enum halmac_ret_status
halmac_check_fw_status_88xx(struct halmac_adapter *halmac_adapter,
bool *fw_status);
enum halmac_ret_status
halmac_dump_fw_dmem_88xx(struct halmac_adapter *halmac_adapter, u8 *dmem,
u32 *size);
enum halmac_ret_status
halmac_cfg_max_dl_size_88xx(struct halmac_adapter *halmac_adapter, u32 size);
enum halmac_ret_status halmac_psd_88xx(struct halmac_adapter *halmac_adapter,
u16 start_psd, u16 end_psd);
enum halmac_ret_status
halmac_cfg_la_mode_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_la_mode la_mode);
enum halmac_ret_status halmac_cfg_rx_fifo_expanding_mode_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_rx_fifo_expanding_mode rx_fifo_expanding_mode);
enum halmac_ret_status
halmac_config_security_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_security_setting *sec_setting);
u8 halmac_get_used_cam_entry_num_88xx(struct halmac_adapter *halmac_adapter,
enum hal_security_type sec_type);
enum halmac_ret_status
halmac_write_cam_88xx(struct halmac_adapter *halmac_adapter, u32 entry_index,
struct halmac_cam_entry_info *cam_entry_info);
enum halmac_ret_status
halmac_read_cam_entry_88xx(struct halmac_adapter *halmac_adapter,
u32 entry_index,
struct halmac_cam_entry_format *content);
enum halmac_ret_status
halmac_clear_cam_entry_88xx(struct halmac_adapter *halmac_adapter,
u32 entry_index);
enum halmac_ret_status
halmac_get_hw_value_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_hw_id hw_id, void *pvalue);
enum halmac_ret_status
halmac_set_hw_value_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_hw_id hw_id, void *pvalue);
enum halmac_ret_status
halmac_cfg_drv_rsvd_pg_num_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_drv_rsvd_pg_num pg_num);
enum halmac_ret_status
halmac_get_chip_version_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_ver *version);
enum halmac_ret_status
halmac_chk_txdesc_88xx(struct halmac_adapter *halmac_adapter, u8 *halmac_buf,
u32 halmac_size);
enum halmac_ret_status
halmac_dl_drv_rsvd_page_88xx(struct halmac_adapter *halmac_adapter,
u8 pg_offset, u8 *halmac_buf, u32 halmac_size);
enum halmac_ret_status
halmac_cfg_csi_rate_88xx(struct halmac_adapter *halmac_adapter, u8 rssi,
u8 current_rate, u8 fixrate_en, u8 *new_rate);
enum halmac_ret_status halmac_sdio_cmd53_4byte_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_sdio_cmd53_4byte_mode cmd53_4byte_mode);
enum halmac_ret_status
halmac_txfifo_is_empty_88xx(struct halmac_adapter *halmac_adapter, u32 chk_num);
#endif /* _HALMAC_API_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "halmac_88xx_cfg.h"
/**
* halmac_init_pcie_cfg_88xx() - init PCIe
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_init_pcie_cfg_88xx(struct halmac_adapter *halmac_adapter)
{
void *driver_adapter = NULL;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_INIT_PCIE_CFG);
driver_adapter = halmac_adapter->driver_adapter;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s ==========>\n", __func__);
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_deinit_pcie_cfg_88xx() - deinit PCIE
* @halmac_adapter : the adapter of halmac
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_deinit_pcie_cfg_88xx(struct halmac_adapter *halmac_adapter)
{
void *driver_adapter = NULL;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_DEINIT_PCIE_CFG);
driver_adapter = halmac_adapter->driver_adapter;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s ==========>\n", __func__);
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_cfg_rx_aggregation_88xx_pcie() - config rx aggregation
* @halmac_adapter : the adapter of halmac
* @halmac_rx_agg_mode
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_cfg_rx_aggregation_88xx_pcie(struct halmac_adapter *halmac_adapter,
struct halmac_rxagg_cfg *phalmac_rxagg_cfg)
{
void *driver_adapter = NULL;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter,
HALMAC_API_CFG_RX_AGGREGATION);
driver_adapter = halmac_adapter->driver_adapter;
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s ==========>\n", __func__);
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_reg_read_8_pcie_88xx() - read 1byte register
* @halmac_adapter : the adapter of halmac
* @halmac_offset : register offset
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
u8 halmac_reg_read_8_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
return PLATFORM_REG_READ_8(driver_adapter, halmac_offset);
}
/**
* halmac_reg_write_8_pcie_88xx() - write 1byte register
* @halmac_adapter : the adapter of halmac
* @halmac_offset : register offset
* @halmac_data : register value
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_reg_write_8_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 halmac_data)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
PLATFORM_REG_WRITE_8(driver_adapter, halmac_offset, halmac_data);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_reg_read_16_pcie_88xx() - read 2byte register
* @halmac_adapter : the adapter of halmac
* @halmac_offset : register offset
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
u16 halmac_reg_read_16_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
return PLATFORM_REG_READ_16(driver_adapter, halmac_offset);
}
/**
* halmac_reg_write_16_pcie_88xx() - write 2byte register
* @halmac_adapter : the adapter of halmac
* @halmac_offset : register offset
* @halmac_data : register value
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_reg_write_16_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u16 halmac_data)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
PLATFORM_REG_WRITE_16(driver_adapter, halmac_offset, halmac_data);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_reg_read_32_pcie_88xx() - read 4byte register
* @halmac_adapter : the adapter of halmac
* @halmac_offset : register offset
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
u32 halmac_reg_read_32_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
return PLATFORM_REG_READ_32(driver_adapter, halmac_offset);
}
/**
* halmac_reg_write_32_pcie_88xx() - write 4byte register
* @halmac_adapter : the adapter of halmac
* @halmac_offset : register offset
* @halmac_data : register value
* Author : KaiYuan Chang/Ivan Lin
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
halmac_reg_write_32_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u32 halmac_data)
{
void *driver_adapter = NULL;
struct halmac_api *halmac_api;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
PLATFORM_REG_WRITE_32(driver_adapter, halmac_offset, halmac_data);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_cfg_tx_agg_align_pcie_88xx() -config sdio bus tx agg alignment
* @halmac_adapter : the adapter of halmac
* @enable : function enable(1)/disable(0)
* @align_size : sdio bus tx agg alignment size (2^n, n = 3~11)
* Author : Soar Tu
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status halmac_cfg_tx_agg_align_pcie_not_support_88xx(
struct halmac_adapter *halmac_adapter, u8 enable, u16 align_size)
{
struct halmac_api *halmac_api;
void *driver_adapter = NULL;
if (halmac_adapter_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_ADAPTER_INVALID;
if (halmac_api_validate(halmac_adapter) != HALMAC_RET_SUCCESS)
return HALMAC_RET_API_INVALID;
halmac_api_record_id_88xx(halmac_adapter, HALMAC_API_CFG_TX_AGG_ALIGN);
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s ==========>\n", __func__);
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s not support\n", __func__);
HALMAC_RT_TRACE(
driver_adapter, HALMAC_MSG_INIT, DBG_DMESG,
"%s <==========\n", __func__);
return HALMAC_RET_SUCCESS;
}
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_88XX_PCIE_H_
#define _HALMAC_API_88XX_PCIE_H_
#include "../halmac_2_platform.h"
#include "../halmac_type.h"
#define LINK_CTRL2_REG_OFFSET 0xA0
#define GEN2_CTRL_OFFSET 0x80C
#define LINK_STATUS_REG_OFFSET 0x82
#define GEN1_SPEED 0x01
#define GEN2_SPEED 0x02
enum halmac_ret_status
halmac_init_pcie_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_deinit_pcie_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_cfg_rx_aggregation_88xx_pcie(struct halmac_adapter *halmac_adapter,
struct halmac_rxagg_cfg *phalmac_rxagg_cfg);
u8 halmac_reg_read_8_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_8_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 halmac_data);
u16 halmac_reg_read_16_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_16_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u16 halmac_data);
u32 halmac_reg_read_32_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_32_pcie_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u32 halmac_data);
enum halmac_ret_status halmac_cfg_tx_agg_align_pcie_not_support_88xx(
struct halmac_adapter *halmac_adapter, u8 enable, u16 align_size);
#endif /* _HALMAC_API_88XX_PCIE_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_88XX_SDIO_H_
#define _HALMAC_API_88XX_SDIO_H_
#include "../halmac_2_platform.h"
#include "../halmac_type.h"
enum halmac_ret_status
halmac_init_sdio_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_deinit_sdio_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_cfg_rx_aggregation_88xx_sdio(struct halmac_adapter *halmac_adapter,
struct halmac_rxagg_cfg *phalmac_rxagg_cfg);
u8 halmac_reg_read_8_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_8_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 halmac_data);
u16 halmac_reg_read_16_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_16_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u16 halmac_data);
u32 halmac_reg_read_32_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_32_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u32 halmac_data);
enum halmac_ret_status
halmac_get_sdio_tx_addr_88xx(struct halmac_adapter *halmac_adapter,
u8 *halmac_buf, u32 halmac_size, u32 *pcmd53_addr);
enum halmac_ret_status
halmac_cfg_tx_agg_align_sdio_88xx(struct halmac_adapter *halmac_adapter,
u8 enable, u16 align_size);
enum halmac_ret_status halmac_cfg_tx_agg_align_sdio_not_support_88xx(
struct halmac_adapter *halmac_adapter, u8 enable, u16 align_size);
enum halmac_ret_status
halmac_tx_allowed_sdio_88xx(struct halmac_adapter *halmac_adapter,
u8 *halmac_buf, u32 halmac_size);
u32 halmac_reg_read_indirect_32_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
u8 halmac_reg_read_nbyte_sdio_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u32 halmac_size,
u8 *halmac_data);
#endif /* _HALMAC_API_88XX_SDIO_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_API_88XX_USB_H_
#define _HALMAC_API_88XX_USB_H_
#include "../halmac_2_platform.h"
#include "../halmac_type.h"
enum halmac_ret_status
halmac_init_usb_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_deinit_usb_cfg_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_cfg_rx_aggregation_88xx_usb(struct halmac_adapter *halmac_adapter,
struct halmac_rxagg_cfg *phalmac_rxagg_cfg);
u8 halmac_reg_read_8_usb_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_8_usb_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u8 halmac_data);
u16 halmac_reg_read_16_usb_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_16_usb_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u16 halmac_data);
u32 halmac_reg_read_32_usb_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset);
enum halmac_ret_status
halmac_reg_write_32_usb_88xx(struct halmac_adapter *halmac_adapter,
u32 halmac_offset, u32 halmac_data);
enum halmac_ret_status
halmac_set_bulkout_num_88xx(struct halmac_adapter *halmac_adapter,
u8 bulkout_num);
enum halmac_ret_status
halmac_get_usb_bulkout_id_88xx(struct halmac_adapter *halmac_adapter,
u8 *halmac_buf, u32 halmac_size, u8 *bulkout_id);
enum halmac_ret_status halmac_cfg_tx_agg_align_usb_not_support_88xx(
struct halmac_adapter *halmac_adapter, u8 enable, u16 align_size);
#endif /* _HALMAC_API_88XX_USB_H_ */
/******************************************************************************
*
* Copyright(c) 2016 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef _HALMAC_FUNC_88XX_H_
#define _HALMAC_FUNC_88XX_H_
#include "../halmac_type.h"
void halmac_init_offload_feature_state_machine_88xx(
struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_send_h2c_pkt_88xx(struct halmac_adapter *halmac_adapter, u8 *hal_buff,
u32 size, bool ack);
enum halmac_ret_status
halmac_download_rsvd_page_88xx(struct halmac_adapter *halmac_adapter,
u8 *hal_buf, u32 size);
enum halmac_ret_status
halmac_set_h2c_header_88xx(struct halmac_adapter *halmac_adapter,
u8 *hal_h2c_hdr, u16 *seq, bool ack);
enum halmac_ret_status halmac_set_fw_offload_h2c_header_88xx(
struct halmac_adapter *halmac_adapter, u8 *hal_h2c_hdr,
struct halmac_h2c_header_info *h2c_header_info, u16 *seq_num);
enum halmac_ret_status
halmac_dump_efuse_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status
halmac_func_read_efuse_88xx(struct halmac_adapter *halmac_adapter, u32 offset,
u32 size, u8 *efuse_map);
enum halmac_ret_status
halmac_func_write_efuse_88xx(struct halmac_adapter *halmac_adapter, u32 offset,
u8 value);
enum halmac_ret_status
halmac_func_switch_efuse_bank_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_efuse_bank efuse_bank);
enum halmac_ret_status
halmac_read_logical_efuse_map_88xx(struct halmac_adapter *halmac_adapter,
u8 *map);
enum halmac_ret_status
halmac_func_write_logical_efuse_88xx(struct halmac_adapter *halmac_adapter,
u32 offset, u8 value);
enum halmac_ret_status
halmac_func_pg_efuse_by_map_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_pg_efuse_info *pg_efuse_info,
enum halmac_efuse_read_cfg cfg);
enum halmac_ret_status
halmac_eeprom_parser_88xx(struct halmac_adapter *halmac_adapter,
u8 *physical_efuse_map, u8 *logical_efuse_map);
enum halmac_ret_status
halmac_read_hw_efuse_88xx(struct halmac_adapter *halmac_adapter, u32 offset,
u32 size, u8 *efuse_map);
enum halmac_ret_status
halmac_dlfw_to_mem_88xx(struct halmac_adapter *halmac_adapter, u8 *ram_code,
u32 dest, u32 code_size);
enum halmac_ret_status
halmac_send_fwpkt_88xx(struct halmac_adapter *halmac_adapter, u8 *ram_code,
u32 code_size);
enum halmac_ret_status
halmac_iddma_dlfw_88xx(struct halmac_adapter *halmac_adapter, u32 source,
u32 dest, u32 length, u8 first);
enum halmac_ret_status
halmac_check_fw_chksum_88xx(struct halmac_adapter *halmac_adapter,
u32 memory_address);
enum halmac_ret_status
halmac_dlfw_end_flow_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_free_dl_fw_end_flow_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_pwr_seq_parser_88xx(struct halmac_adapter *halmac_adapter, u8 cut,
u8 fab, u8 intf,
struct halmac_wl_pwr_cfg_ **pp_pwr_seq_cfg
);
enum halmac_ret_status
halmac_get_h2c_buff_free_space_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_send_h2c_set_pwr_mode_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_fwlps_option *hal_fw_lps_opt);
enum halmac_ret_status
halmac_func_send_original_h2c_88xx(struct halmac_adapter *halmac_adapter,
u8 *original_h2c, u16 *seq, u8 ack);
enum halmac_ret_status
halmac_media_status_rpt_88xx(struct halmac_adapter *halmac_adapter, u8 op_mode,
u8 mac_id_ind, u8 mac_id, u8 mac_id_end);
enum halmac_ret_status halmac_send_h2c_update_datapack_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_data_type halmac_data_type,
struct halmac_phy_parameter_info *para_info);
enum halmac_ret_status
halmac_send_h2c_run_datapack_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_data_type halmac_data_type);
enum halmac_ret_status
halmac_send_bt_coex_cmd_88xx(struct halmac_adapter *halmac_adapter, u8 *bt_buf,
u32 bt_size, u8 ack);
enum halmac_ret_status
halmac_func_ctrl_ch_switch_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_ch_switch_option *cs_option);
enum halmac_ret_status
halmac_func_send_general_info_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_general_info *general_info);
enum halmac_ret_status
halmac_send_h2c_ps_tuning_para_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_parse_c2h_packet_88xx(struct halmac_adapter *halmac_adapter,
u8 *halmac_buf, u32 halmac_size);
enum halmac_ret_status
halmac_send_h2c_update_packet_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_packet_id pkt_id, u8 *pkt,
u32 pkt_size);
enum halmac_ret_status
halmac_send_h2c_phy_parameter_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_phy_parameter_info *para_info,
bool full_fifo);
enum halmac_ret_status
halmac_dump_physical_efuse_fw_88xx(struct halmac_adapter *halmac_adapter,
u32 offset, u32 size, u8 *efuse_map);
enum halmac_ret_status halmac_send_h2c_update_bcn_parse_info_88xx(
struct halmac_adapter *halmac_adapter,
struct halmac_bcn_ie_info *bcn_ie_info);
enum halmac_ret_status
halmac_convert_to_sdio_bus_offset_88xx(struct halmac_adapter *halmac_adapter,
u32 *halmac_offset);
enum halmac_ret_status
halmac_update_sdio_free_page_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_update_oqt_free_space_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_efuse_cmd_construct_state
halmac_query_efuse_curr_state_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status halmac_transition_efuse_state_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_efuse_cmd_construct_state dest_state);
enum halmac_cfg_para_cmd_construct_state
halmac_query_cfg_para_curr_state_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status halmac_transition_cfg_para_state_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cfg_para_cmd_construct_state dest_state);
enum halmac_scan_cmd_construct_state
halmac_query_scan_curr_state_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status halmac_transition_scan_state_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_scan_cmd_construct_state dest_state);
enum halmac_ret_status halmac_query_cfg_para_status_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status, u8 *data, u32 *size);
enum halmac_ret_status halmac_query_dump_physical_efuse_status_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status, u8 *data, u32 *size);
enum halmac_ret_status halmac_query_dump_logical_efuse_status_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status, u8 *data, u32 *size);
enum halmac_ret_status halmac_query_channel_switch_status_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status, u8 *data, u32 *size);
enum halmac_ret_status halmac_query_update_packet_status_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status, u8 *data, u32 *size);
enum halmac_ret_status
halmac_query_iqk_status_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status,
u8 *data, u32 *size);
enum halmac_ret_status halmac_query_power_tracking_status_88xx(
struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status, u8 *data, u32 *size);
enum halmac_ret_status
halmac_query_psd_status_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_cmd_process_status *process_status,
u8 *data, u32 *size);
enum halmac_ret_status
halmac_verify_io_88xx(struct halmac_adapter *halmac_adapter);
enum halmac_ret_status
halmac_verify_send_rsvd_page_88xx(struct halmac_adapter *halmac_adapter);
void halmac_power_save_cb_88xx(void *cb_data);
enum halmac_ret_status
halmac_buffer_read_88xx(struct halmac_adapter *halmac_adapter, u32 offset,
u32 size, enum hal_fifo_sel halmac_fifo_sel,
u8 *fifo_map);
void halmac_restore_mac_register_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_restore_info *restore_info,
u32 restore_num);
void halmac_api_record_id_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_api_id api_id);
enum halmac_ret_status
halmac_set_usb_mode_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_usb_mode usb_mode);
void halmac_enable_bb_rf_88xx(struct halmac_adapter *halmac_adapter, u8 enable);
void halmac_config_sdio_tx_page_threshold_88xx(
struct halmac_adapter *halmac_adapter,
struct halmac_tx_page_threshold_info *threshold_info);
enum halmac_ret_status
halmac_rqpn_parser_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode,
struct halmac_rqpn_ *pwr_seq_cfg);
enum halmac_ret_status
halmac_check_oqt_88xx(struct halmac_adapter *halmac_adapter, u32 tx_agg_num,
u8 *halmac_buf);
enum halmac_ret_status
halmac_pg_num_parser_88xx(struct halmac_adapter *halmac_adapter,
enum halmac_trx_mode halmac_trx_mode,
struct halmac_pg_num_ *pg_num_table);
enum halmac_ret_status
halmac_parse_intf_phy_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_intf_phy_para_ *intf_phy_para,
enum halmac_intf_phy_platform platform,
enum hal_intf_phy intf_phy);
enum halmac_ret_status
halmac_dbi_write32_88xx(struct halmac_adapter *halmac_adapter, u16 addr,
u32 data);
u32 halmac_dbi_read32_88xx(struct halmac_adapter *halmac_adapter, u16 addr);
enum halmac_ret_status
halmac_dbi_write8_88xx(struct halmac_adapter *halmac_adapter, u16 addr,
u8 data);
u8 halmac_dbi_read8_88xx(struct halmac_adapter *halmac_adapter, u16 addr);
u16 halmac_mdio_read_88xx(struct halmac_adapter *halmac_adapter, u8 addr,
u8 speed
);
enum halmac_ret_status
halmac_mdio_write_88xx(struct halmac_adapter *halmac_adapter, u8 addr, u16 data,
u8 speed);
void halmac_config_ampdu_88xx(struct halmac_adapter *halmac_adapter,
struct halmac_ampdu_config *ampdu_config);
enum halmac_ret_status
halmac_usbphy_write_88xx(struct halmac_adapter *halmac_adapter, u8 addr,
u16 data, u8 speed);
u16 halmac_usbphy_read_88xx(struct halmac_adapter *halmac_adapter, u8 addr,
u8 speed);
#endif /* _HALMAC_FUNC_88XX_H_ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册