94a477675197b605139b9ec10e0b666caac5bb24
[openwrt/staging/luka.git] /
1 From cf589ce71e84d3b8811c65740645af254c5248c0 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Wed, 9 May 2018 10:17:29 +0200
4 Subject: [PATCH] mtd: bcm47xxpart: add of_match_table with a new DT binding
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This allows using bcm47xxpart parser to find partitions on flash
10 described in DT using the "brcm,bcm947xx-cfe-partitions" compatible
11 property. It means this parser doesn't have to be explicitly selected by
12 a flash driver anymore. It can be used e.g. together with a generic
13 m25p80 / spi-nor if device is just properly described.
14
15 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
16 Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
17 ---
18 drivers/mtd/bcm47xxpart.c | 7 +++++++
19 1 file changed, 7 insertions(+)
20
21 --- a/drivers/mtd/bcm47xxpart.c
22 +++ b/drivers/mtd/bcm47xxpart.c
23 @@ -15,6 +15,7 @@
24 #include <linux/slab.h>
25 #include <linux/mtd/mtd.h>
26 #include <linux/mtd/partitions.h>
27 +#include <linux/mod_devicetable.h>
28
29 #include <uapi/linux/magic.h>
30
31 @@ -304,9 +305,16 @@ static int bcm47xxpart_parse(struct mtd_
32 return curr_part;
33 };
34
35 +static const struct of_device_id bcm47xxpart_of_match_table[] = {
36 + { .compatible = "brcm,bcm947xx-cfe-partitions" },
37 + {},
38 +};
39 +MODULE_DEVICE_TABLE(of, bcm47xxpart_of_match_table);
40 +
41 static struct mtd_part_parser bcm47xxpart_mtd_parser = {
42 .parse_fn = bcm47xxpart_parse,
43 .name = "bcm47xxpart",
44 + .of_match_table = bcm47xxpart_of_match_table,
45 };
46 module_mtd_part_parser(bcm47xxpart_mtd_parser);
47