mailbox: Add Marvell MHU driver
Subsystems (2)
v4 cover mailbox: Add Marvell MHU driver
Hi Jassi,
This is the v4 of my patchset that adds support for the mailbox found in the OcteonTX and OcteonTX2 based SoCs, which is used for SCMI communication.
The v4 fixes building on some archs that don't define ioread64 / iowrite64.
Sorry for the rapid-fire. If this v4 doesn't pass Sashiko's review I'll wait a few days before sending a v5.
Changes in v4:
[2/2]:
- Use readq / writeq instead of ioread64 / iowrite64, which aren't available on every arch.
Changes in v3:
[2/2]:
- Request an interrupt vector of exactly 3 interrupts
- Pass IRQF_NO_AUTOEN to devm_request_irq()
- Invert success condition of mrvl_mhu_last_tx_done()
Changes in v2:
[1/2]:
- Fix binding path in MAINTAINERS file
- Move MAINTAINERS entry so that it's in alphabetical order
- Fix formatting of DT example
[2/2]:
- 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
Cheers,
-Paul
George Cherian (2):
dt-bindings: mailbox: add Marvell MHU
mailbox: marvell-mhu: add Marvell MHU driver
.../bindings/mailbox/marvell,mhu.yaml | 61 +++++ MAINTAINERS | 7 + drivers/mailbox/Kconfig | 11 + drivers/mailbox/Makefile | 2 + drivers/mailbox/marvell_mhu.c | 239 ++++++++++++++++++ 5 files changed, 320 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml create mode 100644 drivers/mailbox/marvell_mhu.c
Signature · 1 line
2.47.3
PATCH v4 1/2 dt-bindings: mailbox: add Marvell MHU
From: George Cherian <[email protected]>
Marvell Message Handling Unit is a mailbox controller present in Marvell OcteonTx and OcteonTX2 SoC family.
---
v3-v4: No change
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
Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml new file +61 -0
@@ -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 <[email protected]> + - George Cherian <[email protected]> + +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>; + }; + }; +...
MAINTAINERS +6 -0
@@ -15825,6 +15825,12 @@ L: [email protected] (moderated for non-subscribers) S: Maintained F: arch/arm64/boot/dts/marvell/armada-8040-mcbin.dts +MARVELL MHU MAILBOX DRIVER +M: Sujeet Baranwal <[email protected]> +M: George Cherian <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml + MARVELL MV643XX ETHERNET DRIVER M: Sebastian Hesselbarth <[email protected]> L: [email protected]
Signature · 1 line
2.47.3
PATCH v4 2/2 mailbox: marvell-mhu: add Marvell MHU driver
In reply to Paul CercueilFrom: George Cherian <[email protected]>
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.
---
v4:
- Use readq / writeq instead of ioread64 / iowrite64, which aren't available on every arch.
v3:
- Request an interrupt vector of exactly 3 interrupts
- Pass IRQF_NO_AUTOEN to devm_request_irq()
- Invert success condition of mrvl_mhu_last_tx_done()
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
MAINTAINERS +1 -0
@@ -15830,6 +15830,7 @@ M: Sujeet Baranwal <[email protected]> M: George Cherian <[email protected]> S: Maintained F: Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml +F: drivers/mailbox/marvell_mhu.c MARVELL MV643XX ETHERNET DRIVER M: Sebastian Hesselbarth <[email protected]>
drivers/mailbox/Kconfig +11 -0
@@ -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
drivers/mailbox/Makefile +2 -0
@@ -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
drivers/mailbox/marvell_mhu.c new file +239 -0
239 lines not on this page · raw message
Signature · 1 line
2.47.3