Skip to contentSkip to conversation

Broadcom/Apple Bluetooth driver for Apple Silicon

PATCH Applied Sven Peter 4 participants 12 messages Nov 4, 2022 – Nov 8, 2022

Subsystems (8)
lore
Share & tools
lore

Sven Peter

author
#0 lore raw

v5 cover Broadcom/Apple Bluetooth driver for Apple Silicon

Hi,

v1: https://lore.kernel.org/asahi/[email protected]/
v2: https://lore.kernel.org/asahi/[email protected]/
v3: https://lore.kernel.org/asahi/[email protected]/
v4: https://lore.kernel.org/asahi/[email protected]/

Here's v5 of the Apple/Broadcom Bluetooth series. Even less changes this
time: I only added a macro for the MWS transport config quirk.

Best,

Sven

Sven Peter (7):
dt-bindings: net: Add generic Bluetooth controller
dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
arm64: dts: apple: t8103: Add Bluetooth controller
Bluetooth: hci_event: Ignore reserved bits in LE Extended Adv Report
Bluetooth: Add quirk to disable extended scanning
Bluetooth: Add quirk to disable MWS Transport Configuration
Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards

 .../devicetree/bindings/net/bluetooth.txt     |    5 -
 .../net/bluetooth/bluetooth-controller.yaml   |   29 +
 .../net/bluetooth/brcm,bcm4377-bluetooth.yaml |   81 +
 .../{ => bluetooth}/qualcomm-bluetooth.yaml   |    6 +-
 .../bindings/soc/qcom/qcom,wcnss.yaml         |    8 +-
 MAINTAINERS                                   |    2 +
 arch/arm64/boot/dts/apple/t8103-j274.dts      |    4 +
 arch/arm64/boot/dts/apple/t8103-j293.dts      |    4 +
 arch/arm64/boot/dts/apple/t8103-j313.dts      |    4 +
 arch/arm64/boot/dts/apple/t8103-j456.dts      |    4 +
 arch/arm64/boot/dts/apple/t8103-j457.dts      |    4 +
 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi     |    8 +
 drivers/bluetooth/Kconfig                     |   12 +
 drivers/bluetooth/Makefile                    |    1 +
 drivers/bluetooth/hci_bcm4377.c               | 2514 +++++++++++++++++
 include/net/bluetooth/hci.h                   |   21 +
 include/net/bluetooth/hci_core.h              |    7 +-
 net/bluetooth/hci_event.c                     |    2 +-
 net/bluetooth/hci_sync.c                      |    2 +-
 19 files changed, 2702 insertions(+), 16 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml
 rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)
 create mode 100644 drivers/bluetooth/hci_bcm4377.c
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v5 1/7 dt-bindings: net: Add generic Bluetooth controller

Bluetooth controllers share the common local-bd-address property. Add a generic YAML schema to replace bluetooth.txt for those.

---
 .../devicetree/bindings/net/bluetooth.txt     |  5 ----
 .../net/bluetooth/bluetooth-controller.yaml   | 29 +++++++++++++++++++
 .../{ => bluetooth}/qualcomm-bluetooth.yaml   |  6 ++--
 .../bindings/soc/qcom/qcom,wcnss.yaml         |  8 ++---
 4 files changed, 35 insertions(+), 13 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml
 rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)
Documentation/devicetree/bindings/net/bluetooth.txt deleted +0 -5
deleted file mode 100644
index 94797df751b8..000000000000
@@ -1,5 +0,0 @@
-The following properties are common to the Bluetooth controllers:
-
-- local-bd-address: array of 6 bytes, specifies the BD address that was
-  uniquely assigned to the Bluetooth device, formatted with least significant
-  byte first (little-endian).
Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml new file +29 -0
new file mode 100644
index 000000000000..9309dc40f54f
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/bluetooth/bluetooth-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bluetooth Controller Generic Binding
+
+maintainers:
+  - Marcel Holtmann <[email protected]>
+  - Johan Hedberg <[email protected]>
+  - Luiz Augusto von Dentz <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "^bluetooth(@.*)?$"
+
+  local-bd-address:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    maxItems: 6
+    description:
+      Specifies the BD address that was uniquely assigned to the Bluetooth
+      device. Formatted with least significant byte first (little-endian), e.g.
+      in order to assign the address 00:11:22:33:44:55 this property must have
+      the value [55 44 33 22 11 00].
+
+additionalProperties: true
+
+...
Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml renamed from Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml +3 -3
similarity index 96%
rename from Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
rename to Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
index f93c6e7a1b59..a6a6b0e4df7a 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
+$id: http://devicetree.org/schemas/net/bluetooth/qualcomm-bluetooth.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Qualcomm Bluetooth Chips
@@ -79,8 +79,7 @@ properties:
   firmware-name:
     description: specify the name of nvm firmware to load
 
-  local-bd-address:
-    description: see Documentation/devicetree/bindings/net/bluetooth.txt
+  local-bd-address: true
 
 
 required:
@@ -89,6 +88,7 @@ required:
 additionalProperties: false
 
 allOf:
+  - $ref: bluetooth-controller.yaml#
   - if:
       properties:
         compatible:
Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.yaml +3 -5
index 5320504bb5e0..0e6fd57d658d 100644
@@ -42,15 +42,13 @@ properties:
   bluetooth:
     type: object
     additionalProperties: false
+    allOf:
+      - $ref: /schemas/net/bluetooth/bluetooth-controller.yaml#
     properties:
       compatible:
         const: qcom,wcnss-bt
 
-      local-bd-address:
-        $ref: /schemas/types.yaml#/definitions/uint8-array
-        maxItems: 6
-        description:
-          See Documentation/devicetree/bindings/net/bluetooth.txt
+      local-bd-address: true
 
     required:
       - compatible
Signature · 1 line
2.25.1
#2 lore raw

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/project/bluetooth/list/?series=692274

---Test result---

Test Summary:

CheckPatch                    FAIL      7.46 seconds
GitLint                       FAIL      2.01 seconds
SubjectPrefix                 FAIL      2.61 seconds
BuildKernel                   PASS      34.62 seconds
BuildKernel32                 PASS      31.22 seconds
Incremental Build with patchesPASS      151.12 seconds
TestRunner: Setup             PASS      513.16 seconds
TestRunner: l2cap-tester      PASS      17.36 seconds
TestRunner: iso-tester        PASS      16.95 seconds
TestRunner: bnep-tester       PASS      6.66 seconds
TestRunner: mgmt-tester       PASS      107.82 seconds
TestRunner: rfcomm-tester     PASS      10.55 seconds
TestRunner: sco-tester        PASS      9.93 seconds
TestRunner: ioctl-tester      PASS      11.21 seconds
TestRunner: mesh-tester       PASS      8.08 seconds
TestRunner: smp-tester        PASS      9.90 seconds
TestRunner: userchan-tester   PASS      6.88 seconds

Details
##############################
Test: CheckPatch - FAIL - 7.46 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v5,1/7] dt-bindings: net: Add generic Bluetooth controller\WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #115:

 .../{ => bluetooth}/qualcomm-bluetooth.yaml   |  6 ++--

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

total: 0 errors, 3 warnings, 71 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.

/github/workspace/src/13032592.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.

[v5,3/7] arm64: dts: apple: t8103: Add Bluetooth controller\WARNING:UNDOCUMENTED_DT_STRING: DT compatible string vendor "pci14e4" appears un-documented -- check ./Documentation/devicetree/bindings/vendor-prefixes.yaml #210: FILE: arch/arm64/boot/dts/apple/t8103-jxxx.dtsi:83:
+ compatible = "pci14e4,5f69";

total: 0 errors, 1 warnings, 68 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.

/github/workspace/src/13032594.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 - 2.01 seconds
Run gitlint with rule in .gitlint
[v5,1/7] dt-bindings: net: Add generic Bluetooth controller
15: B1 Line exceeds max length (93>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml" 16: B1 Line exceeds max length (91>80): " rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)"

[v5,2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
14: B1 Line exceeds max length (95>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml"

##############################
Test: SubjectPrefix - FAIL - 2.61 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject

---
Regards,
Linux Bluetooth

#3 lore raw

Hi Sven,

Quoted 36 lines · On Fri, Nov 4, 2022 at 3:15 PM <[email protected]> wrote:

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/project/bluetooth/list/?series=692274

---Test result---

Test Summary:

CheckPatch                    FAIL      7.46 seconds
GitLint                       FAIL      2.01 seconds
SubjectPrefix                 FAIL      2.61 seconds
BuildKernel                   PASS      34.62 seconds
BuildKernel32                 PASS      31.22 seconds
Incremental Build with patchesPASS      151.12 seconds
TestRunner: Setup             PASS      513.16 seconds
TestRunner: l2cap-tester      PASS      17.36 seconds
TestRunner: iso-tester        PASS      16.95 seconds
TestRunner: bnep-tester       PASS      6.66 seconds
TestRunner: mgmt-tester       PASS      107.82 seconds
TestRunner: rfcomm-tester     PASS      10.55 seconds
TestRunner: sco-tester        PASS      9.93 seconds
TestRunner: ioctl-tester      PASS      11.21 seconds
TestRunner: mesh-tester       PASS      8.08 seconds
TestRunner: smp-tester        PASS      9.90 seconds
TestRunner: userchan-tester   PASS      6.88 seconds

Details
##############################
Test: CheckPatch - FAIL - 7.46 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v5,1/7] dt-bindings: net: Add generic Bluetooth controller\WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #115:

Quoted 7 lines
 .../{ => bluetooth}/qualcomm-bluetooth.yaml   |  6 ++--

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

total: 0 errors, 3 warnings, 71 lines checked

The other errors you can probably ignore but this one above got my attention, it seems we are doing the right by having the documentation changes as a separate patch but checkpatch is still complaining?

Quoted 52 lines

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/13032592.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.

[v5,3/7] arm64: dts: apple: t8103: Add Bluetooth controller\WARNING:UNDOCUMENTED_DT_STRING: DT compatible string vendor "pci14e4" appears un-documented -- check ./Documentation/devicetree/bindings/vendor-prefixes.yaml #210: FILE: arch/arm64/boot/dts/apple/t8103-jxxx.dtsi:83:
+ compatible = "pci14e4,5f69";

total: 0 errors, 1 warnings, 68 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.

/github/workspace/src/13032594.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 - 2.01 seconds
Run gitlint with rule in .gitlint
[v5,1/7] dt-bindings: net: Add generic Bluetooth controller
15: B1 Line exceeds max length (93>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml" 16: B1 Line exceeds max length (91>80): " rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)"

[v5,2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
14: B1 Line exceeds max length (95>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml"

##############################
Test: SubjectPrefix - FAIL - 2.61 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject

---
Regards,
Linux Bluetooth

Signature · 1 line
Luiz Augusto von Dentz
author
#4 lore raw

Hi Luiz,

Quoted 43 lines · Luiz Augusto von Dentz

Hi Sven,

Quoted 40 lines · On Fri, Nov 4, 2022 at 3:15 PM <[email protected]> wrote:

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/project/bluetooth/list/?series=692274

---Test result---

Test Summary:

CheckPatch                    FAIL      7.46 seconds
GitLint                       FAIL      2.01 seconds
SubjectPrefix                 FAIL      2.61 seconds
BuildKernel                   PASS      34.62 seconds
BuildKernel32                 PASS      31.22 seconds
Incremental Build with patchesPASS      151.12 seconds
TestRunner: Setup             PASS      513.16 seconds
TestRunner: l2cap-tester      PASS      17.36 seconds
TestRunner: iso-tester        PASS      16.95 seconds
TestRunner: bnep-tester       PASS      6.66 seconds
TestRunner: mgmt-tester       PASS      107.82 seconds
TestRunner: rfcomm-tester     PASS      10.55 seconds
TestRunner: sco-tester        PASS      9.93 seconds
TestRunner: ioctl-tester      PASS      11.21 seconds
TestRunner: mesh-tester       PASS      8.08 seconds
TestRunner: smp-tester        PASS      9.90 seconds
TestRunner: userchan-tester   PASS      6.88 seconds

Details
##############################
Test: CheckPatch - FAIL - 7.46 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v5,1/7] dt-bindings: net: Add generic Bluetooth controller\WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #115:

 .../{ => bluetooth}/qualcomm-bluetooth.yaml   |  6 ++--

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

Quoted 7 lines
Quoted 3 lines

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

total: 0 errors, 3 warnings, 71 lines checked

The other errors you can probably ignore but this one above got my attention, it seems we are doing the right by having the documentation changes as a separate patch but checkpatch is still complaining?

I think that one happens because I replace bluetooth.txt with the yml binding and replace all references to bluetooth.txt in the same commit. So technically it looks like I introduce a generic binding and a more specific binding that includes the generic one in a single commit.

I could split that into multiple commits but the DT maintainers seems to be fine with the single commit. They also have their own CI and usually complain if it generates warnings.

Best,

Sven

author
#5 lore raw

PATCH v5 2/7 dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

In reply to Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---
 .../net/bluetooth/brcm,bcm4377-bluetooth.yaml | 81 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml
Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml new file +81 -0
new file mode 100644
index 000000000000..37cb39a3a62e
@@ -0,0 +1,81 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/bluetooth/brcm,bcm4377-bluetooth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM4377 family PCIe Bluetooth Chips
+
+maintainers:
+  - Sven Peter <[email protected]>
+
+description:
+  This binding describes Broadcom BCM4377 family PCIe-attached bluetooth chips
+  usually found in Apple machines. The Wi-Fi part of the chip is described in
+  bindings/net/wireless/brcm,bcm4329-fmac.yaml.
+
+allOf:
+  - $ref: bluetooth-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - pci14e4,5fa0 # BCM4377
+      - pci14e4,5f69 # BCM4378
+      - pci14e4,5f71 # BCM4387
+
+  reg:
+    maxItems: 1
+
+  brcm,board-type:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Board type of the Bluetooth chip. This is used to decouple
+      the overall system board from the Bluetooth module and used to construct
+      firmware and calibration data filenames.
+      On Apple platforms, this should be the Apple module-instance codename
+      prefixed by "apple,", e.g. "apple,atlantisb".
+    pattern: '^apple,.*'
+
+  brcm,taurus-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module does not
+      support beamforming.
+
+  brcm,taurus-bf-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module supports
+      beamforming.
+
+  local-bd-address: true
+
+required:
+  - compatible
+  - reg
+  - local-bd-address
+  - brcm,board-type
+
+additionalProperties: false
+
+examples:
+  - |
+    pcie@a0000000 {
+      #address-cells = <3>;
+      #size-cells = <2>;
+      reg = <0xa0000000 0x1000000>;
+      device_type = "pci";
+      ranges = <0x43000000 0x6 0xa0000000 0xa0000000 0x0 0x20000000>;
+
+      bluetooth@0,1 {
+        compatible = "pci14e4,5f69";
+        reg = <0x100 0x0 0x0 0x0 0x0>;
+        brcm,board-type = "apple,honshu";
+        /* To be filled by the bootloader */
+        local-bd-address = [00 00 00 00 00 00];
+      };
+    };
MAINTAINERS +1 -0
index cf0f18502372..ca45551220f5 100644
@@ -1903,6 +1903,7 @@ F:	Documentation/devicetree/bindings/interrupt-controller/apple,*
 F:	Documentation/devicetree/bindings/iommu/apple,dart.yaml
 F:	Documentation/devicetree/bindings/iommu/apple,sart.yaml
 F:	Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
+F:	Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml
 F:	Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml
 F:	Documentation/devicetree/bindings/nvmem/apple,efuses.yaml
 F:	Documentation/devicetree/bindings/pci/apple,pcie.yaml
Signature · 1 line
2.25.1
author
#6 lore raw

PATCH v5 3/7 arm64: dts: apple: t8103: Add Bluetooth controller

In reply to Sven Peter

Add bluetooth controller nodes and the required brcm,board-type properties to be able to select the correct firmware to all board device trees.

---
 arch/arm64/boot/dts/apple/t8103-j274.dts  | 4 ++++
 arch/arm64/boot/dts/apple/t8103-j293.dts  | 4 ++++
 arch/arm64/boot/dts/apple/t8103-j313.dts  | 4 ++++
 arch/arm64/boot/dts/apple/t8103-j456.dts  | 4 ++++
 arch/arm64/boot/dts/apple/t8103-j457.dts  | 4 ++++
 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 8 ++++++++
 6 files changed, 28 insertions(+)
arch/arm64/boot/dts/apple/t8103-j274.dts +4 -0
index c1f3ba9c39f6..b52ddc409893 100644
@@ -21,6 +21,10 @@ aliases {
 	};
 };
 
+&bluetooth0 {
+	brcm,board-type = "apple,atlantisb";
+};
+
 &wifi0 {
 	brcm,board-type = "apple,atlantisb";
 };
arch/arm64/boot/dts/apple/t8103-j293.dts +4 -0
index ecb10d237a05..151074109a11 100644
@@ -17,6 +17,10 @@ / {
 	model = "Apple MacBook Pro (13-inch, M1, 2020)";
 };
 
+&bluetooth0 {
+	brcm,board-type = "apple,honshu";
+};
+
 &wifi0 {
 	brcm,board-type = "apple,honshu";
 };
arch/arm64/boot/dts/apple/t8103-j313.dts +4 -0
index df741737b8e6..bc1f865aa790 100644
@@ -17,6 +17,10 @@ / {
 	model = "Apple MacBook Air (M1, 2020)";
 };
 
+&bluetooth0 {
+	brcm,board-type = "apple,shikoku";
+};
+
 &wifi0 {
 	brcm,board-type = "apple,shikoku";
 };
arch/arm64/boot/dts/apple/t8103-j456.dts +4 -0
index 8c6bf9592510..7ea27456f33c 100644
@@ -21,6 +21,10 @@ aliases {
 	};
 };
 
+&bluetooth0 {
+	brcm,board-type = "apple,capri";
+};
+
 &wifi0 {
 	brcm,board-type = "apple,capri";
 };
arch/arm64/boot/dts/apple/t8103-j457.dts +4 -0
index fe7c0aaf7d62..8ee0ac871426 100644
@@ -21,6 +21,10 @@ aliases {
 	};
 };
 
+&bluetooth0 {
+	brcm,board-type = "apple,santorini";
+};
+
 &wifi0 {
 	brcm,board-type = "apple,santorini";
 };
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi +8 -0
index 3d15b8e2a6c1..cc2e04035763 100644
@@ -11,6 +11,7 @@
 
 / {
 	aliases {
+		bluetooth0 = &bluetooth0;
 		serial0 = &serial0;
 		serial2 = &serial2;
 		wifi0 = &wifi0;
@@ -77,4 +78,11 @@ wifi0: network@0,0 {
 		local-mac-address = [00 00 00 00 00 00];
 		apple,antenna-sku = "XX";
 	};
+
+	bluetooth0: bluetooth@0,1 {
+		compatible = "pci14e4,5f69";
+		reg = <0x10100 0x0 0x0 0x0 0x0>;
+		/* To be filled by the loader */
+		local-bd-address = [00 00 00 00 00 00];
+	};
 };
Signature · 1 line
2.25.1
author
#7 lore raw

PATCH v5 4/7 Bluetooth: hci_event: Ignore reserved bits in LE Extended Adv Report

In reply to Sven Peter

Broadcom controllers present on Apple Silicon devices use the upper 8 bits of the event type in the LE Extended Advertising Report for the channel on which the frame has been received.
These bits are reserved according to the Bluetooth spec anyway such that we can just drop them to ensure that the advertising results are parsed correctly.

The following excerpt from a btmon trace shows a report received on channel 37 by these controllers:

Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 55

      LE Extended Advertising Report (0x0d)
        Num reports: 1
        Entry 0
          Event type: 0x2513
            Props: 0x0013
              Connectable
              Scannable
              Use legacy advertising PDUs
            Data status: Complete
            Reserved (0x2500)
          Legacy PDU Type: Reserved (0x2513)
          Address type: Public (0x00)
          Address: XX:XX:XX:XX:XX:XX (Shenzhen Jingxun Software [...])
          Primary PHY: LE 1M
          Secondary PHY: No packets
          SID: no ADI field (0xff)
          TX power: 127 dBm
          RSSI: -76 dBm (0xb4)
          Periodic advertising interval: 0.00 msec (0x0000)
          Direct address type: Public (0x00)
          Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
          Data length: 0x1d
          [...]
        Flags: 0x18
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Harman International Industries, Inc. (87)
          Data: [...]
        Service Data (UUID 0xfddf):
        Name (complete): JBL Flip 5
---
 include/net/bluetooth/hci.h | 1 +
 net/bluetooth/hci_event.c   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +1 -0
index e004ba04a9ae..f4aa7b78a844 100644
@@ -2580,6 +2580,7 @@ struct hci_ev_le_conn_complete {
 #define LE_EXT_ADV_DIRECT_IND		0x0004
 #define LE_EXT_ADV_SCAN_RSP		0x0008
 #define LE_EXT_ADV_LEGACY_PDU		0x0010
+#define LE_EXT_ADV_EVT_TYPE_MASK	0x007f
 
 #define ADDR_LE_DEV_PUBLIC		0x00
 #define ADDR_LE_DEV_RANDOM		0x01
net/bluetooth/hci_event.c +1 -1
index faca701bce2a..ade2628aae0d 100644
@@ -6494,7 +6494,7 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data,
 					info->length))
 			break;
 
-		evt_type = __le16_to_cpu(info->type);
+		evt_type = __le16_to_cpu(info->type) & LE_EXT_ADV_EVT_TYPE_MASK;
 		legacy_evt_type = ext_evt_type_to_legacy(hdev, evt_type);
 		if (legacy_evt_type != LE_ADV_INVALID) {
 			process_adv_report(hdev, legacy_evt_type, &info->bdaddr,
Signature · 1 line
2.25.1
author
#8 lore raw

PATCH v5 5/7 Bluetooth: Add quirk to disable extended scanning

In reply to Sven Peter

Broadcom 4377 controllers found in Apple x86 Macs with the T2 chip claim to support extended scanning when querying supported states,

< HCI Command: LE Read Supported St.. (0x08|0x001c) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 12

      LE Read Supported States (0x08|0x001c) ncmd 1
        Status: Success (0x00)
        States: 0x000003ffffffffff

[...]
LE Set Extended Scan Parameters (Octet 37 - Bit 5) LE Set Extended Scan Enable (Octet 37 - Bit 6)
[...]

, but then fail to actually implement the extended scanning:

< HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8

        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
        PHYs: 0x01
        Entry 0: LE 1M
          Type: Active (0x01)
          Interval: 11.250 msec (0x0012)
          Window: 11.250 msec (0x0012)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
        Status: Unknown HCI Command (0x01)
---
 include/net/bluetooth/hci.h      | 10 ++++++++++
 include/net/bluetooth/hci_core.h |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +10 -0
index f4aa7b78a844..8cd89948f961 100644
@@ -263,6 +263,16 @@ enum {
 	 * during the hdev->setup vendor callback.
 	 */
 	HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN,
+
+	/*
+	 * When this quirk is set, the HCI_OP_LE_SET_EXT_SCAN_ENABLE command is
+	 * disabled. This is required for some Broadcom controllers which
+	 * erroneously claim to support extended scanning.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_EXT_SCAN,
 };
 
 /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index c54bc71254af..3cd00be0fcd2 100644
@@ -1689,7 +1689,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 
 /* Use ext scanning if set ext scan param and ext scan enable is supported */
 #define use_ext_scan(dev) (((dev)->commands[37] & 0x20) && \
-			   ((dev)->commands[37] & 0x40))
+			   ((dev)->commands[37] & 0x40) && \
+			   !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks))
+
 /* Use ext create connection if command is supported */
 #define use_ext_conn(dev) ((dev)->commands[37] & 0x80)
 
Signature · 1 line
2.25.1
author
#9 lore raw

PATCH v5 6/7 Bluetooth: Add quirk to disable MWS Transport Configuration

In reply to Sven Peter

Broadcom 4378/4387 controllers found in Apple Silicon Macs claim to support getting MWS Transport Layer Configuration,

< HCI Command: Read Local Supported... (0x04|0x0002) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 68

      Read Local Supported Commands (0x04|0x0002) ncmd 1
        Status: Success (0x00)

[...]
Get MWS Transport Layer Configuration (Octet 30 - Bit 3)]
[...]

, but then don't actually allow the required command:

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 15

      Get MWS Transport Layer Configuration (0x05|0x000c) ncmd 1
        Status: Command Disallowed (0x0c)
        Number of transports: 0
        Baud rate list: 0 entries
        00 00 00 00 00 00 00 00 00 00
---
 include/net/bluetooth/hci.h      | 10 ++++++++++
 include/net/bluetooth/hci_core.h |  3 +++
 net/bluetooth/hci_sync.c         |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +10 -0
index 8cd89948f961..110d6df1299b 100644
@@ -273,6 +273,16 @@ enum {
 	 * during the hdev->setup vendor callback.
 	 */
 	HCI_QUIRK_BROKEN_EXT_SCAN,
+
+	/*
+	 * When this quirk is set, the HCI_OP_GET_MWS_TRANSPORT_CONFIG command is
+	 * disabled. This is required for some Broadcom controllers which
+	 * erroneously claim to support MWS Transport Layer Configuration.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG,
 };
 
 /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -0
index 3cd00be0fcd2..7f585e5dd71b 100644
@@ -1719,6 +1719,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 	((dev)->le_features[3] & HCI_LE_CIS_PERIPHERAL)
 #define bis_capable(dev) ((dev)->le_features[3] & HCI_LE_ISO_BROADCASTER)
 
+#define mws_transport_config_capable(dev) (((dev)->commands[30] & 0x08) && \
+	(!test_bit(HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, &(dev)->quirks)))
+
 /* ----- HCI protocols ----- */
 #define HCI_PROTO_DEFER             0x01
 
net/bluetooth/hci_sync.c +1 -1
index 76c3107c9f91..d8e9eae17083 100644
@@ -4258,7 +4258,7 @@ static int hci_read_local_pairing_opts_sync(struct hci_dev *hdev)
 /* Get MWS transport configuration if the HCI command is supported */
 static int hci_get_mws_transport_config_sync(struct hci_dev *hdev)
 {
-	if (!(hdev->commands[30] & 0x08))
+	if (!mws_transport_config_capable(hdev))
 		return 0;
 
 	return __hci_cmd_sync_status(hdev, HCI_OP_GET_MWS_TRANSPORT_CONFIG,
Signature · 1 line
2.25.1
author
#10 lore raw

PATCH v5 7/7 Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards

In reply to Sven Peter

Broadcom BCM4377/4378/4387 are dual WiFi/Bluetooth boards found in Apple machines. This driver adds support for the Bluetooth function which exposes a shared memory IPC protocol over PCIe to tunnel HCI traffic.

---
 MAINTAINERS                     |    1 +
 drivers/bluetooth/Kconfig       |   12 +
 drivers/bluetooth/Makefile      |    1 +
 drivers/bluetooth/hci_bcm4377.c | 2514 +++++++++++++++++++++++++++++++
 4 files changed, 2528 insertions(+)
 create mode 100644 drivers/bluetooth/hci_bcm4377.c
MAINTAINERS +1 -0
index ca45551220f5..82828ef36f85 100644
@@ -1911,6 +1911,7 @@ F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
 F:	Documentation/devicetree/bindings/power/apple*
 F:	Documentation/devicetree/bindings/watchdog/apple,wdt.yaml
 F:	arch/arm64/boot/dts/apple/
+F:	drivers/bluetooth/hci_bcm4377.c
 F:	drivers/clk/clk-apple-nco.c
 F:	drivers/dma/apple-admac.c
 F:	drivers/i2c/busses/i2c-pasemi-core.c
drivers/bluetooth/Kconfig +12 -0
index e30707405455..71732e51516f 100644
@@ -274,6 +274,18 @@ config BT_HCIBCM203X
 	  Say Y here to compile support for HCI BCM203x devices into the
 	  kernel or say M to compile it as module (bcm203x).
 
+
+config BT_HCIBCM4377
+	tristate "HCI BCM4377/4378/4387 PCIe driver"
+	depends on PCI
+	select FW_LOADER
+	help
+	  Support for Broadcom BCM4377/4378/4387 Bluetooth chipsets attached via
+	  PCIe. These are usually found in Apple machines.
+
+	  Say Y here to compile support for HCI BCM4377 family devices into the
+	  kernel or say M to compile it as module (hci_bcm4377).
+
 config BT_HCIBPA10X
 	tristate "HCI BPA10x USB driver"
 	depends on USB
drivers/bluetooth/Makefile +1 -0
index 3321a8aea4a0..e0b261f24fc9 100644
@@ -6,6 +6,7 @@
 obj-$(CONFIG_BT_HCIVHCI)	+= hci_vhci.o
 obj-$(CONFIG_BT_HCIUART)	+= hci_uart.o
 obj-$(CONFIG_BT_HCIBCM203X)	+= bcm203x.o
+obj-$(CONFIG_BT_HCIBCM4377)	+= hci_bcm4377.o
 obj-$(CONFIG_BT_HCIBPA10X)	+= bpa10x.o
 obj-$(CONFIG_BT_HCIBFUSB)	+= bfusb.o
 obj-$(CONFIG_BT_HCIDTL1)	+= dtl1_cs.o
drivers/bluetooth/hci_bcm4377.c new file +2514 -0

2,514 lines not on this page · raw message

Signature · 1 line
2.25.1
#11 lore raw
In reply to Sven Peter
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Fri, 4 Nov 2022 22:12:56 +0100 you wrote:

Hi,

v1: https://lore.kernel.org/asahi/[email protected]/
v2: https://lore.kernel.org/asahi/[email protected]/
v3: https://lore.kernel.org/asahi/[email protected]/
v4: https://lore.kernel.org/asahi/[email protected]/

[...]

Here is the summary with links:
- [v5,1/7] dt-bindings: net: Add generic Bluetooth controller

    https://git.kernel.org/bluetooth/bluetooth-next/c/dea8565cb4a6
  - [v5,2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
    https://git.kernel.org/bluetooth/bluetooth-next/c/f29c81596cd9
  - [v5,3/7] arm64: dts: apple: t8103: Add Bluetooth controller
    https://git.kernel.org/bluetooth/bluetooth-next/c/58092596a45f
  - [v5,4/7] Bluetooth: hci_event: Ignore reserved bits in LE Extended Adv Report
    https://git.kernel.org/bluetooth/bluetooth-next/c/7e551e41a298
  - [v5,5/7] Bluetooth: Add quirk to disable extended scanning
    https://git.kernel.org/bluetooth/bluetooth-next/c/612a79830bed
  - [v5,6/7] Bluetooth: Add quirk to disable MWS Transport Configuration
    https://git.kernel.org/bluetooth/bluetooth-next/c/d73a5e165e2e

- [v5,7/7] Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards
https://git.kernel.org/bluetooth/bluetooth-next/c/ab80b2cec05f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html