Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Crawford <steve@crawford.dev>
To: jassisinghbrar@gmail.com
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	kernel-list@raspberrypi.com, Steve Crawford <steve@crawford.dev>
Subject: [PATCH] mailbox: bcm2835: Add ACPI support for UEFI-booted Raspberry Pi 4
Date: Sun,  7 Jun 2026 17:43:50 +0200	[thread overview]
Message-ID: <20260607154350.204064-1-steve@crawford.dev> (raw)

On Raspberry Pi 4 booted via UEFI (e.g. using the pftf/RPi4 firmware),
the kernel enumerates devices via ACPI rather than the device tree. The
RPIQ mailbox device is already correctly described in the edk2-platforms
GpuDevs.asl with HID BCM2849, complete with MMIO and interrupt resources,
but the driver has no ACPI match table and therefore never binds.

Add an ACPI device ID table matching BCM2849, and replace the
DT-only irq_of_parse_and_map() call with platform_get_irq(), which
handles both DT and ACPI resource lookup transparently.

The existing DT path (brcm,bcm2835-mbox) is unchanged; this is a
purely additive change that has no effect on any boot path other than
UEFI+ACPI on RPi4.

Testing
-------
On Fedora CoreOS 44 (kernel 7.0.8-200.fc44.aarch64) booted via pftf/RPi4
UEFI v1.42, BCM2849:00 (the RPIQ mailbox device) is visible in ACPI but
unbound. Using driver_override to force-bind the unpatched driver
reproduces the exact failure this patch fixes:

  # echo bcm2835-mbox > /sys/bus/platform/devices/BCM2849:00/driver_override
  # echo BCM2849:00 > /sys/bus/platform/drivers/bcm2835-mbox/bind
  bcm2835-mbox BCM2849:00: error -EINVAL: request_irq(0) bcm2835_mbox_irq 0x0 BCM2849:00
  bcm2835-mbox BCM2849:00: Failed to register a mailbox IRQ handler: -22

irq_of_parse_and_map() returns 0 when dev->of_node is NULL (ACPI case).
platform_get_irq() correctly reads the interrupt from the ACPI _CRS
resources instead.

Signed-off-by: Steve Crawford <steve@crawford.dev>
---
 bcm2835-mailbox.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/bcm2835-mailbox.c b/bcm2835-mailbox.c
index ea12fb8..d450f3b 100644
--- a/bcm2835-mailbox.c
+++ b/bcm2835-mailbox.c
@@ -15,6 +15,7 @@
  *    https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
  */
 
+#include <linux/acpi.h>
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
@@ -24,7 +25,6 @@
 #include <linux/mailbox_controller.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 
@@ -144,7 +144,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	spin_lock_init(&mbox->lock);
 
-	ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
+	ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
 			       bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev),
 			       mbox);
 	if (ret) {
@@ -186,10 +186,24 @@ static const struct of_device_id bcm2835_mbox_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match);
 
+static const struct acpi_device_id bcm2835_mbox_acpi_match[] = {
+	/*
+	 * BCM2849 is the ACPI HID for the RPi4 UEFI firmware's RPIQ mailbox
+	 * device (defined in GpuDevs.asl of the tianocore/edk2-platforms RPi4
+	 * platform). On UEFI-booted systems this device carries the correct
+	 * MMIO and interrupt resources, allowing the driver to bind via ACPI
+	 * rather than the device tree.
+	 */
+	{ "BCM2849", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, bcm2835_mbox_acpi_match);
+
 static struct platform_driver bcm2835_mbox_driver = {
 	.driver = {
 		.name = "bcm2835-mbox",
 		.of_match_table = bcm2835_mbox_of_match,
+		.acpi_match_table = bcm2835_mbox_acpi_match,
 	},
 	.probe		= bcm2835_mbox_probe,
 };
-- 
2.54.0



                 reply	other threads:[~2026-06-07 15:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260607154350.204064-1-steve@crawford.dev \
    --to=steve@crawford.dev \
    --cc=jassisinghbrar@gmail.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox