linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: call of_platform_populate() for MTD partitions
@ 2022-04-06 14:32 Rafał Miłecki
  2022-04-06 14:32 ` [PATCH 2/2] nvmem: add driver handling U-Boot environment variables Rafał Miłecki
  2022-04-11  9:00 ` [PATCH 1/2] mtd: call of_platform_populate() for MTD partitions Miquel Raynal
  0 siblings, 2 replies; 10+ messages in thread
From: Rafał Miłecki @ 2022-04-06 14:32 UTC (permalink / raw)
  To: Srinivas Kandagatla, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra
  Cc: Tom Rini, linux-mtd, linux-arm-kernel, linux-kernel, u-boot,
	devicetree, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Until this change MTD subsystem supported handling partitions only with
MTD partitions parsers. That's a specific / limited API designed around
partitions.

Some MTD partitions may however require different handling. They may
contain specific data that needs to be parsed and somehow extracted. For
that purpose MTD subsystem should allow binding of standard platform
drivers.

An example can be U-Boot (sub)partition with environment variables.
There exist a "u-boot,env" DT binding for MTD (sub)partition that
requires an NVMEM driver.

Ref: 5db1c2dbc04c ("dt-bindings: nvmem: add U-Boot environment variables binding")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/mtd/mtdpart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 357661b62c94..9fce946fa69c 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -17,6 +17,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#include <linux/of_platform.h>
 
 #include "mtdcore.h"
 
@@ -593,6 +594,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
 			continue;
 		ret = mtd_part_do_parse(parser, master, pparts, NULL);
 		if (ret > 0) {
+			of_platform_populate(np, NULL, NULL, &master->dev);
 			of_node_put(np);
 			return ret;
 		}
@@ -600,6 +602,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
 		if (ret < 0 && !err)
 			err = ret;
 	}
+	of_platform_populate(np, NULL, NULL, &master->dev);
 	of_node_put(np);
 
 	/*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-04 13:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 14:32 [PATCH 1/2] mtd: call of_platform_populate() for MTD partitions Rafał Miłecki
2022-04-06 14:32 ` [PATCH 2/2] nvmem: add driver handling U-Boot environment variables Rafał Miłecki
2022-04-11  8:59   ` Miquel Raynal
2022-04-11  9:45     ` Srinivas Kandagatla
2022-04-11 10:04       ` Miquel Raynal
2022-04-11 10:18   ` Srinivas Kandagatla
2022-04-11  9:00 ` [PATCH 1/2] mtd: call of_platform_populate() for MTD partitions Miquel Raynal
2022-04-25  1:20   ` Regression? " Daniel Golle
2022-04-25  8:39     ` Miquel Raynal
2022-05-04 13:40     ` Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).