2021-09-16 18:58:14

by Sven Peter

[permalink] [raw]
Subject: [PATCH v2 0/2] Apple Mailbox Controller support

Hi,

This is the second version of my series which adds support for the mailbox
controllers found on the Apple M1.

v1: https://lore.kernel.org/lkml/[email protected]/

Thanks to Jassi, Mark and Alyssa for the initial review. I've addressed
your comments with the following changes:

- switched to txdone_irq instead of introducing a new mode
- switched to a threaded interrupt handler for receiving messages
- added co-processor examples to the device tree binding
- reformatted the register defines and clarified multiple comments

Best,

Sven

Sven Peter (2):
dt-bindings: mailbox: Add Apple mailbox bindings
mailbox: apple: Add driver for Apple mailboxes

.../bindings/mailbox/apple,mailbox.yaml | 84 ++++
MAINTAINERS | 3 +
drivers/mailbox/Kconfig | 12 +
drivers/mailbox/Makefile | 2 +
drivers/mailbox/apple-mailbox.c | 431 ++++++++++++++++++
include/linux/apple-mailbox.h | 18 +
6 files changed, 550 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
create mode 100644 drivers/mailbox/apple-mailbox.c
create mode 100644 include/linux/apple-mailbox.h

--
2.25.1


2021-09-16 19:24:21

by Sven Peter

[permalink] [raw]
Subject: [PATCH v2 1/2] dt-bindings: mailbox: Add Apple mailbox bindings

Apple mailbox controller are found on the M1 and are used for
communication with various co-processors.

Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Mark Kettenis <[email protected]>
Signed-off-by: Sven Peter <[email protected]>
---
.../bindings/mailbox/apple,mailbox.yaml | 84 +++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 85 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml

diff --git a/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml b/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
new file mode 100644
index 000000000000..79b0cef08232
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/apple,mailbox.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Apple Mailbox Controller
+
+maintainers:
+ - Hector Martin <[email protected]>
+ - Sven Peter <[email protected]>
+
+description:
+ The Apple mailbox consists of two FIFOs used to exchange 64+32 bit
+ messages between the main CPU and a co-processor. Multiple instances
+ of this mailbox can be found on Apple SoCs.
+ One of the two FIFOs is used to send data to a co-processor while the other
+ FIFO is used for the other direction.
+ Various clients implement different IPC protocols based on these simple
+ messages and shared memory buffers.
+
+properties:
+ compatible:
+ oneOf:
+ - description:
+ ASC mailboxes are the most common variant found on the M1 used
+ for example for the display controller, the system management
+ controller and the NVMe coprocessor.
+ items:
+ - const: apple,t8103-asc-mailbox
+
+ - description:
+ M3 mailboxes are an older variant with a slightly different MMIO
+ interface still found on the M1. It is used for the Thunderbolt
+ co-processors.
+ items:
+ - const: apple,t8103-m3-mailbox
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ minItems: 4
+ items:
+ - description: send fifo is empty interrupt
+ - description: send fifo is not empty interrupt
+ - description: receive fifo is empty interrupt
+ - description: receive fifo is not empty interrupt
+
+ interrupt-names:
+ minItems: 4
+ items:
+ - const: send-empty
+ - const: send-not-empty
+ - const: recv-empty
+ - const: recv-not-empty
+
+ clocks:
+ description:
+ Reference to the clock gate phandle(s) if required for this mailbox.
+ Optional since not all mailboxes are attached to a clock gate.
+
+ "#mbox-cells":
+ const: 0
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-names
+ - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ mailbox@77408000 {
+ compatible = "apple,t8103-asc-mailbox";
+ reg = <0x77408000 0x4000>;
+ interrupts = <1 583 4>, <1 584 4>, <1 585 4>, <1 586 4>;
+ interrupt-names = "send-empty", "send-not-empty",
+ "recv-empty", "recv-not-empty";
+ #mbox-cells = <0>;
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index cad1289793db..47de27282c98 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1720,6 +1720,7 @@ C: irc://irc.oftc.net/asahi-dev
T: git https://github.com/AsahiLinux/linux.git
F: Documentation/devicetree/bindings/arm/apple.yaml
F: Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
+F: Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
F: arch/arm64/boot/dts/apple/
F: drivers/irqchip/irq-apple-aic.c
--
2.25.1

2021-09-19 13:19:24

by Alyssa Rosenzweig

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Apple Mailbox Controller support

I've dropped v1 from my tree and cherry-picked "mailbox: apple: Add
driver for Apple mailboxes". NVMe and DCP both still work, so this is

Tested-by: Alyssa Rosenzweig <[email protected]>

Thanks!

On Thu , Sep 16, 2021 at 05:49:09PM +0200, Sven Peter wrote:
> Hi,
>
> This is the second version of my series which adds support for the mailbox
> controllers found on the Apple M1.
>
> v1: https://lore.kernel.org/lkml/[email protected]/
>
> Thanks to Jassi, Mark and Alyssa for the initial review. I've addressed
> your comments with the following changes:
>
> - switched to txdone_irq instead of introducing a new mode
> - switched to a threaded interrupt handler for receiving messages
> - added co-processor examples to the device tree binding
> - reformatted the register defines and clarified multiple comments
>
> Best,
>
> Sven
>
> Sven Peter (2):
> dt-bindings: mailbox: Add Apple mailbox bindings
> mailbox: apple: Add driver for Apple mailboxes
>
> .../bindings/mailbox/apple,mailbox.yaml | 84 ++++
> MAINTAINERS | 3 +
> drivers/mailbox/Kconfig | 12 +
> drivers/mailbox/Makefile | 2 +
> drivers/mailbox/apple-mailbox.c | 431 ++++++++++++++++++
> include/linux/apple-mailbox.h | 18 +
> 6 files changed, 550 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
> create mode 100644 drivers/mailbox/apple-mailbox.c
> create mode 100644 include/linux/apple-mailbox.h
>
> --
> 2.25.1
>

2021-09-22 00:11:30

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] dt-bindings: mailbox: Add Apple mailbox bindings

On Thu, 16 Sep 2021 17:49:10 +0200, Sven Peter wrote:
> Apple mailbox controller are found on the M1 and are used for
> communication with various co-processors.
>
> Reviewed-by: Alyssa Rosenzweig <[email protected]>
> Reviewed-by: Mark Kettenis <[email protected]>
> Signed-off-by: Sven Peter <[email protected]>
> ---
> .../bindings/mailbox/apple,mailbox.yaml | 84 +++++++++++++++++++
> MAINTAINERS | 1 +
> 2 files changed, 85 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
>

Reviewed-by: Rob Herring <[email protected]>

2021-10-18 03:31:34

by Sven Peter

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Apple Mailbox Controller support

On Thu, Sep 16, 2021, at 17:49, Sven Peter wrote:
> Hi,
>
> This is the second version of my series which adds support for the mailbox
> controllers found on the Apple M1.
>
> v1: https://lore.kernel.org/lkml/[email protected]/
>
> Thanks to Jassi, Mark and Alyssa for the initial review. I've addressed
> your comments with the following changes:
>
> - switched to txdone_irq instead of introducing a new mode
> - switched to a threaded interrupt handler for receiving messages
> - added co-processor examples to the device tree binding
> - reformatted the register defines and clarified multiple comments
>
> Best,
>
> Sven
>
> Sven Peter (2):
> dt-bindings: mailbox: Add Apple mailbox bindings
> mailbox: apple: Add driver for Apple mailboxes
>
> .../bindings/mailbox/apple,mailbox.yaml | 84 ++++
> MAINTAINERS | 3 +
> drivers/mailbox/Kconfig | 12 +
> drivers/mailbox/Makefile | 2 +
> drivers/mailbox/apple-mailbox.c | 431 ++++++++++++++++++
> include/linux/apple-mailbox.h | 18 +
> 6 files changed, 550 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
> create mode 100644 drivers/mailbox/apple-mailbox.c
> create mode 100644 include/linux/apple-mailbox.h
>
> --
> 2.25.1

Hi Jassi,

Have you had a chance to look at this series yet?


Thanks,


Sven