* [PATCH master] of: partition: do not try to translate offset as OF address
@ 2025-04-10 9:55 Ahmad Fatoum
0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2025-04-10 9:55 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
of_platform_populate will eventually call of_platform_device_create,
which will print out errors, because of_translate_address chokes on the
partitions node.
The correct fix would be not to use a platform bus here, but until we
add something like the fauxbus, just opencode the platform device
creation without the address translation parts.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/of/partition.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index a0890bfcdef0..4be2a2c33716 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -112,11 +112,33 @@ int of_parse_partitions(struct cdev *cdev, struct device_node *node)
}
for_each_child_of_node(node, n) {
- of_parse_partition(cdev, n);
+ struct cdev *partcdev;
+ struct device *dev;
+ int ret;
+
+ partcdev = of_parse_partition(cdev, n);
+ if (!partcdev || !subnode)
+ continue;
+
+ if (!of_property_present(n, "compatible") ||
+ !of_device_is_available(n))
+ continue;
+
+ /* TODO: migrate to a faux bus? */
+ dev = xzalloc(sizeof(*dev));
+ dev->id = DEVICE_ID_SINGLE;
+ dev->of_node = n;
+ dev->parent = partcdev->dev;
+ n->dev = dev;
+ dev_set_name(dev, "%s", partcdev->name);
+
+ ret = platform_device_register(dev);
+ if (WARN_ON(ret)) {
+ n->dev = NULL;
+ free_device(dev);
+ }
}
- if (subnode)
- of_platform_populate(subnode, NULL, cdev->dev);
return 0;
}
--
2.39.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-10 11:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-10 9:55 [PATCH master] of: partition: do not try to translate offset as OF address Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox