ar71xx: backport patches for archer c25/c59/c60 support

This commit is contained in:
RubenKelevra 2017-06-26 22:50:09 +02:00
parent 08e667ba2e
commit ce64ec7656
14 changed files with 3333 additions and 0 deletions

View File

@ -0,0 +1,291 @@
From 2f964ef7d3e7bc0902e8171523e30a9623b6da0e Mon Sep 17 00:00:00 2001
From: Jan Niehusmann <jan@gondor.com>
Date: Fri, 19 May 2017 09:42:24 +0200
Subject: [PATCH] firmware-utils: tplink-safeloader: support strings as
soft_version
Some TP-Link routers (C25, C59, C60) contain a version string instead
of a binary structure in the soft_version partition.
Flashing LEDE from the original firmware's GUI, this version string
taken from the soft_ver partition of the firmware image is written to
the router's config partition.
When using tftp recovery to go back to the original Archer C25 firmware,
a version check compares that version to the version of the firmware to
be flashed.
Without proper contents in the config partition, reverting to the
original firmware fails.
Therefore, write the string "soft_ver:1.0.0\n" to that soft_ver
partition.
Signed-off-by: Jan Niehusmann <jan@gondor.com>
---
tools/firmware-utils/src/tplink-safeloader.c | 151 ++++++++++++++++++++++++++-
1 file changed, 150 insertions(+), 1 deletion(-)
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 4e3d2058b2..9c9efc369c 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -75,6 +75,7 @@ struct device_info {
const char *vendor;
const char *support_list;
char support_trail;
+ const char *soft_ver;
const struct flash_partition_entry partitions[MAX_PARTITIONS+1];
const char *first_sysupgrade_partition;
const char *last_sysupgrade_partition;
@@ -130,6 +131,7 @@ static struct device_info boards[] = {
"CPE220(TP-LINK|US|N300-2):1.1\r\n"
"CPE220(TP-LINK|EU|N300-2):1.1\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -167,6 +169,7 @@ static struct device_info boards[] = {
"CPE520(TP-LINK|US|N300-5):1.1\r\n"
"CPE520(TP-LINK|EU|N300-5):1.1\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -198,6 +201,7 @@ static struct device_info boards[] = {
"WBS210(TP-LINK|US|N300-2):1.20\r\n"
"WBS210(TP-LINK|EU|N300-2):1.20\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -229,6 +233,7 @@ static struct device_info boards[] = {
"WBS510(TP-LINK|US|N300-5):1.20\r\n"
"WBS510(TP-LINK|EU|N300-5):1.20\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -259,6 +264,7 @@ static struct device_info boards[] = {
"SupportList:\r\n"
"{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
.partitions = {
{"SBL1", 0x00000, 0x20000},
@@ -293,6 +299,79 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the C59v1 */
+ {
+ .id = "ARCHER-C59-V1",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:Archer C59,product_ver:1.0.0,special_id:00000000}\r\n"
+ "{product_name:Archer C59,product_ver:1.0.0,special_id:45550000}\r\n"
+ "{product_name:Archer C59,product_ver:1.0.0,special_id:55530000}\r\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x10000},
+ {"default-mac", 0x10000, 0x00200},
+ {"pin", 0x10200, 0x00200},
+ {"device-id", 0x10400, 0x00100},
+ {"product-info", 0x10500, 0x0fb00},
+ {"os-image", 0x20000, 0x180000},
+ {"file-system", 0x1a0000, 0xcb0000},
+ {"partition-table", 0xe50000, 0x10000},
+ {"soft-version", 0xe60000, 0x10000},
+ {"support-list", 0xe70000, 0x10000},
+ {"profile", 0xe80000, 0x10000},
+ {"default-config", 0xe90000, 0x10000},
+ {"user-config", 0xea0000, 0x40000},
+ {"usb-config", 0xee0000, 0x10000},
+ {"certificate", 0xef0000, 0x10000},
+ {"qos-db", 0xf00000, 0x40000},
+ {"log", 0xfe0000, 0x10000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
+ /** Firmware layout for the C60v1 */
+ {
+ .id = "ARCHER-C60-V1",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:Archer C60,product_ver:1.0.0,special_id:00000000}\r\n"
+ "{product_name:Archer C60,product_ver:1.0.0,special_id:45550000}\r\n"
+ "{product_name:Archer C60,product_ver:1.0.0,special_id:55530000}\r\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x10000},
+ {"default-mac", 0x10000, 0x00200},
+ {"pin", 0x10200, 0x00200},
+ {"product-info", 0x10400, 0x00100},
+ {"partition-table", 0x10500, 0x00800},
+ {"soft-version", 0x11300, 0x00200},
+ {"support-list", 0x11500, 0x00100},
+ {"device-id", 0x11600, 0x00100},
+ {"profile", 0x11700, 0x03900},
+ {"default-config", 0x15000, 0x04000},
+ {"user-config", 0x19000, 0x04000},
+ {"os-image", 0x20000, 0x150000},
+ {"file-system", 0x170000, 0x678000},
+ {"certyficate", 0x7e8000, 0x08000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the C5 */
{
.id = "ARCHER-C5-V2",
@@ -303,6 +382,7 @@ static struct device_info boards[] = {
"product_ver:2.0.0,"
"special_id:00000000}\r\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x40000},
@@ -337,6 +417,7 @@ static struct device_info boards[] = {
"product_ver:1.0.0,"
"special_id:00000000}\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x40000},
@@ -369,6 +450,7 @@ static struct device_info boards[] = {
"SupportList:\r\n"
"EAP120(TP-LINK|UN|N300-2):1.0\r\n",
.support_trail = '\xff',
+ .soft_ver = NULL,
.partitions = {
{"fs-uboot", 0x00000, 0x20000},
@@ -390,6 +472,50 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the TL-WA850RE v2 */
+ {
+ .id = "TLWA850REV2",
+ .vendor = "",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55530000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:00000000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:55534100}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:45550000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4B520000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:42520000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:4A500000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:43410000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:41550000}\n"
+ "{product_name:TL-WA850RE,product_ver:2.0.0,special_id:52550000}\n",
+ .support_trail = '\x00',
+ .soft_ver = NULL,
+
+ /**
+ 576KB were moved from file-system to os-image
+ in comparison to the stock image
+ */
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"os-image", 0x20000, 0x150000},
+ {"file-system", 0x170000, 0x240000},
+ {"partition-table", 0x3b0000, 0x02000},
+ {"default-mac", 0x3c0000, 0x00020},
+ {"pin", 0x3c0100, 0x00020},
+ {"product-info", 0x3c1000, 0x01000},
+ {"soft-version", 0x3c2000, 0x00100},
+ {"support-list", 0x3c3000, 0x01000},
+ {"profile", 0x3c4000, 0x08000},
+ {"user-config", 0x3d0000, 0x10000},
+ {"default-config", 0x3e0000, 0x10000},
+ {"radio", 0x3f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system"
+ },
+
/** Firmware layout for the TL-WR1043 v4 */
{
.id = "TLWR1043NDV4",
@@ -398,6 +524,7 @@ static struct device_info boards[] = {
"SupportList:\n"
"{product_name:TL-WR1043ND,product_ver:4.0.0,special_id:45550000}\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
/**
We use a bigger os-image partition than the stock images (and thus
@@ -441,6 +568,7 @@ static struct device_info boards[] = {
"{product_name:RE450,product_ver:1.0.0,special_id:4B520000}\r\n"
"{product_name:RE450,product_ver:1.0.0,special_id:55534100}\r\n",
.support_trail = '\x00',
+ .soft_ver = NULL,
/**
The flash partition table for RE450;
@@ -569,6 +697,23 @@ static struct image_partition_entry make_soft_version(uint32_t rev) {
return entry;
}
+static struct image_partition_entry make_soft_version_from_string(const char *soft_ver) {
+ /** String length _including_ the terminating zero byte */
+ uint32_t ver_len = strlen(soft_ver) + 1;
+ /** Partition contains 64 bit header, the version string, and one additional null byte */
+ size_t partition_len = 2*sizeof(uint32_t) + ver_len + 1;
+ struct image_partition_entry entry = alloc_image_partition("soft-version", partition_len);
+
+ uint32_t *len = (uint32_t *)entry.data;
+ len[0] = htonl(ver_len);
+ len[1] = 0;
+ memcpy(&len[2], soft_ver, ver_len);
+
+ entry.data[partition_len - 1] = 0;
+
+ return entry;
+}
+
/** Generates the support-list partition */
static struct image_partition_entry make_support_list(const struct device_info *info) {
size_t len = strlen(info->support_list);
@@ -799,7 +944,11 @@ static void build_image(const char *output,
struct image_partition_entry parts[6] = {};
parts[0] = make_partition_table(info->partitions);
- parts[1] = make_soft_version(rev);
+ if (info->soft_ver)
+ parts[1] = make_soft_version_from_string(info->soft_ver);
+ else
+ parts[1] = make_soft_version(rev);
+
parts[2] = make_support_list(info);
parts[3] = read_file("os-image", kernel_image, false);
parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
--
2.13.1

View File

@ -0,0 +1,88 @@
From 11b595e5053115a726c075dcc5c9eddf8caaff7e Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Tue, 30 May 2017 22:25:02 +0200
Subject: [PATCH] ar71xx: image: drop redundant uboot-envtools from
DEVICE_PACKAGES
uboot-envtools is already included in DEFAULT_PACKAGES for ar71xx.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index d978dec412..29ed108d5d 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -140,7 +140,7 @@ TARGET_DEVICES += gl-ar300
define Device/gl-ar300m
DEVICE_TITLE := GL AR300M
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 uboot-envtools
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = GL-AR300M
IMAGE_SIZE = 16000k
CONSOLE = ttyS0,115200
@@ -259,7 +259,6 @@ TARGET_DEVICES += wndr3700 wndr3700v2 wndr3800 wndr3800ch wndrmac wndrmacv2
define Device/cap324
DEVICE_TITLE := PowerCloud CAP324 Cloud AP
- DEVICE_PACKAGES := uboot-envtools
BOARDNAME := CAP324
DEVICE_PROFILE := CAP324
IMAGE_SIZE = 15296k
@@ -270,7 +269,6 @@ TARGET_DEVICES += cap324
define Device/cap324-nocloud
DEVICE_TITLE := PowerCloud CAP324 Cloud AP (No-Cloud)
- DEVICE_PACKAGES := uboot-envtools
BOARDNAME := CAP324
DEVICE_PROFILE := CAP324
IMAGE_SIZE = 16000k
@@ -281,7 +279,6 @@ TARGET_DEVICES += cap324-nocloud
define Device/cr3000
DEVICE_TITLE := PowerCloud CR3000 Cloud Router
- DEVICE_PACKAGES := uboot-envtools
BOARDNAME := CR3000
DEVICE_PROFILE := CR3000
IMAGE_SIZE = 7104k
@@ -292,7 +289,6 @@ TARGET_DEVICES += cr3000
define Device/cr3000-nocloud
DEVICE_TITLE := PowerCloud CR3000 (No-Cloud)
- DEVICE_PACKAGES := uboot-envtools
BOARDNAME := CR3000
DEVICE_PROFILE := CR3000
IMAGE_SIZE = 7808k
@@ -303,7 +299,7 @@ TARGET_DEVICES += cr3000-nocloud
define Device/cr5000
DEVICE_TITLE := PowerCloud CR5000 Cloud Router
- DEVICE_PACKAGES := uboot-envtools kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-usb-core
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-usb-core
BOARDNAME := CR5000
DEVICE_PROFILE := CR5000
IMAGE_SIZE = 7104k
@@ -314,7 +310,7 @@ TARGET_DEVICES += cr5000
define Device/cr5000-nocloud
DEVICE_TITLE := PowerCloud CR5000 (No-Cloud)
- DEVICE_PACKAGES := uboot-envtools kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-usb-core
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-usb-core
BOARDNAME := CR5000
DEVICE_PROFILE := CR5000
IMAGE_SIZE = 7808k
@@ -690,7 +686,7 @@ endef
define Device/dap-2695-a1
DEVICE_TITLE := D-Link DAP-2695 rev. A1
- DEVICE_PACKAGES := ath10k-firmware-qca988x kmod-ath10k uboot-envtools
+ DEVICE_PACKAGES := ath10k-firmware-qca988x kmod-ath10k
BOARDNAME = DAP-2695-A1
IMAGES := factory.img sysupgrade.bin
IMAGE_SIZE = 15360k
--
2.13.1

View File

@ -0,0 +1,248 @@
From 3ceeeea448d35004dafbd44c596dfe0535bb8db7 Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Tue, 30 May 2017 22:55:29 +0200
Subject: [PATCH] ar71xx: image: drop redundant kmod-usb-ohci from
DEVICE_PACKAGES
kmod-usb-ohci is needed only on devices with AR71xx and AR7240 SoCs.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 90 ++++++++++++++++++++++++++++-
target/linux/ar71xx/image/legacy-devices.mk | 8 +--
target/linux/ar71xx/image/nand.mk | 6 +-
target/linux/ar71xx/image/ubnt.mk | 8 +--
4 files changed, 98 insertions(+), 14 deletions(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 29ed108d5d..b95ccac86d 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -101,7 +101,7 @@ TARGET_DEVICES += cpe870
define Device/dragino2
BOARDNAME := DRAGINO2
CONSOLE := ttyATH0,115200
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
DEVICE_TITLE := Dragino 2 (MS14)
IMAGE_SIZE := 16000k
MTDPARTS := spi0.0:256k(u-boot)ro,16000k(firmware),64k(config)ro,64k(art)ro
@@ -299,7 +299,7 @@ TARGET_DEVICES += cr3000-nocloud
define Device/cr5000
DEVICE_TITLE := PowerCloud CR5000 Cloud Router
- DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-usb-core
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-core
BOARDNAME := CR5000
DEVICE_PROFILE := CR5000
IMAGE_SIZE = 7104k
@@ -310,7 +310,7 @@ TARGET_DEVICES += cr5000
define Device/cr5000-nocloud
DEVICE_TITLE := PowerCloud CR5000 (No-Cloud)
- DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-usb-core
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-core
BOARDNAME := CR5000
DEVICE_PROFILE := CR5000
IMAGE_SIZE = 7808k
@@ -460,6 +460,33 @@ define Device/onion-omega
endef
TARGET_DEVICES += onion-omega
+define Device/sc1750
+ DEVICE_TITLE := Abicom SC1750
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME = SC1750
+ IMAGE_SIZE = 15744k
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),15744k(firmware),128k(APConfig),128k(kplog),64k(ART)
+endef
+TARGET_DEVICES += sc1750
+
+define Device/sc300m
+ DEVICE_TITLE := Abicom SC300M
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME = SC300M
+ IMAGE_SIZE = 15744k
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),15744k(firmware),128k(APConfig),128k(kplog),64k(ART)
+endef
+TARGET_DEVICES += sc300m
+
+define Device/sc450
+ DEVICE_TITLE := Abicom SC450
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME = SC450
+ IMAGE_SIZE = 15744k
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),15744k(firmware),128k(APConfig),128k(kplog),64k(ART)
+endef
+TARGET_DEVICES += sc450
+
define Device/smart-300
$(Device/tplink-8mlzma)
DEVICE_TITLE := NC-LINK SMART-300
@@ -721,3 +748,60 @@ define Device/bhr-4grv2
IMAGE/factory.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | mkbuffaloimg
endef
TARGET_DEVICES += bhr-4grv2
+
+define Device/wpj342
+ DEVICE_TITLE := Compex WPJ342 (16MB flash)
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME := WPJ342
+ MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
+ IMAGE_SIZE := 16128k
+endef
+TARGET_DEVICES += wpj342
+
+define Device/wpj344
+ DEVICE_TITLE := Compex WPJ344 (16MB flash)
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME := WPJ344
+ MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
+ IMAGE_SIZE := 16128k
+endef
+TARGET_DEVICES += wpj344
+
+define Device/wpj531
+ DEVICE_TITLE := Compex WPJ531 (16MB flash)
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME := WPJ531
+ MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
+ IMAGE_SIZE := 16128k
+endef
+TARGET_DEVICES += wpj531
+
+define Device/wpj558
+ DEVICE_TITLE := Compex WPJ558 (16MB flash)
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME := WPJ558
+ MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
+ IMAGE_SIZE := 16128k
+endef
+TARGET_DEVICES += wpj558
+
+define Device/wpj563
+ DEVICE_TITLE := Compex WPJ563 (16MB flash)
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME := WPJ563
+ MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
+ IMAGE_SIZE := 16128k
+endef
+TARGET_DEVICES += wpj563
+
+define Device/zbt-we1526
+ DEVICE_TITLE := Zbtlink ZBT-WE1526
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+ BOARDNAME := ZBT-WE1526
+ IMAGE_SIZE := 16000k
+ KERNEL_SIZE := 1472k
+ ROOTFS_SIZE := 14528k
+ MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
+ IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += zbt-we1526
diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk
index 87423ce55c..6898079567 100644
--- a/target/linux/ar71xx/image/legacy-devices.mk
+++ b/target/linux/ar71xx/image/legacy-devices.mk
@@ -117,7 +117,7 @@ LEGACY_DEVICES += AP152_16M
define LegacyDevice/BXU2000N2
DEVICE_TITLE := BHU BXU2000n-2
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage
endef
LEGACY_DEVICES += BXU2000N2
@@ -134,19 +134,19 @@ LEGACY_DEVICES += DB120
define LegacyDevice/EWDORINAP
DEVICE_TITLE := Embedded Wireless Dorin Platform (4MB flash)
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
endef
LEGACY_DEVICES += EWDORINAP
define LegacyDevice/EWDORINRT
DEVICE_TITLE := Embedded Wireless Dorin Router
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
endef
LEGACY_DEVICES += EWDORINRT
define LegacyDevice/EWDORIN16M
DEVICE_TITLE := Embedded Wireless Dorin Platform (16MB flash)
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
endef
LEGACY_DEVICES += EWDORIN16M
diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk
index ce1b067c55..aef9fc3ec8 100644
--- a/target/linux/ar71xx/image/nand.mk
+++ b/target/linux/ar71xx/image/nand.mk
@@ -71,19 +71,19 @@ TARGET_DEVICES += z1
define LegacyDevice/R6100
DEVICE_TITLE := NETGEAR R6100
- DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
endef
LEGACY_DEVICES += R6100
define LegacyDevice/WNDR3700V4
DEVICE_TITLE := NETGEAR WNDR3700v4
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
endef
LEGACY_DEVICES += WNDR3700V4
define LegacyDevice/WNDR4300V1
DEVICE_TITLE := NETGEAR WNDR4300v1
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
endef
LEGACY_DEVICES += WNDR4300V1
diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk
index 68fe8ad301..31a9901d12 100644
--- a/target/linux/ar71xx/image/ubnt.mk
+++ b/target/linux/ar71xx/image/ubnt.mk
@@ -53,7 +53,7 @@ define Device/ubnt-xm
endef
define Device/ubnt-xw
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
DEVICE_PROFILE := UBNT
IMAGE_SIZE := 7552k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
@@ -66,7 +66,7 @@ define Device/ubnt-xw
endef
define Device/ubnt-bz
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
DEVICE_PROFILE := UBNT
IMAGE_SIZE := 7552k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
@@ -79,7 +79,7 @@ define Device/ubnt-bz
endef
define Device/ubnt-unifiac
- DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
DEVICE_PROFILE := UBNT
IMAGE_SIZE := 7744k
MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
@@ -136,7 +136,7 @@ endef
define Device/ubnt-unifiac-pro
$(Device/ubnt-unifiac)
DEVICE_TITLE := Ubiquiti UniFi AC-Pro
- DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb2
DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
BOARDNAME := UBNT-UF-AC-PRO
endef
--
2.13.1

View File

@ -0,0 +1,80 @@
From 14ab1dab980220150fc804a06d5ef8537df1d4c9 Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Tue, 30 May 2017 23:20:16 +0200
Subject: [PATCH] ar71xx: image: simplify Compex devices definitions
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index b95ccac86d..77fe70190c 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -749,50 +749,42 @@ define Device/bhr-4grv2
endef
TARGET_DEVICES += bhr-4grv2
-define Device/wpj342
- DEVICE_TITLE := Compex WPJ342 (16MB flash)
+define Device/wpj-16m
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
- BOARDNAME := WPJ342
MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
IMAGE_SIZE := 16128k
endef
-TARGET_DEVICES += wpj342
+
+define Device/wpj342
+ $(Device/wpj-16m)
+ DEVICE_TITLE := Compex WPJ342 (16MB flash)
+ BOARDNAME := WPJ342
+endef
define Device/wpj344
+ $(Device/wpj-16m)
DEVICE_TITLE := Compex WPJ344 (16MB flash)
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
BOARDNAME := WPJ344
- MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
- IMAGE_SIZE := 16128k
endef
-TARGET_DEVICES += wpj344
define Device/wpj531
+ $(Device/wpj-16m)
DEVICE_TITLE := Compex WPJ531 (16MB flash)
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
BOARDNAME := WPJ531
- MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
- IMAGE_SIZE := 16128k
endef
-TARGET_DEVICES += wpj531
define Device/wpj558
+ $(Device/wpj-16m)
DEVICE_TITLE := Compex WPJ558 (16MB flash)
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
BOARDNAME := WPJ558
- MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
- IMAGE_SIZE := 16128k
endef
-TARGET_DEVICES += wpj558
define Device/wpj563
+ $(Device/wpj-16m)
DEVICE_TITLE := Compex WPJ563 (16MB flash)
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
BOARDNAME := WPJ563
- MTDPARTS := spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
- IMAGE_SIZE := 16128k
endef
-TARGET_DEVICES += wpj563
+TARGET_DEVICES += wpj342 wpj344 wpj531 wpj558 wpj563
define Device/zbt-we1526
DEVICE_TITLE := Zbtlink ZBT-WE1526
--
2.13.1

View File

@ -0,0 +1,222 @@
From b01164df0c4b505947053716924fc9156e4afe63 Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Wed, 31 May 2017 16:31:44 +0200
Subject: [PATCH] ar71xx: image: keep custom Build/* functions in separate
files
Most of the custom Build/* functions in ar71xx target are rarely used by
image building code for devices from more than one subtarget. As they
don't need to be always included, move them to corresponding *.mk files.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/Makefile | 52 +---------------------
target/linux/ar71xx/image/generic.mk | 86 ++++++++++++++++++++++++++++++++++++
target/linux/ar71xx/image/tp-link.mk | 16 ++++++-
3 files changed, 102 insertions(+), 52 deletions(-)
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 8eac5fc997..16881bceda 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/image.mk
KERNEL_LOADADDR = 0x80060000
-DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD_ID NETGEAR_HW_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS LOADER_TYPE
+DEVICE_VARS += BOARDNAME CMDLINE CONSOLE IMAGE_SIZE LOADER_TYPE
ifeq ($(SUBTARGET),generic)
include ./tp-link.mk
@@ -26,29 +26,6 @@ include ./mikrotik.mk
endif
include ./legacy.mk
-define Build/netgear-squashfs
- rm -rf $@.fs $@.squashfs
- mkdir -p $@.fs/image
- cp $@ $@.fs/image/uImage
- $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
- $@.fs $@.squashfs \
- -noappend -root-owned -be -b 65536 \
- $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
-
- dd if=/dev/zero bs=1k count=1 >> $@.squashfs
- mkimage \
- -A mips -O linux -T filesystem -C none \
- -M $(NETGEAR_KERNEL_MAGIC) \
- -a 0xbf070000 -e 0xbf070000 \
- -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
- -d $@.squashfs $@
- rm -rf $@.squashfs $@.fs
-endef
-
-define Build/netgear-uImage
- $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
-endef
-
define Build/loader-common
rm -rf $@.src
$(MAKE) -C lzma-loader \
@@ -61,10 +38,6 @@ define Build/loader-common
rm -rf $@.src
endef
-define Build/loader-okli-compile
- $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0 KERNEL_CMDLINE="$(CMDLINE)")
-endef
-
define Build/loader-kernel
$(call Build/loader-common,LOADER_DATA="$@")
endef
@@ -73,29 +46,6 @@ define Build/loader-kernel-cmdline
$(call Build/loader-common,LOADER_DATA="$@" KERNEL_CMDLINE="$(CMDLINE)")
endef
-define Build/loader-okli
- dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
- cat "$@" >> "$@.new"
- mv "$@.new" "$@"
-endef
-
-define Build/relocate-kernel
- rm -rf $@.relocate
- $(CP) ../../generic/image/relocate $@.relocate
- $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
- ( \
- dd if=$@.relocate/loader.bin bs=32 conv=sync && \
- perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
- cat "$@" \
- ) > "$@.new"
- mv "$@.new" "$@"
- rm -rf $@.relocate
-endef
-
-define Build/copy-file
- cat "$(1)" > "$@"
-endef
-
define Device/Default
BOARDNAME :=
DEVICE_PROFILE = $$(BOARDNAME)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 77fe70190c..74474fb4c9 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -1,3 +1,89 @@
+DEVICE_VARS += DAP_SIGNATURE NETGEAR_BOARD_ID NETGEAR_HW_ID NETGEAR_KERNEL_MAGIC SEAMA_SIGNATURE
+
+define Build/mkbuffaloimg
+ $(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \
+ -R $$(($(subst k, * 1024,$(ROOTFS_SIZE)))) \
+ -K $$(($(subst k, * 1024,$(KERNEL_SIZE)))) \
+ -i $@ -o $@.new
+ mv $@.new $@
+endef
+
+define Build/mkwrggimg
+ $(STAGING_DIR_HOST)/bin/mkwrggimg -b \
+ -i $@ -o $@.imghdr -d /dev/mtdblock/1 \
+ -m $(BOARDNAME) -s $(DAP_SIGNATURE) \
+ -v LEDE -B $(REVISION)
+ mv $@.imghdr $@
+endef
+
+define Build/netgear-squashfs
+ rm -rf $@.fs $@.squashfs
+ mkdir -p $@.fs/image
+ cp $@ $@.fs/image/uImage
+ $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
+ $@.fs $@.squashfs \
+ -noappend -root-owned -be -b 65536 \
+ $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
+
+ dd if=/dev/zero bs=1k count=1 >> $@.squashfs
+ mkimage \
+ -A mips -O linux -T filesystem -C none \
+ -M $(NETGEAR_KERNEL_MAGIC) \
+ -a 0xbf070000 -e 0xbf070000 \
+ -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
+ -d $@.squashfs $@
+ rm -rf $@.squashfs $@.fs
+endef
+
+define Build/netgear-uImage
+ $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
+endef
+
+define Build/relocate-kernel
+ rm -rf $@.relocate
+ $(CP) ../../generic/image/relocate $@.relocate
+ $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
+ ( \
+ dd if=$@.relocate/loader.bin bs=32 conv=sync && \
+ perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
+ cat "$@" \
+ ) > "$@.new"
+ mv "$@.new" "$@"
+ rm -rf $@.relocate
+endef
+
+define Build/seama
+ $(STAGING_DIR_HOST)/bin/seama -i $@ $(if $(1),$(1),-m "dev=/dev/mtdblock/1" -m "type=firmware")
+ mv $@.seama $@
+endef
+
+define Build/seama-seal
+ $(call Build/seama,-s $@.seama $(1))
+endef
+
+define Build/uImageHiWiFi
+ # Field ih_name needs to start with "tw150v1"
+ mkimage -A $(LINUX_KARCH) \
+ -O linux -T kernel \
+ -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+ -n 'tw150v1 $(call toupper,$(LINUX_KARCH)) LEDE Linux-$(LINUX_VERSION)' -d $@ $@.new
+ @mv $@.new $@
+endef
+
+define Build/wrgg-pad-rootfs
+ $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@
+endef
+
+
+define Device/ap531b0
+ DEVICE_TITLE := Rockeetech AP531B0
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+ BOARDNAME = AP531B0
+ IMAGE_SIZE := 16000k
+ MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
+endef
+TARGET_DEVICES += ap531b0
+
define Device/ap90q
DEVICE_TITLE := YunCore AP90Q
BOARDNAME = AP90Q
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 1c88f434a6..a84eefab70 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -1,4 +1,18 @@
-DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_BOARD_NAME
+DEVICE_VARS += LOADER_FLASH_OFFS TPLINK_BOARD_NAME TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_HWID TPLINK_HWREV
+
+define Build/copy-file
+ cat "$(1)" > "$@"
+endef
+
+define Build/loader-okli
+ dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
+ cat "$@" >> "$@.new"
+ mv "$@.new" "$@"
+endef
+
+define Build/loader-okli-compile
+ $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0 KERNEL_CMDLINE="$(CMDLINE)")
+endef
# combine kernel and rootfs into one image
# mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
--
2.13.1

View File

@ -0,0 +1,68 @@
From 01ef434fe876a418ca4155c8939eca543a2081b3 Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Wed, 31 May 2017 20:02:36 +0200
Subject: [PATCH] ar71xx: image: add ROOTFS_SIZE to DEVICE_VARS
Also use ROOTFS_SIZE variable in place of static values.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 74474fb4c9..28ed50972f 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -1,4 +1,4 @@
-DEVICE_VARS += DAP_SIGNATURE NETGEAR_BOARD_ID NETGEAR_HW_ID NETGEAR_KERNEL_MAGIC SEAMA_SIGNATURE
+DEVICE_VARS += DAP_SIGNATURE NETGEAR_BOARD_ID NETGEAR_HW_ID NETGEAR_KERNEL_MAGIC ROOTFS_SIZE SEAMA_SIGNATURE
define Build/mkbuffaloimg
$(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \
@@ -258,11 +258,12 @@ define Device/mr12
DEVICE_TITLE := Meraki MR12
DEVICE_PACKAGES := kmod-spi-gpio
BOARDNAME = MR12
+ ROOTFS_SIZE := 13440k
IMAGE_SIZE = 15680k
MTDPARTS = spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2240k(kernel),64k(mac),128k(art)ro,15680k@0x80000(firmware)
IMAGE/kernel.bin = append-kernel
IMAGE/rootfs.bin = append-rootfs | pad-rootfs
- IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to 13440k | append-kernel | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE)
IMAGES := kernel.bin rootfs.bin sysupgrade.bin
endef
TARGET_DEVICES += mr12
@@ -271,15 +272,27 @@ define Device/mr16
DEVICE_TITLE := Meraki MR16
DEVICE_PACKAGES := kmod-spi-gpio
BOARDNAME = MR16
+ ROOTFS_SIZE := 13440k
IMAGE_SIZE = 15680k
MTDPARTS = spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2240k(kernel),64k(mac),128k(art)ro,15680k@0x80000(firmware)
IMAGE/kernel.bin = append-kernel
IMAGE/rootfs.bin = append-rootfs | pad-rootfs
- IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to 13440k | append-kernel | check-size $$$$(IMAGE_SIZE)
+ IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE)
IMAGES := kernel.bin rootfs.bin sysupgrade.bin
endef
TARGET_DEVICES += mr16
+define Device/dr344
+ DEVICE_TITLE := Wallys DR344
+ BOARDNAME = DR344
+ KERNEL_SIZE := 1408k
+ ROOTFS_SIZE := 6336k
+ IMAGE_SIZE = 7744k
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
+ IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += dr344
+
define Device/dr531
DEVICE_TITLE := Wallys DR531
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
--
2.13.1

View File

@ -0,0 +1,215 @@
From f21bdc895f9728ff05a6243e4284fa0d2158c34f Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Wed, 31 May 2017 21:23:53 +0200
Subject: [PATCH] ar71xx: image: cosmetic: drop redundant empty lines
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 24 ++++++++++--------------
target/linux/ar71xx/image/mikrotik.mk | 2 +-
target/linux/ar71xx/image/nand.mk | 2 --
target/linux/ar71xx/image/tp-link.mk | 1 -
target/linux/ar71xx/image/ubnt.mk | 3 ---
5 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 28ed50972f..522f6d56a4 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -353,7 +353,6 @@ $(Device/wndr3800)
DEVICE_TITLE := NETGEAR WNDRMAC v2
NETGEAR_BOARD_ID = WNDRMACv2
endef
-
TARGET_DEVICES += wndr3700 wndr3700v2 wndr3800 wndr3800ch wndrmac wndrmacv2
define Device/cap324
@@ -363,7 +362,6 @@ define Device/cap324
IMAGE_SIZE = 15296k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15296k(firmware),640k(certs),64k(nvram),64k(art)ro
endef
-
TARGET_DEVICES += cap324
define Device/cap324-nocloud
@@ -373,7 +371,6 @@ define Device/cap324-nocloud
IMAGE_SIZE = 16000k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
endef
-
TARGET_DEVICES += cap324-nocloud
define Device/cr3000
@@ -383,7 +380,6 @@ define Device/cr3000
IMAGE_SIZE = 7104k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7104k(firmware),640k(certs),64k(nvram),64k(art)ro
endef
-
TARGET_DEVICES += cr3000
define Device/cr3000-nocloud
@@ -393,7 +389,6 @@ define Device/cr3000-nocloud
IMAGE_SIZE = 7808k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro
endef
-
TARGET_DEVICES += cr3000-nocloud
define Device/cr5000
@@ -404,7 +399,6 @@ define Device/cr5000
IMAGE_SIZE = 7104k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7104k(firmware),640k(certs),64k(nvram),64k(art)ro
endef
-
TARGET_DEVICES += cr5000
define Device/cr5000-nocloud
@@ -415,9 +409,18 @@ define Device/cr5000-nocloud
IMAGE_SIZE = 7808k
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro
endef
-
TARGET_DEVICES += cr5000-nocloud
+define Device/pqi-air-pen
+ DEVICE_TITLE := PQI Air Pen
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage
+ BOARDNAME = PQI-AIR-PEN
+ IMAGE_SIZE = 7744k
+ CONSOLE = ttyATH0,115200
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(art)ro,64k(NVRAM)ro,7680k(firmware),64k(CONF)
+endef
+TARGET_DEVICES += pqi-air-pen
+
define Device/antminer-s1
$(Device/tplink-8mlzma)
DEVICE_TITLE := Antminer-S1
@@ -646,7 +649,6 @@ define Device/oolite
endef
TARGET_DEVICES += oolite
-
define Device/NBG6616
DEVICE_TITLE := ZyXEL NBG6616
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-rtc-pcf8563 kmod-ath10k ath10k-firmware-qca988x
@@ -680,7 +682,6 @@ define Device/NBG6616
#
# The header is padded with 0xff to the erase block size of the device.
endef
-
TARGET_DEVICES += NBG6616
define Device/c-55
@@ -692,10 +693,8 @@ define Device/c-55
MTDPARTS = spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x60000(firmware)
IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
endef
-
TARGET_DEVICES += c-55
-
define Build/uImageHiWiFi
# Field ih_name needs to start with "tw150v1"
mkimage -A $(LINUX_KARCH) \
@@ -718,7 +717,6 @@ define Device/hiwifi-hc6361
endef
TARGET_DEVICES += hiwifi-hc6361
-
define Build/seama
$(STAGING_DIR_HOST)/bin/seama -i $@ $(if $(1),$(1),-m "dev=/dev/mtdblock/1" -m "type=firmware")
mv $@.seama $@
@@ -795,7 +793,6 @@ $(Device/seama)
MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
SEAMA_SIGNATURE := wrgac26_qihoo360_360rg
endef
-
TARGET_DEVICES += dir-869-a1 mynet-n600 mynet-n750 qihoo-c301
define Build/mkwrggimg
@@ -824,7 +821,6 @@ define Device/dap-2695-a1
DAP_SIGNATURE := wapac02_dkbs_dap2695
DEVICE_VARS += DAP_SIGNATURE
endef
-
TARGET_DEVICES += dap-2695-a1
define Build/mkbuffaloimg
diff --git a/target/linux/ar71xx/image/mikrotik.mk b/target/linux/ar71xx/image/mikrotik.mk
index bcfa64da62..7312ea58ae 100644
--- a/target/linux/ar71xx/image/mikrotik.mk
+++ b/target/linux/ar71xx/image/mikrotik.mk
@@ -21,7 +21,6 @@ define Device/nand-large
$(Device/mikrotik)
KERNEL := kernel-bin | kernel2minor -s 2048 -e -c
endef
-
TARGET_DEVICES += nand-64m nand-large
define Device/rb-nor-flash-16M
@@ -42,3 +41,4 @@ $(Device/rb-nor-flash-16M)
DEVICE_TITLE := hAP lite
BOARDNAME:= rb-941-2nd
endef
+TARGET_DEVICES += rb-nor-flash-16M rb-nor-flash-16M-ac
diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk
index aef9fc3ec8..8c44cad605 100644
--- a/target/linux/ar71xx/image/nand.mk
+++ b/target/linux/ar71xx/image/nand.mk
@@ -10,7 +10,6 @@ define Device/c-60
KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
IMAGE/sysupgrade.tar := sysupgrade-tar
endef
-
TARGET_DEVICES += c-60
define Device/domywifi-dw33d
@@ -66,7 +65,6 @@ define Device/z1
KERNEL_INITRAMFS := kernel-bin | patch-cmdline | MerakiNAND-old
IMAGE/sysupgrade.tar := sysupgrade-tar
endef
-
TARGET_DEVICES += z1
define LegacyDevice/R6100
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index a84eefab70..561fae3533 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -1003,7 +1003,6 @@ define Device/tl-wa901nd-v4
TPLINK_HWID := 0x09010004
IMAGE/factory.bin := append-rootfs | mktplinkfw factory -C EU
endef
-
TARGET_DEVICES += tl-wa901nd-v1 tl-wa901nd-v2 tl-wa901nd-v3 tl-wa901nd-v4
define Device/tl-wa7210n-v2
diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk
index 31a9901d12..35d719fad7 100644
--- a/target/linux/ar71xx/image/ubnt.mk
+++ b/target/linux/ar71xx/image/ubnt.mk
@@ -206,7 +206,6 @@ define Device/ubdev01
UBNT_TYPE := XM
UBNT_CHIP := ar7240
endef
-
TARGET_DEVICES += ubdev01
define Device/ubnt-routerstation
@@ -248,7 +247,6 @@ $(Device/ubnt-routerstation)
UBNT_TYPE := LS-SR71
UBNT_CHIP := ar7100
endef
-
TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
define Device/ubnt-uap-pro
@@ -273,5 +271,4 @@ $(Device/ubnt-uap-pro)
BOARDNAME := UBNT-UOP
DEVICE_PROFILE := UBNT
endef
-
TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus
--
2.13.1

View File

@ -0,0 +1,44 @@
From b6249ea354645554c2c5cd5cc08cdfb4c3454b2c Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Wed, 31 May 2017 21:56:10 +0200
Subject: [PATCH] ar71xx: image: fix 8devices boards DEVICE_TITLE
Be consistent with DEVICE_TITLE syntax and use vendor + board names.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 522f6d56a4..60fc2f7679 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -104,7 +104,7 @@ endef
TARGET_DEVICES += bsb
define Device/carambola2
- DEVICE_TITLE := Carambola2 board from 8Devices
+ DEVICE_TITLE := 8devices Carambola2
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = CARAMBOLA2
IMAGE_SIZE = 16000k
@@ -254,6 +254,15 @@ define Device/gl-mifi
endef
TARGET_DEVICES += gl-mifi
+define Device/lima
+ DEVICE_TITLE := 8devices Lima
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+ BOARDNAME = LIMA
+ IMAGE_SIZE = 15616k
+ MTDPARTS = spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,256k(art)ro,-(firmware)
+endef
+TARGET_DEVICES += lima
+
define Device/mr12
DEVICE_TITLE := Meraki MR12
DEVICE_PACKAGES := kmod-spi-gpio
--
2.13.1

View File

@ -0,0 +1,66 @@
From 5627a13d1061a733d511bd29c2fdd5a68d383b45 Mon Sep 17 00:00:00 2001
From: Piotr Dymacz <pepe2k@gmail.com>
Date: Wed, 31 May 2017 22:12:51 +0200
Subject: [PATCH] ar71xx: image: update GL.iNet boards DEVICE_TITLE
Use "GL.iNet" as vendor name (based on information from the vendor, this
is registered name of the company) and align model names with official
website.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/image/generic.mk | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 60fc2f7679..2bb75a0875 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -205,7 +205,7 @@ endef
TARGET_DEVICES += weio
define Device/gl-ar150
- DEVICE_TITLE := GL AR150
+ DEVICE_TITLE := GL.iNet GL-AR150
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = GL-AR150
IMAGE_SIZE = 16000k
@@ -215,7 +215,7 @@ endef
TARGET_DEVICES += gl-ar150
define Device/gl-ar300
- DEVICE_TITLE := GL AR300
+ DEVICE_TITLE := GL.iNet GL-AR300
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = GL-AR300
IMAGE_SIZE = 16000k
@@ -225,7 +225,7 @@ endef
TARGET_DEVICES += gl-ar300
define Device/gl-ar300m
- DEVICE_TITLE := GL AR300M
+ DEVICE_TITLE := GL.iNet GL-AR300M
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = GL-AR300M
IMAGE_SIZE = 16000k
@@ -235,7 +235,7 @@ endef
TARGET_DEVICES += gl-ar300m
define Device/gl-domino
- DEVICE_TITLE := GL Domino Pi
+ DEVICE_TITLE := GL.iNet Domino Pi
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = DOMINO
IMAGE_SIZE = 16000k
@@ -245,7 +245,7 @@ endef
TARGET_DEVICES += gl-domino
define Device/gl-mifi
- DEVICE_TITLE := GL MIFI
+ DEVICE_TITLE := GL.iNet GL-MiFi
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME = GL-MIFI
IMAGE_SIZE = 16000k
--
2.13.1

View File

@ -0,0 +1,647 @@
From ac56ca1999a6d5ccf6a144187a3b94a9641678b4 Mon Sep 17 00:00:00 2001
From: Serg Studzinskii <serguzhg@gmail.com>
Date: Wed, 8 Mar 2017 22:10:05 +0200
Subject: [PATCH] ar71xx: add support for TP-Link TL-WR942N v1
TP-Link TL-WR942N v1 is a 2.4 GHz single-band N450 router, based on
Qualcomm/Atheros QCA9561.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 5x 10/100 Mbps Ethernet
- 2x USB 2.0
- 11x LED (most are controlled by 74HC595)
- 2x button
- UART header on PCB*
* Serial console is disabled in OEM non-beta firmwares and corresponding
GPIO pins 14 and 15 are assigned to control USB1 and USB2 LEDs by
production (non-beta) U-Boot and firmware.
Currently not working:
1. USB1 and USB2 LEDs if UART RX and TX pins are assigned to their GPIOs
by some U-Boot versions.
Flash instruction under vendor GUI:
1. Download "lede-ar71xx-generic-tl-wr942n-v1-squashfs-factory.bin".
2. Go to WEB interface and perform usual firmware upgrade.
FLash instruction under U-Boot recovery mode (doesn't work in beta
firmware):
1. Setup PC with static IP "192.168.0.66/24" and tftp server.
2. Change "*-factory" image filename to "WR942v1_recovery.bin" and make
it available to download from your tftp server.
3. Press "reset" button and power up the router, wait till "WPS" LED
turns on.
Flash instruction under U-Boot, using UART (can be done only with
preinstalled UART-enabled U-Boot version!):
1. Use "tpl" to stop autobooting and obtain U-Boot CLI access.
2. Setup ip addresses for U-Boot and your tftp server.
3. Issue below commands:
tftp 0x81000000 lede-ar71xx-generic-tl-wr942n-v1-sysupgrade.bin
erase 0x9f020000 +$filesize
cp.b 0x81000000 0x9f020000 $filesize
reset
Signed-off-by: Serg Studzinskii <serguzhg@gmail.com>
[minor code style fixes, extended commit message]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/base-files/etc/board.d/01_leds | 31 +++
.../linux/ar71xx/base-files/etc/board.d/02_network | 9 +
target/linux/ar71xx/base-files/etc/diag.sh | 1 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +
.../ar71xx/base-files/lib/upgrade/platform.sh | 1 +
target/linux/ar71xx/config-4.4 | 1 +
.../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 11 +
target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 +
.../files/arch/mips/ath79/mach-tl-wr942n-v1.c | 279 +++++++++++++++++++++
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
target/linux/ar71xx/files/arch/mips/ath79/nvram.c | 7 +-
target/linux/ar71xx/image/tp-link.mk | 15 ++
target/linux/ar71xx/mikrotik/config-default | 1 +
target/linux/ar71xx/nand/config-default | 3 +
tools/firmware-utils/src/tplink-safeloader.c | 37 +++
15 files changed, 400 insertions(+), 1 deletion(-)
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr942n-v1.c
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 0279dfca88..eafff81e37 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -648,6 +648,37 @@ tl-wr842n-v3)
;;
esac
;;
+tl-wr802n-v1)
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:system" "phy0tpt"
+ ;;
+tl-wr802n-v2)
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:system" "phy0tpt"
+ ;;
+tl-wr940n-v4|\
+tl-wr941nd-v6)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:blue:wan" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:blue:lan1" "switch0" "0x10"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:blue:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:blue:lan3" "switch0" "0x04"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:blue:lan4" "switch0" "0x02"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:blue:wlan" "phy0tpt"
+ ;;
+tl-wr840n-v2|\
+tl-wr840n-v3)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
+ ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x1E"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+ ;;
+tl-wr942n-v1)
+ ucidef_set_led_switch "lan1" "LAN1" "$board:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
+ ucidef_set_led_usbdev "usb1" "USB1" "$board:green:usb1" "1-1.2"
+ ucidef_set_led_usbdev "usb2" "USB2" "$board:green:usb2" "1-1.1"
+ ;;
tl-wr1043nd|\
tl-wr1043nd-v2)
ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index c8c7827a87..b33b924573 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -378,6 +378,15 @@ ar71xx_setup_interfaces()
ucidef_set_interface_wan "eth0"
ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
;;
+ tl-mr3420-v2|\
+ tl-wr841n-v8|\
+ tl-wr842n-v2|\
+ tl-wr941nd-v5|\
+ tl-wr942n-v1)
+ ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
+ ucidef_add_switch "switch0" \
+ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
+ ;;
tl-wdr4300|\
tl-wr1041n-v2)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 7b8aac8f8e..1a62d8fb29 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -33,6 +33,7 @@ get_status_led() {
db120|\
dr344|\
tew-632brp|\
+ tl-wr942n-v1|\
wpj344|\
zbt-we1526)
status_led="$board:green:status"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index b035535a42..5e2c151dc1 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1088,6 +1088,9 @@ ar71xx_board_detect() {
*"TL-MR13U v1")
name="tl-mr13u"
;;
+ *"TL-WR942N v1")
+ name="tl-wr942n-v1"
+ ;;
*"Tube2H")
name="tube2h"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 580e09a46f..74c1046241 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -259,6 +259,7 @@ platform_check_image() {
tew-712br|\
tew-732br|\
tew-823dru|\
+ tl-wr942n-v1|\
unifi-outdoor|\
unifiac-lite|\
unifiac-pro|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index ff6bb135d1..287d1597dd 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -192,6 +192,7 @@ CONFIG_ATH79_MACH_TL_WR841N_V9=y
CONFIG_ATH79_MACH_TL_WR941ND=y
CONFIG_ATH79_MACH_TL_WR941ND_V6=y
CONFIG_ATH79_MACH_TL_WR940N_V4=y
+CONFIG_ATH79_MACH_TL_WR942N_V1=y
CONFIG_ATH79_MACH_TUBE2H=y
CONFIG_ATH79_MACH_UBNT=y
CONFIG_ATH79_MACH_UBNT_UNIFIAC=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 76ba6fafb7..bce65ec2a7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1533,6 +1533,17 @@ config ATH79_MACH_TL_WR940N_V4
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
+config ATH79_MACH_TL_WR942N_V1
+ bool "TP-LINK TL-WR942N v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+ select ATH79_NVRAM
+
config ATH79_MACH_TL_WR1041N_V2
bool "TP-LINK TL-WR1041N v2 support"
select SOC_AR934X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index c91d03ff21..876444249f 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -196,6 +196,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += mach-tl-wr841n-v9.o
obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o
obj-$(CONFIG_ATH79_MACH_TL_WR941ND_V6) += mach-tl-wr941nd-v6.o
obj-$(CONFIG_ATH79_MACH_TL_WR940N_V4) += mach-tl-wr940n-v4.o
+obj-$(CONFIG_ATH79_MACH_TL_WR942N_V1) += mach-tl-wr942n-v1.o
obj-$(CONFIG_ATH79_MACH_TUBE2H) += mach-tube2h.o
obj-$(CONFIG_ATH79_MACH_UBNT) += mach-ubnt.o
obj-$(CONFIG_ATH79_MACH_UBNT_UNIFIAC) += mach-ubnt-unifiac.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr942n-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr942n-v1.c
new file mode 100644
index 0000000000..72910400c5
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr942n-v1.c
@@ -0,0 +1,279 @@
+/*
+ * TP-Link TL-WR942N(RU) v1 board support
+ *
+ * Copyright (C) 2017 Sergey Studzinski <serguzhg@gmail.com>
+ * Thanks to Henryk Heisig <hyniu@o2.pl>
+ *
+ * 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 <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "nvram.h"
+
+#define TL_WR942N_V1_KEYS_POLL_INTERVAL 20
+#define TL_WR942N_V1_KEYS_DEBOUNCE_INTERVAL \
+ (3 * TL_WR942N_V1_KEYS_POLL_INTERVAL)
+
+#define TL_WR942N_V1_GPIO_BTN_RESET 1
+#define TL_WR942N_V1_GPIO_BTN_RFKILL 2
+
+#define TL_WR942N_V1_GPIO_UART_TX 4
+#define TL_WR942N_V1_GPIO_UART_RX 5
+
+#define TL_WR942N_V1_GPIO_LED_USB2 14
+#define TL_WR942N_V1_GPIO_LED_USB1 15
+
+#define TL_WR942N_V1_GPIO_SHIFT_OE 16
+#define TL_WR942N_V1_GPIO_SHIFT_SER 17
+#define TL_WR942N_V1_GPIO_SHIFT_SRCLK 18
+#define TL_WR942N_V1_GPIO_SHIFT_SRCLR 19
+#define TL_WR942N_V1_GPIO_SHIFT_RCLK 20
+#define TL_WR942N_V1_GPIO_LED_WPS 21
+#define TL_WR942N_V1_GPIO_LED_STATUS 22
+
+#define TL_WR942N_V1_74HC_GPIO_BASE QCA956X_GPIO_COUNT
+#define TL_WR942N_V1_74HC_GPIO_LED_LAN4 23
+#define TL_WR942N_V1_74HC_GPIO_LED_LAN3 24
+#define TL_WR942N_V1_74HC_GPIO_LED_LAN2 25
+#define TL_WR942N_V1_74HC_GPIO_LED_LAN1 26
+#define TL_WR942N_V1_74HC_GPIO_LED_WAN_GREEN 27
+#define TL_WR942N_V1_74HC_GPIO_LED_WAN_AMBER 28
+#define TL_WR942N_V1_74HC_GPIO_LED_WLAN 29
+#define TL_WR942N_V1_74HC_GPIO_HUB_RESET 30 /* from u-boot sources */
+
+#define TL_WR942N_V1_SSR_BIT_0 0
+#define TL_WR942N_V1_SSR_BIT_1 1
+#define TL_WR942N_V1_SSR_BIT_2 2
+#define TL_WR942N_V1_SSR_BIT_3 3
+#define TL_WR942N_V1_SSR_BIT_4 4
+#define TL_WR942N_V1_SSR_BIT_5 5
+#define TL_WR942N_V1_SSR_BIT_6 6
+#define TL_WR942N_V1_SSR_BIT_7 7
+
+#define TL_WR942N_V1_WMAC_CALDATA_OFFSET 0x1000
+#define TL_WR942N_V1_DEFAULT_MAC_ADDR 0x1fe40008
+#define TL_WR942N_V1_DEFAULT_MAC_SIZE 0x200
+
+#define GPIO_IN_ENABLE0_UART_SIN_LSB 8
+#define GPIO_IN_ENABLE0_UART_SIN_MASK 0x0000ff00
+
+static struct gpio_led tl_wr942n_v1_leds_gpio[] __initdata = {
+ {
+ .name = "tl-wr942n-v1:green:status",
+ .gpio = TL_WR942N_V1_GPIO_LED_STATUS,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:wlan",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_WLAN,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:lan1",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:lan2",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:lan3",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:lan4",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN4,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:wan",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:amber:wan",
+ .gpio = TL_WR942N_V1_74HC_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:wps",
+ .gpio = TL_WR942N_V1_GPIO_LED_WPS,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:usb1",
+ .gpio = TL_WR942N_V1_GPIO_LED_USB1,
+ .active_low = 1,
+ }, {
+ .name = "tl-wr942n-v1:green:usb2",
+ .gpio = TL_WR942N_V1_GPIO_LED_USB2,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button tl_wr942n_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_WR942N_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR942N_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = TL_WR942N_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_WR942N_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+};
+
+static struct spi_gpio_platform_data tl_wr942n_v1_spi_data = {
+ .sck = TL_WR942N_V1_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = TL_WR942N_V1_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 tl_wr942n_v1_ssr_initdata[] __initdata = {
+ BIT(TL_WR942N_V1_SSR_BIT_7) |
+ BIT(TL_WR942N_V1_SSR_BIT_6) |
+ BIT(TL_WR942N_V1_SSR_BIT_5) |
+ BIT(TL_WR942N_V1_SSR_BIT_4) |
+ BIT(TL_WR942N_V1_SSR_BIT_3) |
+ BIT(TL_WR942N_V1_SSR_BIT_2) |
+ BIT(TL_WR942N_V1_SSR_BIT_1) |
+ BIT(TL_WR942N_V1_SSR_BIT_0)
+};
+
+static struct gen_74x164_chip_platform_data tl_wr942n_v1_ssr_data = {
+ .base = TL_WR942N_V1_74HC_GPIO_BASE,
+ .num_registers = ARRAY_SIZE(tl_wr942n_v1_ssr_initdata),
+ .init_data = tl_wr942n_v1_ssr_initdata,
+};
+
+static struct platform_device tl_wr942n_v1_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &tl_wr942n_v1_spi_data,
+ },
+};
+
+static struct spi_board_info tl_wr942n_v1_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &tl_wr942n_v1_ssr_data,
+ .controller_data = (void *) TL_WR942N_V1_GPIO_SHIFT_RCLK,
+ },
+};
+
+static void tl_wr942n_v1_get_mac(const char *name, char *mac)
+{
+ u8 *nvram = (u8 *) KSEG1ADDR(TL_WR942N_V1_DEFAULT_MAC_ADDR);
+ int err;
+
+ err = ath79_nvram_parse_mac_addr(nvram, TL_WR942N_V1_DEFAULT_MAC_SIZE,
+ name, mac);
+
+ if (err)
+ pr_err("no MAC address found for %s\n", name);
+}
+
+static void __init tl_wr942n_v1_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+ u8 tmpmac[ETH_ALEN];
+ void __iomem *base;
+ u32 t;
+
+ ath79_register_m25p80(NULL);
+
+ spi_register_board_info(tl_wr942n_v1_spi_info,
+ ARRAY_SIZE(tl_wr942n_v1_spi_info));
+ platform_device_register(&tl_wr942n_v1_spi_device);
+
+ /* Check inherited UART RX GPIO definition */
+ base = ioremap(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE);
+
+ t = __raw_readl(base + QCA956X_GPIO_REG_IN_ENABLE0);
+ if (((t & GPIO_IN_ENABLE0_UART_SIN_MASK)
+ >> GPIO_IN_ENABLE0_UART_SIN_LSB) == TL_WR942N_V1_GPIO_LED_USB1) {
+ pr_warn("Active UART detected on USBLED's GPIOs!\n");
+
+ tl_wr942n_v1_leds_gpio[9].gpio = TL_WR942N_V1_GPIO_UART_TX;
+ tl_wr942n_v1_leds_gpio[10].gpio = TL_WR942N_V1_GPIO_UART_RX;
+ }
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr942n_v1_leds_gpio),
+ tl_wr942n_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, TL_WR942N_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_wr942n_v1_gpio_keys),
+ tl_wr942n_v1_gpio_keys);
+
+ tl_wr942n_v1_get_mac("MAC:", tmpmac);
+
+ /* swap PHYs */
+ ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
+ QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+
+ ath79_register_mdio(0, 0x0);
+ ath79_register_mdio(1, 0x0);
+
+ /* WAN port */
+ ath79_init_mac(ath79_eth0_data.mac_addr, tmpmac, 1);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+
+ /* swaped PHYs */
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_register_eth(0);
+
+ /* LAN ports */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth1_data.mac_addr, tmpmac, 0);
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+
+ /* swaped PHYs */
+ ath79_switch_data.phy_poll_mask |= BIT(0);
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + TL_WR942N_V1_WMAC_CALDATA_OFFSET, tmpmac);
+
+ ath79_register_usb();
+
+ gpio_request_one(TL_WR942N_V1_74HC_GPIO_HUB_RESET,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ gpio_request_one(TL_WR942N_V1_GPIO_SHIFT_OE,
+ GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "LED control");
+
+ gpio_request_one(TL_WR942N_V1_GPIO_SHIFT_SRCLR,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "LED reset");
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WR942N_V1, "TL-WR942N-V1", "TP-LINK TL-WR942N v1",
+ tl_wr942n_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index b9a8e3e4e0..469d2fa794 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -234,6 +234,7 @@ enum ath79_mach_type {
ATH79_MACH_TL_WR941ND_V5, /* TP-LINK TL-WR941ND v5 */
ATH79_MACH_TL_WR941ND_V6, /* TP-LINK TL-WR941ND v6 */
ATH79_MACH_TL_WR940N_V4, /* TP-LINK TL-WR940N v4 */
+ ATH79_MACH_TL_WR942N_V1, /* TP-LINK TL-WR942N v1 */
ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */
ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */
ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c
index e55af5abe2..a1de55fb19 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c
@@ -13,6 +13,7 @@
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/string.h>
+#include <linux/etherdevice.h>
#include "nvram.h"
@@ -67,7 +68,11 @@ int ath79_nvram_parse_mac_addr(const char *nvram, unsigned nvram_len,
t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
- if (t != 6) {
+ if (t != ETH_ALEN)
+ t = sscanf(mac_str, "%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx",
+ &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
+
+ if (t != ETH_ALEN) {
ret = -EINVAL;
goto free;
}
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 561fae3533..93a263cfc1 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -795,6 +795,21 @@ define Device/tl-wr941nd-v6-cn
endef
TARGET_DEVICES += tl-wr941nd-v2 tl-wr941nd-v3 tl-wr941nd-v4 tl-wr941nd-v5 tl-wr941nd-v6 tl-wr941nd-v6-cn tl-wr940n-v4
+define Device/tl-wr942n-v1
+ DEVICE_TITLE := TP-LINK TL-WR942N v1
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+ BOARDNAME := TL-WR942N-V1
+ TPLINK_BOARD_NAME := TLWR942NV1
+ DEVICE_PROFILE := TLWR942
+ IMAGE_SIZE := 14464k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:128k(u-boot)ro,1344k(kernel),13120k(rootfs),64k(product-info)ro,64k(partition-table)ro,256k(oem-config)ro,1344k(oem-vars)ro,64k(ART)ro,14464k@0x20000(firmware)
+endef
+TARGET_DEVICES += tl-wr942n-v1
+
define Device/tl-wr1041n-v2
$(Device/tplink-4mlzma)
DEVICE_TITLE := TP-LINK TL-WR1041N
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 44ea327fb1..7368519cee 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -157,6 +157,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y
# CONFIG_ATH79_MACH_TL_WR940N_V4 is not set
# CONFIG_ATH79_MACH_TL_WR941ND is not set
# CONFIG_ATH79_MACH_TL_WR941ND_V6 is not set
+# CONFIG_ATH79_MACH_TL_WR942N_V1 is not set
# CONFIG_ATH79_MACH_TUBE2H is not set
# CONFIG_ATH79_MACH_UBNT is not set
# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 515266b0f8..caad128aa6 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -61,6 +61,9 @@
# CONFIG_ATH79_MACH_TL_WR841N_V8 is not set
# CONFIG_ATH79_MACH_TL_WR941ND is not set
# CONFIG_ATH79_MACH_TL_WR940N_V4 is not set
+# CONFIG_ATH79_MACH_TL_WR941ND_V6 is not set
+# CONFIG_ATH79_MACH_TL_WR942N_V1 is not set
+# CONFIG_ATH79_MACH_TUBE2H is not set
# CONFIG_ATH79_MACH_UBNT is not set
# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set
# CONFIG_ATH79_MACH_UBNT_XM is not set
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 9c9efc369c..31b374f523 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -553,6 +553,43 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the TL-WR942N V1 */
+ {
+ .id = "TLWR942NV1",
+ .vendor = "",
+ .support_list =
+ "SupportList:\r\n"
+ "{product_name:TL-WR942N,product_ver:1.0.0,special_id:00000000}\r\n"
+ "{product_name:TL-WR942N,product_ver:1.0.0,special_id:52550000}\r\n",
+ .support_trail = '\x00',
+ .soft_ver = NULL,
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"os-image", 0x20000, 0x150000},
+ {"file-system", 0x170000, 0xcd0000},
+ {"default-mac", 0xe40000, 0x00200},
+ {"pin", 0xe40200, 0x00200},
+ {"product-info", 0xe40400, 0x0fc00},
+ {"partition-table", 0xe50000, 0x10000},
+ {"soft-version", 0xe60000, 0x10000},
+ {"support-list", 0xe70000, 0x10000},
+ {"profile", 0xe80000, 0x10000},
+ {"default-config", 0xe90000, 0x10000},
+ {"user-config", 0xea0000, 0x40000},
+ {"qos-db", 0xee0000, 0x40000},
+ {"certificate", 0xf20000, 0x10000},
+ {"usb-config", 0xfb0000, 0x10000},
+ {"log", 0xfc0000, 0x20000},
+ {"radio-bk", 0xfe0000, 0x10000},
+ {"radio", 0xff0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the RE450 */
{
.id = "RE450",
--
2.13.1

View File

@ -0,0 +1,548 @@
From d6210582e7dd9f69d0abe1cf667693c4c8b430e3 Mon Sep 17 00:00:00 2001
From: Ludwig Thomeczek <ledesrc@wxorx.net>
Date: Sat, 22 Apr 2017 18:21:47 +0200
Subject: [PATCH] ar71xx: add support for TP-Link Archer C25 v1
The TP-Link Archer C25 is a low-cost dual-band router.
Specification:
- CPU: Atheros QCA9561 775 MHz
- RAM: 64 MB
- Flash: 8 MB
- Wifi: 3x3 2.4 GHz (integrated), 1x1 5 GHz QCA9887
- NET: 5x 10/100 Mbps Ethernet
Some LEDs are controlled by an additional 74HC595 chip.
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
[minor code style fixes, boards alphabetical order fixes,
reworked commit message]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
---
target/linux/ar71xx/base-files/etc/board.d/01_leds | 27 +++
.../linux/ar71xx/base-files/etc/board.d/02_network | 1 +
target/linux/ar71xx/base-files/etc/diag.sh | 3 +
.../etc/hotplug.d/firmware/11-ath10k-caldata | 3 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +
.../ar71xx/base-files/lib/upgrade/platform.sh | 3 +
target/linux/ar71xx/config-4.4 | 3 +
.../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 31 +++
target/linux/ar71xx/files/arch/mips/ath79/Makefile | 3 +
.../files/arch/mips/ath79/mach-archer-c25-v1.c | 227 +++++++++++++++++++++
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
target/linux/ar71xx/image/tp-link.mk | 46 +++++
target/linux/ar71xx/mikrotik/config-default | 3 +
target/linux/ar71xx/nand/config-default | 3 +
14 files changed, 357 insertions(+)
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index eafff81e37..4a54785e5e 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -49,6 +49,33 @@ antrouter-r1)
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
ucidef_set_led_default "btc" "BTC" "$board:green:btc" "0"
;;
+ap531b0|\
+sc1750|\
+sc450)
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
+ ;;
+archer-c25-v1)
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
+ ucidef_set_led_switch "lan1" "LAN1" "$board:green:lan1" "switch0" "0x10"
+ ucidef_set_led_switch "lan2" "LAN2" "$board:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "$board:green:lan3" "switch0" "0x04"
+ ucidef_set_led_switch "lan4" "LAN4" "$board:green:lan4" "switch0" "0x02"
+ ;;
+archer-c59-v1|\
+archer-c60-v1)
+ ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x1E"
+ ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan2g" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
+
+ case "$board" in
+ archer-c59-v1)
+ ucidef_set_led_usbdev "usb" "USB" "$board:green:usb" "1-1"
+ ;;
+ esac
+ ;;
arduino-yun)
ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index b33b924573..de7e082551 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -122,6 +122,7 @@ ar71xx_setup_interfaces()
a60|\
alfa-ap96|\
alfa-nx|\
+ archer-c25-v1|\
dr344|\
gl-ar150|\
gl-ar300m|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 1a62d8fb29..ffd137600d 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -48,6 +48,9 @@ get_status_led() {
ap135-020)
status_led="ap135:green:status"
;;
+ archer-c25-v1|\
+ archer-c59-v1|\
+ archer-c60-v1|\
mr12|\
mr16|\
nbg6616|\
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index b3e23c9a8f..39cd602627 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -92,6 +92,9 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;;
+ archer-c25-v1|\
+ archer-c59-v1|\
+ archer-c60-v1|\
tl-wdr6500-v2)
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 5e2c151dc1..88ad71a1d8 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -457,6 +457,9 @@ ar71xx_board_detect() {
*AP90Q)
name="ap90q"
;;
+ *"Archer C25 v1")
+ name="archer-c25-v1"
+ ;;
*"Archer C5")
name="archer-c5"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 74c1046241..68915be410 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -205,6 +205,9 @@ platform_check_image() {
airrouter|\
ap132|\
ap90q|\
+ archer-c25-v1|\
+ archer-c59-v1|\
+ archer-c60-v1|\
bullet-m|\
c-55|\
carambola2|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 287d1597dd..c63d97d527 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -50,6 +50,9 @@ CONFIG_ATH79_MACH_AP152=y
# CONFIG_ATH79_MACH_AP81 is not set
CONFIG_ATH79_MACH_AP90Q=y
CONFIG_ATH79_MACH_AP96=y
+CONFIG_ATH79_MACH_ARCHER_C25_V1=y
+CONFIG_ATH79_MACH_ARCHER_C59_V1=y
+CONFIG_ATH79_MACH_ARCHER_C60_V1=y
CONFIG_ATH79_MACH_ARCHER_C7=y
CONFIG_ATH79_MACH_ARDUINO_YUN=y
CONFIG_ATH79_MACH_AW_NR580=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index bce65ec2a7..042f05c8b5 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1224,6 +1224,37 @@ config ATH79_MACH_BSB
select ATH79_DEV_USB
select ATH79_DEV_WMAC
+config ATH79_MACH_ARCHER_C25_V1
+ bool "TP-LINK Archer C25 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
+config ATH79_MACH_ARCHER_C59_V1
+ bool "TP-LINK Archer C59 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
+config ATH79_MACH_ARCHER_C60_V1
+ bool "TP-LINK Archer C60 v1 support"
+ select SOC_QCA956X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_ARCHER_C7
bool "TP-LINK Archer C5/C7/TL-WDR4900 v2 board support"
select SOC_QCA955X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 876444249f..b938f97ab2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -55,6 +55,9 @@ obj-$(CONFIG_ATH79_MACH_AP147) += mach-ap147.o
obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o
obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o
obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C59_V1) += mach-archer-c59-v1.o
+obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V1) += mach-archer-c60-v1.o
obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o
obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o
obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
new file mode 100644
index 0000000000..a0f001cb49
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c
@@ -0,0 +1,227 @@
+/*
+ * TP-Link Archer C25 v1 board support
+ *
+ * Copyright (C) 2017 Ludwig Thomeczek <ledesrc@wxorx.net>
+ * based on mach-archer-c60/C59-v1.c
+ * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ *
+ * 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 <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#define ARCHER_C25_GPIO_SHIFT_OE 21 /* OE, Output Enable */
+#define ARCHER_C25_GPIO_SHIFT_SER 14 /* DS, Data Serial Input */
+#define ARCHER_C25_GPIO_SHIFT_SRCLK 15 /* SHCP, Shift Reg Clock Input */
+#define ARCHER_C25_GPIO_SHIFT_SRCLR 19 /* MR, Master Reset */
+#define ARCHER_C25_GPIO_SHIFT_RCLK 16 /* STCP, Storage Reg Clock Input */
+
+#define ARCHER_C25_74HC_GPIO_BASE QCA956X_GPIO_COUNT
+#define ARCHER_C25_74HC_GPIO_LED_WAN_AMBER 27
+#define ARCHER_C25_74HC_GPIO_LED_WAN_GREEN 28
+#define ARCHER_C25_74HC_GPIO_LED_WLAN2 29
+#define ARCHER_C25_74HC_GPIO_LED_WLAN5 30
+#define ARCHER_C25_74HC_GPIO_LED_LAN1 23
+#define ARCHER_C25_74HC_GPIO_LED_LAN2 24
+#define ARCHER_C25_74HC_GPIO_LED_LAN3 25
+#define ARCHER_C25_74HC_GPIO_LED_LAN4 26
+
+#define ARCHER_C25_V1_SSR_BIT_0 0
+#define ARCHER_C25_V1_SSR_BIT_1 1
+#define ARCHER_C25_V1_SSR_BIT_2 2
+#define ARCHER_C25_V1_SSR_BIT_3 3
+#define ARCHER_C25_V1_SSR_BIT_4 4
+#define ARCHER_C25_V1_SSR_BIT_5 5
+#define ARCHER_C25_V1_SSR_BIT_6 6
+#define ARCHER_C25_V1_SSR_BIT_7 7
+
+
+#define ARCHER_C25_V1_KEYS_POLL_INTERVAL 20
+#define ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL \
+ (3 * ARCHER_C25_V1_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C25_V1_GPIO_BTN_RESET 1
+#define ARCHER_C25_V1_GPIO_BTN_RFKILL 22
+
+#define ARCHER_C25_V1_GPIO_LED_POWER 17
+#define ARCHER_C25_V1_GPIO_LED_WPS 2
+
+#define ARCHER_C25_V1_WMAC_CALDATA_OFFSET 0x1000
+
+static struct spi_gpio_platform_data archer_c25_v1_spi_data = {
+ .sck = ARCHER_C25_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = ARCHER_C25_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 archer_c25_v1_ssr_initdata[] __initdata = {
+ BIT(ARCHER_C25_V1_SSR_BIT_7) |
+ BIT(ARCHER_C25_V1_SSR_BIT_6) |
+ BIT(ARCHER_C25_V1_SSR_BIT_5) |
+ BIT(ARCHER_C25_V1_SSR_BIT_4) |
+ BIT(ARCHER_C25_V1_SSR_BIT_3) |
+ BIT(ARCHER_C25_V1_SSR_BIT_2) |
+ BIT(ARCHER_C25_V1_SSR_BIT_1)
+};
+
+static struct gen_74x164_chip_platform_data archer_c25_v1_ssr_data = {
+ .base = ARCHER_C25_74HC_GPIO_BASE,
+ .num_registers = ARRAY_SIZE(archer_c25_v1_ssr_initdata),
+ .init_data = archer_c25_v1_ssr_initdata,
+};
+
+static struct platform_device archer_c25_v1_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &archer_c25_v1_spi_data,
+ },
+};
+
+static struct spi_board_info archer_c25_v1_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &archer_c25_v1_ssr_data,
+ .controller_data = (void *) ARCHER_C25_GPIO_SHIFT_RCLK,
+ },
+};
+
+static struct gpio_led archer_c25_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c25-v1:green:power",
+ .gpio = ARCHER_C25_V1_GPIO_LED_POWER,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wps",
+ .gpio = ARCHER_C25_V1_GPIO_LED_WPS,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wlan2g",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WLAN2,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wlan5g",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WLAN5,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan1",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan2",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan3",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:lan4",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_LAN4,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:green:wan",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "archer-c25-v1:amber:wan",
+ .gpio = ARCHER_C25_74HC_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c25_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C25_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C25_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+};
+
+static void __init archer_c25_v1_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f7e0008);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000);
+
+ ath79_register_m25p80(NULL);
+
+ spi_register_board_info(archer_c25_v1_spi_info,
+ ARRAY_SIZE(archer_c25_v1_spi_info));
+
+ platform_device_register(&archer_c25_v1_spi_device);
+
+ gpio_request_one(ARCHER_C25_GPIO_SHIFT_OE,
+ GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "LED control");
+
+ gpio_request_one(ARCHER_C25_GPIO_SHIFT_SRCLR,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "LED reset");
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c25_v1_leds_gpio),
+ archer_c25_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C25_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c25_v1_gpio_keys),
+ archer_c25_v1_gpio_keys);
+
+ ath79_register_mdio(0, 0x0);
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
+
+ /* WAN port */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_register_eth(0);
+
+ /* LAN ports */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + ARCHER_C25_V1_WMAC_CALDATA_OFFSET, mac);
+ ap91_pci_init(NULL, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C25_V1, "ARCHER-C25-V1", "TP-LINK Archer C25 v1",
+ archer_c25_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 469d2fa794..69b0cc97ec 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -39,6 +39,7 @@ enum ath79_mach_type {
ATH79_MACH_AP152, /* Atheros AP152 reference board */
ATH79_MACH_AP90Q, /* YunCore AP90Q */
ATH79_MACH_AP96, /* Atheros AP96 */
+ ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */
ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */
ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */
ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 93a263cfc1..1a7de01498 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -109,6 +109,52 @@ $(Device/tplink)
IMAGE_SIZE := 15872k
endef
+define Device/archer-c25-v1
+ DEVICE_TITLE := TP-LINK Archer C25 v1
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887
+ BOARDNAME := ARCHER-C25-V1
+ TPLINK_BOARD_NAME := ARCHER-C25-V1
+ DEVICE_PROFILE := ARCHERC25V1
+ IMAGE_SIZE := 7808k
+ LOADER_TYPE := elf
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:128k(factory-uboot)ro,64k(u-boot)ro,1536k(kernel),6272k(rootfs),128k(config)ro,64k(art)ro,7808k@0x30000(firmware)
+endef
+TARGET_DEVICES += archer-c25-v1
+
+define Device/archer-c59-v1
+ DEVICE_TITLE := TP-LINK Archer C59 v1
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca988x
+ BOARDNAME := ARCHER-C59-V1
+ TPLINK_BOARD_NAME := ARCHER-C59-V1
+ DEVICE_PROFILE := ARCHERC59V1
+ IMAGE_SIZE := 14528k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1536k(kernel),12992k(rootfs),1664k(tplink)ro,64k(art)ro,14528k@0x20000(firmware)
+endef
+TARGET_DEVICES += archer-c59-v1
+
+define Device/archer-c60-v1
+ DEVICE_TITLE := TP-LINK Archer C60 v1
+ DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
+ BOARDNAME := ARCHER-C60-V1
+ TPLINK_BOARD_NAME := ARCHER-C60-V1
+ DEVICE_PROFILE := ARCHERC60V1
+ IMAGE_SIZE := 7936k
+ KERNEL := kernel-bin | patch-cmdline | lzma | uImageArcher lzma
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
+ IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
+ MTDPARTS := spi0.0:64k(u-boot)ro,64k(mac)ro,1344k(kernel),6592k(rootfs),64k(tplink)ro,64k(art)ro,7936k@0x20000(firmware)
+endef
+TARGET_DEVICES += archer-c60-v1
+
define Device/cpe510-520
DEVICE_TITLE := TP-LINK CPE510/520
DEVICE_PACKAGES := rssileds
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 7368519cee..3b09a9d98f 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -15,6 +15,9 @@
# CONFIG_ATH79_MACH_AP152 is not set
# CONFIG_ATH79_MACH_AP90Q is not set
# CONFIG_ATH79_MACH_AP96 is not set
+# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
# CONFIG_ATH79_MACH_ARDUINO_YUN is not set
# CONFIG_ATH79_MACH_AW_NR580 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index caad128aa6..2d6af55584 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -8,6 +8,9 @@
# CONFIG_ATH79_MACH_AP136 is not set
# CONFIG_ATH79_MACH_AP147 is not set
# CONFIG_ATH79_MACH_AP96 is not set
+# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
# CONFIG_ATH79_MACH_ARCHER_C7 is not set
# CONFIG_ATH79_MACH_AW_NR580 is not set
# CONFIG_ATH79_MACH_CAP324 is not set
--
2.13.1

View File

@ -0,0 +1,109 @@
From 56139beb22e6c39b4888f05997c2c41438d652c6 Mon Sep 17 00:00:00 2001
From: Ludwig Thomeczek <ledesrc@wxorx.net>
Date: Sat, 13 May 2017 11:40:48 +0200
Subject: [PATCH] firmware-utils: tplink-safeloader: add TP-Link Archer C25 v1
This adds the necessary firmware layout definitions for the Archer C25.
It has an addtional partition containing some static data ("extra-para")
without which no factory flash is possible, therefore put_data() has been
added.
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
---
tools/firmware-utils/src/tplink-safeloader.c | 59 +++++++++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 31b374f523..fd4c2ab70d 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -299,6 +299,48 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
+ /** Firmware layout for the C25v1 */
+ {
+ .id = "ARCHER-C25-V1",
+ .support_list =
+ "SupportList:\n"
+ "{product_name:ArcherC25,product_ver:1.0.0,special_id:00000000}\n"
+ "{product_name:ArcherC25,product_ver:1.0.0,special_id:55530000}\n"
+ "{product_name:ArcherC25,product_ver:1.0.0,special_id:45550000}\n",
+ .support_trail = '\x00',
+ .soft_ver = "soft_ver:1.0.0\n",
+
+ /**
+ We use a bigger os-image partition than the stock images (and thus
+ smaller file-system), as our kernel doesn't fit in the stock firmware's
+ 1MB os-image.
+ */
+ .partitions = {
+ {"factory-boot", 0x00000, 0x20000},
+ {"fs-uboot", 0x20000, 0x10000},
+ {"os-image", 0x30000, 0x180000}, /* Stock: base 0x30000 size 0x100000 */
+ {"file-system", 0x1b0000, 0x620000}, /* Stock: base 0x130000 size 0x6a0000 */
+ {"user-config", 0x7d0000, 0x04000},
+ {"default-mac", 0x7e0000, 0x00100},
+ {"device-id", 0x7e0100, 0x00100},
+ {"extra-para", 0x7e0200, 0x00100},
+ {"pin", 0x7e0300, 0x00100},
+ {"support-list", 0x7e0400, 0x00400},
+ {"soft-version", 0x7e0800, 0x00400},
+ {"product-info", 0x7e0c00, 0x01400},
+ {"partition-table", 0x7e2000, 0x01000},
+ {"profile", 0x7e3000, 0x01000},
+ {"default-config", 0x7e4000, 0x04000},
+ {"merge-config", 0x7ec000, 0x02000},
+ {"qos-db", 0x7ee000, 0x02000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the C59v1 */
{
.id = "ARCHER-C59-V1",
@@ -797,6 +839,15 @@ static struct image_partition_entry read_file(const char *part_name, const char
return entry;
}
+/** Creates a new image partition from arbitrary data */
+static struct image_partition_entry put_data(const char *part_name, const char *datain, size_t len) {
+
+ struct image_partition_entry entry = alloc_image_partition(part_name, len);
+
+ memcpy(entry.data, datain, len);
+
+ return entry;
+}
/**
Copies a list of image partitions into an image buffer and generates the image partition table while doing so
@@ -978,7 +1029,8 @@ static void build_image(const char *output,
bool add_jffs2_eof,
bool sysupgrade,
const struct device_info *info) {
- struct image_partition_entry parts[6] = {};
+
+ struct image_partition_entry parts[7] = {};
parts[0] = make_partition_table(info->partitions);
if (info->soft_ver)
@@ -990,6 +1042,11 @@ static void build_image(const char *output,
parts[3] = read_file("os-image", kernel_image, false);
parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof);
+ if (strcasecmp(info->id, "ARCHER-C25-V1") == 0) {
+ const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
+ parts[5] = put_data("extra-para", mdat, 11);
+ }
+
size_t len;
void *image;
if (sysupgrade)
--
2.13.1

View File

@ -0,0 +1,532 @@
From fcd9c8598e8bb04a1f8e11f00b8d721e1c6e7591 Mon Sep 17 00:00:00 2001
From: Henryk Heisig <hyniu@o2.pl>
Date: Tue, 27 Dec 2016 22:41:41 +0100
Subject: [PATCH] ar71xx: add support to TP-Link Archer C59v1 and C60v1
TP-Link Archer C59v1 is a dual-band AC1350 router, based on Qualcomm/Atheros
QCA9561+QCA9886.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- USB 2.0 port
- 8x LED (controled by 74HC595), 3x button
- UART header on PCB
TP-Link Archer C60v1 is a dual-band AC1350 router, based on Qualcomm/Atheros
QCA9561+QCA9886.
Specification:
- 775/650/258 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- 7x LED, 2x button
- UART header on PCB
Currently not working:
- Port LAN1 on C59, LAN4 on C60
- WiFi 5GHz (missing ath10k firmware for QCA9886 chip)
- Update from oficial web interface ( tplink-saveloader not support "product-info")
Flash instruction:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-cXX-v1-squashfs-factory.bin
and rename it to tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin in its root directory
4. Turn off the router
5. Press and hold Reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time
the firmware should be transferred from the tftp server
8. Wait ~30 second to complete recovery.
Flash instruction under U-Boot, using UART:
1. tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
2. erase 0x9f020000 +$filesize
3. cp.b $fileaddr 0x9f020000 $filesize
4. reset
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
[Jo-Philipp Wich: remove duplicate ATH79_MACH_ARCHER_C59/C60_V1 entries]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
---
.../linux/ar71xx/base-files/etc/board.d/02_network | 5 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 6 +
target/linux/ar71xx/config-4.4 | 2 +
.../files/arch/mips/ath79/mach-archer-c59-v1.c | 223 +++++++++++++++++++++
.../files/arch/mips/ath79/mach-archer-c60-v1.c | 135 +++++++++++++
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 2 +
target/linux/ar71xx/image/tp-link.mk | 9 +
7 files changed, 382 insertions(+)
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index de7e082551..51407cb842 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -199,6 +199,11 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
;;
+ archer-c59-v1|\
+ archer-c60-v1)
+ ucidef_add_switch "switch0" \
+ "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
+ ;;
arduino-yun|\
dir-505-a1|\
tl-wa801nd-v3)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 88ad71a1d8..acf667b09f 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -463,6 +463,12 @@ ar71xx_board_detect() {
*"Archer C5")
name="archer-c5"
;;
+ *"Archer C59 v1")
+ name="archer-c59-v1"
+ ;;
+ *"Archer C60 v1")
+ name="archer-c60-v1"
+ ;;
*"Archer C7")
name="archer-c7"
;;
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index c63d97d527..494f9580c8 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -273,6 +273,7 @@ CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
+CONFIG_GPIO_74X164=y
CONFIG_GPIO_DEVRES=y
# CONFIG_GPIO_LATCH is not set
CONFIG_GPIO_NXP_74HC153=y
@@ -431,6 +432,7 @@ CONFIG_SOC_QCA956X=y
CONFIG_SPI=y
CONFIG_SPI_ATH79=y
CONFIG_SPI_BITBANG=y
+CONFIG_SPI_GPIO=y
CONFIG_SPI_MASTER=y
# CONFIG_SPI_RB4XX is not set
# CONFIG_SPI_VSC7385 is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
new file mode 100644
index 0000000000..28353aa77b
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
@@ -0,0 +1,223 @@
+/*
+ * TP-Link Archer C59 v1 board support
+ *
+ * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ *
+ * 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 <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/74x164.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+#define ARCHER_C59_V1_KEYS_POLL_INTERVAL 20
+#define ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C59_V1_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C59_V1_GPIO_BTN_RESET 21
+#define ARCHER_C59_V1_GPIO_BTN_RFKILL 2
+#define ARCHER_C59_V1_GPIO_BTN_WPS 1
+
+#define ARCHER_C59_V1_GPIO_USB_POWER 22
+
+#define ARCHER_C59_GPIO_SHIFT_OE 16
+#define ARCHER_C59_GPIO_SHIFT_SER 17
+#define ARCHER_C59_GPIO_SHIFT_SRCLK 18
+#define ARCHER_C59_GPIO_SHIFT_SRCLR 19
+#define ARCHER_C59_GPIO_SHIFT_RCLK 20
+
+#define ARCHER_C59_74HC_GPIO_BASE QCA956X_GPIO_COUNT
+#define ARCHER_C59_74HC_GPIO_LED_POWER 23
+#define ARCHER_C59_74HC_GPIO_LED_WLAN2 24
+#define ARCHER_C59_74HC_GPIO_LED_WLAN5 25
+#define ARCHER_C59_74HC_GPIO_LED_LAN 26
+#define ARCHER_C59_74HC_GPIO_LED_WAN_GREEN 27
+#define ARCHER_C59_74HC_GPIO_LED_WAN_AMBER 28
+#define ARCHER_C59_74HC_GPIO_LED_WPS 29
+#define ARCHER_C59_74HC_GPIO_LED_USB 30
+
+#define ARCHER_C59_V1_SSR_BIT_0 0
+#define ARCHER_C59_V1_SSR_BIT_1 1
+#define ARCHER_C59_V1_SSR_BIT_2 2
+#define ARCHER_C59_V1_SSR_BIT_3 3
+#define ARCHER_C59_V1_SSR_BIT_4 4
+#define ARCHER_C59_V1_SSR_BIT_5 5
+#define ARCHER_C59_V1_SSR_BIT_6 6
+#define ARCHER_C59_V1_SSR_BIT_7 7
+
+#define ARCHER_C59_V1_WMAC_CALDATA_OFFSET 0x1000
+#define ARCHER_C59_V1_PCI_CALDATA_OFFSET 0x5000
+
+static struct gpio_led archer_c59_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c59-v1:green:power",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_POWER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wlan2g",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN2,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wlan5g",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN5,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:lan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:amber:wan",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:wps",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c59-v1:green:usb",
+ .gpio = ARCHER_C59_74HC_GPIO_LED_USB,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c59_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C59_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+ {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C59_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+ {
+ .desc = "WPS button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C59_V1_GPIO_BTN_WPS,
+ .active_low = 1,
+ },
+};
+
+static struct spi_gpio_platform_data archer_c59_v1_spi_data = {
+ .sck = ARCHER_C59_GPIO_SHIFT_SRCLK,
+ .miso = SPI_GPIO_NO_MISO,
+ .mosi = ARCHER_C59_GPIO_SHIFT_SER,
+ .num_chipselect = 1,
+};
+
+static u8 archer_c59_v1_ssr_initdata[] __initdata = {
+ BIT(ARCHER_C59_V1_SSR_BIT_7) |
+ BIT(ARCHER_C59_V1_SSR_BIT_6) |
+ BIT(ARCHER_C59_V1_SSR_BIT_5) |
+ BIT(ARCHER_C59_V1_SSR_BIT_4) |
+ BIT(ARCHER_C59_V1_SSR_BIT_3) |
+ BIT(ARCHER_C59_V1_SSR_BIT_2) |
+ BIT(ARCHER_C59_V1_SSR_BIT_1)
+};
+
+static struct gen_74x164_chip_platform_data archer_c59_v1_ssr_data = {
+ .base = ARCHER_C59_74HC_GPIO_BASE,
+ .num_registers = ARRAY_SIZE(archer_c59_v1_ssr_initdata),
+ .init_data = archer_c59_v1_ssr_initdata,
+};
+
+static struct platform_device archer_c59_v1_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &archer_c59_v1_spi_data,
+ },
+};
+
+static struct spi_board_info archer_c59_v1_spi_info[] = {
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "74x164",
+ .platform_data = &archer_c59_v1_ssr_data,
+ .controller_data = (void *) ARCHER_C59_GPIO_SHIFT_RCLK,
+ },
+};
+
+static void __init archer_c59_v1_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_m25p80(NULL);
+ spi_register_board_info(archer_c59_v1_spi_info,
+ ARRAY_SIZE(archer_c59_v1_spi_info));
+ platform_device_register(&archer_c59_v1_spi_device);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v1_leds_gpio),
+ archer_c59_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C59_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c59_v1_gpio_keys),
+ archer_c59_v1_gpio_keys);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_eth1_data.phy_mask = BIT(4);
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + ARCHER_C59_V1_WMAC_CALDATA_OFFSET, mac);
+ ap91_pci_init(art + ARCHER_C59_V1_PCI_CALDATA_OFFSET, NULL);
+
+
+ ath79_register_usb();
+ gpio_request_one(ARCHER_C59_V1_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ gpio_request_one(ARCHER_C59_GPIO_SHIFT_OE,
+ GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+ "LED control");
+ gpio_request_one(ARCHER_C59_GPIO_SHIFT_SRCLR,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "LED reset");
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C59_V1, "ARCHER-C59-V1",
+ "TP-LINK Archer C59 v1", archer_c59_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
new file mode 100644
index 0000000000..78186f02cd
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
@@ -0,0 +1,135 @@
+/*
+ * TP-Link Archer C60 v1 board support
+ *
+ * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
+ *
+ * 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 <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/gpio.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+#define ARCHER_C60_V1_GPIO_LED_LAN 2
+#define ARCHER_C60_V1_GPIO_LED_POWER 16
+#define ARCHER_C60_V1_GPIO_LED_WLAN2 17
+#define ARCHER_C60_V1_GPIO_LED_WLAN5 18
+#define ARCHER_C60_V1_GPIO_LED_WPS 19
+#define ARCHER_C60_V1_GPIO_LED_WAN_GREEN 20
+#define ARCHER_C60_V1_GPIO_LED_WAN_AMBER 22
+
+
+#define ARCHER_C60_V1_KEYS_POLL_INTERVAL 20
+#define ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C60_V1_KEYS_POLL_INTERVAL)
+
+#define ARCHER_C60_V1_GPIO_BTN_RESET 21
+#define ARCHER_C60_V1_GPIO_BTN_RFKILL 1
+
+
+
+#define ARCHER_C60_V1_WMAC_CALDATA_OFFSET 0x1000
+#define ARCHER_C60_V1_PCI_CALDATA_OFFSET 0x5000
+
+static struct gpio_led archer_c60_v1_leds_gpio[] __initdata = {
+ {
+ .name = "archer-c60-v1:green:power",
+ .gpio = ARCHER_C60_V1_GPIO_LED_POWER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wlan2g",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WLAN2,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wlan5g",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WLAN5,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:lan",
+ .gpio = ARCHER_C60_V1_GPIO_LED_LAN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wan",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:amber:wan",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ },
+ {
+ .name = "archer-c60-v1:green:wps",
+ .gpio = ARCHER_C60_V1_GPIO_LED_WPS,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button archer_c60_v1_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C60_V1_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+ {
+ .desc = "RFKILL button",
+ .type = EV_KEY,
+ .code = KEY_RFKILL,
+ .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = ARCHER_C60_V1_GPIO_BTN_RFKILL,
+ .active_low = 1,
+ },
+};
+
+static void __init archer_c60_v1_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c60_v1_leds_gpio),
+ archer_c60_v1_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, ARCHER_C60_V1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(archer_c60_v1_gpio_keys),
+ archer_c60_v1_gpio_keys);
+
+ ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
+ QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(art + ARCHER_C60_V1_WMAC_CALDATA_OFFSET, mac);
+ ap91_pci_init(art + ARCHER_C60_V1_PCI_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C60_V1, "ARCHER-C60-V1",
+ "TP-LINK Archer C60 v1", archer_c60_v1_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 69b0cc97ec..fedbbc9f4e 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -41,6 +41,8 @@ enum ath79_mach_type {
ATH79_MACH_AP96, /* Atheros AP96 */
ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */
ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */
+ ATH79_MACH_ARCHER_C59_V1, /* TP-LINK Archer C59 V1 board */
+ ATH79_MACH_ARCHER_C60_V1, /* TP-LINK Archer C60 V1 board */
ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */
ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */
ATH79_MACH_ARDUINO_YUN, /* Yun */
diff --git a/target/linux/ar71xx/image/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk
index 1a7de01498..0649ba6d40 100644
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -59,6 +59,15 @@ define Build/mktplinkfw-kernel
@mv $@.new $@
endef
+define Build/uImageArcher
+ mkimage -A $(LINUX_KARCH) \
+ -O linux -T kernel \
+ -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
+ -n '$(call toupper,$(LINUX_KARCH)) LEDE Linux-$(LINUX_VERSION)' -d $@ $@.new
+ @mv $@.new $@
+endef
+
+
define Device/tplink
TPLINK_HWREV := 0x1
TPLINK_HEADER_VERSION := 1
--
2.13.1

View File

@ -0,0 +1,175 @@
From caf2844a4a90ad035bd0720839427f9718527d4d Mon Sep 17 00:00:00 2001
From: Henryk Heisig <hyniu@o2.pl>
Date: Fri, 6 Jan 2017 21:21:11 +0100
Subject: [PATCH] ar71xx: QCA956X: add missing register
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
---
.../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 23 ++++++++++++-
.../linux/ar71xx/files/arch/mips/ath79/dev-eth.h | 1 +
.../mips/include/asm/mach-ath79/ag71xx_platform.h | 2 ++
...add-more-register-defines-for-QCA956x-SoC.patch | 38 ++++++++++++++++++++++
.../640-MIPS-ath79-add-QCA955x-wmac-reset.patch | 2 +-
.../820-MIPS-ath79-add_gpio_function2_setup.patch | 4 +--
6 files changed, 66 insertions(+), 4 deletions(-)
create mode 100644 target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
index 790c2d3396..a8b19b68b2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -686,7 +686,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
case ATH79_SOC_AR7241:
case ATH79_SOC_AR9330:
case ATH79_SOC_AR9331:
- case ATH79_SOC_QCA956X:
case ATH79_SOC_TP9343:
pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII;
break;
@@ -698,6 +697,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
case ATH79_SOC_AR9342:
case ATH79_SOC_AR9344:
case ATH79_SOC_QCA9533:
+ case ATH79_SOC_QCA956X:
switch (pdata->phy_if_mode) {
case PHY_INTERFACE_MODE_MII:
case PHY_INTERFACE_MODE_GMII:
@@ -814,6 +814,27 @@ void __init ath79_setup_qca955x_eth_cfg(u32 mask)
iounmap(base);
}
+void __init ath79_setup_qca956x_eth_cfg(u32 mask)
+{
+ void __iomem *base;
+ u32 t;
+
+ base = ioremap(QCA956X_GMAC_BASE, QCA956X_GMAC_SIZE);
+
+ t = __raw_readl(base + QCA956X_GMAC_REG_ETH_CFG);
+
+ t &= ~(QCA956X_ETH_CFG_SW_ONLY_MODE |
+ QCA956X_ETH_CFG_SW_PHY_SWAP);
+
+ t |= mask;
+
+ __raw_writel(t, base + QCA956X_GMAC_REG_ETH_CFG);
+ /* flush write */
+ __raw_readl(base + QCA956X_GMAC_REG_ETH_CFG);
+
+ iounmap(base);
+}
+
static int ath79_eth_instance __initdata;
void __init ath79_register_eth(unsigned int id)
{
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
index 5a226e4028..fb9e4f63c6 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
@@ -49,5 +49,6 @@ void ath79_setup_ar933x_phy4_switch(bool mac, bool mdio);
void ath79_setup_ar934x_eth_cfg(u32 mask);
void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
void ath79_setup_qca955x_eth_cfg(u32 mask);
+void ath79_setup_qca956x_eth_cfg(u32 mask);
#endif /* _ATH79_DEV_ETH_H */
diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
index 5fd352c638..078fa157f2 100644
--- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
+++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
@@ -37,11 +37,13 @@ struct ag71xx_platform_data {
u8 is_ar724x:1;
u8 has_ar8216:1;
u8 use_flow_control:1;
+ u8 is_qca956x:1;
struct ag71xx_switch_platform_data *switch_data;
void (*ddr_flush)(void);
void (*set_speed)(int speed);
+ void (*update_pll)(u32 pll_10, u32 pll_100, u32 pll_1000);
u32 fifo_cfg1;
u32 fifo_cfg2;
diff --git a/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
new file mode 100644
index 0000000000..dff354398c
--- /dev/null
+++ b/target/linux/ar71xx/patches-4.4/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch
@@ -0,0 +1,38 @@
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -157,6 +157,10 @@
+ #define QCA956X_EHCI0_BASE 0x1b000000
+ #define QCA956X_EHCI1_BASE 0x1b400000
+ #define QCA956X_EHCI_SIZE 0x200
++#define QCA956X_GMAC_SGMII_BASE (AR71XX_APB_BASE + 0x00070000)
++#define QCA956X_GMAC_SGMII_SIZE 0x64
++#define QCA956X_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
++#define QCA956X_PLL_SIZE 0x50
+ #define QCA956X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
+ #define QCA956X_GMAC_SIZE 0x64
+
+@@ -404,6 +408,7 @@
+ #define QCA956X_PLL_DDR_CONFIG_REG 0x08
+ #define QCA956X_PLL_DDR_CONFIG1_REG 0x0c
+ #define QCA956X_PLL_CLK_CTRL_REG 0x10
++#define QCA956X_PLL_ETH_XMII_CONTROL_REG 0x30
+
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
+@@ -1186,4 +1191,16 @@
+ #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3
+ #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20
+
++/*
++ * QCA956X GMAC Interface
++ */
++
++#define QCA956X_GMAC_REG_ETH_CFG 0x00
++
++#define QCA956X_ETH_CFG_SW_ONLY_MODE BIT(7)
++#define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8)
++#define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(9)
++#define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10)
++#define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
++
+ #endif /* __ASM_MACH_AR71XX_REGS_H */
diff --git a/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch b/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
index add2992186..8aa5957a71 100644
--- a/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
+++ b/target/linux/ar71xx/patches-4.4/640-MIPS-ath79-add-QCA955x-wmac-reset.patch
@@ -20,7 +20,7 @@
#define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000)
#define AR71XX_UART_SIZE 0x100
#define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
-@@ -218,6 +218,9 @@
+@@ -222,6 +222,9 @@
#define QCA953X_DDR_REG_FLUSH_PCIE 0xa8
#define QCA953X_DDR_REG_FLUSH_WMAC 0xac
diff --git a/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch b/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
index 7db6ad361f..6b331587d1 100644
--- a/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
+++ b/target/linux/ar71xx/patches-4.4/820-MIPS-ath79-add_gpio_function2_setup.patch
@@ -48,7 +48,7 @@ functions on the Arduino Yun.
void __iomem *reg = ath79_gpio_get_function_reg();
--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
-@@ -850,6 +850,7 @@
+@@ -855,6 +855,7 @@
#define AR71XX_GPIO_REG_INT_PENDING 0x20
#define AR71XX_GPIO_REG_INT_ENABLE 0x24
#define AR71XX_GPIO_REG_FUNC 0x28
@@ -56,7 +56,7 @@ functions on the Arduino Yun.
#define AR934X_GPIO_REG_OUT_FUNC0 0x2c
#define AR934X_GPIO_REG_OUT_FUNC1 0x30
-@@ -974,6 +975,8 @@
+@@ -979,6 +980,8 @@
#define AR724X_GPIO_FUNC_UART_EN BIT(1)
#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0)
--
2.13.1