Commit 3d2d61b5 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76: remove wait argument from mt76x02_mcu_function_select

Remove wait argument from mt76x02_mcu_function_select and wait for
response when function is not Q_SELECT, what is the same behaviour
like in vendor driver.

Note this change behaviour for PCIe devices for Q_SELECT function
form wait to no-wait, and for mt76x0u BW_SETTING from no-wait to wait.
But the change is in align with vendor driver.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent a74d6336
...@@ -227,7 +227,7 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev) ...@@ -227,7 +227,7 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev)
return -ETIMEDOUT; return -ETIMEDOUT;
mt76x0_reset_csr_bbp(dev); mt76x0_reset_csr_bbp(dev);
ret = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false); ret = mt76x02_mcu_function_select(dev, Q_SELECT, 1);
if (ret) if (ret)
return ret; return ret;
......
...@@ -500,7 +500,7 @@ mt76x0_phy_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width) ...@@ -500,7 +500,7 @@ mt76x0_phy_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width)
return ; return ;
} }
mt76x02_mcu_function_select(dev, BW_SETTING, bw, false); mt76x02_mcu_function_select(dev, BW_SETTING, bw);
} }
static void mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev) static void mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev)
......
...@@ -132,9 +132,8 @@ int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, ...@@ -132,9 +132,8 @@ int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
} }
EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_send); EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_send);
int mt76x02_mcu_function_select(struct mt76x02_dev *dev, int mt76x02_mcu_function_select(struct mt76x02_dev *dev, enum mcu_function func,
enum mcu_function func, u32 val)
u32 val, bool wait_resp)
{ {
struct { struct {
__le32 id; __le32 id;
...@@ -143,9 +142,12 @@ int mt76x02_mcu_function_select(struct mt76x02_dev *dev, ...@@ -143,9 +142,12 @@ int mt76x02_mcu_function_select(struct mt76x02_dev *dev,
.id = cpu_to_le32(func), .id = cpu_to_le32(func),
.value = cpu_to_le32(val), .value = cpu_to_le32(val),
}; };
bool wait = false;
return mt76_mcu_send_msg(dev, CMD_FUN_SET_OP, &msg, sizeof(msg), if (func != Q_SELECT)
wait_resp); wait = true;
return mt76_mcu_send_msg(dev, CMD_FUN_SET_OP, &msg, sizeof(msg), wait);
} }
EXPORT_SYMBOL_GPL(mt76x02_mcu_function_select); EXPORT_SYMBOL_GPL(mt76x02_mcu_function_select);
......
...@@ -101,9 +101,8 @@ int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, ...@@ -101,9 +101,8 @@ int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type,
u32 param, bool wait); u32 param, bool wait);
int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
int len, bool wait_resp); int len, bool wait_resp);
int mt76x02_mcu_function_select(struct mt76x02_dev *dev, int mt76x02_mcu_function_select(struct mt76x02_dev *dev, enum mcu_function func,
enum mcu_function func, u32 val);
u32 val, bool wait_resp);
int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on, int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on,
bool wait_resp); bool wait_resp);
void mt76x02_set_ethtool_fwver(struct mt76x02_dev *dev, void mt76x02_set_ethtool_fwver(struct mt76x02_dev *dev,
......
...@@ -182,6 +182,6 @@ int mt76x2_mcu_init(struct mt76x02_dev *dev) ...@@ -182,6 +182,6 @@ int mt76x2_mcu_init(struct mt76x02_dev *dev)
if (ret) if (ret)
return ret; return ret;
mt76x02_mcu_function_select(dev, Q_SELECT, 1, true); mt76x02_mcu_function_select(dev, Q_SELECT, 1);
return 0; return 0;
} }
...@@ -258,7 +258,7 @@ int mt76x2u_mcu_init(struct mt76x02_dev *dev) ...@@ -258,7 +258,7 @@ int mt76x2u_mcu_init(struct mt76x02_dev *dev)
{ {
int err; int err;
err = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false); err = mt76x02_mcu_function_select(dev, Q_SELECT, 1);
if (err < 0) if (err < 0)
return err; return err;
......
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