Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sunil V L and committed by
Paul Walmsley
7e64042f 3f5d7a5c

+26 -1
+26 -1
drivers/mailbox/riscv-sbi-mpxy-mbox.c
··· 5 5 * Copyright (C) 2025 Ventana Micro Systems Inc. 6 6 */ 7 7 8 + #include <linux/acpi.h> 8 9 #include <linux/cpu.h> 9 10 #include <linux/errno.h> 10 11 #include <linux/init.h> 12 + #include <linux/irqchip/riscv-imsic.h> 11 13 #include <linux/mailbox_controller.h> 12 14 #include <linux/mailbox/riscv-rpmi-message.h> 13 15 #include <linux/minmax.h> ··· 908 906 * explicitly configure here. 909 907 */ 910 908 if (!dev_get_msi_domain(dev)) { 909 + struct fwnode_handle *fwnode = dev_fwnode(dev); 910 + 911 911 /* 912 912 * The device MSI domain for OF devices is only set at the 913 913 * time of populating/creating OF device. If the device MSI ··· 917 913 * then we need to set it explicitly before using any platform 918 914 * MSI functions. 919 915 */ 920 - if (dev_of_node(dev)) 916 + if (is_of_node(fwnode)) { 921 917 of_msi_configure(dev, dev_of_node(dev)); 918 + } else if (is_acpi_device_node(fwnode)) { 919 + struct irq_domain *msi_domain; 920 + 921 + msi_domain = irq_find_matching_fwnode(imsic_acpi_get_fwnode(dev), 922 + DOMAIN_BUS_PLATFORM_MSI); 923 + dev_set_msi_domain(dev, msi_domain); 924 + } 922 925 923 926 if (!dev_get_msi_domain(dev)) 924 927 return -EPROBE_DEFER; ··· 971 960 return rc; 972 961 } 973 962 963 + #ifdef CONFIG_ACPI 964 + struct acpi_device *adev = ACPI_COMPANION(dev); 965 + 966 + if (adev) 967 + acpi_dev_clear_dependencies(adev); 968 + #endif 969 + 974 970 dev_info(dev, "mailbox registered with %d channels\n", 975 971 mbox->channel_count); 976 972 return 0; ··· 997 979 }; 998 980 MODULE_DEVICE_TABLE(of, mpxy_mbox_of_match); 999 981 982 + static const struct acpi_device_id mpxy_mbox_acpi_match[] = { 983 + { "RSCV0005" }, 984 + {} 985 + }; 986 + MODULE_DEVICE_TABLE(acpi, mpxy_mbox_acpi_match); 987 + 1000 988 static struct platform_driver mpxy_mbox_driver = { 1001 989 .driver = { 1002 990 .name = "riscv-sbi-mpxy-mbox", 1003 991 .of_match_table = mpxy_mbox_of_match, 992 + .acpi_match_table = mpxy_mbox_acpi_match, 1004 993 }, 1005 994 .probe = mpxy_mbox_probe, 1006 995 .remove = mpxy_mbox_remove,