Skip to contentSkip to conversation

ASPEED: Add mailbox driver for AST2700 series

PATCH Superseded Jammy Huang 3 participants 7 messages Jul 2, 2025 – Jul 25, 2025

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover ASPEED: Add mailbox driver for AST2700 series

Add mailbox controller driver for AST27XX SoCs, which provides independent tx/rx mailbox between different processors. There are 4 channels for each tx/rx mailbox and each channel has an 32-byte FIFO.

v6 changes:
- Update document
1. Update description to preserve paragraphs.
2. Update for property, reg.
3. Add reg-names.
4. Add 'Reviewed-by' from Krok.
- Update driver
1. Use devm_platform_ioremap_resource_byname since we add reg-names now.
2. Update error code for ch not enabled.

v5 changes:
- Update document
1. Separate reg from 1 to 2. 1st is tx controller; 2nd is rx.
2. Remove 'Reviewed-by' since the patch has changed.
- Update driver, no functional changes.
1. Update since there is 2 reg base now.
2. Refine reg definitions
3. Add spinlock to protect registers
4. Use bool as return value for ast2700_mbox_tx_done
5. Rename variable from drv_data to dev_data.

v4 changes:
- Update driver, no functional changes.
1. Remove unused variable, rx_buff, in struct ast2700_mbox.
2. Remove unneeded cast on device_get_match_data.
3. Remove the usage of writel/readl_relaxed.
4. Improve readability.
v3 changes:
- Correct document
1. Use 32-bit addressing in dts example property, reg.
v2 changes:
- Update document
1. Correct error in dts example.
2. Drop description for mbox-cell per suggestion previously.

Jammy Huang (2):
dt-bindings: mailbox: Add ASPEED AST2700 series SoC
mailbox: aspeed: add mailbox driver for AST27XX series SoC

 .../mailbox/aspeed,ast2700-mailbox.yaml       |  68 +++++
 drivers/mailbox/Kconfig                       |   8 +
 drivers/mailbox/Makefile                      |   2 +
 drivers/mailbox/ast2700-mailbox.c             | 240 ++++++++++++++++++
 4 files changed, 318 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/aspeed,ast2700-mailbox.yaml
 create mode 100644 drivers/mailbox/ast2700-mailbox.c

base-commit: ec7714e4947909190ffb3041a03311a975350fe0

Signature · 1 line
2.25.1
#1 lore raw

PATCH v6 1/2 dt-bindings: mailbox: Add ASPEED AST2700 series SoC

Introduce the mailbox module for AST27XX series SoC, which is responsible for interchanging messages between asymmetric processors.

---
 .../mailbox/aspeed,ast2700-mailbox.yaml       | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/aspeed,ast2700-mailbox.yaml
Documentation/devicetree/bindings/mailbox/aspeed,ast2700-mailbox.yaml new file +68 -0
new file mode 100644
index 000000000000..600e2d63fccd
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/aspeed,ast2700-mailbox.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ASPEED AST2700 mailbox controller
+
+maintainers:
+  - Jammy Huang <[email protected]>
+
+description: >
+  ASPEED AST2700 has multiple processors that need to communicate with each
+  other. The mailbox controller provides a way for these processors to send
+  messages to each other. It is a hardware-based inter-processor communication
+  mechanism that allows processors to send and receive messages through
+  dedicated channels.
+
+  The mailbox's tx/rx are independent, meaning that one processor can send a
+  message while another processor is receiving a message simultaneously.
+  There are 4 channels available for both tx and rx operations. Each channel
+  has a FIFO buffer that can hold messages of a fixed size (32 bytes in this
+  case).
+
+  The mailbox controller also supports interrupt generation, allowing
+  processors to notify each other when a message is available or when an event
+  occurs.
+
+properties:
+  compatible:
+    const: aspeed,ast2700-mailbox
+
+  reg:
+    items:
+      - description: TX control register
+      - description: RX control register
+
+  reg-names:
+    items:
+      - const: tx
+      - const: rx
+
+  interrupts:
+    maxItems: 1
+
+  "#mbox-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    mailbox@12c1c200 {
+        compatible = "aspeed,ast2700-mailbox";
+        reg = <0x12c1c200 0x100>, <0x12c1c300 0x100>;
+        reg-names = "tx", "rx";
+        interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+        #mbox-cells = <1>;
+    };
Signature · 1 line
2.25.1
#3 lore raw

PATCH v6 2/2 mailbox: aspeed: add mailbox driver for AST27XX series SoC

In reply to Jammy Huang

Add mailbox controller driver for AST27XX SoCs, which provides independent tx/rx mailbox between different processors. There are 4 channels for each tx/rx mailbox and each channel has an 32-byte FIFO.

---
 drivers/mailbox/Kconfig           |   8 +
 drivers/mailbox/Makefile          |   2 +
 drivers/mailbox/ast2700-mailbox.c | 240 ++++++++++++++++++++++++++++++
 3 files changed, 250 insertions(+)
 create mode 100644 drivers/mailbox/ast2700-mailbox.c
drivers/mailbox/Kconfig +8 -0
index 68eeed660a4a..1c38cd570091 100644
@@ -340,4 +340,12 @@ config THEAD_TH1520_MBOX
 	  kernel is running, and E902 core used for power management among other
 	  things.
 
+config AST2700_MBOX
+	tristate "ASPEED AST2700 IPC driver"
+	depends on ARCH_ASPEED || COMPILE_TEST
+	help
+	  Mailbox driver implementation for ASPEED AST27XX SoCs. This driver
+	  can be used to send message between different processors in SoC.
+	  The driver provides mailbox support for sending interrupts to the
+	  clients. Say Y here if you want to build this driver.
 endif
drivers/mailbox/Makefile +2 -0
index 13a3448b3271..9a9add9a7548 100644
@@ -72,3 +72,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_AST2700_MBOX)	+= ast2700-mailbox.o
drivers/mailbox/ast2700-mailbox.c new file +240 -0

240 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer Reviewed-by on v6 2/2
#4 lore raw

Re: [PATCH v6 2/2] mailbox: aspeed: add mailbox driver for AST27XX series SoC

Quoted 5 lines · Jammy Huang

Add mailbox controller driver for AST27XX SoCs, which provides independent tx/rx mailbox between different processors. There are 4 channels for each tx/rx mailbox and each channel has an 32-byte FIFO.

maintainer
#5 lore raw

Re: [PATCH v6 2/2] mailbox: aspeed: add mailbox driver for AST27XX series SoC

In reply to Jammy Huang

On Tue, Jul 1, 2025 at 8:19 PM Jammy Huang <[email protected]> wrote:

.....

drivers/mailbox/ast2700-mailbox.c line 76

Quoted 8 lines
drivers/mailbox/ast2700-mailbox.c new file +8 -0
+               /* Read the message data */
+               for (data_reg = mb->rx_regs + IPCR_DATA + mb->msg_size * n,
+                    word_data = chan->con_priv,
+                    num_words = (mb->msg_size / sizeof(u32));
+                    num_words;
+                    num_words--, data_reg += sizeof(u32), word_data++)
+                       *word_data = readl(data_reg);
+

Please clean this for loop.

Thanks
-Jassi

#6 lore raw

RE: [PATCH v6 2/2] mailbox: aspeed: add mailbox driver for AST27XX series SoC

Quoted 7 lines

On Tue, Jul 1, 2025 at 8:19 PM Jammy Huang
<[email protected]> wrote:

.....

Review

Quoted 2 lines
(quoted diff) +2 -0
+               /* Read the message data */
+               for (data_reg = mb->rx_regs + IPCR_DATA +

mb->msg_size * n,

Quoted 8 lines

drivers/mailbox/ast2700-mailbox.c

Quoted 4 lines
drivers/mailbox/ast2700-mailbox.c new file +4 -0
+                    word_data = chan->con_priv,
+                    num_words = (mb->msg_size / sizeof(u32));
+                    num_words;
+                    num_words--, data_reg += sizeof(u32),

word_data++)

Review

Quoted 2 lines
(quoted diff) +2 -0
+                       *word_data = readl(data_reg);
+

Please clean this for loop.

OK, will be updated in later patch.
Thanks for help.

Quoted 3 lines

Thanks
-Jassi

Regards.