Skip to content

Commit 4694961

Browse files
dwmw2davem330
authored andcommitted
libertas: Check for PS mode support on USB devices
Move the various firmware setup bits into a separate function, which used to do just boot2 version. Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent b2c57ee commit 4694961

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

drivers/net/wireless/libertas/if_usb.c

+22-6
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,36 @@ static void if_usb_free(struct if_usb_card *cardp)
102102
lbs_deb_leave(LBS_DEB_USB);
103103
}
104104

105-
static void if_usb_set_boot2_ver(struct lbs_private *priv)
105+
static void if_usb_setup_firmware(struct lbs_private *priv)
106106
{
107107
struct cmd_ds_set_boot2_ver b2_cmd;
108+
struct cmd_ds_802_11_fw_wake_method wake_method;
108109

109110
b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd));
110111
b2_cmd.action = 0;
111112
b2_cmd.version = priv->boot2_version;
112113

113114
if (lbs_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd))
114115
lbs_deb_usb("Setting boot2 version failed\n");
116+
117+
priv->wol_gpio = 2; /* Wake via GPIO2... */
118+
priv->wol_gap = 20; /* ... after 20ms */
119+
lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA);
120+
121+
wake_method.hdr.size = cpu_to_le16(sizeof(wake_method));
122+
wake_method.action = cpu_to_le16(CMD_ACT_GET);
123+
if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) {
124+
lbs_pr_info("Firmware does not seem to support PS mode\n");
125+
} else {
126+
if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) {
127+
lbs_deb_usb("Firmware seems to support PS with wake-via-command\n");
128+
priv->ps_supported = 1;
129+
} else {
130+
/* The versions which boot up this way don't seem to
131+
work even if we set it to the command interrupt */
132+
lbs_pr_info("Firmware doesn't wake via command interrupt; disabling PS mode\n");
133+
}
134+
}
115135
}
116136

117137
static void if_usb_fw_timeo(unsigned long priv)
@@ -221,11 +241,7 @@ static int if_usb_probe(struct usb_interface *intf,
221241
if (lbs_start_card(priv))
222242
goto err_start_card;
223243

224-
if_usb_set_boot2_ver(priv);
225-
226-
priv->wol_gpio = 2; /* Wake via GPIO2... */
227-
priv->wol_gap = 20; /* ... after 20ms */
228-
lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA);
244+
if_usb_setup_firmware(priv);
229245

230246
usb_get_dev(udev);
231247
usb_set_intfdata(intf, cardp);

0 commit comments

Comments
 (0)