Linux bluetooth development
 help / color / mirror / Atom feed
From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: chethan.tumkur.narayan@intel.com,
	chandrashekar.devegowda@intel.com, Kiran K <kiran.k@intel.com>
Subject: [PATCH v1 5/7] Bluetooth: btintel_pcie: Add MAC access logging under LOG_MASK
Date: Thu, 29 Oct 2026 15:23:42 +0530	[thread overview]
Message-ID: <20261029095344.3989729-5-kiran.k@intel.com> (raw)
In-Reply-To: <20261029095344.3989729-1-kiran.k@intel.com>

Log MAC access grant and release along with the FUNC_CTRL register
value, gated by BTINTEL_PCIE_LOG_MAC_ACCESS (bit 4). Also report MAC
access timeouts unconditionally as errors since they indicate a stuck
controller.

Assisted-by: Copilot:Claude Opus 4.7
Signed-off-by: Kiran K <kiran.k@intel.com>
---
 drivers/bluetooth/btintel_pcie.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 56c76e5fe473..878bcc1412fd 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -36,6 +36,7 @@
 #define BTINTEL_PCIE_DUMP_RX		BIT(1)
 #define BTINTEL_PCIE_LOG_ALIVE_INTR	BIT(2)
 #define BTINTEL_PCIE_LOG_SX		BIT(3)
+#define BTINTEL_PCIE_LOG_MAC_ACCESS	BIT(4)
 
 #define BTINTEL_PCI_DEVICE(dev, subdev)	\
 	.vendor = PCI_VENDOR_ID_INTEL,	\
@@ -1014,13 +1015,19 @@ static int btintel_pcie_get_mac_access(struct btintel_pcie_data *data)
 
 	do {
 		reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
-		if (reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_STS)
+		if (reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_STS) {
+			if (data->log_mask & BTINTEL_PCIE_LOG_MAC_ACCESS)
+				bt_dev_info(data->hdev,
+					    "MAC access granted: func_ctrl: 0x%8.8x",
+					    reg);
 			return 0;
+		}
 		/* Need delay here for Target Access harwdware to settle down*/
 		usleep_range(1000, 1200);
 
 	} while (--retry > 0);
 
+	bt_dev_err(data->hdev, "MAC access timeout: func_ctrl: 0x%8.8x", reg);
 	return -ETIME;
 }
 
@@ -1033,6 +1040,10 @@ static void btintel_pcie_release_mac_access(struct btintel_pcie_data *data)
 	if (reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_REQ) {
 		reg &= ~BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_REQ;
 		btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+
+		if (data->log_mask & BTINTEL_PCIE_LOG_MAC_ACCESS)
+			bt_dev_info(data->hdev,
+				    "MAC access released: func_ctrl: 0x%8.8x", reg);
 	}
 }
 
-- 
2.54.0


  parent reply	other threads:[~2026-10-29  9:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  9:53 [PATCH v1 1/7] Bluetooth: btintel_pcie: Add LOG_MASK parsing from debug INI Kiran K
2026-10-29  9:53 ` [PATCH v1 2/7] Bluetooth: btintel_pcie: Add TX/RX packet dumps under LOG_MASK Kiran K
2026-10-29  9:53 ` [PATCH v1 3/7] Bluetooth: btintel_pcie: Add alive interrupt logging " Kiran K
2026-10-29  9:53 ` [PATCH v1 4/7] Bluetooth: btintel_pcie: Add Sx transition " Kiran K
2026-10-29  9:53 ` Kiran K [this message]
2026-10-29  9:53 ` [PATCH v1 6/7] Bluetooth: btintel_pcie: Add target memory read " Kiran K
2026-10-29  9:53 ` [PATCH v1 7/7] Bluetooth: btintel_pcie: Gate mailbox logging behind LOG_MASK Kiran K
2026-10-29 14:52 ` [v1,1/7] Bluetooth: btintel_pcie: Add LOG_MASK parsing from debug INI bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261029095344.3989729-5-kiran.k@intel.com \
    --to=kiran.k@intel.com \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox