Commit 871fc09f authored by Daniel Drake's avatar Daniel Drake Committed by John W. Linville

libertas: set mac control synchronously during init

CMD_MAC_CONTROL is currently sent async to the firmware, and is sent
from the lbs_setup_firmware() path during device init.

This means that device init can complete with commands pending, and
the if_sdio driver will sometimes power down the device (after init)
with this command still pending.

This was causing an occasional spurious command timeout after init,
leading to a device reset.

Fix this by making CMD_MAC_CONTROL synchronous when called from the
lbs_setup_firmware() path.
Signed-off-by: default avatarDaniel Drake <dsd@laptop.org>
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 46025f55
...@@ -1159,6 +1159,22 @@ void lbs_set_mac_control(struct lbs_private *priv) ...@@ -1159,6 +1159,22 @@ void lbs_set_mac_control(struct lbs_private *priv)
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
} }
int lbs_set_mac_control_sync(struct lbs_private *priv)
{
struct cmd_ds_mac_control cmd;
int ret = 0;
lbs_deb_enter(LBS_DEB_CMD);
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(priv->mac_control);
cmd.reserved = 0;
ret = lbs_cmd_with_response(priv, CMD_MAC_CONTROL, &cmd);
lbs_deb_leave(LBS_DEB_CMD);
return ret;
}
/** /**
* lbs_allocate_cmd_buffer - allocates the command buffer and links * lbs_allocate_cmd_buffer - allocates the command buffer and links
* it to command free queue * it to command free queue
......
...@@ -96,6 +96,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv); ...@@ -96,6 +96,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv);
int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on);
void lbs_set_mac_control(struct lbs_private *priv); void lbs_set_mac_control(struct lbs_private *priv);
int lbs_set_mac_control_sync(struct lbs_private *priv);
int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel,
s16 *maxlevel); s16 *maxlevel);
......
...@@ -682,8 +682,10 @@ static int lbs_setup_firmware(struct lbs_private *priv) ...@@ -682,8 +682,10 @@ static int lbs_setup_firmware(struct lbs_private *priv)
/* Send cmd to FW to enable 11D function */ /* Send cmd to FW to enable 11D function */
ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1); ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1);
if (ret)
goto done;
lbs_set_mac_control(priv); ret = lbs_set_mac_control_sync(priv);
done: done:
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
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