diff options
| author | Sunil V L <sunilvl@ventanamicro.com> | 2025-08-18 09:39:17 +0530 |
|---|---|---|
| committer | Paul Walmsley <pjw@kernel.org> | 2025-09-25 19:49:17 -0600 |
| commit | 7e64042fdbacc04adce0caf4a0718bf2c4b2045f (patch) | |
| tree | f3c9106dc1b41a556bbd53002f31c0ac3b7b4bb9 /drivers/mailbox | |
| parent | 3f5d7a5c05b4d5ac011223359f15fb140125894b (diff) | |
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>
Diffstat (limited to 'drivers/mailbox')
| -rw-r--r-- | drivers/mailbox/riscv-sbi-mpxy-mbox.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/mailbox/riscv-sbi-mpxy-mbox.c b/drivers/mailbox/riscv-sbi-mpxy-mbox.c index 21404baa6df0..7c9c006b7244 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/minmax.h> @@ -906,6 +908,8 @@ static int mpxy_mbox_probe(struct platform_device *pdev) * explicitly configure here. */ 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 @@ -913,8 +917,15 @@ 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)) { + struct irq_domain *msi_domain; + + msi_domain = irq_find_matching_fwnode(imsic_acpi_get_fwnode(dev), + DOMAIN_BUS_PLATFORM_MSI); + dev_set_msi_domain(dev, msi_domain); + } if (!dev_get_msi_domain(dev)) return -EPROBE_DEFER; @@ -960,6 +971,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; @@ -979,10 +997,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, |
