kernel: add DT binding support to the jimage parser
authorPawel Dembicki <paweldembicki@gmail.com>
Thu, 29 Nov 2018 14:03:12 +0000 (14:03 +0000)
committerMathias Kresin <dev@kresin.me>
Thu, 29 Nov 2018 23:22:04 +0000 (00:22 +0100)
It allows specifying jimage parser directly in the DT.

Tested on LAVA LR-25G001

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_jimage.c

index 51544a794b5698e25f98e19e4a36c10326684735..5c6c5b09ef5c7fc8c8a35a6f22271002a4e733a7 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/vmalloc.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/version.h>
 #include <linux/byteorder/generic.h>
 
 #include "mtdsplit.h"
@@ -256,9 +257,19 @@ mtdsplit_jimage_parse_generic(struct mtd_info *master,
                                      jimage_verify_default);
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+static const struct of_device_id mtdsplit_jimage_of_match_table[] = {
+       { .compatible = "amit,jimage" },
+       {},
+};
+#endif
+
 static struct mtd_part_parser jimage_generic_parser = {
        .owner = THIS_MODULE,
        .name = "jimage-fw",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+       .of_match_table = mtdsplit_jimage_of_match_table,
+#endif
        .parse_fn = mtdsplit_jimage_parse_generic,
        .type = MTD_PARSER_TYPE_FIRMWARE,
 };