Skip to content

Commit 7e64042

Browse files
vlsunilPaul Walmsley
authored andcommitted
mailbox/riscv-sbi-mpxy: Add ACPI support
Add ACPI support for the RISC-V SBI message proxy (MPXY) based mailbox driver. Acked-by: Jassi Brar <jassisinghbrar@gmail.com> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com> Link: https://lore.kernel.org/r/20250818040920.272664-22-apatel@ventanamicro.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
1 parent 3f5d7a5 commit 7e64042

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

drivers/mailbox/riscv-sbi-mpxy-mbox.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
* Copyright (C) 2025 Ventana Micro Systems Inc.
66
*/
77

8+
#include <linux/acpi.h>
89
#include <linux/cpu.h>
910
#include <linux/errno.h>
1011
#include <linux/init.h>
12+
#include <linux/irqchip/riscv-imsic.h>
1113
#include <linux/mailbox_controller.h>
1214
#include <linux/mailbox/riscv-rpmi-message.h>
1315
#include <linux/minmax.h>
@@ -906,15 +908,24 @@ static int mpxy_mbox_probe(struct platform_device *pdev)
906908
* explicitly configure here.
907909
*/
908910
if (!dev_get_msi_domain(dev)) {
911+
struct fwnode_handle *fwnode = dev_fwnode(dev);
912+
909913
/*
910914
* The device MSI domain for OF devices is only set at the
911915
* time of populating/creating OF device. If the device MSI
912916
* domain is discovered later after the OF device is created
913917
* then we need to set it explicitly before using any platform
914918
* MSI functions.
915919
*/
916-
if (dev_of_node(dev))
920+
if (is_of_node(fwnode)) {
917921
of_msi_configure(dev, dev_of_node(dev));
922+
} else if (is_acpi_device_node(fwnode)) {
923+
struct irq_domain *msi_domain;
924+
925+
msi_domain = irq_find_matching_fwnode(imsic_acpi_get_fwnode(dev),
926+
DOMAIN_BUS_PLATFORM_MSI);
927+
dev_set_msi_domain(dev, msi_domain);
928+
}
918929

919930
if (!dev_get_msi_domain(dev))
920931
return -EPROBE_DEFER;
@@ -960,6 +971,13 @@ static int mpxy_mbox_probe(struct platform_device *pdev)
960971
return rc;
961972
}
962973

974+
#ifdef CONFIG_ACPI
975+
struct acpi_device *adev = ACPI_COMPANION(dev);
976+
977+
if (adev)
978+
acpi_dev_clear_dependencies(adev);
979+
#endif
980+
963981
dev_info(dev, "mailbox registered with %d channels\n",
964982
mbox->channel_count);
965983
return 0;
@@ -979,10 +997,17 @@ static const struct of_device_id mpxy_mbox_of_match[] = {
979997
};
980998
MODULE_DEVICE_TABLE(of, mpxy_mbox_of_match);
981999

1000+
static const struct acpi_device_id mpxy_mbox_acpi_match[] = {
1001+
{ "RSCV0005" },
1002+
{}
1003+
};
1004+
MODULE_DEVICE_TABLE(acpi, mpxy_mbox_acpi_match);
1005+
9821006
static struct platform_driver mpxy_mbox_driver = {
9831007
.driver = {
9841008
.name = "riscv-sbi-mpxy-mbox",
9851009
.of_match_table = mpxy_mbox_of_match,
1010+
.acpi_match_table = mpxy_mbox_acpi_match,
9861011
},
9871012
.probe = mpxy_mbox_probe,
9881013
.remove = mpxy_mbox_remove,

0 commit comments

Comments
 (0)