[PATCH v5 20/23] mailbox/riscv-sbi-mpxy: Add ACPI support
From: Anup Patel
Date: Wed Jun 11 2025 - 02:27:31 EST
From: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>
Add ACPI support for the RISC-V SBI message proxy (MPXY) based
mailbox driver.
Signed-off-by: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>
Signed-off-by: Anup Patel <apatel@xxxxxxxxxxxxxxxx>
---
drivers/mailbox/riscv-sbi-mpxy-mbox.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/mailbox/riscv-sbi-mpxy-mbox.c b/drivers/mailbox/riscv-sbi-mpxy-mbox.c
index ead67345456e..dbc76a254c44 100644
--- a/drivers/mailbox/riscv-sbi-mpxy-mbox.c
+++ b/drivers/mailbox/riscv-sbi-mpxy-mbox.c
@@ -5,9 +5,11 @@
* Copyright (C) 2025 Ventana Micro Systems Inc.
*/
+#include <linux/acpi.h>
#include <linux/cpu.h>
#include <linux/errno.h>
#include <linux/init.h>
+#include <linux/irqchip/riscv-imsic.h>
#include <linux/mailbox_controller.h>
#include <linux/mailbox/riscv-rpmi-message.h>
#include <linux/mm.h>
@@ -769,6 +771,7 @@ static int mpxy_mbox_probe(struct platform_device *pdev)
u32 i, *channel_ids __free(kfree) = NULL;
struct device *dev = &pdev->dev;
struct mpxy_mbox_channel *mchan;
+ struct irq_domain *msi_domain;
struct mpxy_mbox *mbox;
int msi_idx, rc;
@@ -891,6 +894,8 @@ static int mpxy_mbox_probe(struct platform_device *pdev)
/* Set the MSI domain if not available */
if (!dev_get_msi_domain(dev)) {
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
+
/*
* The device MSI domain for OF devices is only set at the
* time of populating/creating OF device. If the device MSI
@@ -898,8 +903,13 @@ static int mpxy_mbox_probe(struct platform_device *pdev)
* then we need to set it explicitly before using any platform
* MSI functions.
*/
- if (dev_of_node(dev))
+ if (is_of_node(fwnode)) {
of_msi_configure(dev, dev_of_node(dev));
+ } else if (is_acpi_device_node(fwnode)) {
+ msi_domain = irq_find_matching_fwnode(imsic_acpi_get_fwnode(dev),
+ DOMAIN_BUS_PLATFORM_MSI);
+ dev_set_msi_domain(dev, msi_domain);
+ }
}
/* Setup MSIs for mailbox (if required) */
@@ -944,6 +954,13 @@ static int mpxy_mbox_probe(struct platform_device *pdev)
return rc;
}
+#ifdef CONFIG_ACPI
+ struct acpi_device *adev = ACPI_COMPANION(dev);
+
+ if (adev)
+ acpi_dev_clear_dependencies(adev);
+#endif
+
dev_info(dev, "mailbox registered with %d channels\n",
mbox->channel_count);
return 0;
@@ -963,10 +980,17 @@ static const struct of_device_id mpxy_mbox_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mpxy_mbox_of_match);
+static const struct acpi_device_id mpxy_mbox_acpi_match[] = {
+ { "RSCV0005" },
+ {}
+};
+MODULE_DEVICE_TABLE(acpi, mpxy_mbox_acpi_match);
+
static struct platform_driver mpxy_mbox_driver = {
.driver = {
.name = "riscv-sbi-mpxy-mbox",
.of_match_table = mpxy_mbox_of_match,
+ .acpi_match_table = mpxy_mbox_acpi_match,
},
.probe = mpxy_mbox_probe,
.remove = mpxy_mbox_remove,
--
2.43.0