]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: partitions: add of_match_table parser matching for the "ofpart" type
authorRafał Miłecki <rafal@milecki.pl>
Wed, 14 Mar 2018 12:10:42 +0000 (13:10 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Tue, 27 Mar 2018 07:10:48 +0000 (09:10 +0200)
commite318c25dc4823ef1f8b55b32f66b94e725caf024
tree59dc52a7c886e68fa6786df6936d95e1a9804721
parent85a30db8fdc33452d6f5875559b810dafcb93d59
mtd: partitions: add of_match_table parser matching for the "ofpart" type

In order to properly support compatibility strings as described in the
bindings/mtd/partition.txt "ofpart" type should be treated as an
indication for looking into OF. MTD should check "compatible" property
and search for a matching parser rather than blindly trying the one
supporting "fixed-partitions".

It also means that existing "fixed-partitions" parser should get renamed
to use a more meaningful name.

This commit achievies that aim by introducing a new mtd_part_of_parse().
It works by looking for a matching parser for every string in the
"compatibility" property (starting with the most specific one).

Please note that driver-specified parsers still take a precedence. It's
assumed that driver providing a parser type has a good reason for that
(e.g. having platform data with device-specific info). Also doing
otherwise could break existing setups. The same applies to using default
parsers (including "cmdlinepart") as some overwrite DT data with cmdline
argument.

Partition parsers can now provide an of_match_table to enable
flash<-->parser matching via device tree as documented in the
mtd/partition.txt.

This support is currently limited to built-in parsers as it uses
request_module() and friends. This should be sufficient for most cases
though as compiling parsers as modules isn't a common choice.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Tested-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/mtdpart.c
include/linux/mtd/partitions.h