mac.c (cecf1643145a3a5980aff221e7b5ca8f90efa1cf) mac.c (aabe741e2d18a3a28b0f08c53b7a81374c0690b0)
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2/* Copyright(c) 2019-2020 Realtek Corporation
3 */
4
5#include "cam.h"
6#include "chan.h"
7#include "debug.h"
8#include "efuse.h"

--- 1658 unchanged lines hidden (view full) ---

1667 B_AX_PLE_EMPTY_QUE_DMAC_SEC_TX | B_AX_WDE_EMPTY_QTA_DMAC_PKTIN |
1668 B_AX_PLE_EMPTY_QTA_DMAC_B0_TXPL | B_AX_PLE_EMPTY_QTA_DMAC_B1_TXPL |
1669 B_AX_PLE_EMPTY_QTA_DMAC_MPDU_TX;
1670 val32 = rtw89_read32(rtwdev, R_AX_DLE_EMPTY0);
1671
1672 return (val32 & msk32) == msk32;
1673}
1674
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2/* Copyright(c) 2019-2020 Realtek Corporation
3 */
4
5#include "cam.h"
6#include "chan.h"
7#include "debug.h"
8#include "efuse.h"

--- 1658 unchanged lines hidden (view full) ---

1667 B_AX_PLE_EMPTY_QUE_DMAC_SEC_TX | B_AX_WDE_EMPTY_QTA_DMAC_PKTIN |
1668 B_AX_PLE_EMPTY_QTA_DMAC_B0_TXPL | B_AX_PLE_EMPTY_QTA_DMAC_B1_TXPL |
1669 B_AX_PLE_EMPTY_QTA_DMAC_MPDU_TX;
1670 val32 = rtw89_read32(rtwdev, R_AX_DLE_EMPTY0);
1671
1672 return (val32 & msk32) == msk32;
1673}
1674
1675static inline u32 dle_used_size(const struct rtw89_dle_size *wde,
1676 const struct rtw89_dle_size *ple)
1675static inline u32 dle_used_size(const struct rtw89_dle_mem *cfg)
1677{
1676{
1678 return wde->pge_size * (wde->lnk_pge_num + wde->unlnk_pge_num) +
1677 const struct rtw89_dle_size *wde = cfg->wde_size;
1678 const struct rtw89_dle_size *ple = cfg->ple_size;
1679 u32 used;
1680
1681 used = wde->pge_size * (wde->lnk_pge_num + wde->unlnk_pge_num) +
1679 ple->pge_size * (ple->lnk_pge_num + ple->unlnk_pge_num);
1682 ple->pge_size * (ple->lnk_pge_num + ple->unlnk_pge_num);
1683
1684 if (cfg->rsvd0_size && cfg->rsvd1_size) {
1685 used += cfg->rsvd0_size->size;
1686 used += cfg->rsvd1_size->size;
1687 }
1688
1689 return used;
1680}
1681
1682static u32 dle_expected_used_size(struct rtw89_dev *rtwdev,
1683 enum rtw89_qta_mode mode)
1684{
1685 u32 size = rtwdev->chip->fifo_size;
1686
1687 if (mode == RTW89_QTA_SCC)

--- 205 unchanged lines hidden (view full) ---

1893 rtw89_err(rtwdev, "[ERR]get_dle_ext_mem_cfg %d\n",
1894 ext_mode);
1895 ret = -EINVAL;
1896 goto error;
1897 }
1898 ext_wde_min_qt_wcpu = ext_cfg->wde_min_qt->wcpu;
1899 }
1900
1690}
1691
1692static u32 dle_expected_used_size(struct rtw89_dev *rtwdev,
1693 enum rtw89_qta_mode mode)
1694{
1695 u32 size = rtwdev->chip->fifo_size;
1696
1697 if (mode == RTW89_QTA_SCC)

--- 205 unchanged lines hidden (view full) ---

1903 rtw89_err(rtwdev, "[ERR]get_dle_ext_mem_cfg %d\n",
1904 ext_mode);
1905 ret = -EINVAL;
1906 goto error;
1907 }
1908 ext_wde_min_qt_wcpu = ext_cfg->wde_min_qt->wcpu;
1909 }
1910
1901 if (dle_used_size(cfg->wde_size, cfg->ple_size) !=
1902 dle_expected_used_size(rtwdev, mode)) {
1911 if (dle_used_size(cfg) != dle_expected_used_size(rtwdev, mode)) {
1903 rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
1904 ret = -EINVAL;
1905 goto error;
1906 }
1907
1908 dle_func_en(rtwdev, false);
1909 dle_clk_en(rtwdev, true);
1910

--- 1121 unchanged lines hidden (view full) ---

3032 int ret;
3033
3034 cfg = get_dle_mem_cfg(rtwdev, mode);
3035 if (!cfg) {
3036 rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
3037 return -EINVAL;
3038 }
3039
1912 rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
1913 ret = -EINVAL;
1914 goto error;
1915 }
1916
1917 dle_func_en(rtwdev, false);
1918 dle_clk_en(rtwdev, true);
1919

--- 1121 unchanged lines hidden (view full) ---

3041 int ret;
3042
3043 cfg = get_dle_mem_cfg(rtwdev, mode);
3044 if (!cfg) {
3045 rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
3046 return -EINVAL;
3047 }
3048
3040 if (dle_used_size(cfg->wde_size, cfg->ple_size) !=
3041 dle_expected_used_size(rtwdev, mode)) {
3049 if (dle_used_size(cfg) != dle_expected_used_size(rtwdev, mode)) {
3042 rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
3043 return -EINVAL;
3044 }
3045
3046 dle_quota_cfg(rtwdev, cfg, INVALID_QT_WCPU);
3047
3048 ret = rtw89_mac_dle_buf_req(rtwdev, 0x20, true, &pkt_id);
3049 if (ret) {

--- 2811 unchanged lines hidden ---
3050 rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
3051 return -EINVAL;
3052 }
3053
3054 dle_quota_cfg(rtwdev, cfg, INVALID_QT_WCPU);
3055
3056 ret = rtw89_mac_dle_buf_req(rtwdev, 0x20, true, &pkt_id);
3057 if (ret) {

--- 2811 unchanged lines hidden ---