Skip to contentSkip to conversation

libertas: implement function init/shutdown commands for SD8688

PATCH In review Bing Zhao 3 participants 7 messages May 27, 2009 – Jun 2, 2009 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH v2 3/4 libertas: implement function init/shutdown commands for SD8688

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

---
 drivers/net/wireless/libertas/host.h    |    2 +
 drivers/net/wireless/libertas/if_sdio.c |   43 +++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/wireless/libertas/host.h +2 -0
index 8ff8ac9..fe8f0cb 100644
@@ -86,6 +86,8 @@
 #define CMD_MESH_CONFIG_OLD			0x00a3
 #define CMD_MESH_CONFIG				0x00ac
 #define	CMD_SET_BOOT2_VER			0x00a5
+#define	CMD_FUNC_INIT				0x00a9
+#define	CMD_FUNC_SHUTDOWN			0x00aa
 #define CMD_802_11_BEACON_CTRL			0x00b0
 
 /* For the IEEE Power Save */
drivers/net/wireless/libertas/if_sdio.c +41 -2

93 lines not on this page · raw message

Signature · 1 line
1.5.3.6
#1 lore raw

Hi Bing,

Quoted 34 lines

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

---
 drivers/net/wireless/libertas/host.h    |    2 +
 drivers/net/wireless/libertas/if_sdio.c |   43 +++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/wireless/libertas/host.h +2 -0
index 8ff8ac9..fe8f0cb 100644
@@ -86,6 +86,8 @@
 #define CMD_MESH_CONFIG_OLD			0x00a3
 #define CMD_MESH_CONFIG				0x00ac
 #define	CMD_SET_BOOT2_VER			0x00a5
+#define	CMD_FUNC_INIT				0x00a9
+#define	CMD_FUNC_SHUTDOWN			0x00aa
 #define CMD_802_11_BEACON_CTRL			0x00b0
 
 /* For the IEEE Power Save */
drivers/net/wireless/libertas/if_sdio.c +0 -0
index e998c12..84fef6b 100644

drivers/net/wireless/libertas/if_sdio.c line 47

Quoted 9 lines
drivers/net/wireless/libertas/if_sdio.c +4 -0
@@ -39,8 +39,12 @@
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
+#include "cmd.h"
 #include "if_sdio.h"
 
+/* set this flag in if_sdio_exit_module() if user removes this module */
+static u8 user_rmmod;
+

what is this suppose to be doing? There is no description in the commit messages or the code. And it looks pretty hackish to me.

Regards

Marcel

author
#2 lore raw
Quoted 56 lines

-----Original Message-----
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, May 28, 2009 12:21 AM
To: Bing Zhao
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 3/4 v2] libertas: implement function init/shutdown commands for SD8688

Hi Bing,

Quoted 34 lines

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

---
 drivers/net/wireless/libertas/host.h    |    2 +
 drivers/net/wireless/libertas/if_sdio.c |   43 +++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/wireless/libertas/host.h +2 -0
index 8ff8ac9..fe8f0cb 100644
@@ -86,6 +86,8 @@
 #define CMD_MESH_CONFIG_OLD			0x00a3
 #define CMD_MESH_CONFIG				0x00ac
 #define	CMD_SET_BOOT2_VER			0x00a5
+#define	CMD_FUNC_INIT				0x00a9
+#define	CMD_FUNC_SHUTDOWN			0x00aa
 #define CMD_802_11_BEACON_CTRL			0x00b0
 
 /* For the IEEE Power Save */
drivers/net/wireless/libertas/if_sdio.c +0 -0
index e998c12..84fef6b 100644

drivers/net/wireless/libertas/if_sdio.c line 47

Quoted 9 lines
drivers/net/wireless/libertas/if_sdio.c +4 -0
@@ -39,8 +39,12 @@
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
+#include "cmd.h"
 #include "if_sdio.h"
 
+/* set this flag in if_sdio_exit_module() if user removes this module */
+static u8 user_rmmod;
+

what is this suppose to be doing? There is no description in the commit messages or the code. And it looks pretty hackish to me.

Quoted 4 lines

Regards

Marcel

Hi Marcel,

I'm using this flag as the indication of module removal.

I have to distinguish these scenarios and handle them differently:
(1) user unplugs the card: As the card is unplugged, there is no way (no need) to send SHUTDOWN command.
(2) user removes the libertas_sdio module manually: Since the card is still in the slot, SHUTDOWN command will be sent to firmware.

When user rmmod the module, if_sdio_exit_module() is called and this flag "user_rmmod" is set to 1. When if_sdio_remove() is called this flag will be used to determine whether the SHUTDOWN command should be sent or not.

I hesitated to use this global variable in such a weird way. But I couldn't think of a better solution.

Thanks,

Bing

#3 lore raw

Hi Bing,

Quoted 49 lines
Quoted 40 lines
Quoted 40 lines

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

---
 drivers/net/wireless/libertas/host.h    |    2 +
 drivers/net/wireless/libertas/if_sdio.c |   43 +++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/wireless/libertas/host.h +2 -0
index 8ff8ac9..fe8f0cb 100644
@@ -86,6 +86,8 @@
 #define CMD_MESH_CONFIG_OLD			0x00a3
 #define CMD_MESH_CONFIG				0x00ac
 #define	CMD_SET_BOOT2_VER			0x00a5
+#define	CMD_FUNC_INIT				0x00a9
+#define	CMD_FUNC_SHUTDOWN			0x00aa
 #define CMD_802_11_BEACON_CTRL			0x00b0
 
 /* For the IEEE Power Save */
drivers/net/wireless/libertas/if_sdio.c +1 -0
index e998c12..84fef6b 100644
@@ -39,8 +39,12 @@
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
+#include "cmd.h"
 #include "if_sdio.h"
 
Quoted 6 lines

drivers/net/wireless/libertas/if_sdio.c line 47

Quoted 3 lines
drivers/net/wireless/libertas/if_sdio.c +3 -0
+/* set this flag in if_sdio_exit_module() if user removes this module */
+static u8 user_rmmod;
+

what is this suppose to be doing? There is no description in the commit messages or the code. And it looks pretty hackish to me.

I'm using this flag as the indication of module removal.

Quoted 7 lines

I have to distinguish these scenarios and handle them differently:
(1) user unplugs the card: As the card is unplugged, there is no way (no need) to send SHUTDOWN command.
(2) user removes the libertas_sdio module manually: Since the card is still in the slot, SHUTDOWN command will be sent to firmware.

When user rmmod the module, if_sdio_exit_module() is called and this flag "user_rmmod" is set to 1. When if_sdio_remove() is called this flag will be used to determine whether the SHUTDOWN command should be sent or not.

I hesitated to use this global variable in such a weird way. But I couldn't think of a better solution.

I still don't see why this is needed. The rmmod should trigger the driver removal and you can do cleanup via the removal callback. I do might be missing something essential here, but I have never seen any driver needing such a weird hack.

Regards

Marcel

author
#4 lore raw
Quoted 73 lines

-----Original Message-----
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, May 28, 2009 12:20 PM
To: Bing Zhao
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 3/4 v2] libertas: implement function init/shutdown commands for SD8688

Hi Bing,

Quoted 47 lines
Quoted 40 lines
Quoted 40 lines

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

---
 drivers/net/wireless/libertas/host.h    |    2 +
 drivers/net/wireless/libertas/if_sdio.c |   43 +++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/net/wireless/libertas/host.h +2 -0
index 8ff8ac9..fe8f0cb 100644
@@ -86,6 +86,8 @@
 #define CMD_MESH_CONFIG_OLD			0x00a3
 #define CMD_MESH_CONFIG				0x00ac
 #define	CMD_SET_BOOT2_VER			0x00a5
+#define	CMD_FUNC_INIT				0x00a9
+#define	CMD_FUNC_SHUTDOWN			0x00aa
 #define CMD_802_11_BEACON_CTRL			0x00b0
 
 /* For the IEEE Power Save */
drivers/net/wireless/libertas/if_sdio.c +1 -0
index e998c12..84fef6b 100644
@@ -39,8 +39,12 @@
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
+#include "cmd.h"
 #include "if_sdio.h"
 
Quoted 6 lines

drivers/net/wireless/libertas/if_sdio.c line 47

Quoted 3 lines
drivers/net/wireless/libertas/if_sdio.c +3 -0
+/* set this flag in if_sdio_exit_module() if user removes this module */
+static u8 user_rmmod;
+

what is this suppose to be doing? There is no description in the commit messages or the code. And it looks pretty hackish to me.

Quoted 4 lines

I'm using this flag as the indication of module removal.

I have to distinguish these scenarios and handle them differently:
(1) user unplugs the card: As the card is unplugged, there is no way (no need) to send SHUTDOWN

command.

Quoted 1 line

(2) user removes the libertas_sdio module manually: Since the card is still in the slot, SHUTDOWN

command will be sent to firmware.

Quoted 2 lines

When user rmmod the module, if_sdio_exit_module() is called and this flag "user_rmmod" is set to 1.

When if_sdio_remove() is called this flag will be used to determine whether the SHUTDOWN command should be sent or not.

Quoted 2 lines

I hesitated to use this global variable in such a weird way. But I couldn't think of a better

solution.

Quoted 9 lines

I still don't see why this is needed. The rmmod should trigger the driver removal and you can do cleanup via the removal callback. I do might be missing something essential here, but I have never seen any driver needing such a weird hack.

Regards

Marcel

Hi Marcel,

Unplugging the card also triggers if_sdio_remove() callback. I wonder if MMC/SDIO driver can provide such indication that upper layer driver can distinguish the two events: card removal or module removal.

Thanks,

Bing

#5 lore raw
In reply to Bing Zhao
Quoted 11 lines · Bing Zhao

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

I already merged the 5/19 version. Could you send a patch rebased on wireless-testing?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
author
#6 lore raw

Hi John,

The new patch against "master-2009-06-01" has been submitted to the lists:

[PATCH] libertas: improve function init/shutdown handling for SD8688

Thanks,

Bing

Quoted 27 lines

-----Original Message-----
From: John W. Linville [mailto:[email protected]]
Sent: Monday, June 01, 2009 11:35 AM
To: Bing Zhao
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 3/4 v2] libertas: implement function init/shutdown commands for SD8688

Quoted 11 lines · Bing Zhao

SD8688 is a WLAN/Bluetooth combo chip and both functions are supported in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded only once through either WLAN function (Libertas driver) or Bluetooth function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

I already merged the 5/19 version. Could you send a patch rebased on wireless-testing?

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.