[PATCH v21 08/13] mfd: core: Add firmware-node support to MFD cells
Shivendra Pratap
shivendra.pratap at oss.qualcomm.com
Mon Apr 27 10:34:48 PDT 2026
MFD core has no way to register a child device using an explicit firmware
node. This prevents drivers from registering child nodes when those nodes
do not define a compatible string. One such example is the PSCI
"reboot-mode" node, which omits a compatible string as it describes
boot-states provided by the underlying firmware.
Extend struct mfd_cell with an optional fwnode pointer and attach it to the
child device during registration when no firmware node is already assigned.
Signed-off-by: Shivendra Pratap <shivendra.pratap at oss.qualcomm.com>
---
drivers/mfd/mfd-core.c | 10 ++++++++++
include/linux/mfd/core.h | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 7aa32b90cf1eb7fa0a05bf3dc506e60a262c9850..d2153d9b6dd75a5f55d232ba87bd9e4abc93c8be 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
+#include <linux/fwnode.h>
#include <linux/list.h>
#include <linux/property.h>
#include <linux/mfd/core.h>
@@ -224,6 +225,15 @@ static int mfd_add_device(struct device *parent, int id,
mfd_acpi_add_device(cell, pdev);
+ /* Use explicit cell fwnode only when no firmware node has been assigned. */
+ if (!pdev->dev.fwnode && cell->fwnode) {
+ /* Get a refcount if fwnode is a device-tree node. */
+ if (is_of_node(cell->fwnode))
+ of_node_get(to_of_node(cell->fwnode));
+
+ device_set_node(&pdev->dev, cell->fwnode);
+ }
+
if (cell->pdata_size) {
ret = platform_device_add_data(pdev,
cell->platform_data, cell->pdata_size);
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index faeea7abd688f223fb0b31cde0a9b69dfe2a61ff..8a461b43fac360672a489ffffeb8d0e1acd193ac 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -50,6 +50,7 @@
#define MFD_DEP_LEVEL_HIGH 1
struct irq_domain;
+struct fwnode_handle;
struct software_node;
/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
@@ -80,6 +81,11 @@ struct mfd_cell {
/* Software node for the device. */
const struct software_node *swnode;
+ /*
+ * Firmware node for the device.
+ * Caller owns the pointer; mfd-core takes an OF node reference.
+ */
+ struct fwnode_handle *fwnode;
/*
* Device Tree compatible string
--
2.34.1
More information about the linux-arm-kernel
mailing list