[PATCH] libertas: Support for firmware ready event.

Ashish Shukla javier at cozybit.com
Wed Nov 28 15:54:52 EST 2007


Firmware sends an event to host to notify that the firmware is ready.
Implemented in wireless firmware version 5.110.21.p1.

Signed-off-by: Javier Cardona <javier at cozybit.com>
---
 drivers/net/wireless/libertas/cmdresp.c |    5 ++++-
 drivers/net/wireless/libertas/host.h    |    1 +
 drivers/net/wireless/libertas/if_usb.c  |   14 +++++++++++---
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index d391391..dd1e188 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -982,7 +982,10 @@ int libertas_process_event(wlan_private * priv)
 	case MACREG_INT_CODE_SNR_HIGH:
 		lbs_pr_alert("EVENT: snr high\n");
 		break;
-
+	case MACREG_INT_CODE_FIRMWARE_READY:
+		priv->adapter->fw_ready = 1;
+		lbs_pr_alert("EVENT: Wireless firmware ready\n");
+		break;
 	case MACREG_INT_CODE_MESH_AUTO_STARTED:
 		/* Ignore spurious autostart events if autostart is disabled */
 		if (!priv->mesh_autostart_enabled) {
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index 00d5675..2150ea0 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -291,5 +291,6 @@ enum cmd_mesh_access_opts {
 #define MACREG_INT_CODE_RSSI_HIGH		0x0000001c
 #define MACREG_INT_CODE_SNR_HIGH		0x0000001d
 #define MACREG_INT_CODE_MESH_AUTO_STARTED	0x00000023
+#define MACREG_INT_CODE_FIRMWARE_READY          0x00000030
 
 #endif				/* _HOST_H_ */
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 4c5e20c..740065b 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -924,10 +924,18 @@ restart:
 
 	if_usb_submit_rx_urb(priv);
 
-	/* Delay 200 ms to waiting for the FW ready */
-	msleep_interruptible(200);
+	/* Wait for the FW ready */
+	i = 0;
+	while (!priv->adapter->fw_ready && i < 100) {
+		msleep_interruptible(10);
+		++i;
+	}
 
-	priv->adapter->fw_ready = 1;
+	if (!priv->adapter->fw_ready) {
+		lbs_pr_alert("No FW RDY event received.  Older FW?\n");
+		priv->adapter->fw_ready = 1;
+	} else
+		lbs_pr_info("FW ready time = %d ms\n", i * 10);
 
 done:
 	lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
-- 
1.5.2.5






More information about the Devel mailing list