Skip to contentSkip to conversation

Bluetooth: btmrvl: implement read-to-clear for SD8897 interrupts

PATCH RESEND In review Bing Zhao 2 participants 2 messages Mar 28, 2014 – Mar 29, 2014 Bluetooth drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH RESEND 2/2 Bluetooth: btmrvl: implement read-to-clear for SD8897 interrupts

For SD8897, CMD52 write_to_clear may have missing interrupts under certain corner case condition. Use CMD53 read-to-clear to fix the problem.

---
 drivers/bluetooth/btmrvl_drv.h  |  2 ++
 drivers/bluetooth/btmrvl_main.c | 17 ++++++++++++++
 drivers/bluetooth/btmrvl_sdio.c | 52 ++++++++++++++++++++++++++++++++++++++++-
 drivers/bluetooth/btmrvl_sdio.h |  3 +++
 4 files changed, 73 insertions(+), 1 deletion(-)
drivers/bluetooth/btmrvl_drv.h +2 -0
index 7399303..199ff49 100644
@@ -59,6 +59,8 @@ struct btmrvl_device {
 };
 
 struct btmrvl_adapter {
+	void *hw_regs_buf;
+	u8 *hw_regs;
 	u32 int_count;
 	struct sk_buff_head tx_queue;
 	u8 psmode;
drivers/bluetooth/btmrvl_main.c +17 -0
index 2c4997c..5c0b944 100644
@@ -24,6 +24,7 @@
 #include <net/bluetooth/hci_core.h>
 
 #include "btmrvl_drv.h"
+#include "btmrvl_sdio.h"
 
 #define VERSION "1.0"
 
@@ -337,10 +338,25 @@ static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb)
 
 static void btmrvl_init_adapter(struct btmrvl_private *priv)
 {
+	int buf_size;
+
 	skb_queue_head_init(&priv->adapter->tx_queue);
 
 	priv->adapter->ps_state = PS_AWAKE;
 
+	buf_size = ALIGN_SZ(SDIO_BLOCK_SIZE, BTSDIO_DMA_ALIGN);
+	priv->adapter->hw_regs_buf = kzalloc(buf_size, GFP_KERNEL);
+	if (!priv->adapter->hw_regs_buf) {
+		priv->adapter->hw_regs = NULL;
+		BT_ERR("Unable to allocate buffer for hw_regs.");
+	} else {
+		priv->adapter->hw_regs =
+			(u8 *)ALIGN_ADDR(priv->adapter->hw_regs_buf,
+					 BTSDIO_DMA_ALIGN);
+		BT_DBG("hw_regs_buf=%p hw_regs=%p",
+		       priv->adapter->hw_regs_buf, priv->adapter->hw_regs);
+	}
+
 	init_waitqueue_head(&priv->adapter->cmd_wait_q);
 }
 
@@ -348,6 +364,7 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv)
 {
 	skb_queue_purge(&priv->adapter->tx_queue);
 
+	kfree(priv->adapter->hw_regs_buf);
 	kfree(priv->adapter);
 
 	priv->adapter = NULL;
drivers/bluetooth/btmrvl_sdio.c +51 -1

88 lines not on this page · raw message

drivers/bluetooth/btmrvl_sdio.h +3 -0
index 43d35a6..d4dd3b0 100644
@@ -78,6 +78,9 @@ struct btmrvl_sdio_card_reg {
 	u8 io_port_0;
 	u8 io_port_1;
 	u8 io_port_2;
+	bool int_read_to_clear;
+	u8 host_int_rsr;
+	u8 card_misc_cfg;
 };
 
 struct btmrvl_sdio_card {
Signature · 1 line
1.8.0
maintainer
#1 lore raw

Hi Bing,

Quoted 11 lines

For SD8897, CMD52 write_to_clear may have missing interrupts under certain corner case condition. Use CMD53 read-to-clear to fix the problem.

---

drivers/bluetooth/btmrvl_drv.h  |  2 ++
drivers/bluetooth/btmrvl_main.c | 17 ++++++++++++++
drivers/bluetooth/btmrvl_sdio.c | 52 ++++++++++++++++++++++++++++++++++++++++-
drivers/bluetooth/btmrvl_sdio.h |  3 +++
4 files changed, 73 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel