Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
PATCH v2 1/2 Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
btintel_pcie_mac_init() is called prior to reading device memory via target access. To acquire MAC access, only the MAC_INIT and MAC_ACCESS_REQ bits in the function control register need to be programmed.
Currently, btintel_pcie_mac_init() also modifies FUNC_ENA, FUNC_INIT, BUS_MASTER_DISCON, and SW_RESET, which are not relevant to MAC access (though doing so had no observed side effects). Leave those bits untouched and only set MAC_INIT if it is not already set.
--- drivers/bluetooth/btintel_pcie.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/bluetooth/btintel_pcie.c +4 -7
@@ -993,14 +993,11 @@ static void btintel_pcie_mac_init(struct btintel_pcie_data *data) {u32 reg; -/* Set MAC_INIT bit to start primary bootloader */ reg =btintel_pcie_rd_reg32 (data,BTINTEL_PCIE_CSR_FUNC_CTRL_REG ); - reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT | -BTINTEL_PCIE_CSR_FUNC_CTRL_BUS_MASTER_DISCON | -BTINTEL_PCIE_CSR_FUNC_CTRL_SW_RESET ); - reg |= (BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_ENA | -BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT ); -btintel_pcie_wr_reg32 (data,BTINTEL_PCIE_CSR_FUNC_CTRL_REG , 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)
Signature · 1 line
2.54.0
PATCH v2 2/2 Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()
Currently, every caller reading device memory has to call btintel_pcie_mac_init() right before btintel_pcie_read_device_mem(). Since btintel_pcie_read_device_mem() acquires MAC access via btintel_pcie_get_mac_access(), fold the MAC_INIT handling into btintel_pcie_get_mac_access() and drop btintel_pcie_mac_init() along with its three call sites.
Set MAC_INIT and MAC_ACCESS_REQ with a single register write when either bit is not already set.
--- drivers/bluetooth/btintel_pcie.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-)
drivers/bluetooth/btintel_pcie.c +6 -22
@@ -989,28 +989,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);
@@ -1948,8 +1938,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)
@@ -2640,8 +2628,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;
@@ -2729,8 +2715,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)
Signature · 1 line
2.54.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1200445/
---Test result---
Test Summary:
CheckPatch FAIL 1.55 seconds VerifyFixes PASS 0.13 seconds VerifySignedoff PASS 0.63 seconds GitLint FAIL 0.70 seconds SubjectPrefix PASS 0.29 seconds BuildKernel PASS 31.54 seconds CheckAllWarning PASS 35.53 seconds CheckSparse PASS 38.19 seconds BuildKernel32 PASS 31.29 seconds CheckKernelLLVM PASS 35.78 seconds TestRunnerSetup PASS 764.06 seconds IncrementalBuild PASS 33.75 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2,1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
WARNING: Non-standard signature: Assisted-by:
#109:
ERROR: Unrecognized email address: 'Copilot:Gemini 4 Argon' #109:
total: 1 errors, 1 warnings, 18 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluetooth-next/bluetooth-next/src/patch/14940452.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[v2,2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()
WARNING: Non-standard signature: Assisted-by:
#111:
ERROR: Unrecognized email address: 'Copilot:Gemini 4 Argon' #111:
total: 1 errors, 1 warnings, 58 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluetooth-next/bluetooth-next/src/patch/14940453.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v2,2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()
1: T1 Title exceeds max length (82>80): "[v2,2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()"
https://github.com/bluez/bluetooth-next/pull/1054
---
Regards,
Linux Bluetooth