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>,
Paul Menzel <pmenzel@molgen.mpg.de>
Subject: [PATCH v3 2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()
Date: Fri, 20 Nov 2026 15:12:49 +0530 [thread overview]
Message-ID: <20261120094249.2419421-2-kiran.k@intel.com> (raw)
In-Reply-To: <20261120094249.2419421-1-kiran.k@intel.com>
MAC_INIT and MAC_ACCESS_REQ are the function control register bits
required to acquire MAC access for target reads. Currently, MAC_INIT is
set separately by btintel_pcie_mac_init(), which is called right before
btintel_pcie_read_device_mem() in btintel_parse_mbox_tlv(),
btintel_pcie_read_hwexp() and btintel_pcie_dump_fwtrigger_event().
btintel_pcie_dump_traces() also reads device memory under MAC access,
but it never called btintel_pcie_mac_init(), so MAC_INIT was missing on
the coredump path.
Fold the MAC_INIT handling into btintel_pcie_get_mac_access() so that
every user of MAC access programs MAC_INIT. Set MAC_INIT and
MAC_ACCESS_REQ with a single register write when either bit is not
already set. Drop btintel_pcie_mac_init() along with its three call
sites. This also fixes btintel_pcie_dump_traces().
Fixes: 07e6bddb54b4 ("Bluetooth: btintel_pcie: Add support for device coredump")
Assisted-by: Copilot:Gemini 4 Argon
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kiran K <kiran.k@intel.com>
---
drivers/bluetooth/btintel_pcie.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
changes in v2:
- split the patch into two
changes in v3:
- https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103143759.555315-1-kiran.k%40intel.com
by update commit message and adding fix tag
- For pre-existing issue, patches will be submitted seperatly.
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 9b75807065c0..55454900322b 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -870,28 +870,18 @@ static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)
return reg == 0 ? 0 : -ENODEV;
}
-static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
-{
- u32 reg;
-
- reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
- if (!(reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT)) {
- reg |= BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT;
- btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
- }
-}
-
static int btintel_pcie_get_mac_access(struct btintel_pcie_data *data)
{
- u32 reg;
+ u32 reg, val;
int retry = 15;
+ const u32 req = BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT |
+ BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_REQ;
reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
- 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);
- }
+ val = reg | req;
+ if (val != reg)
+ btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, val);
do {
reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
@@ -2045,8 +2035,6 @@ static int btintel_parse_mbox_tlv(struct btintel_pcie_data *data)
if (!buffer)
return -ENOMEM;
- btintel_pcie_mac_init(data);
-
err = btintel_pcie_read_device_mem(data, buffer, tbl_addr,
buffer_len);
if (err)
@@ -2737,8 +2725,6 @@ static void btintel_pcie_read_hwexp(struct btintel_pcie_data *data)
if (!buf)
goto exit_on_error;
- btintel_pcie_mac_init(data);
-
err = btintel_pcie_read_device_mem(data, buf, addr, len);
if (err)
goto exit_on_error;
@@ -2826,8 +2812,6 @@ static int btintel_pcie_dump_fwtrigger_event(struct btintel_pcie_data *data)
if (!buf)
return -ENOMEM;
- btintel_pcie_mac_init(data);
-
err = btintel_pcie_read_device_mem(data, buf, data->debug_evt_addr,
len);
if (err)
--
2.54.0
prev parent reply other threads:[~2026-11-20 9:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 9:42 [PATCH v3 1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Kiran K
2026-11-20 9:42 ` Kiran K [this message]
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=20261120094249.2419421-2-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 \
--cc=pmenzel@molgen.mpg.de \
/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