mailbox: Add Broadcom STB mailbox driver
Subsystems (3)
v3 cover mailbox: Add Broadcom STB mailbox driver
Patchset Summary:
Adds a simple mailbox driver to be used by the ARM SCMI drivers.
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 | 173 ++++++++++++++++++ 4 files changed, 226 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
PATCH v3 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
@@ -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
PATCH v3 2/2 mailbox: Add Broadcom STB mailbox driver
In reply to Jim QuinlanThis 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 | 173 ++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 drivers/mailbox/brcmstb-mailbox.c
drivers/mailbox/Kconfig +12 -0
@@ -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
@@ -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 +173 -0
173 lines not on this page · raw message
Signature · 1 line
2.17.1
Hi Jim,
Quoted 12 lines · Jim Quinlan
--- drivers/mailbox/Kconfig | 12 +++ drivers/mailbox/Makefile | 2 + drivers/mailbox/brcmstb-mailbox.c | 173 ++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 drivers/mailbox/brcmstb-mailbox.cdrivers/mailbox/Kconfig +0
-0
drivers/mailbox/Kconfig config QCOM_IPCC · line 262
Quoted 9 lines
drivers/mailbox/Kconfig +6
-0@@ -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
"help" is still indented with spaces instead of one tab.
You probably should wait a bit to see if there are other comments on this patch before doing a v4.
Quoted 13 lines
drivers/mailbox/Kconfig +6
-0+ 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. + endifdrivers/mailbox/brcmstb-mailbox.c new file +0
-0
drivers/mailbox/brcmstb-mailbox.c line 2
Quoted 2 lines
drivers/mailbox/brcmstb-mailbox.c new file +2
-0@@ -0,0 +1,173 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2017, Broadcom */
2017 is a little surprising.
Quoted 5 lines
drivers/mailbox/brcmstb-mailbox.c new file +5
-0+#if defined(CONFIG_ARM64 ) || defined(CONFIG_ARM ) +static int announce_msg (unsigned int mbox_num,unsigned int ch) +{ +struct arm_smccc_res res; +
drivers/mailbox/brcmstb-mailbox.c line 68
Quoted 10 lines
drivers/mailbox/brcmstb-mailbox.c new file +10
-0+if (ch >=NUM_CHAN ) +return -EIO ; +arm_smccc_smc (BRCM_FID (ch), mbox_num,0 ,0 ,0 ,0 ,0 ,0 , &res); +if (res.a0) +return -EIO ; + return 0; +} +#else +#error Func announce_msg() not defined for the current ARCH +#endif
This is handled by the Kconfig depends on clause.
Why is it repeated here?
thanks.
Signature · 1 line
~Randy
Quoted 19 lines · Randy Dunlap
Hi Jim,
Quoted 15 lines · Jim Quinlan
--- drivers/mailbox/Kconfig | 12 +++ drivers/mailbox/Makefile | 2 + drivers/mailbox/brcmstb-mailbox.c | 173 ++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 drivers/mailbox/brcmstb-mailbox.cdrivers/mailbox/Kconfig +0
-0@@ -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.
Quoted 10 lines
drivers/mailbox/Kconfig config QCOM_IPCC · line 262
Quoted 6 lines
drivers/mailbox/Kconfig +6
-0+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"help" is still indented with spaces instead of one tab.
You probably should wait a bit to see if there are other comments on this patch before doing a v4.
Hi Randy,
Will fix, then wait...
Quoted 10 lines
Quoted 10 lines
drivers/mailbox/Kconfig +6
-0+ 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. + endifdrivers/mailbox/brcmstb-mailbox.c new file +0
-0
Quoted 8 lines
drivers/mailbox/brcmstb-mailbox.c line 2
Quoted 6 lines
index 000000000000..27d87938b08c
drivers/mailbox/brcmstb-mailbox.c new file +2
-0@@ -0,0 +1,173 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2017, Broadcom */ 2017 is a little surprising.
Will fix.
Quoted 12 lines
Quoted 12 lines
drivers/mailbox/brcmstb-mailbox.c new file +10
-0+#if defined(CONFIG_ARM64 ) || defined(CONFIG_ARM ) +static int announce_msg (unsigned int mbox_num,unsigned int ch) +{ +struct arm_smccc_res res; + +if (ch >=NUM_CHAN ) +return -EIO ; +arm_smccc_smc (BRCM_FID (ch), mbox_num,0 ,0 ,0 ,0 ,0 ,0 , &res); +if (res.a0) +return -EIO ;
Quoted 8 lines
drivers/mailbox/brcmstb-mailbox.c line 68
Quoted 5 lines
drivers/mailbox/brcmstb-mailbox.c new file +5
-0+ return 0; +} +#else +#error Func announce_msg() not defined for the current ARCH +#endif This is handled by the
Kconfigdepends on clause.
Why is it repeated here?
Will fix.
Thanks,
Jim
Quoted 7 lines
thanks.
--
~Randy
Quoted 1 line · Jim Quinlan
only implements the agent-to-platform channel;
In that case any reason why you can't reuse the existing smc transport for SCMI. It was added recently in case you haven't checked the latest kernel version(v5.8 or above). Check out for drivers/firmware/arm_scmi/smc.c IIUC rather vaguely Florian was cc-ed on those patches.
Quoted 1 line
we may implement the platform-to-agent channel in the future.
This is not yet support with that transport, it is hard to generalise as different vendors have their own solutions there.
Quoted 5 lines
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.
So are these not fast SMC/HVC calls then ? If so we may need some changes to that driver. I just rejected multiple message support as we had assumed fast smc/hvc.
Signature · 2 lines
Regards, Sudeep
Quoted 7 lines · Sudeep Holla
Quoted 1 line · Jim Quinlan
only implements the agent-to-platform channel;
In that case any reason why you can't reuse the existing smc transport for SCMI. It was added recently in case you haven't checked the latest kernel version(v5.8 or above). Check out for
drivers/firmware/arm_scmi/smc.cIIUC rather vaguely Florian was cc-ed on those patches.
Our firmware completes all commands by posting an interrupt and we already have platforms in the field with this mailbox driver. I was hoping we could make use of the SMC transport, but the current firmware implementation completes commands by raising an interrupt. The reason why we did that was that we could support synchronous and asynchronous calls the same way.
Quoted 16 lines
Quoted 2 lines
we may implement the platform-to-agent channel in the future.
This is not yet support with that transport, it is hard to generalise as different vendors have their own solutions there.
Quoted 5 lines
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.
So are these not fast SMC/HVC calls then ? If so we may need some changes to that driver. I just rejected multiple message support as we had assumed fast smc/hvc.
Signature · 1 line
Florian
Quoted 8 lines · Sudeep Holla
Quoted 1 line · Jim Quinlan
only implements the agent-to-platform channel;
In that case any reason why you can't reuse the existing smc transport for SCMI. It was added recently in case you haven't checked the latest kernel version(v5.8 or above). Check out for
drivers/firmware/arm_scmi/smc.cIIUC rather vaguely Florian was cc-ed on those patches.
Hi Sudeep,
Sorry for the delay. As Florian mentioned, we tried to use what you've submitted but could not because in our system a return does not indicate the completion of the SCMI operation. It is indicated by an interrupt. There are a number of reasons for this and some are out of our control.
Quoted 13 lines
Quoted 3 lines
we may implement the platform-to-agent channel in the future.
This is not yet support with that transport, it is hard to generalise as different vendors have their own solutions there.
Quoted 5 lines
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.
Quoted 3 lines
So are these not fast SMC/HVC calls then ? If so we may need some changes to that driver. I just rejected multiple message support as we had assumed fast smc/hvc.
Yes, we are using fast SMC calls. We don't have multiple message support either. The disconnect we have with the smc/hvc transport commit si this:
smc_send_message(...)
{
/* ... */
+ arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res);
+ scmi_rx_callback(scmi_info->cinfo, shmem_read_header(scmi_info->shmem));
In our code the second line is not here but in the interrupt handler. I don't see any way you can easily change/augment the smc/hvc transport to accommodate us.
Regards,
Jim
Quoted 5 lines
--
Regards,
Sudeep