162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/* Copyright(c) 2018-2019  Realtek Corporation
362306a36Sopenharmony_ci */
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __RTW_MAC_H__
662306a36Sopenharmony_ci#define __RTW_MAC_H__
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define RTW_HW_PORT_NUM		5
962306a36Sopenharmony_ci#define cut_version_to_mask(cut) (0x1 << ((cut) + 1))
1062306a36Sopenharmony_ci#define DDMA_POLLING_COUNT	1000
1162306a36Sopenharmony_ci#define C2H_PKT_BUF		256
1262306a36Sopenharmony_ci#define REPORT_BUF		128
1362306a36Sopenharmony_ci#define PHY_STATUS_SIZE		4
1462306a36Sopenharmony_ci#define ILLEGAL_KEY_GROUP	0xFAAAAA00
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* HW memory address */
1762306a36Sopenharmony_ci#define OCPBASE_RXBUF_FW_88XX		0x18680000
1862306a36Sopenharmony_ci#define OCPBASE_TXBUF_88XX		0x18780000
1962306a36Sopenharmony_ci#define OCPBASE_ROM_88XX		0x00000000
2062306a36Sopenharmony_ci#define OCPBASE_IMEM_88XX		0x00030000
2162306a36Sopenharmony_ci#define OCPBASE_DMEM_88XX		0x00200000
2262306a36Sopenharmony_ci#define OCPBASE_EMEM_88XX		0x00100000
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define RSVD_PG_DRV_NUM			16
2562306a36Sopenharmony_ci#define RSVD_PG_H2C_EXTRAINFO_NUM	24
2662306a36Sopenharmony_ci#define RSVD_PG_H2C_STATICINFO_NUM	8
2762306a36Sopenharmony_ci#define RSVD_PG_H2CQ_NUM		8
2862306a36Sopenharmony_ci#define RSVD_PG_CPU_INSTRUCTION_NUM	0
2962306a36Sopenharmony_ci#define RSVD_PG_FW_TXBUF_NUM		4
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_civoid rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
3262306a36Sopenharmony_ci			 u8 primary_ch_idx);
3362306a36Sopenharmony_ciint rtw_mac_power_on(struct rtw_dev *rtwdev);
3462306a36Sopenharmony_civoid rtw_mac_power_off(struct rtw_dev *rtwdev);
3562306a36Sopenharmony_ciint rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw);
3662306a36Sopenharmony_ciint rtw_mac_init(struct rtw_dev *rtwdev);
3762306a36Sopenharmony_civoid rtw_mac_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop);
3862306a36Sopenharmony_ciint rtw_ddma_to_fw_fifo(struct rtw_dev *rtwdev, u32 ocp_src, u32 size);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cistatic inline void rtw_mac_flush_all_queues(struct rtw_dev *rtwdev, bool drop)
4162306a36Sopenharmony_ci{
4262306a36Sopenharmony_ci	rtw_mac_flush_queues(rtwdev, BIT(rtwdev->hw->queues) - 1, drop);
4362306a36Sopenharmony_ci}
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#endif
46