Skip to contentSkip to conversation

bluetooth: add btmrvl driver to support Marvell bluetooth devices

PATCH Superseded Bing Zhao 2 participants 7 messages May 29, 2009 – Jun 2, 2009

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH v2 1/4 bluetooth: add btmrvl driver to support Marvell bluetooth devices

This driver provides basic definitions and library functions to support Marvell Bluetooth enabled devices, such as 88W8688 WLAN/BT combo chip.

This patch incorporates a lot of comments given by Nicolas Pitre <[email protected]>. Many thanks to Nicolas Pitre.

---
 drivers/bluetooth/Kconfig       |   12 +
 drivers/bluetooth/Makefile      |    3 +
 drivers/bluetooth/btmrvl_drv.h  |  138 ++++++++
 drivers/bluetooth/btmrvl_main.c |  711 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 864 insertions(+), 0 deletions(-)
 create mode 100644 drivers/bluetooth/btmrvl_drv.h
 create mode 100644 drivers/bluetooth/btmrvl_main.c
drivers/bluetooth/Kconfig +12 -0
index 1164837..b049a79 100644
@@ -170,5 +170,17 @@ config BT_HCIVHCI
 	  Say Y here to compile support for virtual HCI devices into the
 	  kernel or say M to compile it as module (hci_vhci).
 
+config BT_MRVL
+	tristate "Marvell Bluetooth driver support"
+	select FW_LOADER
+	help
+	  The core driver to support Marvell Bluetooth devices.
+
+	  This driver is required if you want to support
+	  Marvell Bluetooth devices, such as 8688.
+
+	  Say Y here to compile Marvell Bluetooth driver
+	  into the kernel or say M to compile it as module.
+
 endmenu
 
drivers/bluetooth/Makefile +3 -0
index 16930f9..3eff123 100644
@@ -15,6 +15,9 @@ obj-$(CONFIG_BT_HCIBTUART)	+= btuart_cs.o
 obj-$(CONFIG_BT_HCIBTUSB)	+= btusb.o
 obj-$(CONFIG_BT_HCIBTSDIO)	+= btsdio.o
 
+btmrvl-objs			:= btmrvl_main.o
+obj-$(CONFIG_BT_MRVL)		+= btmrvl.o
+
 hci_uart-y				:= hci_ldisc.o
 hci_uart-$(CONFIG_BT_HCIUART_H4)	+= hci_h4.o
 hci_uart-$(CONFIG_BT_HCIUART_BCSP)	+= hci_bcsp.o
drivers/bluetooth/btmrvl_drv.h new file +138 -0

138 lines not on this page · raw message

drivers/bluetooth/btmrvl_main.c new file +711 -0

711 lines not on this page · raw message

Signature · 1 line
1.5.3.6
author
#1 lore raw

PATCH v2 2/4 bluetooth: btmrvl_sdio: Marvell BT-over-SDIO driver

This driver supports Marvell Bluetooth enabled devices with SDIO interface. Currently only SD8688 chip is supported.

The helper/firmware images of SD8688 can be downloaded from this tree:
git://git.infradead.org/users/dwmw2/linux-firmware.git

This patch incorporates a lot of comments given by Nicolas Pitre <[email protected]>. Many thanks to Nicolas Pitre.

---
 drivers/bluetooth/Kconfig       |   13 +
 drivers/bluetooth/Makefile      |    1 +
 drivers/bluetooth/btmrvl_sdio.c | 1124 +++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btmrvl_sdio.h |  113 ++++
 4 files changed, 1251 insertions(+), 0 deletions(-)
 create mode 100644 drivers/bluetooth/btmrvl_sdio.c
 create mode 100644 drivers/bluetooth/btmrvl_sdio.h
drivers/bluetooth/Kconfig +13 -0
index b049a79..8c89bd4 100644
@@ -182,5 +182,18 @@ config BT_MRVL
 	  Say Y here to compile Marvell Bluetooth driver
 	  into the kernel or say M to compile it as module.
 
+config BT_MRVL_SDIO
+	tristate "Marvell BT-over-SDIO driver"
+	depends on BT_MRVL && MMC
+	help
+	  The driver for Marvell Bluetooth chipsets with SDIO interface.
+
+	  This driver is required if you want to use Marvell Bluetooth
+	  devices with SDIO interface. Currently only SD8688 chipset is
+	  supported.
+
+	  Say Y here to compile support for Marvell BT-over-SDIO driver
+	  into the kernel or say M to compile it as module.
+
 endmenu
 
drivers/bluetooth/Makefile +1 -0
index 3eff123..2dc12e7 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_BT_HCIBTSDIO)	+= btsdio.o
 
 btmrvl-objs			:= btmrvl_main.o
 obj-$(CONFIG_BT_MRVL)		+= btmrvl.o
+obj-$(CONFIG_BT_MRVL_SDIO)	+= btmrvl_sdio.o
 
 hci_uart-y				:= hci_ldisc.o
 hci_uart-$(CONFIG_BT_HCIUART_H4)	+= hci_h4.o
drivers/bluetooth/btmrvl_sdio.c new file +1124 -0

1,124 lines not on this page · raw message

drivers/bluetooth/btmrvl_sdio.h new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
1.5.3.6
author
#2 lore raw

PATCH v2 3/4 bluetooth: Add debugfs support to btmrvl driver

In reply to Bing Zhao

/debug/btmrvl/config/
/debug/btmrvl/status/

See Documentation/btmrvl.txt for details.

This patch incorporates a lot of comments given by Nicolas Pitre <[email protected]>. Many thanks to Nicolas Pitre.

---
 drivers/bluetooth/Kconfig          |    1 +
 drivers/bluetooth/Makefile         |    2 +-
 drivers/bluetooth/btmrvl_debugfs.c |  445 ++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btmrvl_drv.h     |    8 +
 drivers/bluetooth/btmrvl_main.c    |    8 +
 5 files changed, 463 insertions(+), 1 deletions(-)
 create mode 100644 drivers/bluetooth/btmrvl_debugfs.c
drivers/bluetooth/Kconfig +1 -0
index 8c89bd4..5f04014 100644
@@ -173,6 +173,7 @@ config BT_HCIVHCI
 config BT_MRVL
 	tristate "Marvell Bluetooth driver support"
 	select FW_LOADER
+	select DEBUG_FS
 	help
 	  The core driver to support Marvell Bluetooth devices.
 
drivers/bluetooth/Makefile +1 -1
index 2dc12e7..75f70e0 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_BT_HCIBTUART)	+= btuart_cs.o
 obj-$(CONFIG_BT_HCIBTUSB)	+= btusb.o
 obj-$(CONFIG_BT_HCIBTSDIO)	+= btsdio.o
 
-btmrvl-objs			:= btmrvl_main.o
+btmrvl-objs			:= btmrvl_main.o btmrvl_debugfs.o
 obj-$(CONFIG_BT_MRVL)		+= btmrvl.o
 obj-$(CONFIG_BT_MRVL_SDIO)	+= btmrvl_sdio.o
 
drivers/bluetooth/btmrvl_debugfs.c new file +445 -0

445 lines not on this page · raw message

drivers/bluetooth/btmrvl_drv.h +8 -0
index 06ea9ed..f5d1175 100644
@@ -79,6 +79,9 @@ struct btm_private {
 				u8 *payload, u16 nb);
 	int (*hw_wakeup_firmware) (struct btm_private *priv);
 	spinlock_t driver_lock;		/* spinlock used by driver */
+#ifdef CONFIG_DEBUG_FS
+	void *debugfs_data;
+#endif
 };
 
 #define MRVL_VENDOR_PKT			0xFE
@@ -135,4 +138,9 @@ int btm_process_event(struct btm_private *priv, struct sk_buff *skb);
 int btm_send_module_cfg_cmd(struct btm_private *priv, int subcmd);
 int btm_prepare_command(struct btm_private *priv);
 
+#ifdef CONFIG_DEBUG_FS
+void btm_debugfs_init(struct hci_dev *hdev);
+void btm_debugfs_remove(struct hci_dev *hdev);
+#endif
+
 #endif /* _BTMRVL_DRV_H_ */
drivers/bluetooth/btmrvl_main.c +8 -0
index da7c21d..d6cf9f1 100644
@@ -655,6 +655,10 @@ struct btm_private *btm_add_card(void *card)
 		goto err_hci_register_dev;
 	}
 
+#ifdef CONFIG_DEBUG_FS
+	btm_debugfs_init(hdev);
+#endif
+
 	BT_DBG("Leave");
 	return priv;
 
@@ -689,6 +693,10 @@ int btm_remove_card(struct btm_private *priv)
 
 	kthread_stop(priv->main_thread.task);
 
+#ifdef CONFIG_DEBUG_FS
+	btm_debugfs_remove(hdev);
+#endif
+
 	hci_unregister_dev(hdev);
 
 	hci_free_dev(hdev);
Signature · 1 line
1.5.3.6
author
#3 lore raw

PATCH v2 4/4 bluetooth: Documentation for Marvell Bluetooth driver

In reply to Bing Zhao

add btmrvl.txt to Documentation/

This patch incorporates a lot of comments given by Nicolas Pitre <[email protected]>. Many thanks to Nicolas Pitre.

---
 Documentation/00-INDEX   |    3 +-
 Documentation/btmrvl.txt |  119 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/btmrvl.txt
Documentation/00-INDEX +2 -1
index d05737a..6adf3aa 100644
@@ -14,7 +14,6 @@ Following translations are available on the WWW:
 	- this file.
 ABI/
 	- info on kernel <-> userspace ABI and relative interface stability.
-
 BUG-HUNTING
 	- brute force method of doing binary search of patches to find bug.
 Changes
@@ -82,6 +81,8 @@ block/
 	- info on the Block I/O (BIO) layer.
 blockdev/
 	- info on block devices & drivers
+btmrvl.txt
+	- info on Marvell Bluetooth driver usage.
 cachetlb.txt
 	- describes the cache/TLB flushing interfaces Linux uses.
 cdrom/
Documentation/btmrvl.txt new file +119 -0

119 lines not on this page · raw message

Signature · 1 line
1.5.3.6
maintainer
#4 lore raw
In reply to Bing Zhao

Hi Bing,

Quoted 3 lines

This driver provides basic definitions and library functions to support Marvell Bluetooth enabled devices, such as 88W8688 WLAN/BT combo chip.

we still have to talk about the handling of vendor commands. Handling these inside the driver is a bad idea. We can just let the core forward them to you if you are interested. I have to think about it a little bit.

drivers/bluetooth/btmrvl_drv.h line 42

Quoted 5 lines
drivers/bluetooth/btmrvl_drv.h new file +5 -0
+struct btm_thread {
+	struct task_struct *task;
+	wait_queue_head_t wait_q;
+	void *priv;
+};

Please prefix everything with btmrvl_* for cleaner namespace. Especially for the exported symbol it is important that you have a clean namespace.

Regards

Marcel

author
#5 lore raw

Hi Marcel,

Thanks for reviewing our patches.

Quoted 10 lines

Hi Bing,
=20

Quoted 3 lines

This driver provides basic definitions and library functions to support Marvell Bluetooth enabled devices, such as 88W8688 WLAN/BT combo chip.

=20
we still have to talk about the handling of vendor commands. Handling these inside the driver is a bad idea. We can just let the core forward them to you if you are interested. I have to think about it a little bit.

I don't know how the vendor specific commands can be handled outside of btm= rvl.ko driver.
Please share with me once you have any idea on the handling of the vendor c= ommands.
=20

Quoted 8 lines

drivers/bluetooth/btmrvl_drv.h line 42

Quoted 5 lines
drivers/bluetooth/btmrvl_drv.h new file +5 -0
+struct btm_thread {
+	struct task_struct *task;
+	wait_queue_head_t wait_q;
+	void *priv;
+};

=20
Please prefix everything with btmrvl_* for cleaner namespace. Especially for the exported symbol it is important that you have a clean namespace.

I've made this change. Do you want me to resend the new patch now, or wait = a while for more feedbacks?

Quoted 5 lines

=20
Regards
=20
Marcel
=20

Thanks,

Bing

maintainer
#6 lore raw

Hi Bing,

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

This driver provides basic definitions and library functions to support Marvell Bluetooth enabled devices, such as 88W8688 WLAN/BT combo chip.

we still have to talk about the handling of vendor commands. Handling these inside the driver is a bad idea. We can just let the core forward them to you if you are interested. I have to think about it a little bit.

I don't know how the vendor specific commands can be handled outside of btmrvl.ko driver. Please share with me once you have any idea on the handling of the vendor commands.

the Bluetooth core parses the commands and events anyway. So we just need a hook in the hci_dev structure to allow to be called when a vendor command arrives. And there needs to be an easy way to send such vendor specific commands from within the driver. Handling it inside the driver is wrong since you are messing with the flow control handling and that should be done by the Bluetooth core.

Quoted 10 lines
Quoted 8 lines

drivers/bluetooth/btmrvl_drv.h line 42

Quoted 5 lines
drivers/bluetooth/btmrvl_drv.h new file +5 -0
+struct btm_thread {
+	struct task_struct *task;
+	wait_queue_head_t wait_q;
+	void *priv;
+};

Please prefix everything with btmrvl_* for cleaner namespace. Especially for the exported symbol it is important that you have a clean namespace.

I've made this change. Do you want me to resend the new patch now, or wait a while for more feedbacks?

Please re-send them. Then I can add them to bluetooth-testing to see how far we get. The vendor command handling should not stop us from merging the driver, but it will be todo item that needs fixing from your side.

I also wanna coordinate with John on how we get the rmmod thing done in a better way. What you are doing right now is messy and ugly.

Regards

Marcel