From 7b2731a691f7abb53a8ef3b2bd7b7170f0f87264 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 12 Apr 2020 11:39:42 +0200 Subject: [PATCH 1/8] kernel: replace "+@" IPV6 dependency by "+" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The combination +@IPV6:kmod-ipsec6 is not valid, the +a:b syntax implies the @. Fix it. Fixes: 2e6b6f9fcaae ("kernel: add @IPv6 dependency to ipv6 modules") Reported-by: Oldřich Jedlička (@oldium) Signed-off-by: Adrian Schmutzler --- package/kernel/linux/modules/netsupport.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 6dade49bad..73e480a549 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -399,7 +399,7 @@ $(eval $(call KernelPackage,ip6-vti)) define KernelPackage/xfrm-interface SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IPsec XFRM Interface - DEPENDS:=+kmod-ipsec4 +@IPV6:kmod-ipsec6 @!LINUX_4_14 + DEPENDS:=+kmod-ipsec4 +IPV6:kmod-ipsec6 @!LINUX_4_14 KCONFIG:=CONFIG_XFRM_INTERFACE FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko AUTOLOAD:=$(call AutoProbe,xfrm_interface) From 5f923498415d79dc500f7ba26c30dde5c9f27586 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 13 Apr 2020 18:43:43 +0200 Subject: [PATCH 2/8] kernel: fix include of myloader.o since kernel 5.4 Between 4.19 and 5.4, mtd parsers have been moved to "parsers" subdirectory. Based on this, the selection of myloader.o in OpenWrt was also moved to that subdirectory, while the Kconfig and our local myloader.c file remained in /drivers/mtd. This resulted in linking errors like the following (on ath25@5.4): make[8]: *** No rule to make target 'drivers/mtd/parsers/myloader.o', ... needed by 'drivers/mtd/parsers/built-in.a'. Stop. make[7]: *** [scripts/Makefile.build:500: drivers/mtd/parsers] Error 2 make[6]: *** [scripts/Makefile.build:500: drivers/mtd] Error 2 Since myloader.c is not too big, this patch moves it to the kernel patches, allowing to adjust the path for kernel 5.4 and keeping Makefiles and file paths better in sync. Other patches have been refreshed accordingly. Signed-off-by: Adrian Schmutzler --- .../405-mtd-tp-link-partition-parser.patch | 6 +- .../generic/files/drivers/mtd/myloader.c | 182 --------------- ...30-mtd-add-myloader-partition-parser.patch | 190 +++++++++++++++- ...30-mtd-add-myloader-partition-parser.patch | 190 +++++++++++++++- ...30-mtd-add-myloader-partition-parser.patch | 207 ++++++++++++++++-- ...cat-add-dt-driver-for-concat-devices.patch | 2 +- 6 files changed, 569 insertions(+), 208 deletions(-) delete mode 100644 target/linux/generic/files/drivers/mtd/myloader.c diff --git a/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch b/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch index 11d1869544..71951a4ede 100644 --- a/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch +++ b/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch @@ -1,8 +1,8 @@ --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig -@@ -62,6 +62,12 @@ config MTD_MYLOADER_PARTS - You will still need the parsing functions to be called by the driver - for your particular device. It won't happen automatically. +@@ -46,6 +46,12 @@ menu "Partition parsers" + source "drivers/mtd/parsers/Kconfig" + endmenu +config MTD_TPLINK_PARTS + tristate "TP-Link AR7XXX/AR9XXX partitioning support" diff --git a/target/linux/generic/files/drivers/mtd/myloader.c b/target/linux/generic/files/drivers/mtd/myloader.c deleted file mode 100644 index 7532d454ed..0000000000 --- a/target/linux/generic/files/drivers/mtd/myloader.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Parse MyLoader-style flash partition tables and produce a Linux partition - * array to match. - * - * Copyright (C) 2007-2009 Gabor Juhos - * - * This file was based on drivers/mtd/redboot.c - * Author: Red Hat, Inc. - David Woodhouse - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BLOCK_LEN_MIN 0x10000 -#define PART_NAME_LEN 32 - -struct part_data { - struct mylo_partition_table tab; - char names[MYLO_MAX_PARTITIONS][PART_NAME_LEN]; -}; - -static int myloader_parse_partitions(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -{ - struct part_data *buf; - struct mylo_partition_table *tab; - struct mylo_partition *part; - struct mtd_partition *mtd_parts; - struct mtd_partition *mtd_part; - int num_parts; - int ret, i; - size_t retlen; - char *names; - unsigned long offset; - unsigned long blocklen; - - buf = vmalloc(sizeof(*buf)); - if (!buf) { - return -ENOMEM; - goto out; - } - tab = &buf->tab; - - blocklen = master->erasesize; - if (blocklen < BLOCK_LEN_MIN) - blocklen = BLOCK_LEN_MIN; - - offset = blocklen; - - /* Find the partition table */ - for (i = 0; i < 4; i++, offset += blocklen) { - printk(KERN_DEBUG "%s: searching for MyLoader partition table" - " at offset 0x%lx\n", master->name, offset); - - ret = mtd_read(master, offset, sizeof(*buf), &retlen, - (void *)buf); - if (ret) - goto out_free_buf; - - if (retlen != sizeof(*buf)) { - ret = -EIO; - goto out_free_buf; - } - - /* Check for Partition Table magic number */ - if (tab->magic == le32_to_cpu(MYLO_MAGIC_PARTITIONS)) - break; - - } - - if (tab->magic != le32_to_cpu(MYLO_MAGIC_PARTITIONS)) { - printk(KERN_DEBUG "%s: no MyLoader partition table found\n", - master->name); - ret = 0; - goto out_free_buf; - } - - /* The MyLoader and the Partition Table is always present */ - num_parts = 2; - - /* Detect number of used partitions */ - for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { - part = &tab->partitions[i]; - - if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) - continue; - - num_parts++; - } - - mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) + - num_parts * PART_NAME_LEN), GFP_KERNEL); - - if (!mtd_parts) { - ret = -ENOMEM; - goto out_free_buf; - } - - mtd_part = mtd_parts; - names = (char *)&mtd_parts[num_parts]; - - strncpy(names, "myloader", PART_NAME_LEN); - mtd_part->name = names; - mtd_part->offset = 0; - mtd_part->size = offset; - mtd_part->mask_flags = MTD_WRITEABLE; - mtd_part++; - names += PART_NAME_LEN; - - strncpy(names, "partition_table", PART_NAME_LEN); - mtd_part->name = names; - mtd_part->offset = offset; - mtd_part->size = blocklen; - mtd_part->mask_flags = MTD_WRITEABLE; - mtd_part++; - names += PART_NAME_LEN; - - for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { - part = &tab->partitions[i]; - - if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) - continue; - - if ((buf->names[i][0]) && (buf->names[i][0] != '\xff')) - strncpy(names, buf->names[i], PART_NAME_LEN); - else - snprintf(names, PART_NAME_LEN, "partition%d", i); - - mtd_part->offset = le32_to_cpu(part->addr); - mtd_part->size = le32_to_cpu(part->size); - mtd_part->name = names; - mtd_part++; - names += PART_NAME_LEN; - } - - *pparts = mtd_parts; - ret = num_parts; - - out_free_buf: - vfree(buf); - out: - return ret; -} - -static struct mtd_part_parser myloader_mtd_parser = { - .owner = THIS_MODULE, - .parse_fn = myloader_parse_partitions, - .name = "MyLoader", -}; - -static int __init myloader_mtd_parser_init(void) -{ - register_mtd_parser(&myloader_mtd_parser); - - return 0; -} - -static void __exit myloader_mtd_parser_exit(void) -{ - deregister_mtd_parser(&myloader_mtd_parser); -} - -module_init(myloader_mtd_parser_init); -module_exit(myloader_mtd_parser_exit); - -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION("Parsing code for MyLoader partition tables"); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/pending-4.14/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-4.14/430-mtd-add-myloader-partition-parser.patch index 889c452057..bf6670a91e 100644 --- a/target/linux/generic/pending-4.14/430-mtd-add-myloader-partition-parser.patch +++ b/target/linux/generic/pending-4.14/430-mtd-add-myloader-partition-parser.patch @@ -5,10 +5,8 @@ Subject: Add myloader partition table parser lede-commit: d8bf22859b51faa09d22c056fe221a45d2f7a3b8 Signed-off-by: Florian Fainelli ---- - drivers/mtd/Kconfig | 16 ++++++++++++++++ - drivers/mtd/Makefile | 1 + - 2 files changed, 17 insertions(+) +[add myloader.c to patch] +Signed-off-by: Adrian Schmutzler --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -45,3 +43,187 @@ Signed-off-by: Florian Fainelli obj-y += parsers/ # 'Users' - code which presents functionality to userspace. +--- /dev/null ++++ b/drivers/mtd/myloader.c +@@ -0,0 +1,181 @@ ++/* ++ * Parse MyLoader-style flash partition tables and produce a Linux partition ++ * array to match. ++ * ++ * Copyright (C) 2007-2009 Gabor Juhos ++ * ++ * This file was based on drivers/mtd/redboot.c ++ * Author: Red Hat, Inc. - David Woodhouse ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BLOCK_LEN_MIN 0x10000 ++#define PART_NAME_LEN 32 ++ ++struct part_data { ++ struct mylo_partition_table tab; ++ char names[MYLO_MAX_PARTITIONS][PART_NAME_LEN]; ++}; ++ ++static int myloader_parse_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct part_data *buf; ++ struct mylo_partition_table *tab; ++ struct mylo_partition *part; ++ struct mtd_partition *mtd_parts; ++ struct mtd_partition *mtd_part; ++ int num_parts; ++ int ret, i; ++ size_t retlen; ++ char *names; ++ unsigned long offset; ++ unsigned long blocklen; ++ ++ buf = vmalloc(sizeof(*buf)); ++ if (!buf) { ++ return -ENOMEM; ++ goto out; ++ } ++ tab = &buf->tab; ++ ++ blocklen = master->erasesize; ++ if (blocklen < BLOCK_LEN_MIN) ++ blocklen = BLOCK_LEN_MIN; ++ ++ offset = blocklen; ++ ++ /* Find the partition table */ ++ for (i = 0; i < 4; i++, offset += blocklen) { ++ printk(KERN_DEBUG "%s: searching for MyLoader partition table" ++ " at offset 0x%lx\n", master->name, offset); ++ ++ ret = mtd_read(master, offset, sizeof(*buf), &retlen, ++ (void *)buf); ++ if (ret) ++ goto out_free_buf; ++ ++ if (retlen != sizeof(*buf)) { ++ ret = -EIO; ++ goto out_free_buf; ++ } ++ ++ /* Check for Partition Table magic number */ ++ if (tab->magic == le32_to_cpu(MYLO_MAGIC_PARTITIONS)) ++ break; ++ ++ } ++ ++ if (tab->magic != le32_to_cpu(MYLO_MAGIC_PARTITIONS)) { ++ printk(KERN_DEBUG "%s: no MyLoader partition table found\n", ++ master->name); ++ ret = 0; ++ goto out_free_buf; ++ } ++ ++ /* The MyLoader and the Partition Table is always present */ ++ num_parts = 2; ++ ++ /* Detect number of used partitions */ ++ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { ++ part = &tab->partitions[i]; ++ ++ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) ++ continue; ++ ++ num_parts++; ++ } ++ ++ mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) + ++ num_parts * PART_NAME_LEN), GFP_KERNEL); ++ ++ if (!mtd_parts) { ++ ret = -ENOMEM; ++ goto out_free_buf; ++ } ++ ++ mtd_part = mtd_parts; ++ names = (char *)&mtd_parts[num_parts]; ++ ++ strncpy(names, "myloader", PART_NAME_LEN); ++ mtd_part->name = names; ++ mtd_part->offset = 0; ++ mtd_part->size = offset; ++ mtd_part->mask_flags = MTD_WRITEABLE; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ ++ strncpy(names, "partition_table", PART_NAME_LEN); ++ mtd_part->name = names; ++ mtd_part->offset = offset; ++ mtd_part->size = blocklen; ++ mtd_part->mask_flags = MTD_WRITEABLE; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ ++ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { ++ part = &tab->partitions[i]; ++ ++ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) ++ continue; ++ ++ if ((buf->names[i][0]) && (buf->names[i][0] != '\xff')) ++ strncpy(names, buf->names[i], PART_NAME_LEN); ++ else ++ snprintf(names, PART_NAME_LEN, "partition%d", i); ++ ++ mtd_part->offset = le32_to_cpu(part->addr); ++ mtd_part->size = le32_to_cpu(part->size); ++ mtd_part->name = names; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ } ++ ++ *pparts = mtd_parts; ++ ret = num_parts; ++ ++ out_free_buf: ++ vfree(buf); ++ out: ++ return ret; ++} ++ ++static struct mtd_part_parser myloader_mtd_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = myloader_parse_partitions, ++ .name = "MyLoader", ++}; ++ ++static int __init myloader_mtd_parser_init(void) ++{ ++ register_mtd_parser(&myloader_mtd_parser); ++ ++ return 0; ++} ++ ++static void __exit myloader_mtd_parser_exit(void) ++{ ++ deregister_mtd_parser(&myloader_mtd_parser); ++} ++ ++module_init(myloader_mtd_parser_init); ++module_exit(myloader_mtd_parser_exit); ++ ++MODULE_AUTHOR("Gabor Juhos "); ++MODULE_DESCRIPTION("Parsing code for MyLoader partition tables"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch index bd49893dd8..149caf3c6c 100644 --- a/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch +++ b/target/linux/generic/pending-4.19/430-mtd-add-myloader-partition-parser.patch @@ -5,10 +5,8 @@ Subject: Add myloader partition table parser lede-commit: d8bf22859b51faa09d22c056fe221a45d2f7a3b8 Signed-off-by: Florian Fainelli ---- - drivers/mtd/Kconfig | 16 ++++++++++++++++ - drivers/mtd/Makefile | 1 + - 2 files changed, 17 insertions(+) +[add myloader.c to patch] +Signed-off-by: Adrian Schmutzler --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -45,3 +43,187 @@ Signed-off-by: Florian Fainelli obj-y += parsers/ # 'Users' - code which presents functionality to userspace. +--- /dev/null ++++ b/drivers/mtd/myloader.c +@@ -0,0 +1,181 @@ ++/* ++ * Parse MyLoader-style flash partition tables and produce a Linux partition ++ * array to match. ++ * ++ * Copyright (C) 2007-2009 Gabor Juhos ++ * ++ * This file was based on drivers/mtd/redboot.c ++ * Author: Red Hat, Inc. - David Woodhouse ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BLOCK_LEN_MIN 0x10000 ++#define PART_NAME_LEN 32 ++ ++struct part_data { ++ struct mylo_partition_table tab; ++ char names[MYLO_MAX_PARTITIONS][PART_NAME_LEN]; ++}; ++ ++static int myloader_parse_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct part_data *buf; ++ struct mylo_partition_table *tab; ++ struct mylo_partition *part; ++ struct mtd_partition *mtd_parts; ++ struct mtd_partition *mtd_part; ++ int num_parts; ++ int ret, i; ++ size_t retlen; ++ char *names; ++ unsigned long offset; ++ unsigned long blocklen; ++ ++ buf = vmalloc(sizeof(*buf)); ++ if (!buf) { ++ return -ENOMEM; ++ goto out; ++ } ++ tab = &buf->tab; ++ ++ blocklen = master->erasesize; ++ if (blocklen < BLOCK_LEN_MIN) ++ blocklen = BLOCK_LEN_MIN; ++ ++ offset = blocklen; ++ ++ /* Find the partition table */ ++ for (i = 0; i < 4; i++, offset += blocklen) { ++ printk(KERN_DEBUG "%s: searching for MyLoader partition table" ++ " at offset 0x%lx\n", master->name, offset); ++ ++ ret = mtd_read(master, offset, sizeof(*buf), &retlen, ++ (void *)buf); ++ if (ret) ++ goto out_free_buf; ++ ++ if (retlen != sizeof(*buf)) { ++ ret = -EIO; ++ goto out_free_buf; ++ } ++ ++ /* Check for Partition Table magic number */ ++ if (tab->magic == le32_to_cpu(MYLO_MAGIC_PARTITIONS)) ++ break; ++ ++ } ++ ++ if (tab->magic != le32_to_cpu(MYLO_MAGIC_PARTITIONS)) { ++ printk(KERN_DEBUG "%s: no MyLoader partition table found\n", ++ master->name); ++ ret = 0; ++ goto out_free_buf; ++ } ++ ++ /* The MyLoader and the Partition Table is always present */ ++ num_parts = 2; ++ ++ /* Detect number of used partitions */ ++ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { ++ part = &tab->partitions[i]; ++ ++ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) ++ continue; ++ ++ num_parts++; ++ } ++ ++ mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) + ++ num_parts * PART_NAME_LEN), GFP_KERNEL); ++ ++ if (!mtd_parts) { ++ ret = -ENOMEM; ++ goto out_free_buf; ++ } ++ ++ mtd_part = mtd_parts; ++ names = (char *)&mtd_parts[num_parts]; ++ ++ strncpy(names, "myloader", PART_NAME_LEN); ++ mtd_part->name = names; ++ mtd_part->offset = 0; ++ mtd_part->size = offset; ++ mtd_part->mask_flags = MTD_WRITEABLE; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ ++ strncpy(names, "partition_table", PART_NAME_LEN); ++ mtd_part->name = names; ++ mtd_part->offset = offset; ++ mtd_part->size = blocklen; ++ mtd_part->mask_flags = MTD_WRITEABLE; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ ++ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { ++ part = &tab->partitions[i]; ++ ++ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) ++ continue; ++ ++ if ((buf->names[i][0]) && (buf->names[i][0] != '\xff')) ++ strncpy(names, buf->names[i], PART_NAME_LEN); ++ else ++ snprintf(names, PART_NAME_LEN, "partition%d", i); ++ ++ mtd_part->offset = le32_to_cpu(part->addr); ++ mtd_part->size = le32_to_cpu(part->size); ++ mtd_part->name = names; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ } ++ ++ *pparts = mtd_parts; ++ ret = num_parts; ++ ++ out_free_buf: ++ vfree(buf); ++ out: ++ return ret; ++} ++ ++static struct mtd_part_parser myloader_mtd_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = myloader_parse_partitions, ++ .name = "MyLoader", ++}; ++ ++static int __init myloader_mtd_parser_init(void) ++{ ++ register_mtd_parser(&myloader_mtd_parser); ++ ++ return 0; ++} ++ ++static void __exit myloader_mtd_parser_exit(void) ++{ ++ deregister_mtd_parser(&myloader_mtd_parser); ++} ++ ++module_init(myloader_mtd_parser_init); ++module_exit(myloader_mtd_parser_exit); ++ ++MODULE_AUTHOR("Gabor Juhos "); ++MODULE_DESCRIPTION("Parsing code for MyLoader partition tables"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch index f66da83924..2fd24a420c 100644 --- a/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch +++ b/target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch @@ -5,17 +5,16 @@ Subject: Add myloader partition table parser lede-commit: d8bf22859b51faa09d22c056fe221a45d2f7a3b8 Signed-off-by: Florian Fainelli ---- - drivers/mtd/Kconfig | 16 ++++++++++++++++ - drivers/mtd/Makefile | 1 + - 2 files changed, 17 insertions(+) +[adjust for kernel 5.4, add myloader.c to patch] +Signed-off-by: Adrian Schmutzler ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -46,6 +46,22 @@ menu "Partition parsers" - source "drivers/mtd/parsers/Kconfig" - endmenu +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -160,3 +160,19 @@ config MTD_REDBOOT_PARTS_READONLY + 'FIS directory' images, enable this option. + endif # MTD_REDBOOT_PARTS ++ +config MTD_MYLOADER_PARTS + tristate "MyLoader partition parsing" + depends on ADM5120 || ATH25 || ATH79 @@ -31,14 +30,194 @@ Signed-off-by: Florian Fainelli + + You will still need the parsing functions to be called by the driver + for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - # --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ++obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o +--- /dev/null ++++ b/drivers/mtd/parsers/myloader.c +@@ -0,0 +1,181 @@ ++/* ++ * Parse MyLoader-style flash partition tables and produce a Linux partition ++ * array to match. ++ * ++ * Copyright (C) 2007-2009 Gabor Juhos ++ * ++ * This file was based on drivers/mtd/redboot.c ++ * Author: Red Hat, Inc. - David Woodhouse ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BLOCK_LEN_MIN 0x10000 ++#define PART_NAME_LEN 32 ++ ++struct part_data { ++ struct mylo_partition_table tab; ++ char names[MYLO_MAX_PARTITIONS][PART_NAME_LEN]; ++}; ++ ++static int myloader_parse_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct part_data *buf; ++ struct mylo_partition_table *tab; ++ struct mylo_partition *part; ++ struct mtd_partition *mtd_parts; ++ struct mtd_partition *mtd_part; ++ int num_parts; ++ int ret, i; ++ size_t retlen; ++ char *names; ++ unsigned long offset; ++ unsigned long blocklen; ++ ++ buf = vmalloc(sizeof(*buf)); ++ if (!buf) { ++ return -ENOMEM; ++ goto out; ++ } ++ tab = &buf->tab; ++ ++ blocklen = master->erasesize; ++ if (blocklen < BLOCK_LEN_MIN) ++ blocklen = BLOCK_LEN_MIN; ++ ++ offset = blocklen; ++ ++ /* Find the partition table */ ++ for (i = 0; i < 4; i++, offset += blocklen) { ++ printk(KERN_DEBUG "%s: searching for MyLoader partition table" ++ " at offset 0x%lx\n", master->name, offset); ++ ++ ret = mtd_read(master, offset, sizeof(*buf), &retlen, ++ (void *)buf); ++ if (ret) ++ goto out_free_buf; ++ ++ if (retlen != sizeof(*buf)) { ++ ret = -EIO; ++ goto out_free_buf; ++ } ++ ++ /* Check for Partition Table magic number */ ++ if (tab->magic == le32_to_cpu(MYLO_MAGIC_PARTITIONS)) ++ break; ++ ++ } ++ ++ if (tab->magic != le32_to_cpu(MYLO_MAGIC_PARTITIONS)) { ++ printk(KERN_DEBUG "%s: no MyLoader partition table found\n", ++ master->name); ++ ret = 0; ++ goto out_free_buf; ++ } ++ ++ /* The MyLoader and the Partition Table is always present */ ++ num_parts = 2; ++ ++ /* Detect number of used partitions */ ++ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { ++ part = &tab->partitions[i]; ++ ++ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) ++ continue; ++ ++ num_parts++; ++ } ++ ++ mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) + ++ num_parts * PART_NAME_LEN), GFP_KERNEL); ++ ++ if (!mtd_parts) { ++ ret = -ENOMEM; ++ goto out_free_buf; ++ } ++ ++ mtd_part = mtd_parts; ++ names = (char *)&mtd_parts[num_parts]; ++ ++ strncpy(names, "myloader", PART_NAME_LEN); ++ mtd_part->name = names; ++ mtd_part->offset = 0; ++ mtd_part->size = offset; ++ mtd_part->mask_flags = MTD_WRITEABLE; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ ++ strncpy(names, "partition_table", PART_NAME_LEN); ++ mtd_part->name = names; ++ mtd_part->offset = offset; ++ mtd_part->size = blocklen; ++ mtd_part->mask_flags = MTD_WRITEABLE; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ ++ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) { ++ part = &tab->partitions[i]; ++ ++ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE) ++ continue; ++ ++ if ((buf->names[i][0]) && (buf->names[i][0] != '\xff')) ++ strncpy(names, buf->names[i], PART_NAME_LEN); ++ else ++ snprintf(names, PART_NAME_LEN, "partition%d", i); ++ ++ mtd_part->offset = le32_to_cpu(part->addr); ++ mtd_part->size = le32_to_cpu(part->size); ++ mtd_part->name = names; ++ mtd_part++; ++ names += PART_NAME_LEN; ++ } ++ ++ *pparts = mtd_parts; ++ ret = num_parts; ++ ++ out_free_buf: ++ vfree(buf); ++ out: ++ return ret; ++} ++ ++static struct mtd_part_parser myloader_mtd_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = myloader_parse_partitions, ++ .name = "MyLoader", ++}; ++ ++static int __init myloader_mtd_parser_init(void) ++{ ++ register_mtd_parser(&myloader_mtd_parser); ++ ++ return 0; ++} ++ ++static void __exit myloader_mtd_parser_exit(void) ++{ ++ deregister_mtd_parser(&myloader_mtd_parser); ++} ++ ++module_init(myloader_mtd_parser_init); ++module_exit(myloader_mtd_parser_exit); ++ ++MODULE_AUTHOR("Gabor Juhos "); ++MODULE_DESCRIPTION("Parsing code for MyLoader partition tables"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/pending-5.4/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch b/target/linux/generic/pending-5.4/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch index 4d7598cc7c..1c42ed7bff 100644 --- a/target/linux/generic/pending-5.4/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch +++ b/target/linux/generic/pending-5.4/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch @@ -43,7 +43,7 @@ Signed-off-by: Bernhard Frauendienst --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig -@@ -244,4 +244,6 @@ source "drivers/mtd/ubi/Kconfig" +@@ -228,4 +228,6 @@ source "drivers/mtd/ubi/Kconfig" source "drivers/mtd/hyperbus/Kconfig" From d3c9630811468499a94302fc57f3a4874f1614bc Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 13 Apr 2020 18:43:44 +0200 Subject: [PATCH 3/8] ath79: move tplinkpart.c parser to patches Between 4.19 and 5.4, mtd parsers have been moved to "parsers" subdirectory. Like for myloader.c in the previous patch, this patch moves tplinkpart.c to the kernel patches, so the code and the kernel includes are at the same location and the path can be adjusted per kernel. While at it, remove some outdated kernel version switches from the C code. Signed-off-by: Adrian Schmutzler --- .../ath79/files/drivers/mtd/tplinkpart.c | 235 ---------------- .../405-mtd-tp-link-partition-parser.patch | 225 ++++++++++++++++ .../405-mtd-tp-link-partition-parser.patch | 255 ++++++++++++++++-- 3 files changed, 462 insertions(+), 253 deletions(-) delete mode 100644 target/linux/ath79/files/drivers/mtd/tplinkpart.c diff --git a/target/linux/ath79/files/drivers/mtd/tplinkpart.c b/target/linux/ath79/files/drivers/mtd/tplinkpart.c deleted file mode 100644 index 1b94163b83..0000000000 --- a/target/linux/ath79/files/drivers/mtd/tplinkpart.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (C) 2011 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#define TPLINK_NUM_PARTS 5 -#define TPLINK_HEADER_V1 0x01000000 -#define TPLINK_HEADER_V2 0x02000000 -#define MD5SUM_LEN 16 - -#define TPLINK_ART_LEN 0x10000 -#define TPLINK_KERNEL_OFFS 0x20000 -#define TPLINK_64K_KERNEL_OFFS 0x10000 - -struct tplink_fw_header { - uint32_t version; /* header version */ - char vendor_name[24]; - char fw_version[36]; - uint32_t hw_id; /* hardware id */ - uint32_t hw_rev; /* hardware revision */ - uint32_t unk1; - uint8_t md5sum1[MD5SUM_LEN]; - uint32_t unk2; - uint8_t md5sum2[MD5SUM_LEN]; - uint32_t unk3; - uint32_t kernel_la; /* kernel load address */ - uint32_t kernel_ep; /* kernel entry point */ - uint32_t fw_length; /* total length of the firmware */ - uint32_t kernel_ofs; /* kernel data offset */ - uint32_t kernel_len; /* kernel data length */ - uint32_t rootfs_ofs; /* rootfs data offset */ - uint32_t rootfs_len; /* rootfs data length */ - uint32_t boot_ofs; /* bootloader data offset */ - uint32_t boot_len; /* bootloader data length */ - uint8_t pad[360]; -} __attribute__ ((packed)); - -static struct tplink_fw_header * -tplink_read_header(struct mtd_info *mtd, size_t offset) -{ - struct tplink_fw_header *header; - size_t header_len; - size_t retlen; - int ret; - u32 t; - - header = vmalloc(sizeof(*header)); - if (!header) - goto err; - - header_len = sizeof(struct tplink_fw_header); - ret = mtd_read(mtd, offset, header_len, &retlen, - (unsigned char *) header); - if (ret) - goto err_free_header; - - if (retlen != header_len) - goto err_free_header; - - /* sanity checks */ - t = be32_to_cpu(header->version); - if ((t != TPLINK_HEADER_V1) && (t != TPLINK_HEADER_V2)) - goto err_free_header; - - t = be32_to_cpu(header->kernel_ofs); - if (t != header_len) - goto err_free_header; - - return header; - -err_free_header: - vfree(header); -err: - return NULL; -} - -static int tplink_check_rootfs_magic(struct mtd_info *mtd, size_t offset) -{ - u32 magic; - size_t retlen; - int ret; - - ret = mtd_read(mtd, offset, sizeof(magic), &retlen, - (unsigned char *) &magic); - if (ret) - return ret; - - if (retlen != sizeof(magic)) - return -EIO; - - if (le32_to_cpu(magic) != SQUASHFS_MAGIC && - magic != 0x19852003) - return -EINVAL; - - return 0; -} - -static int tplink_parse_partitions_offset(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data, - size_t offset) -{ - struct mtd_partition *parts; - struct tplink_fw_header *header; - int nr_parts; - size_t art_offset; - size_t rootfs_offset; - size_t squashfs_offset; - int ret; - - nr_parts = TPLINK_NUM_PARTS; - parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL); - if (!parts) { - ret = -ENOMEM; - goto err; - } - - header = tplink_read_header(master, offset); - if (!header) { - pr_notice("%s: no TP-Link header found\n", master->name); - ret = -ENODEV; - goto err_free_parts; - } - - squashfs_offset = offset + sizeof(struct tplink_fw_header) + - be32_to_cpu(header->kernel_len); - - ret = tplink_check_rootfs_magic(master, squashfs_offset); - if (ret == 0) - rootfs_offset = squashfs_offset; - else - rootfs_offset = offset + be32_to_cpu(header->rootfs_ofs); - - art_offset = master->size - TPLINK_ART_LEN; - - parts[0].name = "u-boot"; - parts[0].offset = 0; - parts[0].size = offset; - parts[0].mask_flags = MTD_WRITEABLE; - - parts[1].name = "kernel"; - parts[1].offset = offset; - parts[1].size = rootfs_offset - offset; - - parts[2].name = "rootfs"; - parts[2].offset = rootfs_offset; - parts[2].size = art_offset - rootfs_offset; - - parts[3].name = "art"; - parts[3].offset = art_offset; - parts[3].size = TPLINK_ART_LEN; - parts[3].mask_flags = MTD_WRITEABLE; - - parts[4].name = "firmware"; - parts[4].offset = offset; - parts[4].size = art_offset - offset; - - vfree(header); - - *pparts = parts; - return nr_parts; - -err_free_parts: - kfree(parts); -err: - *pparts = NULL; - return ret; -} - -static int tplink_parse_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - return tplink_parse_partitions_offset(master, pparts, data, - TPLINK_KERNEL_OFFS); -} - -static int tplink_parse_64k_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - return tplink_parse_partitions_offset(master, pparts, data, - TPLINK_64K_KERNEL_OFFS); -} - -static struct mtd_part_parser tplink_parser = { - .owner = THIS_MODULE, - .parse_fn = tplink_parse_partitions, - .name = "tp-link", -}; - -static struct mtd_part_parser tplink_64k_parser = { - .owner = THIS_MODULE, - .parse_fn = tplink_parse_64k_partitions, - .name = "tp-link-64k", -}; - -static int __init tplink_parser_init(void) -{ - register_mtd_parser(&tplink_parser); - register_mtd_parser(&tplink_64k_parser); - - return 0; -} - -module_init(tplink_parser_init); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/ath79/patches-4.19/405-mtd-tp-link-partition-parser.patch b/target/linux/ath79/patches-4.19/405-mtd-tp-link-partition-parser.patch index 16fe5ed272..d65bf663b5 100644 --- a/target/linux/ath79/patches-4.19/405-mtd-tp-link-partition-parser.patch +++ b/target/linux/ath79/patches-4.19/405-mtd-tp-link-partition-parser.patch @@ -23,3 +23,228 @@ # 'Users' - code which presents functionality to userspace. obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o +--- /dev/null ++++ b/drivers/mtd/tplinkpart.c +@@ -0,0 +1,222 @@ ++/* ++ * Copyright (C) 2011 Gabor Juhos ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define TPLINK_NUM_PARTS 5 ++#define TPLINK_HEADER_V1 0x01000000 ++#define TPLINK_HEADER_V2 0x02000000 ++#define MD5SUM_LEN 16 ++ ++#define TPLINK_ART_LEN 0x10000 ++#define TPLINK_KERNEL_OFFS 0x20000 ++#define TPLINK_64K_KERNEL_OFFS 0x10000 ++ ++struct tplink_fw_header { ++ uint32_t version; /* header version */ ++ char vendor_name[24]; ++ char fw_version[36]; ++ uint32_t hw_id; /* hardware id */ ++ uint32_t hw_rev; /* hardware revision */ ++ uint32_t unk1; ++ uint8_t md5sum1[MD5SUM_LEN]; ++ uint32_t unk2; ++ uint8_t md5sum2[MD5SUM_LEN]; ++ uint32_t unk3; ++ uint32_t kernel_la; /* kernel load address */ ++ uint32_t kernel_ep; /* kernel entry point */ ++ uint32_t fw_length; /* total length of the firmware */ ++ uint32_t kernel_ofs; /* kernel data offset */ ++ uint32_t kernel_len; /* kernel data length */ ++ uint32_t rootfs_ofs; /* rootfs data offset */ ++ uint32_t rootfs_len; /* rootfs data length */ ++ uint32_t boot_ofs; /* bootloader data offset */ ++ uint32_t boot_len; /* bootloader data length */ ++ uint8_t pad[360]; ++} __attribute__ ((packed)); ++ ++static struct tplink_fw_header * ++tplink_read_header(struct mtd_info *mtd, size_t offset) ++{ ++ struct tplink_fw_header *header; ++ size_t header_len; ++ size_t retlen; ++ int ret; ++ u32 t; ++ ++ header = vmalloc(sizeof(*header)); ++ if (!header) ++ goto err; ++ ++ header_len = sizeof(struct tplink_fw_header); ++ ret = mtd_read(mtd, offset, header_len, &retlen, ++ (unsigned char *) header); ++ if (ret) ++ goto err_free_header; ++ ++ if (retlen != header_len) ++ goto err_free_header; ++ ++ /* sanity checks */ ++ t = be32_to_cpu(header->version); ++ if ((t != TPLINK_HEADER_V1) && (t != TPLINK_HEADER_V2)) ++ goto err_free_header; ++ ++ t = be32_to_cpu(header->kernel_ofs); ++ if (t != header_len) ++ goto err_free_header; ++ ++ return header; ++ ++err_free_header: ++ vfree(header); ++err: ++ return NULL; ++} ++ ++static int tplink_check_rootfs_magic(struct mtd_info *mtd, size_t offset) ++{ ++ u32 magic; ++ size_t retlen; ++ int ret; ++ ++ ret = mtd_read(mtd, offset, sizeof(magic), &retlen, ++ (unsigned char *) &magic); ++ if (ret) ++ return ret; ++ ++ if (retlen != sizeof(magic)) ++ return -EIO; ++ ++ if (le32_to_cpu(magic) != SQUASHFS_MAGIC && ++ magic != 0x19852003) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int tplink_parse_partitions_offset(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data, ++ size_t offset) ++{ ++ struct mtd_partition *parts; ++ struct tplink_fw_header *header; ++ int nr_parts; ++ size_t art_offset; ++ size_t rootfs_offset; ++ size_t squashfs_offset; ++ int ret; ++ ++ nr_parts = TPLINK_NUM_PARTS; ++ parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL); ++ if (!parts) { ++ ret = -ENOMEM; ++ goto err; ++ } ++ ++ header = tplink_read_header(master, offset); ++ if (!header) { ++ pr_notice("%s: no TP-Link header found\n", master->name); ++ ret = -ENODEV; ++ goto err_free_parts; ++ } ++ ++ squashfs_offset = offset + sizeof(struct tplink_fw_header) + ++ be32_to_cpu(header->kernel_len); ++ ++ ret = tplink_check_rootfs_magic(master, squashfs_offset); ++ if (ret == 0) ++ rootfs_offset = squashfs_offset; ++ else ++ rootfs_offset = offset + be32_to_cpu(header->rootfs_ofs); ++ ++ art_offset = master->size - TPLINK_ART_LEN; ++ ++ parts[0].name = "u-boot"; ++ parts[0].offset = 0; ++ parts[0].size = offset; ++ parts[0].mask_flags = MTD_WRITEABLE; ++ ++ parts[1].name = "kernel"; ++ parts[1].offset = offset; ++ parts[1].size = rootfs_offset - offset; ++ ++ parts[2].name = "rootfs"; ++ parts[2].offset = rootfs_offset; ++ parts[2].size = art_offset - rootfs_offset; ++ ++ parts[3].name = "art"; ++ parts[3].offset = art_offset; ++ parts[3].size = TPLINK_ART_LEN; ++ parts[3].mask_flags = MTD_WRITEABLE; ++ ++ parts[4].name = "firmware"; ++ parts[4].offset = offset; ++ parts[4].size = art_offset - offset; ++ ++ vfree(header); ++ ++ *pparts = parts; ++ return nr_parts; ++ ++err_free_parts: ++ kfree(parts); ++err: ++ *pparts = NULL; ++ return ret; ++} ++ ++static int tplink_parse_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ return tplink_parse_partitions_offset(master, pparts, data, ++ TPLINK_KERNEL_OFFS); ++} ++ ++static int tplink_parse_64k_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ return tplink_parse_partitions_offset(master, pparts, data, ++ TPLINK_64K_KERNEL_OFFS); ++} ++ ++static struct mtd_part_parser tplink_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = tplink_parse_partitions, ++ .name = "tp-link", ++}; ++ ++static struct mtd_part_parser tplink_64k_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = tplink_parse_64k_partitions, ++ .name = "tp-link-64k", ++}; ++ ++static int __init tplink_parser_init(void) ++{ ++ register_mtd_parser(&tplink_parser); ++ register_mtd_parser(&tplink_64k_parser); ++ ++ return 0; ++} ++ ++module_init(tplink_parser_init); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch b/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch index 71951a4ede..281cd2c351 100644 --- a/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch +++ b/target/linux/ath79/patches-5.4/405-mtd-tp-link-partition-parser.patch @@ -1,25 +1,244 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -46,6 +46,12 @@ menu "Partition parsers" - source "drivers/mtd/parsers/Kconfig" - endmenu +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -184,3 +184,9 @@ config MTD_MYLOADER_PARTS + You will still need the parsing functions to be called by the driver + for your particular device. It won't happen automatically. ++ +config MTD_TPLINK_PARTS + tristate "TP-Link AR7XXX/AR9XXX partitioning support" + depends on ATH79 + ---help--- + TBD. +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -11,3 +11,4 @@ obj-$(CONFIG_MTD_PARSER_TRX) += parser_ + obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o + obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o + obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ++obj-$(CONFIG_MTD_TPLINK_PARTS) += tplinkpart.o +--- /dev/null ++++ b/drivers/mtd/parsers/tplinkpart.c +@@ -0,0 +1,222 @@ ++/* ++ * Copyright (C) 2011 Gabor Juhos ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ + - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD) += mtd.o - mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o - - obj-y += parsers/ -+obj-$(CONFIG_MTD_TPLINK_PARTS) += tplinkpart.o - - obj-$(CONFIG_MTD_SPLIT) += mtdsplit/ - ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define TPLINK_NUM_PARTS 5 ++#define TPLINK_HEADER_V1 0x01000000 ++#define TPLINK_HEADER_V2 0x02000000 ++#define MD5SUM_LEN 16 ++ ++#define TPLINK_ART_LEN 0x10000 ++#define TPLINK_KERNEL_OFFS 0x20000 ++#define TPLINK_64K_KERNEL_OFFS 0x10000 ++ ++struct tplink_fw_header { ++ uint32_t version; /* header version */ ++ char vendor_name[24]; ++ char fw_version[36]; ++ uint32_t hw_id; /* hardware id */ ++ uint32_t hw_rev; /* hardware revision */ ++ uint32_t unk1; ++ uint8_t md5sum1[MD5SUM_LEN]; ++ uint32_t unk2; ++ uint8_t md5sum2[MD5SUM_LEN]; ++ uint32_t unk3; ++ uint32_t kernel_la; /* kernel load address */ ++ uint32_t kernel_ep; /* kernel entry point */ ++ uint32_t fw_length; /* total length of the firmware */ ++ uint32_t kernel_ofs; /* kernel data offset */ ++ uint32_t kernel_len; /* kernel data length */ ++ uint32_t rootfs_ofs; /* rootfs data offset */ ++ uint32_t rootfs_len; /* rootfs data length */ ++ uint32_t boot_ofs; /* bootloader data offset */ ++ uint32_t boot_len; /* bootloader data length */ ++ uint8_t pad[360]; ++} __attribute__ ((packed)); ++ ++static struct tplink_fw_header * ++tplink_read_header(struct mtd_info *mtd, size_t offset) ++{ ++ struct tplink_fw_header *header; ++ size_t header_len; ++ size_t retlen; ++ int ret; ++ u32 t; ++ ++ header = vmalloc(sizeof(*header)); ++ if (!header) ++ goto err; ++ ++ header_len = sizeof(struct tplink_fw_header); ++ ret = mtd_read(mtd, offset, header_len, &retlen, ++ (unsigned char *) header); ++ if (ret) ++ goto err_free_header; ++ ++ if (retlen != header_len) ++ goto err_free_header; ++ ++ /* sanity checks */ ++ t = be32_to_cpu(header->version); ++ if ((t != TPLINK_HEADER_V1) && (t != TPLINK_HEADER_V2)) ++ goto err_free_header; ++ ++ t = be32_to_cpu(header->kernel_ofs); ++ if (t != header_len) ++ goto err_free_header; ++ ++ return header; ++ ++err_free_header: ++ vfree(header); ++err: ++ return NULL; ++} ++ ++static int tplink_check_rootfs_magic(struct mtd_info *mtd, size_t offset) ++{ ++ u32 magic; ++ size_t retlen; ++ int ret; ++ ++ ret = mtd_read(mtd, offset, sizeof(magic), &retlen, ++ (unsigned char *) &magic); ++ if (ret) ++ return ret; ++ ++ if (retlen != sizeof(magic)) ++ return -EIO; ++ ++ if (le32_to_cpu(magic) != SQUASHFS_MAGIC && ++ magic != 0x19852003) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int tplink_parse_partitions_offset(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data, ++ size_t offset) ++{ ++ struct mtd_partition *parts; ++ struct tplink_fw_header *header; ++ int nr_parts; ++ size_t art_offset; ++ size_t rootfs_offset; ++ size_t squashfs_offset; ++ int ret; ++ ++ nr_parts = TPLINK_NUM_PARTS; ++ parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL); ++ if (!parts) { ++ ret = -ENOMEM; ++ goto err; ++ } ++ ++ header = tplink_read_header(master, offset); ++ if (!header) { ++ pr_notice("%s: no TP-Link header found\n", master->name); ++ ret = -ENODEV; ++ goto err_free_parts; ++ } ++ ++ squashfs_offset = offset + sizeof(struct tplink_fw_header) + ++ be32_to_cpu(header->kernel_len); ++ ++ ret = tplink_check_rootfs_magic(master, squashfs_offset); ++ if (ret == 0) ++ rootfs_offset = squashfs_offset; ++ else ++ rootfs_offset = offset + be32_to_cpu(header->rootfs_ofs); ++ ++ art_offset = master->size - TPLINK_ART_LEN; ++ ++ parts[0].name = "u-boot"; ++ parts[0].offset = 0; ++ parts[0].size = offset; ++ parts[0].mask_flags = MTD_WRITEABLE; ++ ++ parts[1].name = "kernel"; ++ parts[1].offset = offset; ++ parts[1].size = rootfs_offset - offset; ++ ++ parts[2].name = "rootfs"; ++ parts[2].offset = rootfs_offset; ++ parts[2].size = art_offset - rootfs_offset; ++ ++ parts[3].name = "art"; ++ parts[3].offset = art_offset; ++ parts[3].size = TPLINK_ART_LEN; ++ parts[3].mask_flags = MTD_WRITEABLE; ++ ++ parts[4].name = "firmware"; ++ parts[4].offset = offset; ++ parts[4].size = art_offset - offset; ++ ++ vfree(header); ++ ++ *pparts = parts; ++ return nr_parts; ++ ++err_free_parts: ++ kfree(parts); ++err: ++ *pparts = NULL; ++ return ret; ++} ++ ++static int tplink_parse_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ return tplink_parse_partitions_offset(master, pparts, data, ++ TPLINK_KERNEL_OFFS); ++} ++ ++static int tplink_parse_64k_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ return tplink_parse_partitions_offset(master, pparts, data, ++ TPLINK_64K_KERNEL_OFFS); ++} ++ ++static struct mtd_part_parser tplink_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = tplink_parse_partitions, ++ .name = "tp-link", ++}; ++ ++static struct mtd_part_parser tplink_64k_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = tplink_parse_64k_partitions, ++ .name = "tp-link-64k", ++}; ++ ++static int __init tplink_parser_init(void) ++{ ++ register_mtd_parser(&tplink_parser); ++ register_mtd_parser(&tplink_64k_parser); ++ ++ return 0; ++} ++ ++module_init(tplink_parser_init); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Gabor Juhos "); From d8b3f53f5e1fe13d2468feff94f4a1f8e53ba53a Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 14 Apr 2020 16:10:49 +0200 Subject: [PATCH 4/8] ltq-adsl(-fw): Makefile clean-up and fixes This fixes a few minor issues (partially cosmetic) in ltq-adsl and ltq-adsl-fw Makefiles: - fix PKG_SOURCE_URL and switch to https - remove non-existant FW_NAME variable - fix package name for config inclusion - fix config symbol for debugging Fixes: 1d0a9d0c0470 ("move ltq-adsl") Cc: John Crispin Signed-off-by: Adrian Schmutzler --- package/kernel/lantiq/ltq-adsl-fw/Makefile | 6 +++--- package/kernel/lantiq/ltq-adsl/Config.in | 6 +++--- package/kernel/lantiq/ltq-adsl/Makefile | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package/kernel/lantiq/ltq-adsl-fw/Makefile b/package/kernel/lantiq/ltq-adsl-fw/Makefile index 5775d0cf50..66f91a991e 100644 --- a/package/kernel/lantiq/ltq-adsl-fw/Makefile +++ b/package/kernel/lantiq/ltq-adsl-fw/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/ltq-dsl-fw-$(PKG_VERSION) PKG_SOURCE:=ltq-dsl-fw-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ +PKG_SOURCE_URL:=https://sources.openwrt.org/ PKG_HASH:=28676d41c4b76e5bf7a2c5eae106a61fb96b93eabc0cb71120575fff9997269f PKG_MAINTAINER:=John Crispin @@ -45,8 +45,8 @@ endef define Package/kmod-ltq-adsl-$(BUILD_VARIANT)/install $(INSTALL_DIR) $(1)/lib/firmware/ - $(CP) $(PKG_BUILD_DIR)/$(FW_NAME)/ltq-dsl-fw-$(ANNEX)-$(SOC).bin $(1)/lib/firmware/ - ln -s /lib/firmware/$(FW_NAME)/ltq-dsl-fw-$(ANNEX)-$(SOC).bin $(1)/lib/firmware/adsl.bin + $(CP) $(PKG_BUILD_DIR)/ltq-dsl-fw-$(ANNEX)-$(SOC).bin $(1)/lib/firmware/ + ln -s /lib/firmware/ltq-dsl-fw-$(ANNEX)-$(SOC).bin $(1)/lib/firmware/adsl.bin endef $(eval $(call BuildPackage,kmod-ltq-adsl-danube-fw-a)) diff --git a/package/kernel/lantiq/ltq-adsl/Config.in b/package/kernel/lantiq/ltq-adsl/Config.in index 6d9caf4419..8ae65d373a 100644 --- a/package/kernel/lantiq/ltq-adsl/Config.in +++ b/package/kernel/lantiq/ltq-adsl/Config.in @@ -1,5 +1,5 @@ -config LANTIQ_DSL_DEBUG +config LANTIQ_ADSL_DEBUG bool "verbose debugging" - depends on PACKAGE_kmod-ltq-dsl + depends on PACKAGE_kmod-ltq-adsl help - Say Y, if you need ltq-dsl to display debug messages. + Say Y, if you need ltq-adsl to display debug messages. diff --git a/package/kernel/lantiq/ltq-adsl/Makefile b/package/kernel/lantiq/ltq-adsl/Makefile index e6817efffc..1a9128fc58 100644 --- a/package/kernel/lantiq/ltq-adsl/Makefile +++ b/package/kernel/lantiq/ltq-adsl/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-adsl PKG_VERSION:=3.24.4.4 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=drv_dsl_cpe_api_danube-$(PKG_VERSION).tar.gz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/ltq-dsl-$(BUILD_VARIANT)/drv_dsl_cpe_api-$(PKG_VERSION) -PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ +PKG_SOURCE_URL:=https://mirror2.openwrt.org/sources/ PKG_HASH:=eb2ed59715d3bf4e8a1460bbbe2f1660039e0a9f9d72afb1b2b16590094eb33c PKG_MAINTAINER:=John Crispin @@ -38,7 +38,7 @@ KernelPackage/ltq-adsl-danube=$(call KernelPackage/ltq-adsl-template,danube,(TAR KernelPackage/ltq-adsl-ar9=$(call KernelPackage/ltq-adsl-template,ar9,TARGET_lantiq_xway) KernelPackage/ltq-adsl-ase=$(call KernelPackage/ltq-adsl-template,ase,TARGET_lantiq_ase) -define KernelPackage/ltq-dsl/config +define KernelPackage/ltq-adsl/config source "$(SOURCE)/Config.in" endef @@ -75,7 +75,7 @@ CONFIGURE_ARGS += --enable-add-drv-cflags="-DMODULE -DCONFIG_$(CONFIG_TAG_$(BUIL CONFIGURE_ARGS += --enable-danube -ifeq ($(CONFIG_LANTIQ_DSL_DEBUG),y) +ifeq ($(CONFIG_LANTIQ_ADSL_DEBUG),y) CONFIGURE_ARGS += \ --enable-debug=yes \ --enable-debug-prints=yes From c0a80b71254fb8710dbd1942a3916fbcdc02835e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 17 Apr 2020 02:05:23 +0200 Subject: [PATCH 5/8] ath79: rename qca9557.dtsi to qca955x.dtsi There are at least 3 different chips in the Scorpion series of SoCs. Rename the common DTSI to better reflect it's purpose for the whole series. Also rename the compatible bindings from qca,ar9557 and qca,qca9557 to qca,qca9550. Signed-off-by: David Bauer --- target/linux/ath79/dts/qca9556_avm_fritz-repeater.dtsi | 2 +- .../dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts | 2 +- target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts | 2 +- target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi | 2 +- target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi | 2 +- target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi | 2 +- target/linux/ath79/dts/qca9558_domywifi_dw33d.dts | 2 +- target/linux/ath79/dts/qca9558_engenius_ecb1750.dts | 2 +- target/linux/ath79/dts/qca9558_engenius_epg5000.dts | 2 +- .../ath79/dts/qca9558_librerouter_librerouter-v1.dts | 2 +- .../dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts | 2 +- target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi | 2 +- target/linux/ath79/dts/qca9558_ocedo_koala.dts | 2 +- target/linux/ath79/dts/qca9558_ocedo_ursus.dts | 2 +- target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts | 2 +- target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts | 2 +- target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi | 2 +- target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi | 2 +- target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts | 2 +- target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts | 2 +- target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts | 2 +- target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts | 2 +- target/linux/ath79/dts/{qca9557.dtsi => qca955x.dtsi} | 8 ++++---- 26 files changed, 29 insertions(+), 29 deletions(-) rename target/linux/ath79/dts/{qca9557.dtsi => qca955x.dtsi} (97%) diff --git a/target/linux/ath79/dts/qca9556_avm_fritz-repeater.dtsi b/target/linux/ath79/dts/qca9556_avm_fritz-repeater.dtsi index b1f5f1bdb3..34b47b15f7 100644 --- a/target/linux/ath79/dts/qca9556_avm_fritz-repeater.dtsi +++ b/target/linux/ath79/dts/qca9556_avm_fritz-repeater.dtsi @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts index 529ac1cf3b..74cf1315b6 100644 --- a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts +++ b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "mikrotik,routerboard-wap-g-5hact2hnd", "qca,qca9556"; diff --git a/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts b/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts index be1ebac41d..7f6c6b5889 100644 --- a/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts +++ b/target/linux/ath79/dts/qca9557_buffalo_bhr-4grv2.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "buffalo,bhr-4grv2", "qca,qca9557"; diff --git a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi index b43ab2c6b6..2b199bfa48 100644 --- a/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi +++ b/target/linux/ath79/dts/qca9557_iodata_wn-ac-dgr.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { aliases { diff --git a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi index 8ee967ab9f..e2a71c0ce6 100644 --- a/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi +++ b/target/linux/ath79/dts/qca9558_comfast_cf-wr650ac.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi b/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi index 42b45c5900..25e0fee3bd 100644 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi +++ b/target/linux/ath79/dts/qca9558_devolo_dvl1xxx.dtsi @@ -13,7 +13,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts index b71bec4e04..5e6e44be74 100644 --- a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts +++ b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "domywifi,dw33d", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts b/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts index 3ccf92a9f7..4bd028a1c6 100644 --- a/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts +++ b/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "engenius,ecb1750", "qca,qca9557"; diff --git a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts index 72179f1da0..850a31790f 100644 --- a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts +++ b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { model = "EnGenius EPG5000"; diff --git a/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts b/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts index 5c01126bc4..ef00d1807b 100644 --- a/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts +++ b/target/linux/ath79/dts/qca9558_librerouter_librerouter-v1.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "librerouter,librerouter-v1", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts index 3f2a1a51a6..dd4d523368 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "mikrotik,routerboard-922uags-5hpacd", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi index bbb43354c4..19b6d5c8cb 100644 --- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi +++ b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts index 77c332cc4e..de24a2c569 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "ocedo,koala", "qca,qca9557"; diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts index 5ae2e2bbb9..b790ed11a2 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "ocedo,ursus", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts index 83e76e463e..e068fd7520 100644 --- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts +++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "openmesh,om5p-ac-v2", "qca,qca9557"; diff --git a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts index d3d9635693..98f2789564 100644 --- a/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts +++ b/target/linux/ath79/dts/qca9558_sitecom_wlr-8100.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { model = "Sitecom WLR-8100 (X8 AC1750)"; diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi index 9f5d7a6fcf..1a550137dd 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi index a65d4e2b53..aab8eac7ce 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts b/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts index f802de271e..8e79e12617 100644 --- a/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts +++ b/target/linux/ath79/dts/qca9558_tplink_re350k-v1.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { model = "TP-Link RE350K v1"; diff --git a/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi b/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi index 8827990eb5..2dde5585cd 100644 --- a/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts index 4f6d39e92e..0003bd1924 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "tplink,tl-wdr4900-v2", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi index a3f2b11212..72062e5d1e 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi @@ -3,7 +3,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { chosen { diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts index 13dacc2ff8..fb60631a3c 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr941n-v7-cn.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "tplink,tl-wr941n-v7-cn", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts index 4bacf4723f..fb7d5fe40c 100644 --- a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts +++ b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "trendnet,tew-823dru", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts index 2f00d0ba4d..ac4a70fbde 100644 --- a/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts +++ b/target/linux/ath79/dts/qca9558_zyxel_nbg6716.dts @@ -4,7 +4,7 @@ #include #include -#include "qca9557.dtsi" +#include "qca955x.dtsi" / { compatible = "zyxel,nbg6716", "qca,qca9558"; diff --git a/target/linux/ath79/dts/qca9557.dtsi b/target/linux/ath79/dts/qca955x.dtsi similarity index 97% rename from target/linux/ath79/dts/qca9557.dtsi rename to target/linux/ath79/dts/qca955x.dtsi index ede658af6d..5bcaccaa14 100644 --- a/target/linux/ath79/dts/qca9557.dtsi +++ b/target/linux/ath79/dts/qca955x.dtsi @@ -3,7 +3,7 @@ #include "ath79.dtsi" / { - compatible = "qca,qca9557"; + compatible = "qca,qca9550"; #address-cells = <1>; #size-cells = <1>; @@ -30,7 +30,7 @@ ahb { apb { ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar9557-ddr-controller", + compatible = "qca,qca9550-ddr-controller", "qca,ar7240-ddr-controller"; reg = <0x18000000 0x100>; @@ -78,7 +78,7 @@ }; gpio: gpio@18040000 { - compatible = "qca,ar9557-gpio", + compatible = "qca,qca9550-gpio", "qca,ar9340-gpio"; reg = <0x18040000 0x28>; @@ -110,7 +110,7 @@ }; pll: pll-controller@18050000 { - compatible = "qca,ar9557-pll", + compatible = "qca,qca9550-pll", "qca,qca9550-pll", "syscon"; reg = <0x18050000 0x50>; From fceef288cf4c15d9d04bb3d8492159c48e5e0e7f Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 18 Apr 2020 19:16:05 +0200 Subject: [PATCH 6/8] ath79: correct QCA9550 machine compatible binding Some boards using a QCA9556 or QCA9558 had their machine compatible binding incorrectly set to qca,qca9557. Signed-off-by: David Bauer --- target/linux/ath79/dts/qca9556_avm_fritz1750e.dts | 2 +- target/linux/ath79/dts/qca9556_avm_fritz450e.dts | 2 +- target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts | 2 +- target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts | 2 +- target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts | 2 +- target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts | 2 +- target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts | 2 +- target/linux/ath79/dts/qca9558_engenius_ecb1750.dts | 2 +- target/linux/ath79/dts/qca9558_engenius_epg5000.dts | 2 +- target/linux/ath79/dts/qca9558_ocedo_koala.dts | 2 +- target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v2.dts | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v3.dts | 2 +- target/linux/ath79/dts/qca9558_tplink_tl-wr1045nd-v2.dts | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts b/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts index 25d3ae8da4..772588fa9c 100644 --- a/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts +++ b/target/linux/ath79/dts/qca9556_avm_fritz1750e.dts @@ -5,7 +5,7 @@ #include "qca9556_avm_fritz-repeater.dtsi" / { - compatible = "avm,fritz1750e", "qca,qca9557"; + compatible = "avm,fritz1750e", "qca,qca9556"; model = "AVM FRITZ!WLAN Repeater 1750E"; aliases { diff --git a/target/linux/ath79/dts/qca9556_avm_fritz450e.dts b/target/linux/ath79/dts/qca9556_avm_fritz450e.dts index 60685bd3f1..a6ffef7dc4 100644 --- a/target/linux/ath79/dts/qca9556_avm_fritz450e.dts +++ b/target/linux/ath79/dts/qca9556_avm_fritz450e.dts @@ -5,7 +5,7 @@ #include "qca9556_avm_fritz-repeater.dtsi" / { - compatible = "avm,fritz450e", "qca,qca9557"; + compatible = "avm,fritz450e", "qca,qca9556"; model = "AVM FRITZ!WLAN Repeater 450E"; aliases { diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts index 4828a5e0f5..74506c2a80 100644 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts +++ b/target/linux/ath79/dts/qca9558_devolo_dvl1200e.dts @@ -4,7 +4,7 @@ #include "qca9558_devolo_dvl1xxx.dtsi" / { - compatible = "devolo,dvl1200e", "qca,qca9557"; + compatible = "devolo,dvl1200e", "qca,qca9558"; model = "devolo WiFi pro 1200e"; aliases { diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts index 61e6a665b9..4ccde031a7 100644 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts +++ b/target/linux/ath79/dts/qca9558_devolo_dvl1200i.dts @@ -4,7 +4,7 @@ #include "qca9558_devolo_dvl1xxx.dtsi" / { - compatible = "devolo,dvl1200i", "qca,qca9557"; + compatible = "devolo,dvl1200i", "qca,qca9558"; model = "devolo WiFi pro 1200i"; aliases { diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts index bd57f34e53..6dbef96aec 100644 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts +++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750c.dts @@ -4,7 +4,7 @@ #include "qca9558_devolo_dvl1xxx.dtsi" / { - compatible = "devolo,dvl1750c", "qca,qca9557"; + compatible = "devolo,dvl1750c", "qca,qca9558"; model = "devolo WiFi pro 1750c"; aliases { diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts index 9e50d9ffe8..f8394ca86e 100644 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts +++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts @@ -4,7 +4,7 @@ #include "qca9558_devolo_dvl1xxx.dtsi" / { - compatible = "devolo,dvl1750e", "qca,qca9557"; + compatible = "devolo,dvl1750e", "qca,qca9558"; model = "devolo WiFi pro 1750e"; aliases { diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts index c088a0b6f5..002d8b2137 100644 --- a/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts +++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750i.dts @@ -4,7 +4,7 @@ #include "qca9558_devolo_dvl1xxx.dtsi" / { - compatible = "devolo,dvl1750i", "qca,qca9557"; + compatible = "devolo,dvl1750i", "qca,qca9558"; model = "devolo WiFi pro 1750i"; aliases { diff --git a/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts b/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts index 4bd028a1c6..15286b7670 100644 --- a/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts +++ b/target/linux/ath79/dts/qca9558_engenius_ecb1750.dts @@ -7,7 +7,7 @@ #include "qca955x.dtsi" / { - compatible = "engenius,ecb1750", "qca,qca9557"; + compatible = "engenius,ecb1750", "qca,qca9558"; model = "EnGenius ECB1750"; chosen { diff --git a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts index 850a31790f..94daefbb79 100644 --- a/target/linux/ath79/dts/qca9558_engenius_epg5000.dts +++ b/target/linux/ath79/dts/qca9558_engenius_epg5000.dts @@ -8,7 +8,7 @@ / { model = "EnGenius EPG5000"; - compatible = "engenius,epg5000", "qca,qca9557"; + compatible = "engenius,epg5000", "qca,qca9558"; chosen { bootargs = "console=ttyS0,115200n8"; diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts index de24a2c569..b3934a90d4 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts @@ -7,7 +7,7 @@ #include "qca955x.dtsi" / { - compatible = "ocedo,koala", "qca,qca9557"; + compatible = "ocedo,koala", "qca,qca9558"; model = "OCEDO Koala"; chosen { diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts index e068fd7520..2c8401d731 100644 --- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts +++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts @@ -7,7 +7,7 @@ #include "qca955x.dtsi" / { - compatible = "openmesh,om5p-ac-v2", "qca,qca9557"; + compatible = "openmesh,om5p-ac-v2", "qca,qca9558"; model = "OpenMesh OM5P-AC V2"; extosc: ref { diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v2.dts index 21256ea160..cd510632eb 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v2.dts @@ -4,6 +4,6 @@ #include "qca9558_tplink_tl-wr1043nd.dtsi" / { - compatible = "tplink,tl-wr1043nd-v2", "qca,qca9557"; + compatible = "tplink,tl-wr1043nd-v2", "qca,qca9558"; model = "TP-Link TL-WR1043ND v2"; }; diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v3.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v3.dts index 7b1ca788f9..3564a4392f 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v3.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd-v3.dts @@ -4,6 +4,6 @@ #include "qca9558_tplink_tl-wr1043nd.dtsi" / { - compatible = "tplink,tl-wr1043nd-v3", "qca,qca9557"; + compatible = "tplink,tl-wr1043nd-v3", "qca,qca9558"; model = "TP-Link TL-WR1043ND v3"; }; diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1045nd-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wr1045nd-v2.dts index 879b55549f..9ae3670aaf 100644 --- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1045nd-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1045nd-v2.dts @@ -4,6 +4,6 @@ #include "qca9558_tplink_tl-wr1043nd.dtsi" / { - compatible = "tplink,tl-wr1045nd-v2", "qca,qca9557"; + compatible = "tplink,tl-wr1045nd-v2", "qca,qca9558"; model = "TP-Link TL-WR1045ND v2"; }; From 1f45ed6c994b154e657bbcab4465ce5f41154e7f Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 19 Apr 2020 18:28:09 +0200 Subject: [PATCH 7/8] ath79: fix QCA953x DDR and GPIO compatible bindings The memory as well as GPIO controller had the wrong SoC name used for their compatible binding. Signed-off-by: David Bauer --- target/linux/ath79/dts/qca953x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/qca953x.dtsi b/target/linux/ath79/dts/qca953x.dtsi index f7e0703e4e..af85e8482a 100644 --- a/target/linux/ath79/dts/qca953x.dtsi +++ b/target/linux/ath79/dts/qca953x.dtsi @@ -34,7 +34,7 @@ ahb { apb { ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar9530-ddr-controller", + compatible = "qca,qca9530-ddr-controller", "qca,ar7240-ddr-controller"; reg = <0x18000000 0x128>; @@ -69,7 +69,7 @@ }; gpio: gpio@18040000 { - compatible = "qca,ar9530-gpio", + compatible = "qca,qca9530-gpio", "qca,ar9340-gpio"; reg = <0x18040000 0x28>; From 9fac9168c6471b743dbaac5cd038593f9f807e9d Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 23 Apr 2020 01:21:11 +0200 Subject: [PATCH 8/8] ipq40xx: fix alphabetical order in 02_network Signed-off-by: David Bauer --- .../ipq40xx/base-files/etc/board.d/02_network | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 0e4b947c5f..d427c64a33 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -18,6 +18,17 @@ ipq40xx_setup_interfaces() engenius,ens620ext) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; + aruba,ap-303|\ + avm,fritzrepeater-1200|\ + dlink,dap-2610 |\ + engenius,eap1300|\ + engenius,emd1|\ + meraki,mr33|\ + netgear,ex6100v2|\ + netgear,ex6150v2|\ + zyxel,wre6606) + ucidef_set_interface_lan "eth0" + ;; aruba,ap-303h) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ @@ -46,17 +57,6 @@ ipq40xx_setup_interfaces() ucidef_add_switch "switch0" \ "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ;; - aruba,ap-303|\ - avm,fritzrepeater-1200|\ - dlink,dap-2610 |\ - engenius,eap1300|\ - engenius,emd1|\ - meraki,mr33|\ - netgear,ex6100v2|\ - netgear,ex6150v2|\ - zyxel,wre6606) - ucidef_set_interface_lan "eth0" - ;; avm,fritzrepeater-3000|\ compex,wpj419|\ compex,wpj428|\