400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. This allows using bcm47xxpart parser to find partitions on flash
  9. described in DT using the "brcm,bcm947xx-cfe-partitions" compatible
  10. property. It means this parser doesn't have to be explicitly selected by
  11. a flash driver anymore. It can be used e.g. together with a generic
  12. m25p80 / spi-nor if device is just properly described.
  13. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  14. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
  15. ---
  16. drivers/mtd/bcm47xxpart.c | 7 +++++++
  17. 1 file changed, 7 insertions(+)
  18. --- a/drivers/mtd/bcm47xxpart.c
  19. +++ b/drivers/mtd/bcm47xxpart.c
  20. @@ -15,6 +15,7 @@
  21. #include <linux/slab.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/partitions.h>
  24. +#include <linux/mod_devicetable.h>
  25. #include <uapi/linux/magic.h>
  26. @@ -304,9 +305,16 @@ static int bcm47xxpart_parse(struct mtd_
  27. return curr_part;
  28. };
  29. +static const struct of_device_id bcm47xxpart_of_match_table[] = {
  30. + { .compatible = "brcm,bcm947xx-cfe-partitions" },
  31. + {},
  32. +};
  33. +MODULE_DEVICE_TABLE(of, bcm47xxpart_of_match_table);
  34. +
  35. static struct mtd_part_parser bcm47xxpart_mtd_parser = {
  36. .parse_fn = bcm47xxpart_parse,
  37. .name = "bcm47xxpart",
  38. + .of_match_table = bcm47xxpart_of_match_table,
  39. };
  40. module_mtd_part_parser(bcm47xxpart_mtd_parser);