419-mtd-redboot-add-of_match_table-with-DT-binding.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  2. Subject: [PATCH] mtd: redboot: add of_match_table with DT binding
  3. MIME-Version: 1.0
  4. Content-Type: text/plain; charset=UTF-8
  5. Content-Transfer-Encoding: 8bit
  6. This allows parsing RedBoot compatible partitions for properly described
  7. flash device in DT.
  8. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  9. ---
  10. --- a/drivers/mtd/redboot.c
  11. +++ b/drivers/mtd/redboot.c
  12. @@ -29,6 +29,7 @@
  13. #include <linux/mtd/mtd.h>
  14. #include <linux/mtd/partitions.h>
  15. #include <linux/module.h>
  16. +#include <linux/mod_devicetable.h>
  17. struct fis_image_desc {
  18. unsigned char name[16]; // Null terminated name
  19. @@ -289,9 +290,16 @@ static int parse_redboot_partitions(stru
  20. return ret;
  21. }
  22. +static const struct of_device_id redboot_parser_of_match_table[] = {
  23. + { .compatible = "ecoscentric,redboot-fis-partitions" },
  24. + {},
  25. +};
  26. +MODULE_DEVICE_TABLE(of, redboot_parser_of_match_table);
  27. +
  28. static struct mtd_part_parser redboot_parser = {
  29. .parse_fn = parse_redboot_partitions,
  30. .name = "RedBoot",
  31. + .of_match_table = redboot_parser_of_match_table,
  32. };
  33. module_mtd_part_parser(redboot_parser);