mtd: core: introduce of support for dynamic partitions
authorChristian Marangi <ansuelsmth@gmail.com>
Wed, 22 Jun 2022 01:06:28 +0000 (03:06 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 29 Jun 2022 11:36:17 +0000 (13:36 +0200)
commitad9b10d1eaada169bd764abcab58f08538877e26
treed93cf7e2724a4b0125f891a1544a288b93eb80b1
parentdd638202dfb6507cd529751b6c39680c292e245e
mtd: core: introduce of support for dynamic partitions

We have many parser that register mtd partitions at runtime. One example
is the cmdlinepart or the smem-part parser where the compatible is defined
in the dts and the partitions gets detected and registered by the
parser. This is problematic for the NVMEM subsystem that requires an OF
node to detect NVMEM cells.

To fix this problem, introduce an additional logic that will try to
assign an OF node to the MTD if declared.

On MTD addition, it will be checked if the MTD has an OF node and if
not declared will check if a partition with the same label / node name is
declared in DTS. If an exact match is found, the partition dynamically
allocated by the parser will have a connected OF node.

The NVMEM subsystem will detect the OF node and register any NVMEM cells
declared statically in the DTS.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220622010628.30414-4-ansuelsmth@gmail.com
drivers/mtd/mtdcore.c