* [PATCH v2 1/2] dt-bindings: mailbox: add Marvell MHU
2026-11-20 11:39 [PATCH v2 0/2] mailbox: Add Marvell MHU driver Paul Cercueil
@ 2026-11-20 11:39 ` Paul Cercueil
2026-11-20 11:39 ` [PATCH v2 2/2] mailbox: marvell-mhu: add Marvell MHU driver Paul Cercueil
1 sibling, 0 replies; 3+ messages in thread
From: Paul Cercueil @ 2026-11-20 11:39 UTC (permalink / raw)
To: Jassi Brar
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Petazzoni,
Sunil Kovvuri Goutham, linux-kernel, devicetree,
linux-arm-kernel, George Cherian, Sujeet Baranwal, Paul Cercueil
From: George Cherian <gcherian@marvell.com>
Marvell Message Handling Unit is a mailbox controller present in
Marvell OcteonTx and OcteonTX2 SoC family.
Signed-off-by: George Cherian <gcherian@marvell.com>
Co-developed-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
v2:
- Fix binding path in MAINTAINERS file
- Move MAINTAINERS entry so that it's in alphabetical order
- Fix formatting of DT example
---
.../bindings/mailbox/marvell,mhu.yaml | 61 +++++++++++++++++++
MAINTAINERS | 6 ++
2 files changed, 67 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
diff --git a/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml b/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
new file mode 100644
index 000000000000..5cf20d5642ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/marvell,mhu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell Message Handling Unit
+
+maintainers:
+ - Sujeet Baranwal <sbaranwal@marvell.com>
+ - George Cherian <gcherian@marvell.com>
+
+description:
+ The Control-Processors Cluster (CPC) provides Arm-platform specification
+ entities for managing the system. One of the CPC processors is the System
+ Control Processor (SCP). The SCP is responsible, among others, for booting
+ the chip, clock and power initialization, controlling power consumption
+ through DVFS, monitoring temperature sensors and controlling AVS. The SCP,
+ as each XCP, contains mailboxes for software-to-software communications.
+ Mailbox writes cause an interrupt to the local XCP core or to the AP.
+ This driver exposes AP-SCP Message Handling Unit to the system, providing
+ the mailbox communication mechanism to the system, with the intention
+ of plugging into the SCMI framework. It is designed to work with Marvell
+ OcteonTX and OcteonTX2-based platforms.
+ The mailbox has no other usage than SCMI communication. In case of
+ configurations running without SCMI support it should be disabled.
+
+properties:
+ compatible:
+ enum:
+ - marvell,octeontx-mhu
+ - marvell,octeontx2-mhu
+ - marvell,cn10-mhu
+
+ reg:
+ maxItems: 1
+
+ "#mbox-cells":
+ description: Index of the channel
+ const: 1
+
+required:
+ - compatible
+ - reg
+ - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ ecam {
+ #address-cells = <3>;
+ #size-cells = <2>;
+
+ mailbox@1c,0 {
+ compatible = "marvell,octeontx2-mhu";
+ reg = <0xe000 0x0 0x0 0 0>;
+ #mbox-cells = <1>;
+ };
+ };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 65e8a4b5c90b..8f6f98acc8fc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15825,6 +15825,12 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Maintained
F: arch/arm64/boot/dts/marvell/armada-8040-mcbin.dts
+MARVELL MHU MAILBOX DRIVER
+M: Sujeet Baranwal <sbaranwal@marvell.com>
+M: George Cherian <gcherian@marvell.com>
+S: Maintained
+F: Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
+
MARVELL MV643XX ETHERNET DRIVER
M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
L: netdev@vger.kernel.org
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 2/2] mailbox: marvell-mhu: add Marvell MHU driver
2026-11-20 11:39 [PATCH v2 0/2] mailbox: Add Marvell MHU driver Paul Cercueil
2026-11-20 11:39 ` [PATCH v2 1/2] dt-bindings: mailbox: add Marvell MHU Paul Cercueil
@ 2026-11-20 11:39 ` Paul Cercueil
1 sibling, 0 replies; 3+ messages in thread
From: Paul Cercueil @ 2026-11-20 11:39 UTC (permalink / raw)
To: Jassi Brar
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thomas Petazzoni,
Sunil Kovvuri Goutham, linux-kernel, devicetree,
linux-arm-kernel, George Cherian, Sujeet Baranwal, Paul Cercueil
From: George Cherian <gcherian@marvell.com>
Add support for Message Handling Units on Marvell OcteonTx and OcteonTx2
platforms. The module uses mailbox controller interface to provide
communication between SCP and AP using SCMI protocol over a single
shared memory communication channel.
Signed-off-by: George Cherian <gcherian@marvell.com>
Co-developed-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
v2:
- Add Kconfig dependency on PCI
- Order includes properly
- Remove duplicated macros
- Pass a pointer to the "mhu" variable to mrvl_mhu_setup_irq(), instead
of getting it from drvdata. Then we don't even need to set drvdata.
- Use devm functions unconditionally. This fixes an issue where
pci_free_irq_vectors() was called while IRQs were still in place.
It also allows to drop mrvl_mhu_remove().
- Use pcim_iomap_region() instead of pcim_request_region() +
pcim_iomap().
- Enable IRQ in .startup(), disable it in .shutdown().
- ACK the IRQ after calling mbox_chan_received_data()
- Fix register used for polling TX done
- Clean up macros
---
MAINTAINERS | 1 +
drivers/mailbox/Kconfig | 11 ++
drivers/mailbox/Makefile | 2 +
drivers/mailbox/marvell_mhu.c | 239 ++++++++++++++++++++++++++++++++++
4 files changed, 253 insertions(+)
create mode 100644 drivers/mailbox/marvell_mhu.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 8f6f98acc8fc..06c49bef8390 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15830,6 +15830,7 @@ M: Sujeet Baranwal <sbaranwal@marvell.com>
M: George Cherian <gcherian@marvell.com>
S: Maintained
F: Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
+F: drivers/mailbox/marvell_mhu.c
MARVELL MV643XX ETHERNET DRIVER
M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index ab869769e278..62744399cdb8 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -195,6 +195,17 @@ config MAILBOX_TEST
Test client to help with testing new Controller driver
implementations.
+config MARVELL_MHU
+ tristate "Marvell Message Handling Unit"
+ depends on (ARM64 || COMPILE_TEST) && 64BIT
+ depends on PCI && OF
+ help
+ This driver adds support for Marvell MHU controller.
+ The MHU mailbox is used by SCMI for OcteonTX and OcteonTX2
+ to control various aspects of platform operation like cpufreq
+ or sensors. The controller supports single channel to SCP.
+ Say Y here to build this module. If unsure say N.
+
config POLARFIRE_SOC_MAILBOX
tristate "PolarFire SoC (MPFS) Mailbox"
depends on HAS_IOMEM
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index 45dc59bb3e7f..83b26e7bbd27 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -49,6 +49,8 @@ obj-$(CONFIG_BCM_PDC_MBOX) += bcm-pdc-mailbox.o
obj-$(CONFIG_BCM_FLEXRM_MBOX) += bcm-flexrm-mailbox.o
+obj-$(CONFIG_MARVELL_MHU) += marvell_mhu.o
+
obj-$(CONFIG_POLARFIRE_SOC_MAILBOX) += mailbox-mpfs.o
obj-$(CONFIG_MCHP_SBI_IPC_MBOX) += mailbox-mchp-ipc-sbi.o
diff --git a/drivers/mailbox/marvell_mhu.c b/drivers/mailbox/marvell_mhu.c
new file mode 100644
index 000000000000..9b618b3fe276
--- /dev/null
+++ b/drivers/mailbox/marvell_mhu.c
@@ -0,0 +1,239 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Marvell Message Handling Unit
+ *
+ * Copyright (c) 2023, 2026 Marvell
+ */
+
+#define DRIVER_NAME "marvell-mhu"
+
+#define pr_fmt(fmt) DRIVER_NAME ": " fmt
+
+#include <linux/acpi.h>
+#include <linux/device/devres.h>
+#include <linux/interrupt.h>
+#include <linux/mailbox_controller.h>
+#include <linux/pci.h>
+
+#define SCP_INDEX 0x0
+#define DEV_AP0 0x2
+#define SCP_TO_AP_INTERRUPT 2
+#define INT_VECS_MIN 0
+#define INT_VECS_MAX 3
+
+#define XCP_ADDR(offt, xcp_core, device_id) \
+ ((offt) | ((uint64_t)(xcp_core) << 36) | ((uint64_t)(device_id) << 4))
+
+#define DEV_TO_XCP_MBOX_LINT(xcp_core, device_id) \
+ XCP_ADDR(0x000E1C00, xcp_core, device_id)
+
+/* The transmit interrupt status register */
+#define AP0_TO_SCP_MBOX_LINT DEV_TO_XCP_MBOX_LINT(SCP_INDEX, DEV_AP0)
+
+/*
+ * Doorbell-Register: XCP(0..1)_DEV(0..7)_XCP_MBOX
+ * Communication data from devices to XCP. When written, sets
+ * XCP(0..1)_DEV(0..7)_XCP_MBOX.
+ * PS: it doesn't matter what is written into this register,
+ * Attempting to writing 'anything' would cause an interrupt
+ * to the target!
+ */
+#define DEV_TO_XCP_MBOX(xcp_core, device_id) \
+ XCP_ADDR(0x000E1000, xcp_core, device_id)
+
+/* AP0-to-SCP doorbell */
+#define AP0_TO_SCP_MBOX DEV_TO_XCP_MBOX(SCP_INDEX, DEV_AP0)
+
+/* Register offset: Enable interrupt from SCP to AP */
+#define XCP_TO_DEV_XCP_MBOX_RINT_ENA_W1S(xcp_core, device_id) \
+ XCP_ADDR(0x000D1C40, xcp_core, device_id)
+
+#define SCP_TO_AP0_MBOX_RINT_ENA_W1S XCP_TO_DEV_XCP_MBOX_RINT_ENA_W1S(SCP_INDEX, DEV_AP0)
+
+/* Rx interrupt from SCP to Non-secure AP (linux kernel) */
+#define XCP_TO_DEV_MBOX_RINT(xcp_core, device_id) \
+ XCP_ADDR(0x000D1C00, xcp_core, device_id)
+
+/* The receive interrupt status register */
+#define SCP_TO_AP0_MBOX_RINT XCP_TO_DEV_MBOX_RINT(SCP_INDEX, DEV_AP0)
+
+struct mrvl_mhu {
+ /* SCP link information */
+ void __iomem *base; /* tx_reg, rx_reg */
+
+ int irq;
+
+ struct mbox_controller ctrl;
+ struct mbox_chan chan;
+};
+
+static irqreturn_t mrvl_mhu_rx_interrupt(int irq, void *p)
+{
+ struct mrvl_mhu *mhu = p;
+ u64 val;
+
+ /* Read interrupt status register */
+ val = readq_relaxed(mhu->base + SCP_TO_AP0_MBOX_RINT);
+ if (val) {
+ /* Poke mbox */
+ mbox_chan_received_data(&mhu->chan, (void *)&val);
+
+ /* Clear the interrupt */
+ writeq_relaxed(1ul, mhu->base + SCP_TO_AP0_MBOX_RINT);
+
+ return IRQ_HANDLED;
+ }
+
+ return IRQ_NONE;
+}
+
+static int mrvl_mhu_send_data(struct mbox_chan *chan, void *data)
+{
+ const u64 doorbell = 0xff; /* Arbitrary value, SCP requires a value */
+ struct mrvl_mhu *mhu = chan->con_priv;
+
+ /* signal SCP */
+ iowrite64(doorbell, mhu->base + AP0_TO_SCP_MBOX);
+
+ return 0;
+}
+
+static bool mrvl_mhu_last_tx_done(struct mbox_chan *chan)
+{
+ struct mrvl_mhu *mhu = chan->con_priv;
+ u64 status;
+
+ status = ioread64(mhu->base + AP0_TO_SCP_MBOX_LINT);
+
+ return status != 0;
+}
+
+static int mrvl_mhu_startup(struct mbox_chan *chan)
+{
+ struct mrvl_mhu *mhu = chan->con_priv;
+
+ /* Enable interrupts only if there is client for data */
+ writeq_relaxed(1ul, mhu->base + SCP_TO_AP0_MBOX_RINT_ENA_W1S);
+
+ enable_irq(mhu->irq);
+
+ return 0;
+}
+
+static void mrvl_mhu_shutdown(struct mbox_chan *chan)
+{
+ struct mrvl_mhu *mhu = chan->con_priv;
+
+ /* Could be using SCP_TO_AP0_MBOX_RINT_DIS_W1S if we knew where it was */
+ disable_irq(mhu->irq);
+}
+
+/* Define operations related to mbox */
+static const struct mbox_chan_ops mrvl_mhu_chan_ops = {
+ .startup = mrvl_mhu_startup,
+ .shutdown = mrvl_mhu_shutdown,
+ .send_data = mrvl_mhu_send_data,
+ .last_tx_done = mrvl_mhu_last_tx_done,
+};
+
+static void mrvl_mhu_free_irq_vector(void *d)
+{
+ pci_free_irq_vectors(d);
+}
+
+static int mrvl_mhu_setup_irq(struct mrvl_mhu *mhu, struct pci_dev *pdev)
+{
+ struct device *dev = &pdev->dev;
+ int ret, nvec;
+
+ nvec = pci_alloc_irq_vectors(pdev, INT_VECS_MIN, INT_VECS_MAX, PCI_IRQ_MSIX);
+ if (nvec < 0)
+ return nvec;
+
+ ret = devm_add_action_or_reset(dev, mrvl_mhu_free_irq_vector, pdev);
+ if (ret)
+ return ret;
+
+ mhu->irq = pci_irq_vector(pdev, SCP_TO_AP_INTERRUPT);
+ if (mhu->irq < 0)
+ return mhu->irq;
+
+ return devm_request_irq(dev, mhu->irq,
+ mrvl_mhu_rx_interrupt, 0, "mvl-mhu", mhu);
+}
+
+static const struct of_device_id mrvl_mhu_dt_ids[] = {
+ { .compatible = "marvell,octeontx-mhu" },
+ { .compatible = "marvell,octeontx2-mhu" },
+ { .compatible = "marvell,cn10-mhu" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, mrvl_mhu_dt_ids);
+
+#define PCI_DEVICE_ID_CAVIUM_OCTEON_MHU 0xa067
+static const struct pci_device_id mrvl_mhu_ids[] = {
+ { PCI_VDEVICE(CAVIUM, PCI_DEVICE_ID_CAVIUM_OCTEON_MHU) },
+ { 0 },
+};
+MODULE_DEVICE_TABLE(pci, mrvl_mhu_ids);
+
+static int mrvl_mhu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+ struct device *dev = &pdev->dev;
+ struct mrvl_mhu *mhu;
+ int ret;
+
+ /* Only support PCI devices with a corresponding OF node. */
+ if (!dev->of_node)
+ return -ENODEV;
+ if (!of_match_node(mrvl_mhu_dt_ids, dev->of_node))
+ return -EINVAL;
+
+ mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL);
+ if (!mhu)
+ return -ENOMEM;
+
+ mhu->chan = (struct mbox_chan) {
+ .con_priv = mhu,
+ };
+
+ mhu->ctrl = (struct mbox_controller){
+ .chans = &mhu->chan,
+ .num_chans = 1,
+ .txdone_poll = true,
+ .txpoll_period = 100,
+ .ops = &mrvl_mhu_chan_ops,
+ .dev = dev,
+ };
+
+ ret = pcim_enable_device(pdev);
+ if (ret)
+ return ret;
+
+ mhu->base = pcim_iomap_region(pdev, 0, DRIVER_NAME);
+ if (IS_ERR(mhu->base))
+ return PTR_ERR(mhu->base);
+
+ /* Configure IRQ from SCP to AP */
+ ret = mrvl_mhu_setup_irq(mhu, pdev);
+ if (ret)
+ return ret;
+
+ return devm_mbox_controller_register(dev, &mhu->ctrl);
+}
+
+static struct pci_driver mrvl_mhu_driver = {
+ .name = DRIVER_NAME,
+ .id_table = mrvl_mhu_ids,
+ .probe = mrvl_mhu_probe,
+ .driver = {
+ .name = DRIVER_NAME,
+ .of_match_table = mrvl_mhu_dt_ids,
+ },
+};
+module_pci_driver(mrvl_mhu_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Marvell Message Handling Unit");
+MODULE_AUTHOR("Sujeet Baranwal <sbaranwal@marvell.com>");
+MODULE_AUTHOR("George Cherian <gcherian@marvell.com>");
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread