Skip to contentSkip to conversation

mailbox: Add Broadcom STB mailbox driver for SCMI

PATCH In review Jim Quinlan 3 participants 10 messages Oct 29, 2020 – Nov 5, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover mailbox: Add Broadcom STB mailbox driver for SCMI

Patchset Summary:
Adds a simple mailbox driver for the use of the ARM SCMI drivers.

v4:
Commit "mailbox: Add Broadcom STB mailbox driver" -- Fixed indentation on Kconfig file (again, RandyD). -- Removed superfluous #ifdefs for ARM/ARM64 (RandyD). -- Fixed Copyright year on source file (RandyD).

v3:
Commit "mailbox: Add Broadcom STB mailbox driver" -- Fixed indentation on Kconfig file (RandyD).

v2:
Commit "mailbox: Add Broadcom STB mailbox driver" -- Remove the Kconfig dependency on SMP (Florian) Commit "mailbox: Add Broadcom STB mailbox driver" -- Drop label,unit address; changed title,description (RobH)

v1:
-- Original submission.

Jim Quinlan (2):
dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver
mailbox: Add Broadcom STB mailbox driver

 .../bindings/mailbox/brcm,brcmstb-mbox.yaml   |  39 ++++
 drivers/mailbox/Kconfig                       |  12 ++
 drivers/mailbox/Makefile                      |   2 +
 drivers/mailbox/brcmstb-mailbox.c             | 167 ++++++++++++++++++
 4 files changed, 220 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml
 create mode 100644 drivers/mailbox/brcmstb-mailbox.c
Signature · 1 line
2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#1 lore raw

PATCH v4 1/2 dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

---
 .../bindings/mailbox/brcm,brcmstb-mbox.yaml   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml
Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml new file +39 -0
new file mode 100644
index 000000000000..797c0cc609a3
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+$id: http://devicetree.org/schemas/mailbox/brcm,brcmstb-mbox.yaml#
+
+title: Broadcom STB mailbox driver bindings
+
+maintainers:
+  - Jim Quinlan <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,brcmstb-mbox
+
+  interrupts:
+    items:
+      - description: a2p return interrupt, indicates SCMI msg completion.
+
+  "#mbox-cells":
+    const: 1
+
+required:
+  - compatible
+  - interrupts
+  - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    mailbox {
+      compatible = "brcm,brcmstb-mailbox";
+      #mbox-cells = <1>;
+      interrupts = <GIC_SPI 0xc6 IRQ_TYPE_LEVEL_HIGH>;
+    };
+...
Signature · 1 line
2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#2 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Quoted 55 lines
---
 .../bindings/mailbox/brcm,brcmstb-mbox.yaml   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml
Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml new file +39 -0
new file mode 100644
index 000000000000..797c0cc609a3
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+$id: http://devicetree.org/schemas/mailbox/brcm,brcmstb-mbox.yaml#
+
+title: Broadcom STB mailbox driver bindings
+
+maintainers:
+  - Jim Quinlan <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,brcmstb-mbox
+
+  interrupts:
+    items:
+      - description: a2p return interrupt, indicates SCMI msg completion.
+
+  "#mbox-cells":
+    const: 1
+
+required:
+  - compatible
+  - interrupts
+  - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    mailbox {
+      compatible = "brcm,brcmstb-mailbox";
+      #mbox-cells = <1>;
+      interrupts = <GIC_SPI 0xc6 IRQ_TYPE_LEVEL_HIGH>;
+    };
+...
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 7 lines · Rob Herring
Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Hi Rob,

I'm not sure where I am implying that SCMI is a mailbox provider? Should I not mention "SCMI" in the subject line?

This is just a mailbox driver, "consumed" by SCMI. Our SCMI DT node
looks like this:

brcm_scmi_mailbox: brcm_scmi_mailbox@0 {
        #mbox-cells = <1>;
        compatible = "brcm,brcmstb-mbox";
};
brcm_scmi@0 {
        compatible = "arm,scmi";
        mboxes = <&brcm_scmi_mailbox 0>;;
        mbox-names = "tx";
        shmem = <&NWMBOX>;
        /* ... */
};

Please advise,
Jim Quinlan
Broadcom STB

Quoted 58 lines
Quoted 56 lines
---
 .../bindings/mailbox/brcm,brcmstb-mbox.yaml   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml
Documentation/devicetree/bindings/mailbox/brcm,brcmstb-mbox.yaml new file +39 -1
new file mode 100644
index 000000000000..797c0cc609a3
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+$id: http://devicetree.org/schemas/mailbox/brcm,brcmstb-mbox.yaml#
+
+title: Broadcom STB mailbox driver bindings
+
+maintainers:
+  - Jim Quinlan <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,brcmstb-mbox
+
+  interrupts:
+    items:
+      - description: a2p return interrupt, indicates SCMI msg completion.
+
+  "#mbox-cells":
+    const: 1
+
+required:
+  - compatible
+  - interrupts
+  - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    mailbox {
+      compatible = "brcm,brcmstb-mailbox";
+      #mbox-cells = <1>;
+      interrupts = <GIC_SPI 0xc6 IRQ_TYPE_LEVEL_HIGH>;
+    };
+...
--

2.17.1

maintainer
#4 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 23 lines · Jim Quinlan
Quoted 7 lines · Rob Herring
Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Hi Rob,

I'm not sure where I am implying that SCMI is a mailbox provider? Should I not mention "SCMI" in the subject line?

This is just a mailbox driver, "consumed" by SCMI. Our SCMI DT node
looks like this:

brcm_scmi_mailbox: brcm_scmi_mailbox@0 {
        #mbox-cells = <1>;
        compatible = "brcm,brcmstb-mbox";
};
Quoted 7 lines
brcm_scmi@0 {
        compatible = "arm,scmi";
        mboxes = <&brcm_scmi_mailbox 0>;;
        mbox-names = "tx";
        shmem = <&NWMBOX>;
        /* ... */
};

Okay, that makes more sense. Though it seems like this is just adding a pointless level of indirection to turn an interrupt into a mailbox. There's nothing more to 'the mailbox' is there? So why not either allow SCMI to have an interrupt directly or have a generic irq mailbox driver?

Rob

#5 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 33 lines · Rob Herring
Quoted 23 lines · Jim Quinlan
Quoted 7 lines · Rob Herring
Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Hi Rob,

I'm not sure where I am implying that SCMI is a mailbox provider? Should I not mention "SCMI" in the subject line?

This is just a mailbox driver, "consumed" by SCMI. Our SCMI DT node
looks like this:

brcm_scmi_mailbox: brcm_scmi_mailbox@0 {
        #mbox-cells = <1>;
        compatible = "brcm,brcmstb-mbox";
};
Quoted 7 lines
brcm_scmi@0 {
        compatible = "arm,scmi";
        mboxes = <&brcm_scmi_mailbox 0>;;
        mbox-names = "tx";
        shmem = <&NWMBOX>;
        /* ... */
};
Quoted 3 lines

Okay, that makes more sense. Though it seems like this is just adding a pointless level of indirection to turn an interrupt into a mailbox. There's nothing more to 'the mailbox' is there?

Correct. Although you can see that it uses both interrupts and SMC calls to get the job done.

Quoted 2 lines

So why not either
allow SCMI to have an interrupt directly

Not sure here -- perhaps the SCMI folks have an answer?

Quoted 2 lines

or have a generic irq mailbox
driver?

The SCMI implementation doesn't offer a generic irq mailbox driver AFAICT. The SCMI folks recently provided an "smc transport" driver in "drivers/firmware/arm_scmi/smc.c" -- it is close to what we need but is missing interrupts.

Regards,
Jim Quinlan
Broadcom STB

Quoted 2 lines

Rob

#6 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 34 lines · Jim Quinlan
Quoted 33 lines · Rob Herring
Quoted 30 lines · Jim Quinlan
Quoted 7 lines · Rob Herring
Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Hi Rob,

I'm not sure where I am implying that SCMI is a mailbox provider? Should I not mention "SCMI" in the subject line?

This is just a mailbox driver, "consumed" by SCMI. Our SCMI DT node
looks like this:

brcm_scmi_mailbox: brcm_scmi_mailbox@0 {
        #mbox-cells = <1>;
        compatible = "brcm,brcmstb-mbox";
};
brcm_scmi@0 {
        compatible = "arm,scmi";
        mboxes = <&brcm_scmi_mailbox 0>;;
        mbox-names = "tx";
        shmem = <&NWMBOX>;
        /* ... */
};
Quoted 7 lines
Quoted 3 lines

Okay, that makes more sense. Though it seems like this is just adding a pointless level of indirection to turn an interrupt into a mailbox. There's nothing more to 'the mailbox' is there?

Correct. Although you can see that it uses both interrupts and SMC calls to get the job done.

I was against having 2 separate solutions and would have raised my concern again. As I mentioned earlier, either extend what we have or move the existing SMC solution into this mailbox driver. Having 2 different solution for this just because you have extra interrupt to deal with is definite NACK from me as I had previously mentioned.

Quoted 4 lines
Quoted 2 lines

So why not either
allow SCMI to have an interrupt directly

Not sure here -- perhaps the SCMI folks have an answer?

I did ask why can't you extend the existing SCMI/SMC binding to add this as optional feature ?

Quoted 1 line
Quoted 1 line

or have a generic irq mailbox driver?

Fine with this too.

Quoted 4 lines

The SCMI implementation doesn't offer a generic irq mailbox driver AFAICT. The SCMI folks recently provided an "smc transport" driver in "drivers/firmware/arm_scmi/smc.c" -- it is close to what we need but is missing interrupts.

IIRC, you were using SGIs and it can't be represented and use today as is ? Am I missing something or anything has changed ?

--
Regards,
Sudeep

#7 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 50 lines · Sudeep Holla
Quoted 34 lines · Jim Quinlan
Quoted 33 lines · Rob Herring
Quoted 30 lines · Jim Quinlan
Quoted 7 lines · Rob Herring
Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Hi Rob,

I'm not sure where I am implying that SCMI is a mailbox provider? Should I not mention "SCMI" in the subject line?

This is just a mailbox driver, "consumed" by SCMI. Our SCMI DT node
looks like this:

brcm_scmi_mailbox: brcm_scmi_mailbox@0 {
        #mbox-cells = <1>;
        compatible = "brcm,brcmstb-mbox";
};
brcm_scmi@0 {
        compatible = "arm,scmi";
        mboxes = <&brcm_scmi_mailbox 0>;;
        mbox-names = "tx";
        shmem = <&NWMBOX>;
        /* ... */
};
Quoted 7 lines
Quoted 3 lines

Okay, that makes more sense. Though it seems like this is just adding a pointless level of indirection to turn an interrupt into a mailbox. There's nothing more to 'the mailbox' is there?

Correct. Although you can see that it uses both interrupts and SMC calls to get the job done.

I was against having 2 separate solutions and would have raised my concern again. As I mentioned earlier, either extend what we have or move the existing SMC solution into this mailbox driver. Having 2 different solution for this just because you have extra interrupt to deal with is definite NACK from me as I had previously mentioned.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

So why not either
allow SCMI to have an interrupt directly

Not sure here -- perhaps the SCMI folks have an answer?

I did ask why can't you extend the existing SCMI/SMC binding to add this as optional feature ?

Hi Sudeep,

Looking at the email you said, "In that case any reason why you can't reuse the existing smc transport for SCMI." , and I replied with the reason. I did not interpret your statement above as what you are clearly saying now: "either extend what we have or move the existing SMC solution into this mailbox driver. "

Fair enough, I will look into this.

Regards,
Jim

Quoted 16 lines
Quoted 2 lines
Quoted 2 lines

or have a generic irq mailbox driver?

Fine with this too.

Quoted 4 lines

The SCMI implementation doesn't offer a generic irq mailbox driver AFAICT. The SCMI folks recently provided an "smc transport" driver in "drivers/firmware/arm_scmi/smc.c" -- it is close to what we need but is missing interrupts.

IIRC, you were using SGIs and it can't be represented and use today as is ? Am I missing something or anything has changed ?

--
Regards,
Sudeep

#8 lore raw

Re: [PATCH v4 1/2] dt-bindings: Add bindings for BrcmSTB SCMI mailbox driver

Quoted 58 lines · Jim Quinlan
Quoted 50 lines · Sudeep Holla
Quoted 34 lines · Jim Quinlan
Quoted 33 lines · Rob Herring
Quoted 30 lines · Jim Quinlan
Quoted 7 lines · Rob Herring
Quoted 2 lines · Jim Quinlan

Bindings are added. Only one interrupt is needed because we do not yet employ the SCMI p2a channel.

I still don't understand what this is. To repeat from v1: I thought SCMI was a mailbox consumer, not provider?

Hi Rob,

I'm not sure where I am implying that SCMI is a mailbox provider? Should I not mention "SCMI" in the subject line?

This is just a mailbox driver, "consumed" by SCMI. Our SCMI DT node
looks like this:

brcm_scmi_mailbox: brcm_scmi_mailbox@0 {
        #mbox-cells = <1>;
        compatible = "brcm,brcmstb-mbox";
};
brcm_scmi@0 {
        compatible = "arm,scmi";
        mboxes = <&brcm_scmi_mailbox 0>;;
        mbox-names = "tx";
        shmem = <&NWMBOX>;
        /* ... */
};
Quoted 7 lines
Quoted 3 lines

Okay, that makes more sense. Though it seems like this is just adding a pointless level of indirection to turn an interrupt into a mailbox. There's nothing more to 'the mailbox' is there?

Correct. Although you can see that it uses both interrupts and SMC calls to get the job done.

I was against having 2 separate solutions and would have raised my concern again. As I mentioned earlier, either extend what we have or move the existing SMC solution into this mailbox driver. Having 2 different solution for this just because you have extra interrupt to deal with is definite NACK from me as I had previously mentioned.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

So why not either
allow SCMI to have an interrupt directly

Not sure here -- perhaps the SCMI folks have an answer?

I did ask why can't you extend the existing SCMI/SMC binding to add this as optional feature ?

Quoted 8 lines

Hi Sudeep,

Looking at the email you said, "In that case any reason why you can't reuse the existing smc transport for SCMI." , and I replied with the reason. I did not interpret your statement above as what you are clearly saying now: "either extend what we have or move the existing SMC solution into this mailbox driver. "

No, you are right. I didn't mention that explicitly. I wanted to, but thought I will wait until this driver got traction to ask you to merge them. Sorry for that. Anyways I am against having existing solution and a mailbox for SMC, they need to be merged at any cost. Where the final solution will be doesn't matter much to me, I am fine either way.

--
Regards,
Sudeep

#9 lore raw

PATCH v4 2/2 mailbox: Add Broadcom STB mailbox driver

In reply to Jim Quinlan

This is a simple mailbox driver to be used by the SCMI protocol stack. It only implements the agent-to-platform channel; we may implement the platform-to-agent channel in the future. An unusual aspect of this driver is how the completion of an SCMI message is indicated. An SCMI message is initiated with an ARM SMC call, but the return of this call does not indicate the execution or completion of the message. Rather, the message's completion is signaled by an interrupt.

---
 drivers/mailbox/Kconfig           |  12 +++
 drivers/mailbox/Makefile          |   2 +
 drivers/mailbox/brcmstb-mailbox.c | 167 ++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/mailbox/brcmstb-mailbox.c
drivers/mailbox/Kconfig +12 -0
index 05b1009e2820..b1e697e8d5f9 100644
@@ -254,4 +254,16 @@ config QCOM_IPCC
 	  acts as an interrupt controller for receiving interrupts from clients.
 	  Say Y here if you want to build this driver.
 
+config BRCMSTB_MBOX
+	tristate "Broadcom STB Mailbox"
+	depends on ARM64 || ARM
+	depends on ARM_SCMI_PROTOCOL && ARCH_BRCMSTB
+	default ARM_SCMI_PROTOCOL && ARCH_BRCMSTB
+	help
+	  Mailbox implementation of the Broadcom STB for the sole purposes
+	  of SCMI communication.  This is used by the SCMI drivers to
+	  communicate with FW that runs in EL3.  This mailbox only implements
+	  the agent-to-platform channgel of SCMI but may be augmented in
+	  the future to add the platform-to-agent channel.
+
 endif
drivers/mailbox/Makefile +2 -0
index 2e06e02b2e03..95fbcd121f2e 100644
@@ -54,3 +54,5 @@ obj-$(CONFIG_SUN6I_MSGBOX)	+= sun6i-msgbox.o
 obj-$(CONFIG_SPRD_MBOX)		+= sprd-mailbox.o
 
 obj-$(CONFIG_QCOM_IPCC)		+= qcom-ipcc.o
+
+obj-$(CONFIG_BRCMSTB_MBOX)	+= brcmstb-mailbox.o
drivers/mailbox/brcmstb-mailbox.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
2.17.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel