kernel: backport mtd patches with Broadcom of_match_table-s
[openwrt/openwrt.git] / target / linux / generic / backport-4.14 / 044-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch
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 @@ -304,9 +304,16 @@ static int bcm47xxpart_parse(struct mtd_
24 return curr_part;
25 };
26
27 +static const struct of_device_id bcm47xxpart_of_match_table[] = {
28 + { .compatible = "brcm,bcm947xx-cfe-partitions" },
29 + {},
30 +};
31 +MODULE_DEVICE_TABLE(of, bcm47xxpart_of_match_table);
32 +
33 static struct mtd_part_parser bcm47xxpart_mtd_parser = {
34 .parse_fn = bcm47xxpart_parse,
35 .name = "bcm47xxpart",
36 + .of_match_table = bcm47xxpart_of_match_table,
37 };
38 module_mtd_part_parser(bcm47xxpart_mtd_parser);
39