Skip to contentSkip to conversation

mailbox: Add support for bcm74110 mailbox

PATCH Superseded Justin Chen 2 participants 4 messages Apr 2, 2025 – Apr 3, 2025

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover mailbox: Add support for bcm74110 mailbox

The bcm74110 mailbox driver is used to communicate with a co-processor for various power management and firmware related tasks.

Justin Chen (2):
dt-bindings: mailbox: Add devicetree binding for bcm74110 mbox
mailbox: Add support for bcm74110 mailbox

 .../bindings/mailbox/brcm,bcm74110-mbox.yaml  |  70 ++
 drivers/mailbox/Kconfig                       |  10 +
 drivers/mailbox/Makefile                      |   2 +
 drivers/mailbox/bcm74110-mailbox.c            | 655 ++++++++++++++++++
 4 files changed, 737 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml
 create mode 100644 drivers/mailbox/bcm74110-mailbox.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 dt-bindings: mailbox: Add devicetree binding for bcm74110 mbox

Add devicetree YAML binding for brcmstb bcm74110 mailbox used for communicating with a co-processor.

---
v2
Renamed brcm,brcm_{tx|rx} to brcm,{tx|rx}. Removed brcm,shmem node. Not necessary to keep in dt. Fixed example and added scmi node.

 .../bindings/mailbox/brcm,bcm74110-mbox.yaml  | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +70 -0
new file mode 100644
index 000000000000..8c3dfffa515f
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/brcm,bcm74110-mbox.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM74110 Mailbox
+
+maintainers:
+  - Justin Chen <[email protected]>
+  - Florian Fainelli <[email protected]>
+
+description: Broadcom mailbox hardware first introduced with 74110
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm74110-mbox
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 2
+
+  "#mbox-cells":
+    const: 2
+    description:
+      The first cell is channel type and second cell is shared memory slot
+
+  brcm,tx:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Mailbox transmit doorbell
+
+  brcm,rx:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Mailbox receive doorbell
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#mbox-cells"
+  - brcm,tx
+  - brcm,rx
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    brcm_mailbox: brcm_mailbox@a552000 {
+        #mbox-cells = <0x2>;
+        brcm,rx = <0x7>;
+        brcm,tx = <0x6>;
+        compatible = "brcm,bcm74110-mbox";
+        reg = <0xa552000 0x1104>;
+        interrupts = <0x0 0x67 0x4>, /* DQM 7 */
+                     <0x0 0x66 0x4>; /* DQM 6 */
+    };
+
+    scmi {
+        compatible = "arm,scmi";
+        mboxes = <&brcm_mailbox 0x2 0x0>;
+        mbox-names = "tx";
+        shmem = <&PMCMBOX>;
+        #address-cells = <0x1>;
+        #size-cells = <0x0>;
+    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: mailbox: Add devicetree binding for bcm74110 mbox

Quoted 6 lines · Justin Chen
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +0 -0
new file mode 100644
index 000000000000..8c3dfffa515f

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +8 -0
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/brcm,bcm74110-mbox.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM74110 Mailbox
+

A nit, subject: drop second/last, redundant "devicetree binding for". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

Quoted 6 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +6 -0
+maintainers:
+  - Justin Chen <[email protected]>
+  - Florian Fainelli <[email protected]>
+
+description: Broadcom mailbox hardware first introduced with 74110
+

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +10 -0
+properties:
+  compatible:
+    enum:
+      - brcm,bcm74110-mbox
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 2

This changed... You need now list items instead.

Quoted 17 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +17 -0
+
+  "#mbox-cells":
+    const: 2
+    description:
+      The first cell is channel type and second cell is shared memory slot
+
+  brcm,tx:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Mailbox transmit doorbell
+
+  brcm,rx:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Mailbox receive doorbell
+
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 51

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +10 -0
+  - interrupts
+  - "#mbox-cells"
+  - brcm,tx
+  - brcm,rx
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>

... and where do you use it?

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 53

Quoted 2 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +2 -0
+
+    brcm_mailbox: brcm_mailbox@a552000 {

Only partially improved.

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 57

Quoted 4 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +4 -0
+        #mbox-cells = <0x2>;
+        brcm,rx = <0x7>;
+        brcm,tx = <0x6>;
+        compatible = "brcm,bcm74110-mbox";

Nothing improved. Didi you read the DTS coding style?

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 60

Quoted 3 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +3 -0
+        reg = <0xa552000 0x1104>;
+        interrupts = <0x0 0x67 0x4>, /* DQM 7 */
+                     <0x0 0x66 0x4>; /* DQM 6 */

Looks like standard flags, so use proper defines.

Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml line 63

Quoted 3 lines
Documentation/devicetree/bindings/mailbox/brcm,bcm74110-mbox.yaml new file +3 -0
+    };
+
+    scmi {

Drop the node, not related.

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/2 mailbox: Add support for bcm74110 mailbox

In reply to Justin Chen

The bcm74110 mailbox driver is used to communicate with a co-processor for various power management and firmware related tasks.

---
v2
Fixed minor formatting issues
Fixed error check of platform_get_irq()
Removed offsetted base iomem vars. Instead we just offset directly from base.
Removed shmem variable. Hardcode it instead.

 drivers/mailbox/Kconfig            |  10 +
 drivers/mailbox/Makefile           |   2 +
 drivers/mailbox/bcm74110-mailbox.c | 655 +++++++++++++++++++++++++++++
 3 files changed, 667 insertions(+)
 create mode 100644 drivers/mailbox/bcm74110-mailbox.c
drivers/mailbox/Kconfig +10 -0
index ed52db272f4d..6fe3356ddde5 100644
@@ -330,4 +330,14 @@ config THEAD_TH1520_MBOX
 	  kernel is running, and E902 core used for power management among other
 	  things.
 
+config BCM74110_MAILBOX
+	tristate "Brcmstb BCM74110 Mailbox"
+	depends on ARCH_BRCMSTB || COMPILE_TEST
+	default ARCH_BRCMSTB
+	help
+	  Broadcom STB mailbox driver present starting with brcmstb bcm74110
+	  SoCs. The mailbox is a communication channel between the host
+	  processor and coprocessor that handles various power management task
+	  and more.
+
 endif
drivers/mailbox/Makefile +2 -0
index 9a1542b55539..eb2e8f55bd15 100644
@@ -70,3 +70,5 @@ obj-$(CONFIG_QCOM_CPUCP_MBOX)	+= qcom-cpucp-mbox.o
 obj-$(CONFIG_QCOM_IPCC)		+= qcom-ipcc.o
 
 obj-$(CONFIG_THEAD_TH1520_MBOX)	+= mailbox-th1520.o
+
+obj-$(CONFIG_BCM74110_MAILBOX)	+= bcm74110-mailbox.o
drivers/mailbox/bcm74110-mailbox.c new file +655 -0

655 lines not on this page · raw message

Signature · 1 line
2.34.1