Thread (16 messages) flat view 16 messages, 3 authors, 5d ago

Re: [PATCH v2 05/10] mailbox: apple: Add DockChannel FIFO controller

From: Yureka Lilian <hidden>
Date: 2026-09-18 13:07:46
Also in: asahi, linux-arm-kernel, linux-devicetree, linux-iommu, lkml

On 9/18/26 13:06, Michael Reeves via B4 Relay wrote:
quoted hunk ↗ jump to hunk
From: Michael Reeves <redacted>

DockChannel is a hardware FIFO used by Apple coprocessors for
low-latency byte-stream communication with the AP.

Add a mailbox controller that preallocates RX storage, tracks IRQ
enable state in software, and reports TX completion from the TX-empty
interrupt.

Reject messages larger than the FIFO and return -EBUSY while the
previous message is still pending. This keeps the provider usable for
future small-message clients such as serial transports without a TX
worker.

Handle RX and TX interrupts in a thread so mailbox callbacks and locking
run outside hard-IRQ context.

Co-developed-by: Hector Martin <redacted>
Signed-off-by: Hector Martin <redacted>
Signed-off-by: Michael Reeves <redacted>
---
  MAINTAINERS                               |   2 +
  drivers/mailbox/Kconfig                   |  12 +
  drivers/mailbox/Makefile                  |   2 +
  drivers/mailbox/apple-dockchannel.c       | 371 ++++++++++++++++++++++++++++++
  include/linux/mailbox/apple-dockchannel.h |  29 +++
  5 files changed, 416 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 7fe2ebb5e..e5be5934c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2677,6 +2677,7 @@ F:	drivers/input/touchscreen/apple_z2.c
  F:	drivers/iommu/apple-dart.c
  F:	drivers/iommu/io-pgtable-dart.c
  F:	drivers/irqchip/irq-apple-aic.c
+F:	drivers/mailbox/apple-dockchannel.c
  F:	drivers/mfd/macsmc.c
  F:	drivers/nvme/host/apple.c
  F:	drivers/nvmem/apple-efuses.c
@@ -2695,6 +2696,7 @@ F:	drivers/video/backlight/apple_dwi_bl.c
  F:	drivers/watchdog/apple_wdt.c
  F:	include/dt-bindings/interrupt-controller/apple-aic.h
  F:	include/dt-bindings/pinctrl/apple.h
+F:	include/linux/mailbox/apple-dockchannel.h
  F:	include/linux/mfd/macsmc.h
  F:	include/linux/soc/apple/*
  F:	include/uapi/drm/asahi_drm.h
[...]
diff --git a/drivers/mailbox/apple-dockchannel.c b/drivers/mailbox/apple-dockchannel.c
new file mode 100644
index 000000000..d0a66e1b7
--- /dev/null
+++ b/drivers/mailbox/apple-dockchannel.c
@@ -0,0 +1,371 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+/*
+ * Apple DockChannel mailbox controller
+ *
+ * Copyright The Asahi Linux Contributors
+ *
+ * DockChannel is a byte FIFO used by Apple co-processors. This driver exposes a
+ * single FIFO pair as a Linux mailbox channel and moves payload bytes with PIO.
+ * There is no DMA involved, so relaxed MMIO accessors are sufficient for the
+ * FIFO accesses themselves.
+ */
+
+#include <linux/device.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/mailbox/apple-dockchannel.h>
+#include <linux/mailbox_controller.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/spinlock.h>
+#include <linux/unaligned.h>
+
+#define APPLE_DOCKCHANNEL_FIFO_SIZE	0x800
+
+#define IRQ_MASK			0x0
+#define IRQ_FLAG			0x4
+
+#define IRQ_TX				BIT(2)
+#define IRQ_RX				BIT(3)
The dockchannel interface used for dockchannel-uart / DebugUSB uses 
different bits here, so these should probably be read from the device 
tree if the mailbox driver is supposed to be somewhat generic.
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help