Commit a712eef6 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: fw: propagate an argument include_bb for BB MCU firmware

Though WiFi 7 chips need BB MCU firmware, we don't download it in probe
stage. Instead, only bring interface up under normal operation or WoWLAN
mode. So, add an argument to assist download flow to setup download
settings properly.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230901073956.54203-6-pkshih@realtek.com
parent fa31a8c5
...@@ -3788,7 +3788,7 @@ static int rtw89_chip_efuse_info_setup(struct rtw89_dev *rtwdev) ...@@ -3788,7 +3788,7 @@ static int rtw89_chip_efuse_info_setup(struct rtw89_dev *rtwdev)
{ {
int ret; int ret;
ret = rtw89_mac_partial_init(rtwdev); ret = rtw89_mac_partial_init(rtwdev, false);
if (ret) if (ret)
return ret; return ret;
......
...@@ -3446,6 +3446,7 @@ struct rtw89_chip_info { ...@@ -3446,6 +3446,7 @@ struct rtw89_chip_info {
const char *fw_basename; const char *fw_basename;
u8 fw_format_max; u8 fw_format_max;
bool try_ce_fw; bool try_ce_fw;
u8 bbmcu_nr;
u32 needed_fw_elms; u32 needed_fw_elms;
u32 fifo_size; u32 fifo_size;
bool small_fifo_size; bool small_fifo_size;
......
...@@ -872,7 +872,8 @@ static void rtw89_fw_dl_fail_dump(struct rtw89_dev *rtwdev) ...@@ -872,7 +872,8 @@ static void rtw89_fw_dl_fail_dump(struct rtw89_dev *rtwdev)
rtw89_fw_prog_cnt_dump(rtwdev); rtw89_fw_prog_cnt_dump(rtwdev);
} }
int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type) int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,
bool include_bb)
{ {
const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def; const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
struct rtw89_fw_info *fw_info = &rtwdev->fw; struct rtw89_fw_info *fw_info = &rtwdev->fw;
...@@ -881,7 +882,7 @@ int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type) ...@@ -881,7 +882,7 @@ int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type)
int ret; int ret;
mac->disable_cpu(rtwdev); mac->disable_cpu(rtwdev);
ret = mac->fwdl_enable_wcpu(rtwdev, 0, true); ret = mac->fwdl_enable_wcpu(rtwdev, 0, true, include_bb);
if (ret) if (ret)
return ret; return ret;
......
...@@ -3628,7 +3628,8 @@ rtw89_early_fw_feature_recognize(struct device *device, ...@@ -3628,7 +3628,8 @@ rtw89_early_fw_feature_recognize(struct device *device,
const struct rtw89_chip_info *chip, const struct rtw89_chip_info *chip,
struct rtw89_fw_info *early_fw, struct rtw89_fw_info *early_fw,
int *used_fw_format); int *used_fw_format);
int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type); int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,
bool include_bb);
void rtw89_load_firmware_work(struct work_struct *work); void rtw89_load_firmware_work(struct work_struct *work);
void rtw89_unload_firmware(struct rtw89_dev *rtwdev); void rtw89_unload_firmware(struct rtw89_dev *rtwdev);
int rtw89_wait_firmware_completion(struct rtw89_dev *rtwdev); int rtw89_wait_firmware_completion(struct rtw89_dev *rtwdev);
......
...@@ -3467,7 +3467,8 @@ static void rtw89_mac_disable_cpu_ax(struct rtw89_dev *rtwdev) ...@@ -3467,7 +3467,8 @@ static void rtw89_mac_disable_cpu_ax(struct rtw89_dev *rtwdev)
rtw89_write32_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN); rtw89_write32_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
} }
static int rtw89_mac_enable_cpu_ax(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw) static int rtw89_mac_enable_cpu_ax(struct rtw89_dev *rtwdev, u8 boot_reason,
bool dlfw, bool include_bb)
{ {
u32 val; u32 val;
int ret; int ret;
...@@ -3592,7 +3593,7 @@ int rtw89_mac_disable_bb_rf(struct rtw89_dev *rtwdev) ...@@ -3592,7 +3593,7 @@ int rtw89_mac_disable_bb_rf(struct rtw89_dev *rtwdev)
} }
EXPORT_SYMBOL(rtw89_mac_disable_bb_rf); EXPORT_SYMBOL(rtw89_mac_disable_bb_rf);
int rtw89_mac_partial_init(struct rtw89_dev *rtwdev) int rtw89_mac_partial_init(struct rtw89_dev *rtwdev, bool include_bb)
{ {
int ret; int ret;
...@@ -3616,7 +3617,7 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev) ...@@ -3616,7 +3617,7 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev)
return ret; return ret;
} }
ret = rtw89_fw_download(rtwdev, RTW89_FW_NORMAL); ret = rtw89_fw_download(rtwdev, RTW89_FW_NORMAL, include_bb);
if (ret) if (ret)
return ret; return ret;
...@@ -3625,9 +3626,11 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev) ...@@ -3625,9 +3626,11 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev)
int rtw89_mac_init(struct rtw89_dev *rtwdev) int rtw89_mac_init(struct rtw89_dev *rtwdev)
{ {
const struct rtw89_chip_info *chip = rtwdev->chip;
bool include_bb = !!chip->bbmcu_nr;
int ret; int ret;
ret = rtw89_mac_partial_init(rtwdev); ret = rtw89_mac_partial_init(rtwdev, include_bb);
if (ret) if (ret)
goto fail; goto fail;
......
...@@ -860,7 +860,8 @@ struct rtw89_mac_gen_def { ...@@ -860,7 +860,8 @@ struct rtw89_mac_gen_def {
u32 rx_fltr; u32 rx_fltr;
void (*disable_cpu)(struct rtw89_dev *rtwdev); void (*disable_cpu)(struct rtw89_dev *rtwdev);
int (*fwdl_enable_wcpu)(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw); int (*fwdl_enable_wcpu)(struct rtw89_dev *rtwdev, u8 boot_reason,
bool dlfw, bool include_bb);
u8 (*fwdl_get_status)(struct rtw89_dev *rtwdev, enum rtw89_fwdl_check_type type); u8 (*fwdl_get_status)(struct rtw89_dev *rtwdev, enum rtw89_fwdl_check_type type);
int (*fwdl_check_path_ready)(struct rtw89_dev *rtwdev, bool h2c_or_fwdl); int (*fwdl_check_path_ready)(struct rtw89_dev *rtwdev, bool h2c_or_fwdl);
}; };
...@@ -962,7 +963,7 @@ rtw89_write32_port_set(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, ...@@ -962,7 +963,7 @@ rtw89_write32_port_set(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
} }
void rtw89_mac_pwr_off(struct rtw89_dev *rtwdev); void rtw89_mac_pwr_off(struct rtw89_dev *rtwdev);
int rtw89_mac_partial_init(struct rtw89_dev *rtwdev); int rtw89_mac_partial_init(struct rtw89_dev *rtwdev, bool include_bb);
int rtw89_mac_init(struct rtw89_dev *rtwdev); int rtw89_mac_init(struct rtw89_dev *rtwdev);
int rtw89_mac_check_mac_en(struct rtw89_dev *rtwdev, u8 band, int rtw89_mac_check_mac_en(struct rtw89_dev *rtwdev, u8 band,
enum rtw89_mac_hwmod_sel sel); enum rtw89_mac_hwmod_sel sel);
......
...@@ -51,10 +51,13 @@ static void rtw89_mac_disable_cpu_be(struct rtw89_dev *rtwdev) ...@@ -51,10 +51,13 @@ static void rtw89_mac_disable_cpu_be(struct rtw89_dev *rtwdev)
rtw89_write32(rtwdev, R_BE_UDM2, 0); rtw89_write32(rtwdev, R_BE_UDM2, 0);
} }
static void set_cpu_en(struct rtw89_dev *rtwdev) static void set_cpu_en(struct rtw89_dev *rtwdev, bool include_bb)
{ {
u32 set = B_BE_WLANCPU_FWDL_EN; u32 set = B_BE_WLANCPU_FWDL_EN;
if (include_bb)
set |= B_BE_BBMCU0_FWDL_EN;
rtw89_write32_set(rtwdev, R_BE_WCPU_FW_CTRL, set); rtw89_write32_set(rtwdev, R_BE_WCPU_FW_CTRL, set);
} }
...@@ -109,9 +112,10 @@ static int wcpu_on(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw) ...@@ -109,9 +112,10 @@ static int wcpu_on(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw)
} }
static int rtw89_mac_fwdl_enable_wcpu_be(struct rtw89_dev *rtwdev, static int rtw89_mac_fwdl_enable_wcpu_be(struct rtw89_dev *rtwdev,
u8 boot_reason, bool dlfw) u8 boot_reason, bool dlfw,
bool include_bb)
{ {
set_cpu_en(rtwdev); set_cpu_en(rtwdev, include_bb);
return wcpu_on(rtwdev, boot_reason, dlfw); return wcpu_on(rtwdev, boot_reason, dlfw);
} }
......
...@@ -2345,6 +2345,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = { ...@@ -2345,6 +2345,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
.fw_basename = RTW8851B_FW_BASENAME, .fw_basename = RTW8851B_FW_BASENAME,
.fw_format_max = RTW8851B_FW_FORMAT_MAX, .fw_format_max = RTW8851B_FW_FORMAT_MAX,
.try_ce_fw = true, .try_ce_fw = true,
.bbmcu_nr = 0,
.needed_fw_elms = 0, .needed_fw_elms = 0,
.fifo_size = 196608, .fifo_size = 196608,
.small_fifo_size = true, .small_fifo_size = true,
......
...@@ -2081,6 +2081,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = { ...@@ -2081,6 +2081,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
.fw_basename = RTW8852A_FW_BASENAME, .fw_basename = RTW8852A_FW_BASENAME,
.fw_format_max = RTW8852A_FW_FORMAT_MAX, .fw_format_max = RTW8852A_FW_FORMAT_MAX,
.try_ce_fw = false, .try_ce_fw = false,
.bbmcu_nr = 0,
.needed_fw_elms = 0, .needed_fw_elms = 0,
.fifo_size = 458752, .fifo_size = 458752,
.small_fifo_size = false, .small_fifo_size = false,
......
...@@ -2514,6 +2514,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = { ...@@ -2514,6 +2514,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
.fw_basename = RTW8852B_FW_BASENAME, .fw_basename = RTW8852B_FW_BASENAME,
.fw_format_max = RTW8852B_FW_FORMAT_MAX, .fw_format_max = RTW8852B_FW_FORMAT_MAX,
.try_ce_fw = true, .try_ce_fw = true,
.bbmcu_nr = 0,
.needed_fw_elms = 0, .needed_fw_elms = 0,
.fifo_size = 196608, .fifo_size = 196608,
.small_fifo_size = true, .small_fifo_size = true,
......
...@@ -2816,6 +2816,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = { ...@@ -2816,6 +2816,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
.fw_basename = RTW8852C_FW_BASENAME, .fw_basename = RTW8852C_FW_BASENAME,
.fw_format_max = RTW8852C_FW_FORMAT_MAX, .fw_format_max = RTW8852C_FW_FORMAT_MAX,
.try_ce_fw = false, .try_ce_fw = false,
.bbmcu_nr = 0,
.needed_fw_elms = 0, .needed_fw_elms = 0,
.fifo_size = 458752, .fifo_size = 458752,
.small_fifo_size = false, .small_fifo_size = false,
......
...@@ -488,6 +488,8 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow) ...@@ -488,6 +488,8 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow)
struct rtw89_wow_param *rtw_wow = &rtwdev->wow; struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
struct ieee80211_vif *wow_vif = rtw_wow->wow_vif; struct ieee80211_vif *wow_vif = rtw_wow->wow_vif;
struct rtw89_vif *rtwvif = (struct rtw89_vif *)wow_vif->drv_priv; struct rtw89_vif *rtwvif = (struct rtw89_vif *)wow_vif->drv_priv;
const struct rtw89_chip_info *chip = rtwdev->chip;
bool include_bb = !!chip->bbmcu_nr;
struct ieee80211_sta *wow_sta; struct ieee80211_sta *wow_sta;
struct rtw89_sta *rtwsta = NULL; struct rtw89_sta *rtwsta = NULL;
bool is_conn = true; bool is_conn = true;
...@@ -501,7 +503,7 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow) ...@@ -501,7 +503,7 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow)
else else
is_conn = false; is_conn = false;
ret = rtw89_fw_download(rtwdev, fw_type); ret = rtw89_fw_download(rtwdev, fw_type, include_bb);
if (ret) { if (ret) {
rtw89_warn(rtwdev, "download fw failed\n"); rtw89_warn(rtwdev, "download fw failed\n");
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment