]> asedeno.scripts.mit.edu Git - linux.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)
commit5b644aa012f67fd211138a067b9f351f30bdcc60
tree59dc52a7c886e68fa6786df6936d95e1a9804721
parent5741a164ff6fb5abbea8548ad0f3846bad2b9aec
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