@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/magic.h>
@@ -209,16 +210,36 @@ static int tplink_parse_64k_partitions(struct mtd_info *master,
TPLINK_64K_KERNEL_OFFS);
}
+#ifdef CONFIG_OF
+static const struct of_device_id parse_tplink_match_table[] = {
+ { .compatible = "tp-link" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, parse_tplink_match_table);
+
+static const struct of_device_id parse_tplink_64k_match_table[] = {
+ { .compatible = "tp-link-64k" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, parse_tplink_64k_match_table);
+#endif
+
static struct mtd_part_parser tplink_parser = {
.owner = THIS_MODULE,
.parse_fn = tplink_parse_partitions,
.name = "tp-link",
+#ifdef CONFIG_OF
+ .of_match_table = parse_tplink_match_table,
+#endif
};
static struct mtd_part_parser tplink_64k_parser = {
.owner = THIS_MODULE,
.parse_fn = tplink_parse_64k_partitions,
.name = "tp-link-64k",
+#ifdef CONFIG_OF
+ .of_match_table = parse_tplink_64k_match_table,
+#endif
};
static int __init tplink_parser_init(void)
@@ -233,3 +254,5 @@ module_init(tplink_parser_init);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
+MODULE_ALIAS("tp-link");
+MODULE_ALIAS("tp-link-64k");
Signed-off-by: Chuanhong Guo <gch981213@gmail.com> --- PS: I tested this patch on ar9331-based pisen ts-d084 and it works correctly. But it seemed that I have no way to tell ethernet and wifi drivers about where mac address and ART data is. Is there any solution for this problem? .../ath79/files/drivers/mtd/tplinkpart.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)