From cfb4c36848c14d390fd9107f388dfaecc77ee97e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 28 Feb 2016 02:30:34 +0100 Subject: [PATCH 001/184] brcm2708-gpu-fw: move pkg build dir to kernel build dir to fix rebuild bugs after cleaning the kernel tree Backport of r48732 --- ...-bugs-after-cleaning-the-kernel-tree.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch diff --git a/patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch b/patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch new file mode 100644 index 00000000..1fab9e46 --- /dev/null +++ b/patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch @@ -0,0 +1,19 @@ +From: Matthias Schiffer +Date: Sun, 28 Feb 2016 02:29:56 +0100 +Subject: brcm2708-gpu-fw: move pkg build dir to kernel build dir to fix rebuild bugs after cleaning the kernel tree + +Backport of r48732 + +diff --git a/package/kernel/brcm2708-gpu-fw/Makefile b/package/kernel/brcm2708-gpu-fw/Makefile +index eee85e0..286984b 100644 +--- a/package/kernel/brcm2708-gpu-fw/Makefile ++++ b/package/kernel/brcm2708-gpu-fw/Makefile +@@ -16,7 +16,7 @@ PKG_SOURCE:=$(PKG_REV).tar.gz + PKG_SOURCE_URL:=https://github.com/Hexxeh/rpi-firmware/archive/ + PKG_MD5SUM:=f5683c1dcb255714942f7c9fd61b3a0a + +-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_REV) ++PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_REV) + + include $(INCLUDE_DIR)/package.mk + From 549187b66cfc19f0f2fe2351a3611c815cd8577d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 28 Feb 2016 04:41:39 +0100 Subject: [PATCH 002/184] kernel/gpio_keys: load module on pre-init fix rescue mode on wdr4900 Backport of r48793 --- ...el-gpio_keys-load-module-on-pre-init.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch diff --git a/patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch b/patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch new file mode 100644 index 00000000..cba048f6 --- /dev/null +++ b/patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch @@ -0,0 +1,21 @@ +From: Matthias Schiffer +Date: Sun, 28 Feb 2016 03:42:29 +0100 +Subject: kernel/gpio_keys: load module on pre-init + +fix rescue mode on wdr4900 + +Backport of r48793 + +diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk +index 86ff33c..eed9aa2 100644 +--- a/package/kernel/linux/modules/input.mk ++++ b/package/kernel/linux/modules/input.mk +@@ -75,7 +75,7 @@ define KernelPackage/input-gpio-keys + CONFIG_KEYBOARD_GPIO \ + CONFIG_INPUT_KEYBOARD=y + FILES:=$(LINUX_DIR)/drivers/input/keyboard/gpio_keys.ko +- AUTOLOAD:=$(call AutoProbe,gpio_keys) ++ AUTOLOAD:=$(call AutoProbe,gpio_keys,1) + endef + + define KernelPackage/input-gpio-keys/description From 6d3de131bf603c67c9a2fa2ce18b2061f0e169fd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 28 Feb 2016 05:00:50 +0100 Subject: [PATCH 003/184] ar71xx/lzma-loader: fix O32 ABI conformance Backport of r48279 --- ...-lzma-loader-fix-O32-ABI-conformance.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch diff --git a/patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch b/patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch new file mode 100644 index 00000000..2d08f3b4 --- /dev/null +++ b/patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch @@ -0,0 +1,36 @@ +From: Matthias Schiffer +Date: Sun, 28 Feb 2016 04:49:51 +0100 +Subject: ar71xx/lzma-loader: fix O32 ABI conformance + +According to the calling convention of the o32 ABI the caller +function must reserve stack space for $a0-$a3 registers in case +the callee needs to save its arguments. + +The assembly code of the loader does not reserve stack space for +these registers thus when the 'loader_main' function needs to save +its arguments, those will be stored in the 'workspace' area instead +of the stack. + +Because the workspace area is also used by other part of the code, the +saved register values gets overwritten and this often leads to failed +kernel boots. + +Fix the code to reserve stack space for the registers to avoid this +error. + +Backport of r48279 + +diff --git a/target/linux/ar71xx/image/lzma-loader/src/head.S b/target/linux/ar71xx/image/lzma-loader/src/head.S +index 543996a..47a7c9b 100644 +--- a/target/linux/ar71xx/image/lzma-loader/src/head.S ++++ b/target/linux/ar71xx/image/lzma-loader/src/head.S +@@ -109,6 +109,9 @@ __bss_check: + /* Setup new "C" stack */ + la sp, _stack + ++ /* reserve stack space for a0-a3 registers */ ++ subu sp, 16 ++ + /* jump to the decompressor routine */ + la t0, loader_main + jr t0 From b4a378d9d841e207dde850f4d48edd6070f629ce Mon Sep 17 00:00:00 2001 From: Matthias Ludwig Date: Mon, 29 Feb 2016 11:23:01 +0100 Subject: [PATCH 004/184] ar71xx-generic: add support for TP-Link MR13U --- targets/ar71xx-generic/profiles.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index d161e15a..f3aecd24 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -130,6 +130,10 @@ endif $(eval $(call GluonProfile,TLMR13U)) $(eval $(call GluonModel,TLMR13U,tl-mr13u-v1,tp-link-tl-mr13u-v1)) +# TL-MR13U v1 +$(eval $(call GluonProfile,TLMR13U)) +$(eval $(call GluonModel,TLMR13U,tl-mr13u-v1,tp-link-tl-mr13u-v1)) + # TL-MR3020 v1 $(eval $(call GluonProfile,TLMR3020)) $(eval $(call GluonModel,TLMR3020,tl-mr3020-v1,tp-link-tl-mr3020-v1)) From 580326dcf5da2f53302b96d1bfa1226eaa3be3c7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 25 Feb 2016 22:50:58 +0100 Subject: [PATCH 005/184] firmware-utils: mkfwimage: fix firmware_max_length for XM layout This should fix problems with flashing from AirOS 5.6.x. --- ...bvious-bugs-causing-compile-warnings.patch | 64 +++++++++++++++++++ ...s-split-ubdev01-flash-layout-from-XM.patch | 39 +++++++++++ ...ix-firmware_max_length-for-XM-layout.patch | 45 +++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch create mode 100644 patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch create mode 100644 patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch diff --git a/patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch b/patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch new file mode 100644 index 00000000..781fd5d4 --- /dev/null +++ b/patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch @@ -0,0 +1,64 @@ +From: Matthias Schiffer +Date: Thu, 25 Feb 2016 21:39:03 +0100 +Subject: firmware-utils: mkfwimage: add -Wall, fix obvious bugs causing compile warnings + +Signed-off-by: Matthias Schiffer + +diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile +index bd69cb4..6d88845 100644 +--- a/tools/firmware-utils/Makefile ++++ b/tools/firmware-utils/Makefile +@@ -32,7 +32,7 @@ define Host/Compile + $(call cc,mkzynfw) + $(call cc,lzma2eva,-lz) + $(call cc,mkcasfw) +- $(call cc,mkfwimage,-lz) ++ $(call cc,mkfwimage,-lz -Wall) + $(call cc,mkfwimage2,-lz) + $(call cc,imagetag imagetag_cmdline cyg_crc32) + $(call cc,add_header) +diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c +index e3a03c1..00bf439 100644 +--- a/tools/firmware-utils/src/mkfwimage.c ++++ b/tools/firmware-utils/src/mkfwimage.c +@@ -104,8 +104,6 @@ typedef struct part_data { + + #define OPTIONS "B:hv:m:o:r:k:" + +-static int debug = 0; +- + typedef struct image_info { + char magic[16]; + char version[256]; +@@ -236,9 +234,9 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c + fw_layout_t* p; + + p = &fw_layout_data[0]; +- while ((strlen(p->name) != 0) && (strncmp(p->name, board_name, sizeof(board_name)) != 0)) ++ while (*p->name && (strcmp(p->name, board_name) != 0)) + p++; +- if (p->name == NULL) { ++ if (!*p->name) { + printf("BUG! Unable to find default fw layout!\n"); + exit(-1); + } +@@ -247,7 +245,7 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c + strcpy(kernel->partition_name, "kernel"); + kernel->partition_index = 1; + kernel->partition_baseaddr = p->kern_start; +- if ( (kernel->partition_length = filelength(kernelfile)) < 0) return (-1); ++ if ( (kernel->partition_length = filelength(kernelfile)) == (u_int32_t)-1) return (-1); + kernel->partition_memaddr = p->kern_entry; + kernel->partition_entryaddr = p->kern_entry; + strncpy(kernel->filename, kernelfile, sizeof(kernel->filename)); +@@ -263,8 +261,8 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c + rootfs->partition_entryaddr = 0x00000000; + strncpy(rootfs->filename, rootfsfile, sizeof(rootfs->filename)); + +-printf("kernel: %d 0x%08x\n", kernel->partition_length, kernel->partition_baseaddr); +-printf("root: %d 0x%08x\n", rootfs->partition_length, rootfs->partition_baseaddr); ++ printf("kernel: %d 0x%08x\n", kernel->partition_length, kernel->partition_baseaddr); ++ printf("root: %d 0x%08x\n", rootfs->partition_length, rootfs->partition_baseaddr); + im->part_count = 2; + + return 0; diff --git a/patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch b/patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch new file mode 100644 index 00000000..3dcad272 --- /dev/null +++ b/patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch @@ -0,0 +1,39 @@ +From: Matthias Schiffer +Date: Thu, 25 Feb 2016 21:40:19 +0100 +Subject: ar71xx, firmware-utils: split ubdev01 flash layout from XM + +The ubdev01 profile defines its own MTDPARTS with smaller firmware +partition, so give it its own UBNT_BOARD in mkfwimage. + +Signed-off-by: Matthias Schiffer + +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 4b29d9c..0806f15 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2031,7 +2031,7 @@ $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,C + $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x)) + $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240)) + +-$(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,XM,XM,ar7240)) ++$(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,UBDEV01,XM,ar7240)) + + $(eval $(call SingleProfile,UBNT,64k,UBNTRS,ubnt-rs,UBNT-RS,ttyS0,115200,RS,RSx,ar7100)) + $(eval $(call SingleProfile,UBNT,64k,UBNTRSPRO,ubnt-rspro,UBNT-RSPRO,ttyS0,115200,RSPRO,RSPRO,ar7100pro)) +diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c +index 00bf439..5dae284 100644 +--- a/tools/firmware-utils/src/mkfwimage.c ++++ b/tools/firmware-utils/src/mkfwimage.c +@@ -81,6 +81,12 @@ fw_layout_t fw_layout_data[] = { + .kern_entry = 0x80002000, + .firmware_max_length= 0x006A0000, + }, ++ { ++ .name = "UBDEV01", ++ .kern_start = 0x9f050000, ++ .kern_entry = 0x80002000, ++ .firmware_max_length= 0x006A0000, ++ }, + { .name = "", + }, + }; diff --git a/patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch b/patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch new file mode 100644 index 00000000..ab1c34db --- /dev/null +++ b/patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch @@ -0,0 +1,45 @@ +From: Matthias Schiffer +Date: Thu, 25 Feb 2016 21:42:14 +0100 +Subject: firmware-utils: mkfwimage: fix firmware_max_length for XM layout + +The new u-boot version bundled with the 5.6.x firmwares from Ubiquiti gets +confused by the smaller rootfs partition size; this can lead to various +issues: + +1. We've gotten reports that flashing from the 5.6.x stock firmware to + OpenWrt will brick devices; I wasn't able to reproduce this myself +2. Flashing from 5.5.x stock firmware to OpenWrt and back to stock (via + TFTP recovery), following by an update to 5.6.x via web interface can + yield a bricked device with the following properties: + - It can't be booted without entering commands over a serial console, as + u-boot supplies the wrong MTD layout + - The web interface won't accept any image with the original flash + layout, so stock firmware upgrades are impossible + - As the TFTP recovery doesn't update u-boot, returning to the old + u-boot from firmware 5.5.x is impossible + +To recover from 2., creating an OpenWrt image which doesn't set u-boot as +read-only and flashing a backup of the old u-boot from there is the only +way known to me. (Fixing the mtdparts variable in u-boot-env from OpenWrt +might also work; settings this from u-boot over serial didn't have +any permanent effect.) + +Fix all of this by setting the correct flash layout also used by the stock +firmware. Flashing has been tested from both firmware 5.5.x and 5.6.x. The +fixed layout also matches the mtdparts defined by OpenWrt. + +Signed-off-by: Matthias Schiffer + +diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c +index 5dae284..d8d5239 100644 +--- a/tools/firmware-utils/src/mkfwimage.c ++++ b/tools/firmware-utils/src/mkfwimage.c +@@ -79,7 +79,7 @@ fw_layout_t fw_layout_data[] = { + .name = "XM", + .kern_start = 0x9f050000, + .kern_entry = 0x80002000, +- .firmware_max_length= 0x006A0000, ++ .firmware_max_length= 0x00760000, + }, + { + .name = "UBDEV01", From 71a23bc4610ce9a96395887361f985490634be5b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 26 Feb 2016 04:39:50 +0100 Subject: [PATCH 006/184] kernel: disable software protection bits for macronix flash chips at init The bootloader of AirOS 5.6.x doesn't remove the flash protection for us, so we have to do this ourselves. --- ...its-for-macronix-flash-chips-at-init.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch diff --git a/patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch b/patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch new file mode 100644 index 00000000..2b16474a --- /dev/null +++ b/patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch @@ -0,0 +1,22 @@ +From: Matthias Schiffer +Date: Fri, 26 Feb 2016 04:24:06 +0100 +Subject: kernel: disable software protection bits for macronix flash chips at init + +Backport of r47626 + +diff --git a/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch +new file mode 100644 +index 0000000..d7d7eec +--- /dev/null ++++ b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch +@@ -0,0 +1,10 @@ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -962,6 +962,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ ++ if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || ++ JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || +++ JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX || ++ JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { ++ write_enable(nor); ++ write_sr(nor, 0); From 7e6acb0ac511b373ff5f8f1eff650b533b2c31ae Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 2 Mar 2016 18:27:29 +0100 Subject: [PATCH 007/184] x86/generic: enable pata_atiixp driver --- ...86-generic-enable-pata_atiixp-driver.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch diff --git a/patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch b/patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch new file mode 100644 index 00000000..9bc53737 --- /dev/null +++ b/patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch @@ -0,0 +1,24 @@ +From: Matthias Schiffer +Date: Wed, 2 Mar 2016 18:26:15 +0100 +Subject: x86/generic: enable pata_atiixp driver + +This enables booting from devices that use an ATI PATA controller for +the boot device, such as the embedded CF cards in Fujitsu-Siemens Futro +thin-clients. + +Signed-off-by: Felix Kaechele + +Backport of r48861 + +diff --git a/target/linux/x86/generic/config-default b/target/linux/x86/generic/config-default +index eb4b357..9e963bf 100644 +--- a/target/linux/x86/generic/config-default ++++ b/target/linux/x86/generic/config-default +@@ -153,6 +153,7 @@ CONFIG_NLS=y + CONFIG_NO_HZ=y + # CONFIG_PANASONIC_LAPTOP is not set + CONFIG_PATA_AMD=y ++CONFIG_PATA_ATIIXP=y + CONFIG_PATA_LEGACY=y + CONFIG_PATA_MPIIX=y + CONFIG_PATA_OLDPIIX=y From abf5e610ae923515288e74e0d631a161ef4046a9 Mon Sep 17 00:00:00 2001 From: JuS Date: Thu, 3 Mar 2016 12:10:44 +0100 Subject: [PATCH 008/184] Merge Datei-Leichen Entfernt --- ...-bugs-after-cleaning-the-kernel-tree.patch | 19 ------ ...el-gpio_keys-load-module-on-pre-init.patch | 21 ------ ...-lzma-loader-fix-O32-ABI-conformance.patch | 36 ----------- ...bvious-bugs-causing-compile-warnings.patch | 64 ------------------- ...s-split-ubdev01-flash-layout-from-XM.patch | 39 ----------- ...ix-firmware_max_length-for-XM-layout.patch | 45 ------------- ...its-for-macronix-flash-chips-at-init.patch | 22 ------- ...86-generic-enable-pata_atiixp-driver.patch | 24 ------- 8 files changed, 270 deletions(-) delete mode 100644 patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch delete mode 100644 patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch delete mode 100644 patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch delete mode 100644 patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch delete mode 100644 patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch delete mode 100644 patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch delete mode 100644 patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch delete mode 100644 patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch diff --git a/patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch b/patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch deleted file mode 100644 index 1fab9e46..00000000 --- a/patches/openwrt/0049-brcm2708-gpu-fw-move-pkg-build-dir-to-kernel-build-dir-to-fix-rebuild-bugs-after-cleaning-the-kernel-tree.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Matthias Schiffer -Date: Sun, 28 Feb 2016 02:29:56 +0100 -Subject: brcm2708-gpu-fw: move pkg build dir to kernel build dir to fix rebuild bugs after cleaning the kernel tree - -Backport of r48732 - -diff --git a/package/kernel/brcm2708-gpu-fw/Makefile b/package/kernel/brcm2708-gpu-fw/Makefile -index eee85e0..286984b 100644 ---- a/package/kernel/brcm2708-gpu-fw/Makefile -+++ b/package/kernel/brcm2708-gpu-fw/Makefile -@@ -16,7 +16,7 @@ PKG_SOURCE:=$(PKG_REV).tar.gz - PKG_SOURCE_URL:=https://github.com/Hexxeh/rpi-firmware/archive/ - PKG_MD5SUM:=f5683c1dcb255714942f7c9fd61b3a0a - --PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_REV) -+PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_REV) - - include $(INCLUDE_DIR)/package.mk - diff --git a/patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch b/patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch deleted file mode 100644 index cba048f6..00000000 --- a/patches/openwrt/0050-kernel-gpio_keys-load-module-on-pre-init.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Matthias Schiffer -Date: Sun, 28 Feb 2016 03:42:29 +0100 -Subject: kernel/gpio_keys: load module on pre-init - -fix rescue mode on wdr4900 - -Backport of r48793 - -diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk -index 86ff33c..eed9aa2 100644 ---- a/package/kernel/linux/modules/input.mk -+++ b/package/kernel/linux/modules/input.mk -@@ -75,7 +75,7 @@ define KernelPackage/input-gpio-keys - CONFIG_KEYBOARD_GPIO \ - CONFIG_INPUT_KEYBOARD=y - FILES:=$(LINUX_DIR)/drivers/input/keyboard/gpio_keys.ko -- AUTOLOAD:=$(call AutoProbe,gpio_keys) -+ AUTOLOAD:=$(call AutoProbe,gpio_keys,1) - endef - - define KernelPackage/input-gpio-keys/description diff --git a/patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch b/patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch deleted file mode 100644 index 2d08f3b4..00000000 --- a/patches/openwrt/0051-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Matthias Schiffer -Date: Sun, 28 Feb 2016 04:49:51 +0100 -Subject: ar71xx/lzma-loader: fix O32 ABI conformance - -According to the calling convention of the o32 ABI the caller -function must reserve stack space for $a0-$a3 registers in case -the callee needs to save its arguments. - -The assembly code of the loader does not reserve stack space for -these registers thus when the 'loader_main' function needs to save -its arguments, those will be stored in the 'workspace' area instead -of the stack. - -Because the workspace area is also used by other part of the code, the -saved register values gets overwritten and this often leads to failed -kernel boots. - -Fix the code to reserve stack space for the registers to avoid this -error. - -Backport of r48279 - -diff --git a/target/linux/ar71xx/image/lzma-loader/src/head.S b/target/linux/ar71xx/image/lzma-loader/src/head.S -index 543996a..47a7c9b 100644 ---- a/target/linux/ar71xx/image/lzma-loader/src/head.S -+++ b/target/linux/ar71xx/image/lzma-loader/src/head.S -@@ -109,6 +109,9 @@ __bss_check: - /* Setup new "C" stack */ - la sp, _stack - -+ /* reserve stack space for a0-a3 registers */ -+ subu sp, 16 -+ - /* jump to the decompressor routine */ - la t0, loader_main - jr t0 diff --git a/patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch b/patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch deleted file mode 100644 index 781fd5d4..00000000 --- a/patches/openwrt/0052-firmware-utils-mkfwimage-add-Wall-fix-obvious-bugs-causing-compile-warnings.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 25 Feb 2016 21:39:03 +0100 -Subject: firmware-utils: mkfwimage: add -Wall, fix obvious bugs causing compile warnings - -Signed-off-by: Matthias Schiffer - -diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile -index bd69cb4..6d88845 100644 ---- a/tools/firmware-utils/Makefile -+++ b/tools/firmware-utils/Makefile -@@ -32,7 +32,7 @@ define Host/Compile - $(call cc,mkzynfw) - $(call cc,lzma2eva,-lz) - $(call cc,mkcasfw) -- $(call cc,mkfwimage,-lz) -+ $(call cc,mkfwimage,-lz -Wall) - $(call cc,mkfwimage2,-lz) - $(call cc,imagetag imagetag_cmdline cyg_crc32) - $(call cc,add_header) -diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c -index e3a03c1..00bf439 100644 ---- a/tools/firmware-utils/src/mkfwimage.c -+++ b/tools/firmware-utils/src/mkfwimage.c -@@ -104,8 +104,6 @@ typedef struct part_data { - - #define OPTIONS "B:hv:m:o:r:k:" - --static int debug = 0; -- - typedef struct image_info { - char magic[16]; - char version[256]; -@@ -236,9 +234,9 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c - fw_layout_t* p; - - p = &fw_layout_data[0]; -- while ((strlen(p->name) != 0) && (strncmp(p->name, board_name, sizeof(board_name)) != 0)) -+ while (*p->name && (strcmp(p->name, board_name) != 0)) - p++; -- if (p->name == NULL) { -+ if (!*p->name) { - printf("BUG! Unable to find default fw layout!\n"); - exit(-1); - } -@@ -247,7 +245,7 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c - strcpy(kernel->partition_name, "kernel"); - kernel->partition_index = 1; - kernel->partition_baseaddr = p->kern_start; -- if ( (kernel->partition_length = filelength(kernelfile)) < 0) return (-1); -+ if ( (kernel->partition_length = filelength(kernelfile)) == (u_int32_t)-1) return (-1); - kernel->partition_memaddr = p->kern_entry; - kernel->partition_entryaddr = p->kern_entry; - strncpy(kernel->filename, kernelfile, sizeof(kernel->filename)); -@@ -263,8 +261,8 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c - rootfs->partition_entryaddr = 0x00000000; - strncpy(rootfs->filename, rootfsfile, sizeof(rootfs->filename)); - --printf("kernel: %d 0x%08x\n", kernel->partition_length, kernel->partition_baseaddr); --printf("root: %d 0x%08x\n", rootfs->partition_length, rootfs->partition_baseaddr); -+ printf("kernel: %d 0x%08x\n", kernel->partition_length, kernel->partition_baseaddr); -+ printf("root: %d 0x%08x\n", rootfs->partition_length, rootfs->partition_baseaddr); - im->part_count = 2; - - return 0; diff --git a/patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch b/patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch deleted file mode 100644 index 3dcad272..00000000 --- a/patches/openwrt/0053-ar71xx-firmware-utils-split-ubdev01-flash-layout-from-XM.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 25 Feb 2016 21:40:19 +0100 -Subject: ar71xx, firmware-utils: split ubdev01 flash layout from XM - -The ubdev01 profile defines its own MTDPARTS with smaller firmware -partition, so give it its own UBNT_BOARD in mkfwimage. - -Signed-off-by: Matthias Schiffer - -diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile -index 4b29d9c..0806f15 100644 ---- a/target/linux/ar71xx/image/Makefile -+++ b/target/linux/ar71xx/image/Makefile -@@ -2031,7 +2031,7 @@ $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,C - $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x)) - $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240)) - --$(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,XM,XM,ar7240)) -+$(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,UBDEV01,XM,ar7240)) - - $(eval $(call SingleProfile,UBNT,64k,UBNTRS,ubnt-rs,UBNT-RS,ttyS0,115200,RS,RSx,ar7100)) - $(eval $(call SingleProfile,UBNT,64k,UBNTRSPRO,ubnt-rspro,UBNT-RSPRO,ttyS0,115200,RSPRO,RSPRO,ar7100pro)) -diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c -index 00bf439..5dae284 100644 ---- a/tools/firmware-utils/src/mkfwimage.c -+++ b/tools/firmware-utils/src/mkfwimage.c -@@ -81,6 +81,12 @@ fw_layout_t fw_layout_data[] = { - .kern_entry = 0x80002000, - .firmware_max_length= 0x006A0000, - }, -+ { -+ .name = "UBDEV01", -+ .kern_start = 0x9f050000, -+ .kern_entry = 0x80002000, -+ .firmware_max_length= 0x006A0000, -+ }, - { .name = "", - }, - }; diff --git a/patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch b/patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch deleted file mode 100644 index ab1c34db..00000000 --- a/patches/openwrt/0054-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 25 Feb 2016 21:42:14 +0100 -Subject: firmware-utils: mkfwimage: fix firmware_max_length for XM layout - -The new u-boot version bundled with the 5.6.x firmwares from Ubiquiti gets -confused by the smaller rootfs partition size; this can lead to various -issues: - -1. We've gotten reports that flashing from the 5.6.x stock firmware to - OpenWrt will brick devices; I wasn't able to reproduce this myself -2. Flashing from 5.5.x stock firmware to OpenWrt and back to stock (via - TFTP recovery), following by an update to 5.6.x via web interface can - yield a bricked device with the following properties: - - It can't be booted without entering commands over a serial console, as - u-boot supplies the wrong MTD layout - - The web interface won't accept any image with the original flash - layout, so stock firmware upgrades are impossible - - As the TFTP recovery doesn't update u-boot, returning to the old - u-boot from firmware 5.5.x is impossible - -To recover from 2., creating an OpenWrt image which doesn't set u-boot as -read-only and flashing a backup of the old u-boot from there is the only -way known to me. (Fixing the mtdparts variable in u-boot-env from OpenWrt -might also work; settings this from u-boot over serial didn't have -any permanent effect.) - -Fix all of this by setting the correct flash layout also used by the stock -firmware. Flashing has been tested from both firmware 5.5.x and 5.6.x. The -fixed layout also matches the mtdparts defined by OpenWrt. - -Signed-off-by: Matthias Schiffer - -diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c -index 5dae284..d8d5239 100644 ---- a/tools/firmware-utils/src/mkfwimage.c -+++ b/tools/firmware-utils/src/mkfwimage.c -@@ -79,7 +79,7 @@ fw_layout_t fw_layout_data[] = { - .name = "XM", - .kern_start = 0x9f050000, - .kern_entry = 0x80002000, -- .firmware_max_length= 0x006A0000, -+ .firmware_max_length= 0x00760000, - }, - { - .name = "UBDEV01", diff --git a/patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch b/patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch deleted file mode 100644 index 2b16474a..00000000 --- a/patches/openwrt/0055-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Matthias Schiffer -Date: Fri, 26 Feb 2016 04:24:06 +0100 -Subject: kernel: disable software protection bits for macronix flash chips at init - -Backport of r47626 - -diff --git a/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch -new file mode 100644 -index 0000000..d7d7eec ---- /dev/null -+++ b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch -@@ -0,0 +1,10 @@ -+--- a/drivers/mtd/spi-nor/spi-nor.c -++++ b/drivers/mtd/spi-nor/spi-nor.c -+@@ -962,6 +962,7 @@ int spi_nor_scan(struct spi_nor *nor, co -+ -+ if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || -+ JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || -++ JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX || -+ JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { -+ write_enable(nor); -+ write_sr(nor, 0); diff --git a/patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch b/patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch deleted file mode 100644 index 9bc53737..00000000 --- a/patches/openwrt/0056-x86-generic-enable-pata_atiixp-driver.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Matthias Schiffer -Date: Wed, 2 Mar 2016 18:26:15 +0100 -Subject: x86/generic: enable pata_atiixp driver - -This enables booting from devices that use an ATI PATA controller for -the boot device, such as the embedded CF cards in Fujitsu-Siemens Futro -thin-clients. - -Signed-off-by: Felix Kaechele - -Backport of r48861 - -diff --git a/target/linux/x86/generic/config-default b/target/linux/x86/generic/config-default -index eb4b357..9e963bf 100644 ---- a/target/linux/x86/generic/config-default -+++ b/target/linux/x86/generic/config-default -@@ -153,6 +153,7 @@ CONFIG_NLS=y - CONFIG_NO_HZ=y - # CONFIG_PANASONIC_LAPTOP is not set - CONFIG_PATA_AMD=y -+CONFIG_PATA_ATIIXP=y - CONFIG_PATA_LEGACY=y - CONFIG_PATA_MPIIX=y - CONFIG_PATA_OLDPIIX=y From 464023d3d715830f0cf733c0e54b381125b9f568 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 3 May 2016 19:30:43 +0200 Subject: [PATCH 009/184] README: add Roadmap link --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 72113cb0..321817b6 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ Before opening an issue, make sure to check whether any existing issues (open or closed) match. If you're suggesting a new feature, drop by on IRC or our mailinglist to discuss it first. +We maintain a [Roadmap](https://github.com/freifunk-gluon/gluon/wiki/Roadmap) for +the future development of Gluon. + ## Use a release! Please refrain from using the `master` branch for anything else but development purposes! From 28c34bed504b00960cc452a933bf1b42249796cc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 5 May 2016 22:23:24 +0200 Subject: [PATCH 010/184] netifd: update and revert problematic patch Fixes VLANs with shell protos on top of WLAN devices. Fixes #754 --- ...7-netifd-update-to-latest-git-master.patch | 133 +++++++++++++++++- 1 file changed, 130 insertions(+), 3 deletions(-) diff --git a/patches/openwrt/0017-netifd-update-to-latest-git-master.patch b/patches/openwrt/0017-netifd-update-to-latest-git-master.patch index 3a173661..8128cfb0 100644 --- a/patches/openwrt/0017-netifd-update-to-latest-git-master.patch +++ b/patches/openwrt/0017-netifd-update-to-latest-git-master.patch @@ -3,7 +3,7 @@ Date: Wed, 9 Mar 2016 06:46:44 +0100 Subject: netifd: update to latest git master diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile -index 619024b..f7563d5 100644 +index 619024b..84a4592 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,13 +1,13 @@ @@ -11,7 +11,7 @@ index 619024b..f7563d5 100644 PKG_NAME:=netifd -PKG_VERSION:=2015-12-16 -+PKG_VERSION:=2016-03-07 ++PKG_VERSION:=2016-03-31 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE_PROTO:=git @@ -19,7 +19,7 @@ index 619024b..f7563d5 100644 +PKG_SOURCE_URL=$(OPENWRT_GIT)/project/netifd.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=245527193e90906451be35c2b8e972b8712ea6ab -+PKG_SOURCE_VERSION:=bd1ee3efb46ae013d81b1aec51668e7595274e69 ++PKG_SOURCE_VERSION:=6fd6be6b7f3fc4883fdc464fcbcb2b5e8d8e8174 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_MAINTAINER:=Felix Fietkau # PKG_MIRROR_MD5SUM:= @@ -53,3 +53,130 @@ index af3aaa8..5515b91 100755 for dev in $(echo "$radio_devs" | sort -u); do /sbin/wifi up "$dev" done +diff --git a/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch b/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch +new file mode 100644 +index 0000000..312964f +--- /dev/null ++++ b/package/network/config/netifd/patches/0001-Revert-device-Don-t-process-link-events-anymore-in-d.patch +@@ -0,0 +1,121 @@ ++From e0f19fdae88f3ef505e22533915f8328f4793980 Mon Sep 17 00:00:00 2001 ++Message-Id: ++From: Matthias Schiffer ++Date: Thu, 5 May 2016 21:49:33 +0200 ++Subject: [PATCH] Revert "device: Don't process link events anymore in device ++ user specific callback handlers" ++ ++This reverts commit 4902ba2999dec02e82066d70ab6096b852a33007. ++--- ++ device.h | 2 ++ ++ macvlan.c | 8 ++++++++ ++ system-linux.c | 2 +- ++ vlan.c | 6 ++++++ ++ vlandev.c | 8 ++++++++ ++ 5 files changed, 25 insertions(+), 1 deletion(-) ++ ++diff --git a/device.h b/device.h ++index ac77cfb..ef1c608 100644 ++--- a/device.h +++++ b/device.h ++@@ -59,6 +59,8 @@ struct device_type { ++ struct list_head list; ++ const char *name; ++ +++ bool keep_link_status; +++ ++ const struct uci_blob_param_list *config_params; ++ ++ struct device *(*create)(const char *name, struct blob_attr *attr); ++diff --git a/macvlan.c b/macvlan.c ++index a0f11ae..051fe05 100644 ++--- a/macvlan.c +++++ b/macvlan.c ++@@ -72,6 +72,12 @@ macvlan_base_cb(struct device_user *dev, enum device_event ev) ++ case DEV_EVENT_REMOVE: ++ device_set_present(&mvdev->dev, false); ++ break; +++ case DEV_EVENT_LINK_UP: +++ device_set_link(&mvdev->dev, true); +++ break; +++ case DEV_EVENT_LINK_DOWN: +++ device_set_link(&mvdev->dev, false); +++ break; ++ default: ++ return; ++ } ++@@ -255,6 +261,8 @@ macvlan_create(const char *name, struct blob_attr *attr) ++ const struct device_type macvlan_device_type = { ++ .name = "MAC VLAN", ++ .config_params = &macvlan_attr_list, +++ .keep_link_status = true, +++ ++ .create = macvlan_create, ++ .config_init = macvlan_config_init, ++ .reload = macvlan_reload, ++diff --git a/system-linux.c b/system-linux.c ++index 351a994..794c1dd 100644 ++--- a/system-linux.c +++++ b/system-linux.c ++@@ -464,7 +464,7 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg) ++ goto out; ++ ++ struct device *dev = device_get(nla_data(nla[IFLA_IFNAME]), false); ++- if (!dev) +++ if (!dev || dev->type->keep_link_status) ++ goto out; ++ ++ if (!system_get_dev_sysctl("/sys/class/net/%s/carrier", dev->ifname, buf, sizeof(buf))) ++diff --git a/vlan.c b/vlan.c ++index ac434ce..8d93799 100644 ++--- a/vlan.c +++++ b/vlan.c ++@@ -79,6 +79,11 @@ static void vlan_dev_cb(struct device_user *dep, enum device_event ev) ++ case DEV_EVENT_REMOVE: ++ device_set_present(&vldev->dev, new_state); ++ break; +++ case DEV_EVENT_LINK_UP: +++ new_state = true; +++ case DEV_EVENT_LINK_DOWN: +++ device_set_link(&vldev->dev, new_state); +++ break; ++ case DEV_EVENT_UPDATE_IFNAME: ++ vlan_dev_set_name(vldev, dep->dev); ++ device_broadcast_event(&vldev->dev, ev); ++@@ -97,6 +102,7 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create) ++ static const struct device_type vlan_type = { ++ .name = "VLAN", ++ .config_params = &device_attr_list, +++ .keep_link_status = true, ++ .free = free_vlan_if, ++ }; ++ struct vlan_device *vldev; ++diff --git a/vlandev.c b/vlandev.c ++index b93527c..884e6ef 100644 ++--- a/vlandev.c +++++ b/vlandev.c ++@@ -63,6 +63,12 @@ vlandev_base_cb(struct device_user *dev, enum device_event ev) ++ case DEV_EVENT_REMOVE: ++ device_set_present(&mvdev->dev, false); ++ break; +++ case DEV_EVENT_LINK_UP: +++ device_set_link(&mvdev->dev, true); +++ break; +++ case DEV_EVENT_LINK_DOWN: +++ device_set_link(&mvdev->dev, false); +++ break; ++ default: ++ return; ++ } ++@@ -243,6 +249,8 @@ vlandev_create(const char *name, struct blob_attr *attr) ++ const struct device_type vlandev_device_type = { ++ .name = "VLANDEV", ++ .config_params = &vlandev_attr_list, +++ .keep_link_status = true, +++ ++ .create = vlandev_create, ++ .config_init = vlandev_config_init, ++ .reload = vlandev_reload, ++-- ++2.8.2 ++ From 273a1cb52d797aa6c5b04e970a8f7c737e32d105 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 6 May 2016 20:10:25 +0200 Subject: [PATCH 011/184] ar71xx-generic: remove BROKEN for Ubiquiti Rocket M XW --- targets/ar71xx-generic/profiles.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index f3aecd24..78a75519 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -184,6 +184,7 @@ $(eval $(call GluonModelAlias,UBNT,ubiquiti-nanostation-m,ubiquiti-nanostation-m $(eval $(call GluonModel,UBNT,ubnt-loco-m-xw,ubiquiti-loco-m-xw)) $(eval $(call GluonModel,UBNT,ubnt-nano-m-xw,ubiquiti-nanostation-m-xw)) +$(eval $(call GluonModel,UBNT,ubnt-rocket-m-xw,ubiquiti-rocket-m-xw)) $(eval $(call GluonModel,UBNT,ubnt-uap-pro,ubiquiti-unifi-ap-pro)) $(eval $(call GluonModel,UBNT,ubnt-unifi,ubiquiti-unifi)) $(eval $(call GluonModel,UBNT,ubnt-unifi-outdoor,ubiquiti-unifiap-outdoor)) @@ -191,7 +192,6 @@ $(eval $(call GluonModel,UBNT,ubnt-unifi-outdoor-plus,ubiquiti-unifiap-outdoor+) ifneq ($(BROKEN),) $(eval $(call GluonModel,UBNT,ubnt-ls-sr71,ubiquiti-ls-sr71)) # BROKEN: Untested -$(eval $(call GluonModel,UBNT,ubnt-rocket-m-xw,ubiquiti-rocket-m-xw)) # BROKEN: Untested endif From 2f0746dda6ddab03e32d8076f81e2ded805edca2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 6 May 2016 20:16:44 +0200 Subject: [PATCH 012/184] docs: clean up and update Ubiquiti hardware support list --- docs/index.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 028c65b8..c24152da 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -172,11 +172,13 @@ ar71xx-generic - Air Gateway - Air Router - Bullet M + - Loco M + - Loco M XW - Nanostation M - Nanostation M XW - - Loco M XW - Picostation M - Rocket M + - Rocket M XW - UniFi AP - UniFi AP Pro - UniFi AP Outdoor From 0bc2fd6a92390d489999ab4dda17882f68c4a653 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 7 May 2016 00:48:34 +0200 Subject: [PATCH 013/184] kernel: backport spi-nor driver from 4.4.9 Fixes #687 --- ...ort-LibreSSL-as-provider-of-openssl.patch} | 0 ...tection-for-Winbond-flash-at-startup.patch | 94 - ...WREV-on-upgrades-of-TP-LINK-devices.patch} | 0 ...-space-on-some-TP-LINK-like-devices.patch} | 0 ...X_MODEL-to-match-labels-image-names.patch} | 0 ...71xx-build-image-for-TL-WR710N-v2.1.patch} | 0 ...gure-compatiblity-with-POSIX-shells.patch} | 0 ...as-only-added-in-the-latest-version.patch} | 0 ...ompile-flock-before-everything-else.patch} | 0 ...fall-back-to-unlocked-shell-command.patch} | 0 ...e-conditions-with-multiple-variants.patch} | 0 ...x-packed-checkout-mirroring-support.patch} | 0 ...l-backport-spi-nor-driver-from-4.4.9.patch | 2012 +++++++++++++++++ ...til-status-register-writes-are-ready.patch | 115 + ...el-mtd-spi-nor-unlock-Winbond-flashs.patch | 56 + 15 files changed, 2183 insertions(+), 94 deletions(-) rename patches/openwrt/{0020-Support-LibreSSL-as-provider-of-openssl.patch => 0019-Support-LibreSSL-as-provider-of-openssl.patch} (100%) delete mode 100644 patches/openwrt/0019-generic-mtd-spi-nor-disable-protection-for-Winbond-flash-at-startup.patch rename patches/openwrt/{0021-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch => 0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch} (100%) rename patches/openwrt/{0022-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch => 0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch} (100%) rename patches/openwrt/{0023-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch => 0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch} (100%) rename patches/openwrt/{0024-ar71xx-build-image-for-TL-WR710N-v2.1.patch => 0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch} (100%) rename patches/openwrt/{0025-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch => 0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch} (100%) rename patches/openwrt/{0026-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch => 0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch} (100%) rename patches/openwrt/{0027-tools-compile-flock-before-everything-else.patch => 0026-tools-compile-flock-before-everything-else.patch} (100%) rename patches/openwrt/{0028-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch => 0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch} (100%) rename patches/openwrt/{0029-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch => 0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch} (100%) rename patches/openwrt/{0030-download.mk-fix-packed-checkout-mirroring-support.patch => 0029-download.mk-fix-packed-checkout-mirroring-support.patch} (100%) create mode 100644 patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch create mode 100644 patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch create mode 100644 patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch diff --git a/patches/openwrt/0020-Support-LibreSSL-as-provider-of-openssl.patch b/patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch similarity index 100% rename from patches/openwrt/0020-Support-LibreSSL-as-provider-of-openssl.patch rename to patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch diff --git a/patches/openwrt/0019-generic-mtd-spi-nor-disable-protection-for-Winbond-flash-at-startup.patch b/patches/openwrt/0019-generic-mtd-spi-nor-disable-protection-for-Winbond-flash-at-startup.patch deleted file mode 100644 index e69735e6..00000000 --- a/patches/openwrt/0019-generic-mtd-spi-nor-disable-protection-for-Winbond-flash-at-startup.patch +++ /dev/null @@ -1,94 +0,0 @@ -From: Matthias Schiffer -Date: Tue, 29 Mar 2016 21:58:53 +0200 -Subject: generic: mtd: spi-nor: disable protection for Winbond flash at startup - -diff --git a/target/linux/generic/patches-3.18/463-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/generic/patches-3.18/463-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch -new file mode 100644 -index 0000000..c906425 ---- /dev/null -+++ b/target/linux/generic/patches-3.18/463-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch -@@ -0,0 +1,47 @@ -+From 26e4790ddad59038ece16c8b89ad856bee946d75 Mon Sep 17 00:00:00 2001 -+Message-Id: <26e4790ddad59038ece16c8b89ad856bee946d75.1459281384.git.mschiffer@universe-factory.net> -+From: Matthias Schiffer -+Date: Tue, 29 Mar 2016 21:51:10 +0200 -+Subject: [PATCH 1/2] mtd: spi-nor: wait until lock/unlock operations are ready -+ -+Upstream commits: -+ -+32321e950d8a237d7e8f3a9b76220007dfa87544 -+edf891ef9ab773363f8e58022a26d7d31604aed6 -+--- -+ drivers/mtd/spi-nor/spi-nor.c | 5 +++++ -+ 1 file changed, 5 insertions(+) -+ -+diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c -+index ef783a4..1ab6e24 100644 -+--- a/drivers/mtd/spi-nor/spi-nor.c -++++ b/drivers/mtd/spi-nor/spi-nor.c -+@@ -370,6 +370,8 @@ static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) -+ ret = write_sr(nor, status_new); -+ if (ret) -+ goto err; -++ -++ ret = wait_till_ready(nor); -+ } -+ -+ err: -+@@ -417,6 +419,8 @@ static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) -+ ret = write_sr(nor, status_new); -+ if (ret) -+ goto err; -++ -++ ret = wait_till_ready(nor); -+ } -+ -+ err: -+@@ -966,6 +970,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) -+ JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { -+ write_enable(nor); -+ write_sr(nor, 0); -++ wait_till_ready(nor); -+ } -+ -+ if (!mtd->name) -+-- -+2.7.4 -+ -diff --git a/target/linux/generic/patches-3.18/464-mtd-spi-nor-disable-protection-for-Winbond-flash-at-.patch b/target/linux/generic/patches-3.18/464-mtd-spi-nor-disable-protection-for-Winbond-flash-at-.patch -new file mode 100644 -index 0000000..7b45666 ---- /dev/null -+++ b/target/linux/generic/patches-3.18/464-mtd-spi-nor-disable-protection-for-Winbond-flash-at-.patch -@@ -0,0 +1,31 @@ -+From 03485b7e91a8f6e69e4945f937f266c59c1376d0 Mon Sep 17 00:00:00 2001 -+Message-Id: <03485b7e91a8f6e69e4945f937f266c59c1376d0.1459281384.git.mschiffer@universe-factory.net> -+In-Reply-To: <26e4790ddad59038ece16c8b89ad856bee946d75.1459281384.git.mschiffer@universe-factory.net> -+References: <26e4790ddad59038ece16c8b89ad856bee946d75.1459281384.git.mschiffer@universe-factory.net> -+From: Matthias Schiffer -+Date: Tue, 29 Mar 2016 21:55:55 +0200 -+Subject: [PATCH 2/2] mtd: spi-nor: disable protection for Winbond flash at -+ startup -+ -+Upstream commit: c6fc2171b249e73745c497b578b417a2946f1b2f -+--- -+ drivers/mtd/spi-nor/spi-nor.c | 3 ++- -+ 1 file changed, 2 insertions(+), 1 deletion(-) -+ -+diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c -+index 1ab6e24..ea7fa30 100644 -+--- a/drivers/mtd/spi-nor/spi-nor.c -++++ b/drivers/mtd/spi-nor/spi-nor.c -+@@ -967,7 +967,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) -+ if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || -+ JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || -+ JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX || -+- JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { -++ JEDEC_MFR(info->jedec_id) == CFI_MFR_SST || -++ JEDEC_MFR(info->jedec_id) == CFI_MFR_WINBOND) { -+ write_enable(nor); -+ write_sr(nor, 0); -+ wait_till_ready(nor); -+-- -+2.7.4 -+ diff --git a/patches/openwrt/0021-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch b/patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch similarity index 100% rename from patches/openwrt/0021-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch rename to patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch diff --git a/patches/openwrt/0022-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch b/patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch similarity index 100% rename from patches/openwrt/0022-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch rename to patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch diff --git a/patches/openwrt/0023-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch b/patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch similarity index 100% rename from patches/openwrt/0023-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch rename to patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch diff --git a/patches/openwrt/0024-ar71xx-build-image-for-TL-WR710N-v2.1.patch b/patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch similarity index 100% rename from patches/openwrt/0024-ar71xx-build-image-for-TL-WR710N-v2.1.patch rename to patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch diff --git a/patches/openwrt/0025-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch b/patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch similarity index 100% rename from patches/openwrt/0025-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch rename to patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch diff --git a/patches/openwrt/0026-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch b/patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch similarity index 100% rename from patches/openwrt/0026-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch rename to patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch diff --git a/patches/openwrt/0027-tools-compile-flock-before-everything-else.patch b/patches/openwrt/0026-tools-compile-flock-before-everything-else.patch similarity index 100% rename from patches/openwrt/0027-tools-compile-flock-before-everything-else.patch rename to patches/openwrt/0026-tools-compile-flock-before-everything-else.patch diff --git a/patches/openwrt/0028-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch b/patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch similarity index 100% rename from patches/openwrt/0028-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch rename to patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch diff --git a/patches/openwrt/0029-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch b/patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch similarity index 100% rename from patches/openwrt/0029-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch rename to patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch diff --git a/patches/openwrt/0030-download.mk-fix-packed-checkout-mirroring-support.patch b/patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch similarity index 100% rename from patches/openwrt/0030-download.mk-fix-packed-checkout-mirroring-support.patch rename to patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch diff --git a/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch b/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch new file mode 100644 index 00000000..f66699ca --- /dev/null +++ b/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch @@ -0,0 +1,2012 @@ +From: Matthias Schiffer +Date: Sat, 7 May 2016 00:07:51 +0200 +Subject: kernel: backport spi-nor driver from 4.4.9 + +diff --git a/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch b/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch +index 568f516..6a91320 100644 +--- a/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch ++++ b/target/linux/ar71xx/patches-3.18/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch +@@ -1,11 +1,11 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -246,7 +246,9 @@ static int m25p_probe(struct spi_device ++@@ -229,7 +229,9 @@ static int m25p_probe(struct spi_device + + ppdata.of_node = spi->dev.of_node; + +-- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, +-+ return mtd_device_parse_register(&flash->mtd, ++- return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, +++ return mtd_device_parse_register(&nor->mtd, + + data ? data->part_probes : NULL, + + &ppdata, + data ? data->parts : NULL, +diff --git a/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch b/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch +index d51694d..175acf6 100644 +--- a/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch ++++ b/target/linux/ar71xx/patches-3.18/412-mtd-m25p80-zero-partition-parser-data.patch +@@ -1,10 +1,10 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -244,6 +244,7 @@ static int m25p_probe(struct spi_device ++@@ -227,6 +227,7 @@ static int m25p_probe(struct spi_device + if (ret) + return ret; + + + memset(&ppdata, '\0', sizeof(ppdata)); + ppdata.of_node = spi->dev.of_node; + +- return mtd_device_parse_register(&flash->mtd, ++ return mtd_device_parse_register(&nor->mtd, +diff --git a/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch b/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch +index 3320e5b..11bf9ff 100644 +--- a/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch ++++ b/target/linux/ar71xx/patches-3.18/462-mtd-m25p80-set-spi-transfer-type.patch +@@ -1,6 +1,6 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -142,10 +142,12 @@ static int m25p80_read(struct spi_nor *n ++@@ -137,10 +137,12 @@ static int m25p80_read(struct spi_nor *n + flash->command[0] = nor->read_opcode; + m25p_addr2cmd(nor, from, flash->command); + +diff --git a/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch b/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch +index e48665d..758d231 100644 +--- a/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch ++++ b/target/linux/ar71xx/patches-3.18/464-spi-ath79-fix-fast-flash-read.patch +@@ -1,6 +1,6 @@ + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -142,6 +142,9 @@ static int m25p80_read(struct spi_nor *n ++@@ -137,6 +137,9 @@ static int m25p80_read(struct spi_nor *n + flash->command[0] = nor->read_opcode; + m25p_addr2cmd(nor, from, flash->command); + +@@ -25,7 +25,7 @@ + while (len--) { + --- a/include/linux/spi/spi.h + +++ b/include/linux/spi/spi.h +-@@ -637,6 +637,7 @@ struct spi_transfer { ++@@ -633,6 +633,7 @@ struct spi_transfer { + u16 delay_usecs; + u32 speed_hz; + enum spi_transfer_type type; +diff --git a/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch b/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch +index b949694..be62e67 100644 +--- a/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch ++++ b/target/linux/brcm63xx/patches-3.18/202-MTD-DEVICES-m25p80-use-parsers-if-provided-in-flash-.patch +@@ -11,12 +11,12 @@ Signed-off-by: Jonas Gorski + + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -246,7 +246,8 @@ static int m25p_probe(struct spi_device ++@@ -229,7 +229,8 @@ static int m25p_probe(struct spi_device + + ppdata.of_node = spi->dev.of_node; + +-- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, +-+ return mtd_device_parse_register(&flash->mtd, ++- return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, +++ return mtd_device_parse_register(&nor->mtd, + + data ? data->part_probe_types : NULL, &ppdata, + data ? data->parts : NULL, + data ? data->nr_parts : 0); +diff --git a/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch b/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch +index 740fb2d..3877442 100644 +--- a/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch ++++ b/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch +@@ -11,15 +11,15 @@ Signed-off-by: Jonas Gorski + + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -32,6 +32,7 @@ struct m25p { ++@@ -31,6 +31,7 @@ ++ struct m25p { + struct spi_device *spi; + struct spi_nor spi_nor; +- struct mtd_info mtd; + + int max_transfer_len; + u8 command[MAX_CMD_SIZE]; + }; + +-@@ -121,7 +122,7 @@ static inline unsigned int m25p80_rx_nbi ++@@ -119,7 +120,7 @@ static inline unsigned int m25p80_rx_nbi + * Read an address range from the nor chip. The address range + * may be any size provided it is within the physical boundaries. + */ +@@ -28,7 +28,7 @@ Signed-off-by: Jonas Gorski + size_t *retlen, u_char *buf) + { + struct m25p *flash = nor->priv; +-@@ -157,6 +158,29 @@ static int m25p80_read(struct spi_nor *n ++@@ -152,6 +153,29 @@ static int m25p80_read(struct spi_nor *n + return 0; + } + +@@ -58,7 +58,7 @@ Signed-off-by: Jonas Gorski + static int m25p80_erase(struct spi_nor *nor, loff_t offset) + { + struct m25p *flash = nor->priv; +-@@ -240,6 +264,9 @@ static int m25p_probe(struct spi_device ++@@ -223,6 +247,9 @@ static int m25p_probe(struct spi_device + else + flash_name = spi->modalias; + +diff --git a/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch b/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch +index b7bf57f..e421e9a 100644 +--- a/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch ++++ b/target/linux/brcm63xx/patches-3.18/414-MTD-m25p80-allow-passing-pp_data.patch +@@ -10,7 +10,7 @@ Subject: [PATCH 64/79] MTD: m25p80: allow passing pp_data + + --- a/drivers/mtd/devices/m25p80.c + +++ b/drivers/mtd/devices/m25p80.c +-@@ -267,6 +267,9 @@ static int m25p_probe(struct spi_device ++@@ -250,6 +250,9 @@ static int m25p_probe(struct spi_device + if (data) + flash->max_transfer_len = data->max_transfer_len; + +diff --git a/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch b/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch +deleted file mode 100644 +index 4d0403b..0000000 +--- a/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch ++++ /dev/null +@@ -1,10 +0,0 @@ +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -510,6 +510,7 @@ static const struct spi_device_id spi_no +- /* GigaDevice */ +- { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, +- { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, +-+ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, +- +- /* Intel/Numonyx -- xxxs33b */ +- { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, +diff --git a/target/linux/generic/patches-3.18/093-m25p80_spi-nor_update_to_4.4.9.patch b/target/linux/generic/patches-3.18/093-m25p80_spi-nor_update_to_4.4.9.patch +new file mode 100644 +index 0000000..5f74d3a +--- /dev/null ++++ b/target/linux/generic/patches-3.18/093-m25p80_spi-nor_update_to_4.4.9.patch +@@ -0,0 +1,1579 @@ ++--- a/drivers/mtd/devices/m25p80.c +++++ b/drivers/mtd/devices/m25p80.c ++@@ -31,7 +31,6 @@ ++ struct m25p { ++ struct spi_device *spi; ++ struct spi_nor spi_nor; ++- struct mtd_info mtd; ++ u8 command[MAX_CMD_SIZE]; ++ }; ++ ++@@ -62,8 +61,7 @@ static int m25p_cmdsz(struct spi_nor *no ++ return 1 + nor->addr_width; ++ } ++ ++-static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len, ++- int wr_en) +++static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) ++ { ++ struct m25p *flash = nor->priv; ++ struct spi_device *spi = flash->spi; ++@@ -128,13 +126,10 @@ static int m25p80_read(struct spi_nor *n ++ struct spi_device *spi = flash->spi; ++ struct spi_transfer t[2]; ++ struct spi_message m; ++- int dummy = nor->read_dummy; ++- int ret; +++ unsigned int dummy = nor->read_dummy; ++ ++- /* Wait till previous write/erase is done. */ ++- ret = nor->wait_till_ready(nor); ++- if (ret) ++- return ret; +++ /* convert the dummy cycles to the number of bytes */ +++ dummy /= 8; ++ ++ spi_message_init(&m); ++ memset(t, 0, (sizeof t)); ++@@ -160,20 +155,9 @@ static int m25p80_read(struct spi_nor *n ++ static int m25p80_erase(struct spi_nor *nor, loff_t offset) ++ { ++ struct m25p *flash = nor->priv; ++- int ret; ++ ++ dev_dbg(nor->dev, "%dKiB at 0x%08x\n", ++- flash->mtd.erasesize / 1024, (u32)offset); ++- ++- /* Wait until finished previous write command. */ ++- ret = nor->wait_till_ready(nor); ++- if (ret) ++- return ret; ++- ++- /* Send write enable, then erase commands. */ ++- ret = nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); ++- if (ret) ++- return ret; +++ flash->spi_nor.mtd.erasesize / 1024, (u32)offset); ++ ++ /* Set up command buffer. */ ++ flash->command[0] = nor->erase_opcode; ++@@ -215,11 +199,10 @@ static int m25p_probe(struct spi_device ++ nor->read_reg = m25p80_read_reg; ++ ++ nor->dev = &spi->dev; ++- nor->mtd = &flash->mtd; +++ nor->flash_node = spi->dev.of_node; ++ nor->priv = flash; ++ ++ spi_set_drvdata(spi, flash); ++- flash->mtd.priv = nor; ++ flash->spi = spi; ++ ++ if (spi->mode & SPI_RX_QUAD) ++@@ -228,7 +211,7 @@ static int m25p_probe(struct spi_device ++ mode = SPI_NOR_DUAL; ++ ++ if (data && data->name) ++- flash->mtd.name = data->name; +++ nor->mtd.name = data->name; ++ ++ /* For some (historical?) reason many platforms provide two different ++ * names in flash_platform_data: "name" and "type". Quite often name is ++@@ -246,7 +229,7 @@ static int m25p_probe(struct spi_device ++ ++ ppdata.of_node = spi->dev.of_node; ++ ++- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, +++ return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, ++ data ? data->parts : NULL, ++ data ? data->nr_parts : 0); ++ } ++@@ -257,64 +240,68 @@ static int m25p_remove(struct spi_device ++ struct m25p *flash = spi_get_drvdata(spi); ++ ++ /* Clean up MTD stuff. */ ++- return mtd_device_unregister(&flash->mtd); +++ return mtd_device_unregister(&flash->spi_nor.mtd); ++ } ++ ++- ++ /* ++- * XXX This needs to be kept in sync with spi_nor_ids. We can't share ++- * it with spi-nor, because if this is built as a module then modpost ++- * won't be able to read it and add appropriate aliases. +++ * Do NOT add to this array without reading the following: +++ * +++ * Historically, many flash devices are bound to this driver by their name. But +++ * since most of these flash are compatible to some extent, and their +++ * differences can often be differentiated by the JEDEC read-ID command, we +++ * encourage new users to add support to the spi-nor library, and simply bind +++ * against a generic string here (e.g., "jedec,spi-nor"). +++ * +++ * Many flash names are kept here in this list (as well as in spi-nor.c) to +++ * keep them available as module aliases for existing platforms. ++ */ ++ static const struct spi_device_id m25p_ids[] = { ++- {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"}, ++- {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"}, ++- {"at26df321"}, {"at45db081d"}, ++- {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"}, ++- {"en25q64"}, {"en25qh128"}, {"en25qh256"}, ++- {"f25l32pa"}, ++- {"mr25h256"}, {"mr25h10"}, ++- {"gd25q32"}, {"gd25q64"}, ++- {"160s33b"}, {"320s33b"}, {"640s33b"}, ++- {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"}, ++- {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"}, ++- {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"}, ++- {"mx66l1g55g"}, ++- {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"}, ++- {"n25q512a"}, {"n25q512ax3"}, {"n25q00"}, ++- {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"}, ++- {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"}, ++- {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"}, ++- {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"}, ++- {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"}, ++- {"s25fl016k"}, {"s25fl064k"}, ++- {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"}, ++- {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"}, ++- {"sst25wf040"}, ++- {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"}, ++- {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"}, ++- {"m25p128"}, {"n25q032"}, +++ /* +++ * Entries not used in DTs that should be safe to drop after replacing +++ * them with "nor-jedec" in platform data. +++ */ +++ {"s25sl064a"}, {"w25x16"}, {"m25p10"}, {"m25px64"}, +++ +++ /* +++ * Entries that were used in DTs without "nor-jedec" fallback and should +++ * be kept for backward compatibility. +++ */ +++ {"at25df321a"}, {"at25df641"}, {"at26df081a"}, +++ {"mr25h256"}, +++ {"mx25l4005a"}, {"mx25l1606e"}, {"mx25l6405d"}, {"mx25l12805d"}, +++ {"mx25l25635e"},{"mx66l51235l"}, +++ {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q512a"}, +++ {"s25fl256s1"}, {"s25fl512s"}, {"s25sl12801"}, {"s25fl008k"}, +++ {"s25fl064k"}, +++ {"sst25vf040b"},{"sst25vf016b"},{"sst25vf032b"},{"sst25wf040"}, +++ {"m25p40"}, {"m25p80"}, {"m25p16"}, {"m25p32"}, +++ {"m25p64"}, {"m25p128"}, +++ {"w25x80"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, +++ {"w25q80bl"}, {"w25q128"}, {"w25q256"}, +++ +++ /* Flashes that can't be detected using JEDEC */ ++ {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"}, ++ {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"}, ++ {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"}, ++- {"m45pe10"}, {"m45pe80"}, {"m45pe16"}, ++- {"m25pe20"}, {"m25pe80"}, {"m25pe16"}, ++- {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"}, ++- {"m25px64"}, {"m25px80"}, ++- {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"}, ++- {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, ++- {"w25x64"}, {"w25q64"}, {"w25q80"}, {"w25q80bl"}, ++- {"w25q128"}, {"w25q256"}, {"cat25c11"}, ++- {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"}, +++ ++ { }, ++ }; ++ MODULE_DEVICE_TABLE(spi, m25p_ids); ++ +++static const struct of_device_id m25p_of_table[] = { +++ /* +++ * Generic compatibility for SPI NOR that can be identified by the +++ * JEDEC READ ID opcode (0x9F). Use this, if possible. +++ */ +++ { .compatible = "jedec,spi-nor" }, +++ {} +++}; +++MODULE_DEVICE_TABLE(of, m25p_of_table); ++ ++ static struct spi_driver m25p80_driver = { ++ .driver = { ++ .name = "m25p80", ++- .owner = THIS_MODULE, +++ .of_match_table = m25p_of_table, ++ }, ++ .id_table = m25p_ids, ++ .probe = m25p_probe, ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -16,19 +16,63 @@ ++ #include ++ #include ++ #include +++#include ++ ++-#include ++ #include ++ #include ++ #include ++ #include ++ ++ /* Define max times to check status register before we give up. */ ++-#define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */ ++ ++-#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) +++/* +++ * For everything but full-chip erase; probably could be much smaller, but kept +++ * around for safety for now +++ */ +++#define DEFAULT_READY_WAIT_JIFFIES (40UL * HZ) +++ +++/* +++ * For full-chip erase, calibrated to a 2MB flash (M25P16); should be scaled up +++ * for larger flash +++ */ +++#define CHIP_ERASE_2MB_READY_WAIT_JIFFIES (40UL * HZ) +++ +++#define SPI_NOR_MAX_ID_LEN 6 +++ +++struct flash_info { +++ char *name; +++ +++ /* +++ * This array stores the ID bytes. +++ * The first three bytes are the JEDIC ID. +++ * JEDEC ID zero means "no ID" (mostly older chips). +++ */ +++ u8 id[SPI_NOR_MAX_ID_LEN]; +++ u8 id_len; +++ +++ /* The size listed here is what works with SPINOR_OP_SE, which isn't +++ * necessarily called a "sector" by the vendor. +++ */ +++ unsigned sector_size; +++ u16 n_sectors; +++ +++ u16 page_size; +++ u16 addr_width; +++ +++ u16 flags; +++#define SECT_4K 0x01 /* SPINOR_OP_BE_4K works uniformly */ +++#define SPI_NOR_NO_ERASE 0x02 /* No erase command needed */ +++#define SST_WRITE 0x04 /* use SST byte programming */ +++#define SPI_NOR_NO_FR 0x08 /* Can't do fastread */ +++#define SECT_4K_PMC 0x10 /* SPINOR_OP_BE_4K_PMC works uniformly */ +++#define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ +++#define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ +++#define USE_FSR 0x80 /* use flag status register */ +++}; ++ ++-static const struct spi_device_id *spi_nor_match_id(const char *name); +++#define JEDEC_MFR(info) ((info)->id[0]) +++ +++static const struct flash_info *spi_nor_match_id(const char *name); ++ ++ /* ++ * Read the status register, returning its value in the location ++@@ -98,7 +142,7 @@ static inline int spi_nor_read_dummy_cyc ++ case SPI_NOR_FAST: ++ case SPI_NOR_DUAL: ++ case SPI_NOR_QUAD: ++- return 1; +++ return 8; ++ case SPI_NOR_NORMAL: ++ return 0; ++ } ++@@ -112,7 +156,7 @@ static inline int spi_nor_read_dummy_cyc ++ static inline int write_sr(struct spi_nor *nor, u8 val) ++ { ++ nor->cmd_buf[0] = val; ++- return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); +++ return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1); ++ } ++ ++ /* ++@@ -121,7 +165,7 @@ static inline int write_sr(struct spi_no ++ */ ++ static inline int write_enable(struct spi_nor *nor) ++ { ++- return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); +++ return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0); ++ } ++ ++ /* ++@@ -129,7 +173,7 @@ static inline int write_enable(struct sp ++ */ ++ static inline int write_disable(struct spi_nor *nor) ++ { ++- return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0, 0); +++ return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0); ++ } ++ ++ static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd) ++@@ -138,23 +182,24 @@ static inline struct spi_nor *mtd_to_spi ++ } ++ ++ /* Enable/disable 4-byte addressing mode. */ ++-static inline int set_4byte(struct spi_nor *nor, u32 jedec_id, int enable) +++static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info, +++ int enable) ++ { ++ int status; ++ bool need_wren = false; ++ u8 cmd; ++ ++- switch (JEDEC_MFR(jedec_id)) { ++- case CFI_MFR_ST: /* Micron, actually */ +++ switch (JEDEC_MFR(info)) { +++ case SNOR_MFR_MICRON: ++ /* Some Micron need WREN command; all will accept it */ ++ need_wren = true; ++- case CFI_MFR_MACRONIX: ++- case 0xEF /* winbond */: +++ case SNOR_MFR_MACRONIX: +++ case SNOR_MFR_WINBOND: ++ if (need_wren) ++ write_enable(nor); ++ ++ cmd = enable ? SPINOR_OP_EN4B : SPINOR_OP_EX4B; ++- status = nor->write_reg(nor, cmd, NULL, 0, 0); +++ status = nor->write_reg(nor, cmd, NULL, 0); ++ if (need_wren) ++ write_disable(nor); ++ ++@@ -162,63 +207,73 @@ static inline int set_4byte(struct spi_n ++ default: ++ /* Spansion style */ ++ nor->cmd_buf[0] = enable << 7; ++- return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1, 0); +++ return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1); ++ } ++ } ++- ++-static int spi_nor_wait_till_ready(struct spi_nor *nor) +++static inline int spi_nor_sr_ready(struct spi_nor *nor) ++ { ++- unsigned long deadline; ++- int sr; ++- ++- deadline = jiffies + MAX_READY_WAIT_JIFFIES; ++- ++- do { ++- cond_resched(); +++ int sr = read_sr(nor); +++ if (sr < 0) +++ return sr; +++ else +++ return !(sr & SR_WIP); +++} ++ ++- sr = read_sr(nor); ++- if (sr < 0) ++- break; ++- else if (!(sr & SR_WIP)) ++- return 0; ++- } while (!time_after_eq(jiffies, deadline)); +++static inline int spi_nor_fsr_ready(struct spi_nor *nor) +++{ +++ int fsr = read_fsr(nor); +++ if (fsr < 0) +++ return fsr; +++ else +++ return fsr & FSR_READY; +++} ++ ++- return -ETIMEDOUT; +++static int spi_nor_ready(struct spi_nor *nor) +++{ +++ int sr, fsr; +++ sr = spi_nor_sr_ready(nor); +++ if (sr < 0) +++ return sr; +++ fsr = nor->flags & SNOR_F_USE_FSR ? spi_nor_fsr_ready(nor) : 1; +++ if (fsr < 0) +++ return fsr; +++ return sr && fsr; ++ } ++ ++-static int spi_nor_wait_till_fsr_ready(struct spi_nor *nor) +++/* +++ * Service routine to read status register until ready, or timeout occurs. +++ * Returns non-zero if error. +++ */ +++static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, +++ unsigned long timeout_jiffies) ++ { ++ unsigned long deadline; ++- int sr; ++- int fsr; +++ int timeout = 0, ret; ++ ++- deadline = jiffies + MAX_READY_WAIT_JIFFIES; +++ deadline = jiffies + timeout_jiffies; +++ +++ while (!timeout) { +++ if (time_after_eq(jiffies, deadline)) +++ timeout = 1; +++ +++ ret = spi_nor_ready(nor); +++ if (ret < 0) +++ return ret; +++ if (ret) +++ return 0; ++ ++- do { ++ cond_resched(); +++ } ++ ++- sr = read_sr(nor); ++- if (sr < 0) { ++- break; ++- } else if (!(sr & SR_WIP)) { ++- fsr = read_fsr(nor); ++- if (fsr < 0) ++- break; ++- if (fsr & FSR_READY) ++- return 0; ++- } ++- } while (!time_after_eq(jiffies, deadline)); +++ dev_err(nor->dev, "flash operation timed out\n"); ++ ++ return -ETIMEDOUT; ++ } ++ ++-/* ++- * Service routine to read status register until ready, or timeout occurs. ++- * Returns non-zero if error. ++- */ ++-static int wait_till_ready(struct spi_nor *nor) +++static int spi_nor_wait_till_ready(struct spi_nor *nor) ++ { ++- return nor->wait_till_ready(nor); +++ return spi_nor_wait_till_ready_with_timeout(nor, +++ DEFAULT_READY_WAIT_JIFFIES); ++ } ++ ++ /* ++@@ -228,19 +283,9 @@ static int wait_till_ready(struct spi_no ++ */ ++ static int erase_chip(struct spi_nor *nor) ++ { ++- int ret; ++- ++- dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd->size >> 10)); +++ dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10)); ++ ++- /* Wait until finished previous write command. */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- return ret; ++- ++- /* Send write enable, then erase commands. */ ++- write_enable(nor); ++- ++- return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0, 0); +++ return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0); ++ } ++ ++ static int spi_nor_lock_and_prep(struct spi_nor *nor, enum spi_nor_ops ops) ++@@ -294,11 +339,28 @@ static int spi_nor_erase(struct mtd_info ++ ++ /* whole-chip erase? */ ++ if (len == mtd->size) { +++ unsigned long timeout; +++ +++ write_enable(nor); +++ ++ if (erase_chip(nor)) { ++ ret = -EIO; ++ goto erase_err; ++ } ++ +++ /* +++ * Scale the timeout linearly with the size of the flash, with +++ * a minimum calibrated to an old 2MB flash. We could try to +++ * pull these from CFI/SFDP, but these values should be good +++ * enough for now. +++ */ +++ timeout = max(CHIP_ERASE_2MB_READY_WAIT_JIFFIES, +++ CHIP_ERASE_2MB_READY_WAIT_JIFFIES * +++ (unsigned long)(mtd->size / SZ_2M)); +++ ret = spi_nor_wait_till_ready_with_timeout(nor, timeout); +++ if (ret) +++ goto erase_err; +++ ++ /* REVISIT in some cases we could speed up erasing large regions ++ * by using SPINOR_OP_SE instead of SPINOR_OP_BE_4K. We may have set up ++ * to use "small sector erase", but that's not always optimal. ++@@ -307,6 +369,8 @@ static int spi_nor_erase(struct mtd_info ++ /* "sector"-at-a-time erase */ ++ } else { ++ while (len) { +++ write_enable(nor); +++ ++ if (nor->erase(nor, addr)) { ++ ret = -EIO; ++ goto erase_err; ++@@ -314,9 +378,15 @@ static int spi_nor_erase(struct mtd_info ++ ++ addr += mtd->erasesize; ++ len -= mtd->erasesize; +++ +++ ret = spi_nor_wait_till_ready(nor); +++ if (ret) +++ goto erase_err; ++ } ++ } ++ +++ write_disable(nor); +++ ++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE); ++ ++ instr->state = MTD_ERASE_DONE; ++@@ -330,152 +400,267 @@ erase_err: ++ return ret; ++ } ++ ++-static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs, +++ uint64_t *len) ++ { ++- struct spi_nor *nor = mtd_to_spi_nor(mtd); ++- uint32_t offset = ofs; ++- uint8_t status_old, status_new; ++- int ret = 0; +++ struct mtd_info *mtd = &nor->mtd; +++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; +++ int shift = ffs(mask) - 1; +++ int pow; +++ +++ if (!(sr & mask)) { +++ /* No protection */ +++ *ofs = 0; +++ *len = 0; +++ } else { +++ pow = ((sr & mask) ^ mask) >> shift; +++ *len = mtd->size >> pow; +++ *ofs = mtd->size - *len; +++ } +++} ++ ++- ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_LOCK); ++- if (ret) ++- return ret; +++/* +++ * Return 1 if the entire region is locked, 0 otherwise +++ */ +++static int stm_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, +++ u8 sr) +++{ +++ loff_t lock_offs; +++ uint64_t lock_len; ++ ++- /* Wait until finished previous command */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto err; +++ stm_get_locked_range(nor, sr, &lock_offs, &lock_len); +++ +++ return (ofs + len <= lock_offs + lock_len) && (ofs >= lock_offs); +++} +++ +++/* +++ * Lock a region of the flash. Compatible with ST Micro and similar flash. +++ * Supports only the block protection bits BP{0,1,2} in the status register +++ * (SR). Does not support these features found in newer SR bitfields: +++ * - TB: top/bottom protect - only handle TB=0 (top protect) +++ * - SEC: sector/block protect - only handle SEC=0 (block protect) +++ * - CMP: complement protect - only support CMP=0 (range is not complemented) +++ * +++ * Sample table portion for 8MB flash (Winbond w25q64fw): +++ * +++ * SEC | TB | BP2 | BP1 | BP0 | Prot Length | Protected Portion +++ * -------------------------------------------------------------------------- +++ * X | X | 0 | 0 | 0 | NONE | NONE +++ * 0 | 0 | 0 | 0 | 1 | 128 KB | Upper 1/64 +++ * 0 | 0 | 0 | 1 | 0 | 256 KB | Upper 1/32 +++ * 0 | 0 | 0 | 1 | 1 | 512 KB | Upper 1/16 +++ * 0 | 0 | 1 | 0 | 0 | 1 MB | Upper 1/8 +++ * 0 | 0 | 1 | 0 | 1 | 2 MB | Upper 1/4 +++ * 0 | 0 | 1 | 1 | 0 | 4 MB | Upper 1/2 +++ * X | X | 1 | 1 | 1 | 8 MB | ALL +++ * +++ * Returns negative on errors, 0 on success. +++ */ +++static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) +++{ +++ struct mtd_info *mtd = &nor->mtd; +++ u8 status_old, status_new; +++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; +++ u8 shift = ffs(mask) - 1, pow, val; ++ ++ status_old = read_sr(nor); ++ ++- if (offset < mtd->size - (mtd->size / 2)) ++- status_new = status_old | SR_BP2 | SR_BP1 | SR_BP0; ++- else if (offset < mtd->size - (mtd->size / 4)) ++- status_new = (status_old & ~SR_BP0) | SR_BP2 | SR_BP1; ++- else if (offset < mtd->size - (mtd->size / 8)) ++- status_new = (status_old & ~SR_BP1) | SR_BP2 | SR_BP0; ++- else if (offset < mtd->size - (mtd->size / 16)) ++- status_new = (status_old & ~(SR_BP0 | SR_BP1)) | SR_BP2; ++- else if (offset < mtd->size - (mtd->size / 32)) ++- status_new = (status_old & ~SR_BP2) | SR_BP1 | SR_BP0; ++- else if (offset < mtd->size - (mtd->size / 64)) ++- status_new = (status_old & ~(SR_BP2 | SR_BP0)) | SR_BP1; ++- else ++- status_new = (status_old & ~(SR_BP2 | SR_BP1)) | SR_BP0; +++ /* SPI NOR always locks to the end */ +++ if (ofs + len != mtd->size) { +++ /* Does combined region extend to end? */ +++ if (!stm_is_locked_sr(nor, ofs + len, mtd->size - ofs - len, +++ status_old)) +++ return -EINVAL; +++ len = mtd->size - ofs; +++ } +++ +++ /* +++ * Need smallest pow such that: +++ * +++ * 1 / (2^pow) <= (len / size) +++ * +++ * so (assuming power-of-2 size) we do: +++ * +++ * pow = ceil(log2(size / len)) = log2(size) - floor(log2(len)) +++ */ +++ pow = ilog2(mtd->size) - ilog2(len); +++ val = mask - (pow << shift); +++ if (val & ~mask) +++ return -EINVAL; +++ /* Don't "lock" with no region! */ +++ if (!(val & mask)) +++ return -EINVAL; +++ +++ status_new = (status_old & ~mask) | val; ++ ++ /* Only modify protection if it will not unlock other areas */ ++- if ((status_new & (SR_BP2 | SR_BP1 | SR_BP0)) > ++- (status_old & (SR_BP2 | SR_BP1 | SR_BP0))) { ++- write_enable(nor); ++- ret = write_sr(nor, status_new); ++- if (ret) ++- goto err; +++ if ((status_new & mask) <= (status_old & mask)) +++ return -EINVAL; +++ +++ write_enable(nor); +++ return write_sr(nor, status_new); +++} +++ +++/* +++ * Unlock a region of the flash. See stm_lock() for more info +++ * +++ * Returns negative on errors, 0 on success. +++ */ +++static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) +++{ +++ struct mtd_info *mtd = &nor->mtd; +++ uint8_t status_old, status_new; +++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; +++ u8 shift = ffs(mask) - 1, pow, val; +++ +++ status_old = read_sr(nor); +++ +++ /* Cannot unlock; would unlock larger region than requested */ +++ if (stm_is_locked_sr(nor, ofs - mtd->erasesize, mtd->erasesize, +++ status_old)) +++ return -EINVAL; +++ +++ /* +++ * Need largest pow such that: +++ * +++ * 1 / (2^pow) >= (len / size) +++ * +++ * so (assuming power-of-2 size) we do: +++ * +++ * pow = floor(log2(size / len)) = log2(size) - ceil(log2(len)) +++ */ +++ pow = ilog2(mtd->size) - order_base_2(mtd->size - (ofs + len)); +++ if (ofs + len == mtd->size) { +++ val = 0; /* fully unlocked */ +++ } else { +++ val = mask - (pow << shift); +++ /* Some power-of-two sizes are not supported */ +++ if (val & ~mask) +++ return -EINVAL; ++ } ++ ++-err: ++- spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); ++- return ret; +++ status_new = (status_old & ~mask) | val; +++ +++ /* Only modify protection if it will not lock other areas */ +++ if ((status_new & mask) >= (status_old & mask)) +++ return -EINVAL; +++ +++ write_enable(nor); +++ return write_sr(nor, status_new); ++ } ++ ++-static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++/* +++ * Check if a region of the flash is (completely) locked. See stm_lock() for +++ * more info. +++ * +++ * Returns 1 if entire region is locked, 0 if any portion is unlocked, and +++ * negative on errors. +++ */ +++static int stm_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) +++{ +++ int status; +++ +++ status = read_sr(nor); +++ if (status < 0) +++ return status; +++ +++ return stm_is_locked_sr(nor, ofs, len, status); +++} +++ +++static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) ++ { ++ struct spi_nor *nor = mtd_to_spi_nor(mtd); ++- uint32_t offset = ofs; ++- uint8_t status_old, status_new; ++- int ret = 0; +++ int ret; ++ ++- ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); +++ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_LOCK); ++ if (ret) ++ return ret; ++ ++- /* Wait until finished previous command */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto err; +++ ret = nor->flash_lock(nor, ofs, len); ++ ++- status_old = read_sr(nor); +++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK); +++ return ret; +++} ++ ++- if (offset+len > mtd->size - (mtd->size / 64)) ++- status_new = status_old & ~(SR_BP2 | SR_BP1 | SR_BP0); ++- else if (offset+len > mtd->size - (mtd->size / 32)) ++- status_new = (status_old & ~(SR_BP2 | SR_BP1)) | SR_BP0; ++- else if (offset+len > mtd->size - (mtd->size / 16)) ++- status_new = (status_old & ~(SR_BP2 | SR_BP0)) | SR_BP1; ++- else if (offset+len > mtd->size - (mtd->size / 8)) ++- status_new = (status_old & ~SR_BP2) | SR_BP1 | SR_BP0; ++- else if (offset+len > mtd->size - (mtd->size / 4)) ++- status_new = (status_old & ~(SR_BP0 | SR_BP1)) | SR_BP2; ++- else if (offset+len > mtd->size - (mtd->size / 2)) ++- status_new = (status_old & ~SR_BP1) | SR_BP2 | SR_BP0; ++- else ++- status_new = (status_old & ~SR_BP0) | SR_BP2 | SR_BP1; +++static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++{ +++ struct spi_nor *nor = mtd_to_spi_nor(mtd); +++ int ret; ++ ++- /* Only modify protection if it will not lock other areas */ ++- if ((status_new & (SR_BP2 | SR_BP1 | SR_BP0)) < ++- (status_old & (SR_BP2 | SR_BP1 | SR_BP0))) { ++- write_enable(nor); ++- ret = write_sr(nor, status_new); ++- if (ret) ++- goto err; ++- } +++ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); +++ if (ret) +++ return ret; ++ ++-err: ++- spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK); +++ ret = nor->flash_unlock(nor, ofs, len); +++ +++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); ++ return ret; ++ } ++ ++-struct flash_info { ++- /* JEDEC id zero means "no ID" (most older chips); otherwise it has ++- * a high byte of zero plus three data bytes: the manufacturer id, ++- * then a two byte device id. ++- */ ++- u32 jedec_id; ++- u16 ext_id; +++static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) +++{ +++ struct spi_nor *nor = mtd_to_spi_nor(mtd); +++ int ret; ++ ++- /* The size listed here is what works with SPINOR_OP_SE, which isn't ++- * necessarily called a "sector" by the vendor. ++- */ ++- unsigned sector_size; ++- u16 n_sectors; +++ ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); +++ if (ret) +++ return ret; ++ ++- u16 page_size; ++- u16 addr_width; +++ ret = nor->flash_is_locked(nor, ofs, len); ++ ++- u16 flags; ++-#define SECT_4K 0x01 /* SPINOR_OP_BE_4K works uniformly */ ++-#define SPI_NOR_NO_ERASE 0x02 /* No erase command needed */ ++-#define SST_WRITE 0x04 /* use SST byte programming */ ++-#define SPI_NOR_NO_FR 0x08 /* Can't do fastread */ ++-#define SECT_4K_PMC 0x10 /* SPINOR_OP_BE_4K_PMC works uniformly */ ++-#define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ ++-#define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ ++-#define USE_FSR 0x80 /* use flag status register */ ++-}; +++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); +++ return ret; +++} ++ +++/* Used when the "_ext_id" is two bytes at most */ ++ #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ ++- ((kernel_ulong_t)&(struct flash_info) { \ ++- .jedec_id = (_jedec_id), \ ++- .ext_id = (_ext_id), \ +++ .id = { \ +++ ((_jedec_id) >> 16) & 0xff, \ +++ ((_jedec_id) >> 8) & 0xff, \ +++ (_jedec_id) & 0xff, \ +++ ((_ext_id) >> 8) & 0xff, \ +++ (_ext_id) & 0xff, \ +++ }, \ +++ .id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))), \ +++ .sector_size = (_sector_size), \ +++ .n_sectors = (_n_sectors), \ +++ .page_size = 256, \ +++ .flags = (_flags), +++ +++#define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ +++ .id = { \ +++ ((_jedec_id) >> 16) & 0xff, \ +++ ((_jedec_id) >> 8) & 0xff, \ +++ (_jedec_id) & 0xff, \ +++ ((_ext_id) >> 16) & 0xff, \ +++ ((_ext_id) >> 8) & 0xff, \ +++ (_ext_id) & 0xff, \ +++ }, \ +++ .id_len = 6, \ ++ .sector_size = (_sector_size), \ ++ .n_sectors = (_n_sectors), \ ++ .page_size = 256, \ ++- .flags = (_flags), \ ++- }) +++ .flags = (_flags), ++ ++ #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags) \ ++- ((kernel_ulong_t)&(struct flash_info) { \ ++ .sector_size = (_sector_size), \ ++ .n_sectors = (_n_sectors), \ ++ .page_size = (_page_size), \ ++ .addr_width = (_addr_width), \ ++- .flags = (_flags), \ ++- }) +++ .flags = (_flags), ++ ++ /* NOTE: double check command sets and memory organization when you add ++ * more nor chips. This current list focusses on newer chips, which ++ * have been converging on command sets which including JEDEC ID. +++ * +++ * All newly added entries should describe *hardware* and should use SECT_4K +++ * (or SECT_4K_PMC) if hardware supports erasing 4 KiB sectors. For usage +++ * scenarios excluding small sectors there is config option that can be +++ * disabled: CONFIG_MTD_SPI_NOR_USE_4K_SECTORS. +++ * For historical (and compatibility) reasons (before we got above config) some +++ * old entries may be missing 4K flag. ++ */ ++-static const struct spi_device_id spi_nor_ids[] = { +++static const struct flash_info spi_nor_ids[] = { ++ /* Atmel -- some are (confusingly) marketed as "DataFlash" */ ++ { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, ++ { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, ++@@ -499,6 +684,7 @@ static const struct spi_device_id spi_no ++ { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, ++ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, +++ { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, ++ ++ /* ESMT */ ++ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, ++@@ -507,16 +693,24 @@ static const struct spi_device_id spi_no ++ { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, ++ { "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, ++ +++ /* Fujitsu */ +++ { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) }, +++ ++ /* GigaDevice */ ++ { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, ++ { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, ++ ++ /* Intel/Numonyx -- xxxs33b */ ++ { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, ++ { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, ++ { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, ++ +++ /* ISSI */ +++ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, +++ ++ /* Macronix */ +++ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, ++ { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, ++ { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, ++ { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, ++@@ -524,6 +718,7 @@ static const struct spi_device_id spi_no ++ { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) }, ++ { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, ++ { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) }, +++ { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, ++ { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, ++ { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, ++ { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, ++@@ -532,13 +727,16 @@ static const struct spi_device_id spi_no ++ { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, ++ ++ /* Micron */ ++- { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) }, ++- { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) }, ++- { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) }, ++- { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) }, ++- { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) }, ++- { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, USE_FSR) }, ++- { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, USE_FSR) }, +++ { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, +++ { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) }, +++ { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, +++ { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) }, +++ { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, +++ { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, +++ { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, ++ ++ /* PMC */ ++ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, ++@@ -549,23 +747,28 @@ static const struct spi_device_id spi_no ++ * for the chips listed here (without boot sectors). ++ */ ++ { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++- { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, 0) }, +++ { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) }, ++ { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, ++ { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, ++ { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, ++- { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) }, ++- { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) }, +++ { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, +++ { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) }, ++ { "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) }, ++ { "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32, 0) }, ++ { "s25sl032a", INFO(0x010215, 0, 64 * 1024, 64, 0) }, ++ { "s25sl064a", INFO(0x010216, 0, 64 * 1024, 128, 0) }, ++- { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, ++- { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) }, +++ { "s25fl004k", INFO(0xef4013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, SECT_4K) }, +++ { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ) }, ++ ++ /* SST -- large erase sizes are "overlays", "sectors" are 4K */ ++ { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, ++@@ -576,7 +779,10 @@ static const struct spi_device_id spi_no ++ { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE) }, ++ { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE) }, ++ { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE) }, +++ { "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4, SECT_4K) }, +++ { "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8, SECT_4K) }, ++ { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, +++ { "sst25wf080", INFO(0xbf2505, 0, 64 * 1024, 16, SECT_4K | SST_WRITE) }, ++ ++ /* ST Microelectronics -- newer production may have feature updates */ ++ { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) }, ++@@ -588,7 +794,6 @@ static const struct spi_device_id spi_no ++ { "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) }, ++ { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, ++ { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, ++- { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, 0) }, ++ ++ { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, ++ { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, ++@@ -616,6 +821,7 @@ static const struct spi_device_id spi_no ++ { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, ++ ++ /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ +++ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, ++ { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, ++ { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, ++ { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, ++@@ -623,9 +829,11 @@ static const struct spi_device_id spi_no ++ { "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) }, ++ { "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) }, ++ { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, ++- { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K) }, +++ { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, +++ { "w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, ++ { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, ++ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, ++@@ -640,35 +848,27 @@ static const struct spi_device_id spi_no ++ { }, ++ }; ++ ++-static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) +++static const struct flash_info *spi_nor_read_id(struct spi_nor *nor) ++ { ++ int tmp; ++- u8 id[5]; ++- u32 jedec; ++- u16 ext_jedec; ++- struct flash_info *info; +++ u8 id[SPI_NOR_MAX_ID_LEN]; +++ const struct flash_info *info; ++ ++- tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, 5); +++ tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN); ++ if (tmp < 0) { ++ dev_dbg(nor->dev, " error %d reading JEDEC ID\n", tmp); ++ return ERR_PTR(tmp); ++ } ++- jedec = id[0]; ++- jedec = jedec << 8; ++- jedec |= id[1]; ++- jedec = jedec << 8; ++- jedec |= id[2]; ++- ++- ext_jedec = id[3] << 8 | id[4]; ++ ++ for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) { ++- info = (void *)spi_nor_ids[tmp].driver_data; ++- if (info->jedec_id == jedec) { ++- if (info->ext_id == 0 || info->ext_id == ext_jedec) +++ info = &spi_nor_ids[tmp]; +++ if (info->id_len) { +++ if (!memcmp(info->id, id, info->id_len)) ++ return &spi_nor_ids[tmp]; ++ } ++ } ++- dev_err(nor->dev, "unrecognized JEDEC id %06x\n", jedec); +++ dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %2x, %2x\n", +++ id[0], id[1], id[2]); ++ return ERR_PTR(-ENODEV); ++ } ++ ++@@ -703,11 +903,6 @@ static int sst_write(struct mtd_info *mt ++ if (ret) ++ return ret; ++ ++- /* Wait until finished previous write command. */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto time_out; ++- ++ write_enable(nor); ++ ++ nor->sst_write_second = false; ++@@ -719,7 +914,7 @@ static int sst_write(struct mtd_info *mt ++ ++ /* write one byte. */ ++ nor->write(nor, to, 1, retlen, buf); ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ } ++@@ -731,7 +926,7 @@ static int sst_write(struct mtd_info *mt ++ ++ /* write two bytes. */ ++ nor->write(nor, to, 2, retlen, buf + actual); ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ to += 2; ++@@ -740,7 +935,7 @@ static int sst_write(struct mtd_info *mt ++ nor->sst_write_second = false; ++ ++ write_disable(nor); ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ ++@@ -751,7 +946,7 @@ static int sst_write(struct mtd_info *mt ++ nor->program_opcode = SPINOR_OP_BP; ++ nor->write(nor, to, 1, retlen, buf + actual); ++ ++- ret = wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); ++ if (ret) ++ goto time_out; ++ write_disable(nor); ++@@ -779,11 +974,6 @@ static int spi_nor_write(struct mtd_info ++ if (ret) ++ return ret; ++ ++- /* Wait until finished previous write command. */ ++- ret = wait_till_ready(nor); ++- if (ret) ++- goto write_err; ++- ++ write_enable(nor); ++ ++ page_offset = to & (nor->page_size - 1); ++@@ -802,16 +992,20 @@ static int spi_nor_write(struct mtd_info ++ if (page_size > nor->page_size) ++ page_size = nor->page_size; ++ ++- wait_till_ready(nor); +++ ret = spi_nor_wait_till_ready(nor); +++ if (ret) +++ goto write_err; +++ ++ write_enable(nor); ++ ++ nor->write(nor, to + i, page_size, retlen, buf + i); ++ } ++ } ++ +++ ret = spi_nor_wait_till_ready(nor); ++ write_err: ++ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); ++- return 0; +++ return ret; ++ } ++ ++ static int macronix_quad_enable(struct spi_nor *nor) ++@@ -821,10 +1015,9 @@ static int macronix_quad_enable(struct s ++ val = read_sr(nor); ++ write_enable(nor); ++ ++- nor->cmd_buf[0] = val | SR_QUAD_EN_MX; ++- nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); +++ write_sr(nor, val | SR_QUAD_EN_MX); ++ ++- if (wait_till_ready(nor)) +++ if (spi_nor_wait_till_ready(nor)) ++ return 1; ++ ++ ret = read_sr(nor); ++@@ -847,7 +1040,7 @@ static int write_sr_cr(struct spi_nor *n ++ nor->cmd_buf[0] = val & 0xff; ++ nor->cmd_buf[1] = (val >> 8); ++ ++- return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2, 0); +++ return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2); ++ } ++ ++ static int spansion_quad_enable(struct spi_nor *nor) ++@@ -874,18 +1067,20 @@ static int spansion_quad_enable(struct s ++ return 0; ++ } ++ ++-static int set_quad_mode(struct spi_nor *nor, u32 jedec_id) +++static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) ++ { ++ int status; ++ ++- switch (JEDEC_MFR(jedec_id)) { ++- case CFI_MFR_MACRONIX: +++ switch (JEDEC_MFR(info)) { +++ case SNOR_MFR_MACRONIX: ++ status = macronix_quad_enable(nor); ++ if (status) { ++ dev_err(nor->dev, "Macronix quad-read not enabled\n"); ++ return -EINVAL; ++ } ++ return status; +++ case SNOR_MFR_MICRON: +++ return 0; ++ default: ++ status = spansion_quad_enable(nor); ++ if (status) { ++@@ -904,21 +1099,15 @@ static int spi_nor_check(struct spi_nor ++ return -EINVAL; ++ } ++ ++- if (!nor->read_id) ++- nor->read_id = spi_nor_read_id; ++- if (!nor->wait_till_ready) ++- nor->wait_till_ready = spi_nor_wait_till_ready; ++- ++ return 0; ++ } ++ ++ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) ++ { ++- const struct spi_device_id *id = NULL; ++- struct flash_info *info; +++ const struct flash_info *info = NULL; ++ struct device *dev = nor->dev; ++- struct mtd_info *mtd = nor->mtd; ++- struct device_node *np = dev->of_node; +++ struct mtd_info *mtd = &nor->mtd; +++ struct device_node *np = nor->flash_node; ++ int ret; ++ int i; ++ ++@@ -926,19 +1115,25 @@ int spi_nor_scan(struct spi_nor *nor, co ++ if (ret) ++ return ret; ++ ++- id = spi_nor_match_id(name); ++- if (!id) +++ if (name) +++ info = spi_nor_match_id(name); +++ /* Try to auto-detect if chip name wasn't specified or not found */ +++ if (!info) +++ info = spi_nor_read_id(nor); +++ if (IS_ERR_OR_NULL(info)) ++ return -ENOENT; ++ ++- info = (void *)id->driver_data; ++- ++- if (info->jedec_id) { ++- const struct spi_device_id *jid; +++ /* +++ * If caller has specified name of flash model that can normally be +++ * detected using JEDEC, let's verify it. +++ */ +++ if (name && info->id_len) { +++ const struct flash_info *jinfo; ++ ++- jid = nor->read_id(nor); ++- if (IS_ERR(jid)) { ++- return PTR_ERR(jid); ++- } else if (jid != id) { +++ jinfo = spi_nor_read_id(nor); +++ if (IS_ERR(jinfo)) { +++ return PTR_ERR(jinfo); +++ } else if (jinfo != info) { ++ /* ++ * JEDEC knows better, so overwrite platform ID. We ++ * can't trust partitions any longer, but we'll let ++@@ -947,28 +1142,28 @@ int spi_nor_scan(struct spi_nor *nor, co ++ * information, even if it's not 100% accurate. ++ */ ++ dev_warn(dev, "found %s, expected %s\n", ++- jid->name, id->name); ++- id = jid; ++- info = (void *)jid->driver_data; +++ jinfo->name, info->name); +++ info = jinfo; ++ } ++ } ++ ++ mutex_init(&nor->lock); ++ ++ /* ++- * Atmel, SST and Intel/Numonyx serial nor tend to power ++- * up with the software protection bits set +++ * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up +++ * with the software protection bits set ++ */ ++ ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || ++- JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || ++- JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { +++ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || +++ JEDEC_MFR(info) == SNOR_MFR_INTEL || +++ JEDEC_MFR(info) == SNOR_MFR_SST) { ++ write_enable(nor); ++ write_sr(nor, 0); ++ } ++ ++ if (!mtd->name) ++ mtd->name = dev_name(dev); +++ mtd->priv = nor; ++ mtd->type = MTD_NORFLASH; ++ mtd->writesize = 1; ++ mtd->flags = MTD_CAP_NORFLASH; ++@@ -976,10 +1171,17 @@ int spi_nor_scan(struct spi_nor *nor, co ++ mtd->_erase = spi_nor_erase; ++ mtd->_read = spi_nor_read; ++ ++- /* nor protection support for STmicro chips */ ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ST) { +++ /* NOR protection support for STmicro/Micron chips and similar */ +++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON) { +++ nor->flash_lock = stm_lock; +++ nor->flash_unlock = stm_unlock; +++ nor->flash_is_locked = stm_is_locked; +++ } +++ +++ if (nor->flash_lock && nor->flash_unlock && nor->flash_is_locked) { ++ mtd->_lock = spi_nor_lock; ++ mtd->_unlock = spi_nor_unlock; +++ mtd->_is_locked = spi_nor_is_locked; ++ } ++ ++ /* sst nor chips use AAI word program */ ++@@ -988,9 +1190,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ else ++ mtd->_write = spi_nor_write; ++ ++- if ((info->flags & USE_FSR) && ++- nor->wait_till_ready == spi_nor_wait_till_ready) ++- nor->wait_till_ready = spi_nor_wait_till_fsr_ready; +++ if (info->flags & USE_FSR) +++ nor->flags |= SNOR_F_USE_FSR; ++ ++ #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS ++ /* prefer "small sector" erase if possible */ ++@@ -1031,7 +1232,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ ++ /* Quad/Dual-read mode takes precedence over fast/normal */ ++ if (mode == SPI_NOR_QUAD && info->flags & SPI_NOR_QUAD_READ) { ++- ret = set_quad_mode(nor, info->jedec_id); +++ ret = set_quad_mode(nor, info); ++ if (ret) { ++ dev_err(dev, "quad mode not supported\n"); ++ return ret; ++@@ -1067,7 +1268,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ else if (mtd->size > 0x1000000) { ++ /* enable 4-byte addressing if the device exceeds 16MiB */ ++ nor->addr_width = 4; ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_AMD) { +++ if (JEDEC_MFR(info) == SNOR_MFR_SPANSION) { ++ /* Dedicated 4-byte command set */ ++ switch (nor->flash_read) { ++ case SPI_NOR_QUAD: ++@@ -1088,14 +1289,14 @@ int spi_nor_scan(struct spi_nor *nor, co ++ nor->erase_opcode = SPINOR_OP_SE_4B; ++ mtd->erasesize = info->sector_size; ++ } else ++- set_4byte(nor, info->jedec_id, 1); +++ set_4byte(nor, info, 1); ++ } else { ++ nor->addr_width = 3; ++ } ++ ++ nor->read_dummy = spi_nor_read_dummy_cycles(nor); ++ ++- dev_info(dev, "%s (%lld Kbytes)\n", id->name, +++ dev_info(dev, "%s (%lld Kbytes)\n", info->name, ++ (long long)mtd->size >> 10); ++ ++ dev_dbg(dev, ++@@ -1118,11 +1319,11 @@ int spi_nor_scan(struct spi_nor *nor, co ++ } ++ EXPORT_SYMBOL_GPL(spi_nor_scan); ++ ++-static const struct spi_device_id *spi_nor_match_id(const char *name) +++static const struct flash_info *spi_nor_match_id(const char *name) ++ { ++- const struct spi_device_id *id = spi_nor_ids; +++ const struct flash_info *id = spi_nor_ids; ++ ++- while (id->name[0]) { +++ while (id->name) { ++ if (!strcmp(name, id->name)) ++ return id; ++ id++; ++--- a/include/linux/mtd/spi-nor.h +++++ b/include/linux/mtd/spi-nor.h ++@@ -10,6 +10,23 @@ ++ #ifndef __LINUX_MTD_SPI_NOR_H ++ #define __LINUX_MTD_SPI_NOR_H ++ +++#include +++#include +++ +++/* +++ * Manufacturer IDs +++ * +++ * The first byte returned from the flash after sending opcode SPINOR_OP_RDID. +++ * Sometimes these are the same as CFI IDs, but sometimes they aren't. +++ */ +++#define SNOR_MFR_ATMEL CFI_MFR_ATMEL +++#define SNOR_MFR_INTEL CFI_MFR_INTEL +++#define SNOR_MFR_MICRON CFI_MFR_ST /* ST Micro <--> Micron */ +++#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX +++#define SNOR_MFR_SPANSION CFI_MFR_AMD +++#define SNOR_MFR_SST CFI_MFR_SST +++#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */ +++ ++ /* ++ * Note on opcode nomenclature: some opcodes have a format like ++ * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number ++@@ -56,22 +73,29 @@ ++ /* Used for Spansion flashes only. */ ++ #define SPINOR_OP_BRWR 0x17 /* Bank register write */ ++ +++/* Used for Micron flashes only. */ +++#define SPINOR_OP_RD_EVCR 0x65 /* Read EVCR register */ +++#define SPINOR_OP_WD_EVCR 0x61 /* Write EVCR register */ +++ ++ /* Status Register bits. */ ++-#define SR_WIP 1 /* Write in progress */ ++-#define SR_WEL 2 /* Write enable latch */ +++#define SR_WIP BIT(0) /* Write in progress */ +++#define SR_WEL BIT(1) /* Write enable latch */ ++ /* meaning of other SR_* bits may differ between vendors */ ++-#define SR_BP0 4 /* Block protect 0 */ ++-#define SR_BP1 8 /* Block protect 1 */ ++-#define SR_BP2 0x10 /* Block protect 2 */ ++-#define SR_SRWD 0x80 /* SR write protect */ +++#define SR_BP0 BIT(2) /* Block protect 0 */ +++#define SR_BP1 BIT(3) /* Block protect 1 */ +++#define SR_BP2 BIT(4) /* Block protect 2 */ +++#define SR_SRWD BIT(7) /* SR write protect */ +++ +++#define SR_QUAD_EN_MX BIT(6) /* Macronix Quad I/O */ ++ ++-#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ +++/* Enhanced Volatile Configuration Register bits */ +++#define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */ ++ ++ /* Flag Status Register bits */ ++-#define FSR_READY 0x80 +++#define FSR_READY BIT(7) ++ ++ /* Configuration Register bits. */ ++-#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ +++#define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ ++ ++ enum read_mode { ++ SPI_NOR_NORMAL = 0, ++@@ -80,33 +104,6 @@ enum read_mode { ++ SPI_NOR_QUAD, ++ }; ++ ++-/** ++- * struct spi_nor_xfer_cfg - Structure for defining a Serial Flash transfer ++- * @wren: command for "Write Enable", or 0x00 for not required ++- * @cmd: command for operation ++- * @cmd_pins: number of pins to send @cmd (1, 2, 4) ++- * @addr: address for operation ++- * @addr_pins: number of pins to send @addr (1, 2, 4) ++- * @addr_width: number of address bytes ++- * (3,4, or 0 for address not required) ++- * @mode: mode data ++- * @mode_pins: number of pins to send @mode (1, 2, 4) ++- * @mode_cycles: number of mode cycles (0 for mode not required) ++- * @dummy_cycles: number of dummy cycles (0 for dummy not required) ++- */ ++-struct spi_nor_xfer_cfg { ++- u8 wren; ++- u8 cmd; ++- u8 cmd_pins; ++- u32 addr; ++- u8 addr_pins; ++- u8 addr_width; ++- u8 mode; ++- u8 mode_pins; ++- u8 mode_cycles; ++- u8 dummy_cycles; ++-}; ++- ++ #define SPI_NOR_MAX_CMD_SIZE 8 ++ enum spi_nor_ops { ++ SPI_NOR_OPS_READ = 0, ++@@ -116,11 +113,18 @@ enum spi_nor_ops { ++ SPI_NOR_OPS_UNLOCK, ++ }; ++ +++enum spi_nor_option_flags { +++ SNOR_F_USE_FSR = BIT(0), +++}; +++ +++struct mtd_info; +++ ++ /** ++ * struct spi_nor - Structure for defining a the SPI NOR layer ++ * @mtd: point to a mtd_info structure ++ * @lock: the lock for the read/write/erase/lock/unlock operations ++ * @dev: point to a spi device, or a spi nor controller device. +++ * @flash_node: point to a device node describing this flash instance. ++ * @page_size: the page size of the SPI NOR ++ * @addr_width: number of address bytes ++ * @erase_opcode: the opcode for erasing a sector ++@@ -129,29 +133,29 @@ enum spi_nor_ops { ++ * @program_opcode: the program opcode ++ * @flash_read: the mode of the read ++ * @sst_write_second: used by the SST write operation ++- * @cfg: used by the read_xfer/write_xfer +++ * @flags: flag options for the current SPI-NOR (SNOR_F_*) ++ * @cmd_buf: used by the write_reg ++ * @prepare: [OPTIONAL] do some preparations for the ++ * read/write/erase/lock/unlock operations ++ * @unprepare: [OPTIONAL] do some post work after the ++ * read/write/erase/lock/unlock operations ++- * @read_xfer: [OPTIONAL] the read fundamental primitive ++- * @write_xfer: [OPTIONAL] the writefundamental primitive ++ * @read_reg: [DRIVER-SPECIFIC] read out the register ++ * @write_reg: [DRIVER-SPECIFIC] write data to the register ++- * @read_id: [REPLACEABLE] read out the ID data, and find ++- * the proper spi_device_id ++- * @wait_till_ready: [REPLACEABLE] wait till the NOR becomes ready ++ * @read: [DRIVER-SPECIFIC] read data from the SPI NOR ++ * @write: [DRIVER-SPECIFIC] write data to the SPI NOR ++ * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR ++ * at the offset @offs +++ * @flash_lock: [FLASH-SPECIFIC] lock a region of the SPI NOR +++ * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR +++ * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is +++ * completely locked ++ * @priv: the private data ++ */ ++ struct spi_nor { ++- struct mtd_info *mtd; +++ struct mtd_info mtd; ++ struct mutex lock; ++ struct device *dev; +++ struct device_node *flash_node; ++ u32 page_size; ++ u8 addr_width; ++ u8 erase_opcode; ++@@ -160,20 +164,13 @@ struct spi_nor { ++ u8 program_opcode; ++ enum read_mode flash_read; ++ bool sst_write_second; ++- struct spi_nor_xfer_cfg cfg; +++ u32 flags; ++ u8 cmd_buf[SPI_NOR_MAX_CMD_SIZE]; ++ ++ int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); ++ void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops); ++- int (*read_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg, ++- u8 *buf, size_t len); ++- int (*write_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg, ++- u8 *buf, size_t len); ++ int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); ++- int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len, ++- int write_enable); ++- const struct spi_device_id *(*read_id)(struct spi_nor *nor); ++- int (*wait_till_ready)(struct spi_nor *nor); +++ int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); ++ ++ int (*read)(struct spi_nor *nor, loff_t from, ++ size_t len, size_t *retlen, u_char *read_buf); ++@@ -181,6 +178,10 @@ struct spi_nor { ++ size_t len, size_t *retlen, const u_char *write_buf); ++ int (*erase)(struct spi_nor *nor, loff_t offs); ++ +++ int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); +++ int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); +++ int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); +++ ++ void *priv; ++ }; ++ +diff --git a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch +index fef483a..eb99609 100644 +--- a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch ++++ b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch +@@ -1,10 +1,14 @@ ++Disable software protection bits for Macronix flashes. ++ ++Signed-off-by: Felix Fietkau ++ + --- a/drivers/mtd/spi-nor/spi-nor.c + +++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -963,6 +963,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++@@ -1164,6 +1164,7 @@ int spi_nor_scan(struct spi_nor *nor, co + +- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || +- JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || +-+ JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX || +- JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { ++ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || ++ JEDEC_MFR(info) == SNOR_MFR_INTEL || +++ JEDEC_MFR(info) == SNOR_MFR_MACRONIX || ++ JEDEC_MFR(info) == SNOR_MFR_SST) { + write_enable(nor); + write_sr(nor, 0); +diff --git a/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch b/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch +deleted file mode 100644 +index dca6895..0000000 +--- a/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch ++++ /dev/null +@@ -1,20 +0,0 @@ +-From eef9dfc4e821408af1af13aa0cc707fc496fb7c6 Mon Sep 17 00:00:00 2001 +-From: Gabor Juhos +-Date: Wed, 11 Dec 2013 19:05:59 +0100 +-Subject: [PATCH] m25p80: add support for the Winbond W25X05 flash +- +-Signed-off-by: Gabor Juhos +---- +- drivers/mtd/devices/m25p80.c | 1 + +- 1 file changed, 1 insertion(+) +- +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -617,6 +617,7 @@ static const struct spi_device_id spi_no +- { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, +- +- /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ +-+ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, +- { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, +- { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, +- { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, +diff --git a/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch b/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch +deleted file mode 100644 +index 9ba7a4a..0000000 +--- a/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch ++++ /dev/null +@@ -1,21 +0,0 @@ +-From 0d7388de0911c1a4fc4a8a3898ef9d0ab818ca08 Mon Sep 17 00:00:00 2001 +-From: Gabor Juhos +-Date: Tue, 7 Apr 2015 18:35:15 +0200 +-Subject: [PATCH] mtd: spi-nor: add support for the Macronix MX25L512E SPI +- flash chip +- +-Signed-off-by: Gabor Juhos +---- +- drivers/mtd/spi-nor/spi-nor.c | 1 + +- 1 file changed, 1 insertion(+) +- +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -518,6 +518,7 @@ static const struct spi_device_id spi_no +- { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, +- +- /* Macronix */ +-+ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, +- { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, +- { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, +- { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, +diff --git a/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch b/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch +deleted file mode 100644 +index b06ac73..0000000 +--- a/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch ++++ /dev/null +@@ -1,22 +0,0 @@ +-From 34e2b403040a2f9d3ba071d95a7f42457e2950f9 Mon Sep 17 00:00:00 2001 +-From: Gabor Juhos +-Date: Tue, 7 Apr 2015 18:35:15 +0200 +-Subject: [PATCH] mtd: spi-nor: add support for the ISSI SI25CD512 SPI flash +- +-Signed-off-by: Gabor Juhos +---- +- drivers/mtd/spi-nor/spi-nor.c | 3 +++ +- 1 file changed, 3 insertions(+) +- +---- a/drivers/mtd/spi-nor/spi-nor.c +-+++ b/drivers/mtd/spi-nor/spi-nor.c +-@@ -517,6 +517,9 @@ static const struct spi_device_id spi_no +- { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, +- { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, +- +-+ /* ISSI */ +-+ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, +-+ +- /* Macronix */ +- { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, +- { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, +diff --git a/target/linux/lantiq/patches-3.18/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch b/target/linux/lantiq/patches-3.18/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch +deleted file mode 100644 +index 203eb94..0000000 +--- a/target/linux/lantiq/patches-3.18/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch ++++ /dev/null +@@ -1,44 +0,0 @@ +-From 4400e1f593ea40a51912128adb4f53d59e62cad8 Mon Sep 17 00:00:00 2001 +-From: John Crispin +-Date: Wed, 10 Sep 2014 22:40:18 +0200 +-Subject: [PATCH 22/36] MTD: m25p80: allow loading mtd name from OF +- +-In accordance with the physmap flash we should honour the linux,mtd-name +-property when deciding what name the mtd device has. +- +-Signed-off-by: Thomas Langer +-Signed-off-by: John Crispin +---- +- drivers/mtd/devices/m25p80.c | 6 ++++++ +- 1 file changed, 6 insertions(+) +- +---- a/drivers/mtd/devices/m25p80.c +-+++ b/drivers/mtd/devices/m25p80.c +-@@ -19,6 +19,7 @@ +- #include +- #include +- #include +-+#include +- +- #include +- #include +-@@ -198,6 +199,10 @@ static int m25p_probe(struct spi_device +- enum read_mode mode = SPI_NOR_NORMAL; +- char *flash_name = NULL; +- int ret; +-+ const char __maybe_unused *of_mtd_name = NULL; +-+ +-+ of_property_read_string(spi->dev.of_node, +-+ "linux,mtd-name", &of_mtd_name); +- +- data = dev_get_platdata(&spi->dev); +- +-@@ -229,6 +234,8 @@ static int m25p_probe(struct spi_device +- +- if (data && data->name) +- flash->mtd.name = data->name; +-+ else if (of_mtd_name) +-+ flash->mtd.name = of_mtd_name; +- +- /* For some (historical?) reason many platforms provide two different +- * names in flash_platform_data: "name" and "type". Quite often name is +diff --git a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch +deleted file mode 100644 +index 1716e1c..0000000 +--- a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch ++++ /dev/null +@@ -1,103 +0,0 @@ +---- a/drivers/mtd/devices/m25p80.c +-+++ b/drivers/mtd/devices/m25p80.c +-@@ -19,6 +19,7 @@ +- #include +- #include +- #include +-+#include +- +- #include +- #include +-@@ -32,6 +33,7 @@ struct m25p { +- struct spi_device *spi; +- struct spi_nor spi_nor; +- struct mtd_info mtd; +-+ u16 chunk_size; +- u8 command[MAX_CMD_SIZE]; +- }; +- +-@@ -157,6 +159,61 @@ static int m25p80_read(struct spi_nor *n +- return 0; +- } +- +-+static void m25p80_chunked_write(struct spi_nor *nor, loff_t _from, size_t _len, +-+ size_t *_retlen, const u_char *_buf) +-+{ +-+ struct m25p *flash = nor->priv; +-+ int chunk_size; +-+ int retlen = 0; +-+ +-+ chunk_size = flash->chunk_size; +-+ if (!chunk_size) +-+ chunk_size = _len; +-+ +-+ if (nor->addr_width > 3) +-+ chunk_size -= nor->addr_width - 3; +-+ +-+ while (retlen < _len) { +-+ size_t len = min_t(int, chunk_size, _len - retlen); +-+ const u_char *buf = _buf + retlen; +-+ loff_t from = _from + retlen; +-+ +-+ nor->wait_till_ready(nor); +-+ nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); +-+ +-+ m25p80_write(nor, from, len, &retlen, buf); +-+ } +-+ *_retlen += retlen; +-+} +-+ +-+static int m25p80_chunked_read(struct spi_nor *nor, loff_t _from, size_t _len, +-+ size_t *_retlen, u_char *_buf) +-+{ +-+ struct m25p *flash = nor->priv; +-+ int chunk_size; +-+ +-+ chunk_size = flash->chunk_size; +-+ if (!chunk_size) +-+ chunk_size = _len; +-+ +-+ *_retlen = 0; +-+ +-+ while (*_retlen < _len) { +-+ size_t len = min_t(int, chunk_size, _len - *_retlen); +-+ u_char *buf = _buf + *_retlen; +-+ loff_t from = _from + *_retlen; +-+ int retlen = 0; +-+ int ret = m25p80_read(nor, from, len, &retlen, buf); +-+ +-+ if (ret) +-+ return ret; +-+ +-+ *_retlen += retlen; +-+ } +-+ +-+ return 0; +-+} +-+ +- static int m25p80_erase(struct spi_nor *nor, loff_t offset) +- { +- struct m25p *flash = nor->priv; +-@@ -197,6 +254,7 @@ static int m25p_probe(struct spi_device +- struct spi_nor *nor; +- enum read_mode mode = SPI_NOR_NORMAL; +- char *flash_name = NULL; +-+ u32 val; +- int ret; +- +- data = dev_get_platdata(&spi->dev); +-@@ -244,6 +302,14 @@ static int m25p_probe(struct spi_device +- if (ret) +- return ret; +- +-+ if (spi->dev.of_node && +-+ !of_property_read_u32(spi->dev.of_node, "m25p,chunked-io", &val)) { +-+ dev_warn(&spi->dev, "using chunked io\n"); +-+ nor->read = m25p80_chunked_read; +-+ nor->write = m25p80_chunked_write; +-+ flash->chunk_size = val; +-+ } +-+ +- ppdata.of_node = spi->dev.of_node; +- +- return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, diff --git a/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch b/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch new file mode 100644 index 00000000..f90f9c61 --- /dev/null +++ b/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch @@ -0,0 +1,115 @@ +From: Matthias Schiffer +Date: Sat, 7 May 2016 00:17:55 +0200 +Subject: kernel: mtd: spi-nor: wait until status register writes are ready + +diff --git a/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch +new file mode 100644 +index 0000000..2c2e5f3 +--- /dev/null ++++ b/target/linux/generic/patches-3.18/094-0001-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch +@@ -0,0 +1,66 @@ ++From 32321e950d8a237d7e8f3a9b76220007dfa87544 Mon Sep 17 00:00:00 2001 ++Message-Id: <32321e950d8a237d7e8f3a9b76220007dfa87544.1462572686.git.mschiffer@universe-factory.net> ++From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= ++Date: Mon, 28 Dec 2015 17:54:51 -0300 ++Subject: [PATCH] mtd: spi-nor: wait until lock/unlock operations are ready ++ ++On Micron and Numonyx devices, the status register write command ++(WRSR), raises a work-in-progress bit (WIP) on the status register. ++The datasheets for these devices specify that while the status ++register write is in progress, the status register WIP bit can still ++be read to check the end of the operation. ++ ++This commit adds a wait_till_ready call on lock/unlock operations, ++which is required for Micron and Numonyx but should be harmless for ++others. This is needed to prevent applications from issuing erase or ++program operations before the unlock operation is completed. ++ ++Reported-by: Stas Sergeev ++Signed-off-by: Ezequiel Garcia ++Signed-off-by: Brian Norris ++--- ++ drivers/mtd/spi-nor/spi-nor.c | 12 ++++++++++-- ++ 1 file changed, 10 insertions(+), 2 deletions(-) ++ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -462,6 +462,7 @@ static int stm_lock(struct spi_nor *nor, ++ u8 status_old, status_new; ++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; ++ u8 shift = ffs(mask) - 1, pow, val; +++ int ret; ++ ++ status_old = read_sr(nor); ++ ++@@ -498,7 +499,10 @@ static int stm_lock(struct spi_nor *nor, ++ return -EINVAL; ++ ++ write_enable(nor); ++- return write_sr(nor, status_new); +++ ret = write_sr(nor, status_new); +++ if (ret) +++ return ret; +++ return spi_nor_wait_till_ready(nor); ++ } ++ ++ /* ++@@ -512,6 +516,7 @@ static int stm_unlock(struct spi_nor *no ++ uint8_t status_old, status_new; ++ u8 mask = SR_BP2 | SR_BP1 | SR_BP0; ++ u8 shift = ffs(mask) - 1, pow, val; +++ int ret; ++ ++ status_old = read_sr(nor); ++ ++@@ -546,7 +551,10 @@ static int stm_unlock(struct spi_nor *no ++ return -EINVAL; ++ ++ write_enable(nor); ++- return write_sr(nor, status_new); +++ ret = write_sr(nor, status_new); +++ if (ret) +++ return ret; +++ return spi_nor_wait_till_ready(nor); ++ } ++ ++ /* +diff --git a/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch +new file mode 100644 +index 0000000..a0573d5 +--- /dev/null ++++ b/target/linux/generic/patches-3.18/094-0002-mtd-spi-nor-wait-for-SR_WIP-to-clear-on-initial-unlo.patch +@@ -0,0 +1,33 @@ ++From edf891ef9ab773363f8e58022a26d7d31604aed6 Mon Sep 17 00:00:00 2001 ++Message-Id: ++From: Brian Norris ++Date: Fri, 29 Jan 2016 11:25:30 -0800 ++Subject: [PATCH] mtd: spi-nor: wait for SR_WIP to clear on initial unlock ++ ++Fixup a piece leftover by commit 32321e950d8a ("mtd: spi-nor: wait until ++lock/unlock operations are ready"). That commit made us wait for the WIP ++bit to settle after lock/unlock operations, but it missed the open-coded ++"unlock" that happens at probe() time. ++ ++We should probably have this code utilize the unlock() routines in the ++future, to avoid duplication, but unfortunately, flash which need to be ++unlocked don't all have a proper ->flash_unlock() callback. ++ ++Signed-off-by: Brian Norris ++Cc: Stas Sergeev ++Reviewed-by: Ezequiel Garcia ++Tested-by: Ezequiel Garcia ++--- ++ drivers/mtd/spi-nor/spi-nor.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -1167,6 +1167,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++ JEDEC_MFR(info) == SNOR_MFR_SST) { ++ write_enable(nor); ++ write_sr(nor, 0); +++ spi_nor_wait_till_ready(nor); ++ } ++ ++ if (!mtd->name) diff --git a/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch b/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch new file mode 100644 index 00000000..655f9ab1 --- /dev/null +++ b/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch @@ -0,0 +1,56 @@ +From: Matthias Schiffer +Date: Sat, 7 May 2016 00:29:06 +0200 +Subject: kernel: mtd: spi-nor: unlock Winbond flashs + +diff --git a/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch b/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +new file mode 100644 +index 0000000..4682b7a +--- /dev/null ++++ b/target/linux/generic/patches-3.18/463-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch +@@ -0,0 +1,46 @@ ++From 20bbd73b6b04677a73933830363ab3178adc2ce9 Mon Sep 17 00:00:00 2001 ++Message-Id: <20bbd73b6b04677a73933830363ab3178adc2ce9.1462573588.git.mschiffer@universe-factory.net> ++From: Matthias Schiffer ++Date: Sat, 7 May 2016 00:26:23 +0200 ++Subject: [PATCH] Revert "mtd: spi-nor: fix Spansion regressions (aliased with ++ Winbond)" ++ ++This reverts commit 67b9bcd36906e12a15ffec19463afbbd6a41660e. ++--- ++ drivers/mtd/spi-nor/spi-nor.c | 6 ++++-- ++ include/linux/mtd/spi-nor.h | 2 +- ++ 2 files changed, 5 insertions(+), 3 deletions(-) ++ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -1165,7 +1165,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || ++ JEDEC_MFR(info) == SNOR_MFR_INTEL || ++ JEDEC_MFR(info) == SNOR_MFR_MACRONIX || ++- JEDEC_MFR(info) == SNOR_MFR_SST) { +++ JEDEC_MFR(info) == SNOR_MFR_SST || +++ JEDEC_MFR(info) == SNOR_MFR_WINBOND) { ++ write_enable(nor); ++ write_sr(nor, 0); ++ spi_nor_wait_till_ready(nor); ++@@ -1182,7 +1183,8 @@ int spi_nor_scan(struct spi_nor *nor, co ++ mtd->_read = spi_nor_read; ++ ++ /* NOR protection support for STmicro/Micron chips and similar */ ++- if (JEDEC_MFR(info) == SNOR_MFR_MICRON) { +++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON || +++ JEDEC_MFR(info) == SNOR_MFR_WINBOND) { ++ nor->flash_lock = stm_lock; ++ nor->flash_unlock = stm_unlock; ++ nor->flash_is_locked = stm_is_locked; ++--- a/include/linux/mtd/spi-nor.h +++++ b/include/linux/mtd/spi-nor.h ++@@ -25,7 +25,7 @@ ++ #define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX ++ #define SNOR_MFR_SPANSION CFI_MFR_AMD ++ #define SNOR_MFR_SST CFI_MFR_SST ++-#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */ +++#define SNOR_MFR_WINBOND 0xef ++ ++ /* ++ * Note on opcode nomenclature: some opcodes have a format like From 5a3601980a4288dedfd591ffe64e54a285715617 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 9 May 2016 17:09:00 +0200 Subject: [PATCH 014/184] Fix build with GCC 6 Make pkg-config, mkimage and gcc build with GCC 6 as host compiler. Fix miscompilation of node. Fixes #755 --- ...ools-pkg-config-fix-build-with-GCC-6.patch | 37 + ...linux-compiler-.h-with-u-boot-master.patch | 815 ++++++++++++++++++ ...5-toolchain-gcc-fix-build-with-GCC-6.patch | 144 ++++ .../openwrt/0005-node-update-to-v4.4.4.patch | 110 +++ ...ur-leading-to-broken-code-with-GCC-6.patch | 80 ++ 5 files changed, 1186 insertions(+) create mode 100644 patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch create mode 100644 patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch create mode 100644 patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch create mode 100644 patches/packages/openwrt/0005-node-update-to-v4.4.4.patch create mode 100644 patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch diff --git a/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch b/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch new file mode 100644 index 00000000..840b8b60 --- /dev/null +++ b/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch @@ -0,0 +1,37 @@ +From: Matthias Schiffer +Date: Sun, 8 May 2016 15:53:14 +0200 +Subject: tools: pkg-config: fix build with GCC 6 + +Fixes the following error: + +gdate.c: In function ‘g_date_strftime’: +gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral] + tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm); + ^~~~~~ + +Signed-off-by: Matthias Schiffer + +diff --git a/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch b/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch +new file mode 100644 +index 0000000..6849299 +--- /dev/null ++++ b/tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch +@@ -0,0 +1,18 @@ ++--- a/glib/glib/gdate.c +++++ b/glib/glib/gdate.c ++@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d, ++ * ++ * Returns: number of characters written to the buffer, or 0 the buffer was too small ++ */ +++#pragma GCC diagnostic push +++#pragma GCC diagnostic ignored "-Wformat-nonliteral" +++ ++ gsize ++ g_date_strftime (gchar *s, ++ gsize slen, ++@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s, ++ return retval; ++ #endif ++ } +++ +++#pragma GCC diagnostic pop diff --git a/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch b/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch new file mode 100644 index 00000000..edca566c --- /dev/null +++ b/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch @@ -0,0 +1,815 @@ +From: Matthias Schiffer +Date: Sun, 8 May 2016 22:06:51 +0200 +Subject: tools: mkimage: sync include/linux/compiler*.h with u-boot master + +Fixes build with GCC 6. + +Signed-off-by: Matthias Schiffer + +diff --git a/tools/mkimage/patches/200-compiler-support.patch b/tools/mkimage/patches/200-compiler-support.patch +new file mode 100644 +index 0000000..ca9c5b5 +--- /dev/null ++++ b/tools/mkimage/patches/200-compiler-support.patch +@@ -0,0 +1,702 @@ ++diff --git b/include/linux/compiler-gcc.h a/include/linux/compiler-gcc.h ++index e057bd2..22ab246 100644 ++--- b/include/linux/compiler-gcc.h +++++ a/include/linux/compiler-gcc.h ++@@ -5,14 +5,28 @@ ++ /* ++ * Common definitions for all gcc versions go here. ++ */ ++-#define GCC_VERSION (__GNUC__ * 10000 \ ++- + __GNUC_MINOR__ * 100 \ ++- + __GNUC_PATCHLEVEL__) ++- +++#define GCC_VERSION (__GNUC__ * 10000 \ +++ + __GNUC_MINOR__ * 100 \ +++ + __GNUC_PATCHLEVEL__) ++ ++ /* Optimization barrier */ +++ ++ /* The "volatile" is due to gcc bugs */ ++ #define barrier() __asm__ __volatile__("": : :"memory") +++/* +++ * This version is i.e. to prevent dead stores elimination on @ptr +++ * where gcc and llvm may behave differently when otherwise using +++ * normal barrier(): while gcc behavior gets along with a normal +++ * barrier(), llvm needs an explicit input variable to be assumed +++ * clobbered. The issue is as follows: while the inline asm might +++ * access any memory it wants, the compiler could have fit all of +++ * @ptr into memory registers instead, and since @ptr never escaped +++ * from that, it proofed that the inline asm wasn't touching any of +++ * it. This version works well with both compilers, i.e. we're telling +++ * the compiler that the inline asm absolutely may see the contents +++ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 +++ */ +++#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") ++ ++ /* ++ * This macro obfuscates arithmetic on a variable address so that gcc ++@@ -32,58 +46,63 @@ ++ * the inline assembly constraint from =g to =r, in this particular ++ * case either is valid. ++ */ ++-#define RELOC_HIDE(ptr, off) \ ++- ({ unsigned long __ptr; \ ++- __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ ++- (typeof(ptr)) (__ptr + (off)); }) +++#define RELOC_HIDE(ptr, off) \ +++({ \ +++ unsigned long __ptr; \ +++ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ +++ (typeof(ptr)) (__ptr + (off)); \ +++}) ++ ++ /* Make the optimizer believe the variable can be manipulated arbitrarily. */ ++-#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) +++#define OPTIMIZER_HIDE_VAR(var) \ +++ __asm__ ("" : "=r" (var) : "0" (var)) ++ ++ #ifdef __CHECKER__ ++-#define __must_be_array(arr) 0 +++#define __must_be_array(a) 0 ++ #else ++ /* &a[0] degrades to a pointer: a different type from an array */ ++-#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +++#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ++ #endif ++ ++ /* ++ * Force always-inline if the user requests it so via the .config, ++ * or if gcc is too old: ++ */ ++-#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ +++#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ ++ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) ++-# define inline inline __attribute__((always_inline)) notrace ++-# define __inline__ __inline__ __attribute__((always_inline)) notrace ++-# define __inline __inline __attribute__((always_inline)) notrace +++#define inline inline __attribute__((always_inline)) notrace +++#define __inline__ __inline__ __attribute__((always_inline)) notrace +++#define __inline __inline __attribute__((always_inline)) notrace ++ #else ++ /* A lot of inline functions can cause havoc with function tracing */ ++-# define inline inline notrace ++-# define __inline__ __inline__ notrace ++-# define __inline __inline notrace +++#define inline inline notrace +++#define __inline__ __inline__ notrace +++#define __inline __inline notrace ++ #endif ++ ++-#define __deprecated __attribute__((deprecated)) ++-#ifndef __packed ++-#define __packed __attribute__((packed)) ++-#endif ++-#ifndef __weak ++-#define __weak __attribute__((weak)) ++-#endif +++#define __always_inline inline __attribute__((always_inline)) +++#define noinline __attribute__((noinline)) +++ +++#define __deprecated __attribute__((deprecated)) +++#define __packed __attribute__((packed)) +++#define __weak __attribute__((weak)) +++#define __alias(symbol) __attribute__((alias(#symbol))) ++ ++ /* ++- * it doesn't make sense on ARM (currently the only user of __naked) to trace ++- * naked functions because then mcount is called without stack and frame pointer ++- * being set up and there is no chance to restore the lr register to the value ++- * before mcount was called. +++ * it doesn't make sense on ARM (currently the only user of __naked) +++ * to trace naked functions because then mcount is called without +++ * stack and frame pointer being set up and there is no chance to +++ * restore the lr register to the value before mcount was called. +++ * +++ * The asm() bodies of naked functions often depend on standard calling +++ * conventions, therefore they must be noinline and noclone. ++ * ++- * The asm() bodies of naked functions often depend on standard calling conventions, ++- * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce ++- * this, so we must do so ourselves. See GCC PR44290. +++ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. +++ * See GCC PR44290. ++ */ ++-#define __naked __attribute__((naked)) noinline __noclone notrace +++#define __naked __attribute__((naked)) noinline __noclone notrace ++ ++-#define __noreturn __attribute__((noreturn)) +++#define __noreturn __attribute__((noreturn)) ++ ++ /* ++ * From the GCC manual: ++@@ -95,34 +114,170 @@ ++ * would be. ++ * [...] ++ */ ++-#ifndef __pure ++-#define __pure __attribute__((pure)) +++#define __pure __attribute__((pure)) +++#define __aligned(x) __attribute__((aligned(x))) +++#define __printf(a, b) __attribute__((format(printf, a, b))) +++#define __scanf(a, b) __attribute__((format(scanf, a, b))) +++#define __attribute_const__ __attribute__((__const__)) +++#define __maybe_unused __attribute__((unused)) +++#define __always_unused __attribute__((unused)) +++ +++/* gcc version specific checks */ +++ +++#if GCC_VERSION < 30200 +++# error Sorry, your compiler is too old - please upgrade it. +++#endif +++ +++#if GCC_VERSION < 30300 +++# define __used __attribute__((__unused__)) +++#else +++# define __used __attribute__((__used__)) +++#endif +++ +++#ifdef CONFIG_GCOV_KERNEL +++# if GCC_VERSION < 30400 +++# error "GCOV profiling support for gcc versions below 3.4 not included" +++# endif /* __GNUC_MINOR__ */ +++#endif /* CONFIG_GCOV_KERNEL */ +++ +++#if GCC_VERSION >= 30400 +++#define __must_check __attribute__((warn_unused_result)) +++#endif +++ +++#if GCC_VERSION >= 40000 +++ +++/* GCC 4.1.[01] miscompiles __weak */ +++#ifdef __KERNEL__ +++# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 +++# error Your version of gcc miscompiles the __weak directive +++# endif +++#endif +++ +++#define __used __attribute__((__used__)) +++#define __compiler_offsetof(a, b) \ +++ __builtin_offsetof(a, b) +++ +++#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 +++# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) +++#endif +++ +++#if GCC_VERSION >= 40300 +++/* Mark functions as cold. gcc will assume any path leading to a call +++ * to them will be unlikely. This means a lot of manual unlikely()s +++ * are unnecessary now for any paths leading to the usual suspects +++ * like BUG(), printk(), panic() etc. [but let's keep them for now for +++ * older compilers] +++ * +++ * Early snapshots of gcc 4.3 don't support this and we can't detect this +++ * in the preprocessor, but we can live with this because they're unreleased. +++ * Maketime probing would be overkill here. +++ * +++ * gcc also has a __attribute__((__hot__)) to move hot functions into +++ * a special section, but I don't see any sense in this right now in +++ * the kernel context +++ */ +++#define __cold __attribute__((__cold__)) +++ +++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) +++ +++#ifndef __CHECKER__ +++# define __compiletime_warning(message) __attribute__((warning(message))) +++# define __compiletime_error(message) __attribute__((error(message))) +++#endif /* __CHECKER__ */ +++#endif /* GCC_VERSION >= 40300 */ +++ +++#if GCC_VERSION >= 40500 +++/* +++ * Mark a position in code as unreachable. This can be used to +++ * suppress control flow warnings after asm blocks that transfer +++ * control elsewhere. +++ * +++ * Early snapshots of gcc 4.5 don't support this and we can't detect +++ * this in the preprocessor, but we can live with this because they're +++ * unreleased. Really, we need to have autoconf for the kernel. +++ */ +++#define unreachable() __builtin_unreachable() +++ +++/* Mark a function definition as prohibited from being cloned. */ +++#define __noclone __attribute__((__noclone__)) +++ +++#endif /* GCC_VERSION >= 40500 */ +++ +++#if GCC_VERSION >= 40600 +++/* +++ * When used with Link Time Optimization, gcc can optimize away C functions or +++ * variables which are referenced only from assembly code. __visible tells the +++ * optimizer that something else uses this function or variable, thus preventing +++ * this. +++ */ +++#define __visible __attribute__((externally_visible)) ++ #endif ++-#ifndef __aligned ++-#define __aligned(x) __attribute__((aligned(x))) +++ +++ +++#if GCC_VERSION >= 40900 && !defined(__CHECKER__) +++/* +++ * __assume_aligned(n, k): Tell the optimizer that the returned +++ * pointer can be assumed to be k modulo n. The second argument is +++ * optional (default 0), so we use a variadic macro to make the +++ * shorthand. +++ * +++ * Beware: Do not apply this to functions which may return +++ * ERR_PTRs. Also, it is probably unwise to apply it to functions +++ * returning extra information in the low bits (but in that case the +++ * compiler should see some alignment anyway, when the return value is +++ * massaged by 'flags = ptr & 3; ptr &= ~3;'). +++ */ +++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) ++ #endif ++-#define __printf(a, b) __attribute__((format(printf, a, b))) ++-#define __scanf(a, b) __attribute__((format(scanf, a, b))) ++-#define noinline __attribute__((noinline)) ++-#define __attribute_const__ __attribute__((__const__)) ++-#define __maybe_unused __attribute__((unused)) ++-#define __always_unused __attribute__((unused)) ++ ++-#define __gcc_header(x) #x ++-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) ++-#define gcc_header(x) _gcc_header(x) ++-#include gcc_header(__GNUC__) +++/* +++ * GCC 'asm goto' miscompiles certain code sequences: +++ * +++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 +++ * +++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. +++ * +++ * (asm goto is automatically volatile - the naming reflects this.) +++ */ +++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) +++ +++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +++#if GCC_VERSION >= 40400 +++#define __HAVE_BUILTIN_BSWAP32__ +++#define __HAVE_BUILTIN_BSWAP64__ +++#endif +++#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) +++#define __HAVE_BUILTIN_BSWAP16__ +++#endif +++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ +++ +++#if GCC_VERSION >= 50000 +++#define KASAN_ABI_VERSION 4 +++#elif GCC_VERSION >= 40902 +++#define KASAN_ABI_VERSION 3 +++#endif +++ +++#if GCC_VERSION >= 40902 +++/* +++ * Tell the compiler that address safety instrumentation (KASAN) +++ * should not be applied to that function. +++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 +++ */ +++#define __no_sanitize_address __attribute__((no_sanitize_address)) +++#endif +++ +++#endif /* gcc version >= 40000 specific checks */ ++ ++ #if !defined(__noclone) ++ #define __noclone /* not needed */ ++ #endif ++ +++#if !defined(__no_sanitize_address) +++#define __no_sanitize_address +++#endif +++ ++ /* ++ * A trick to suppress uninitialized variable warning without generating any ++ * code ++ */ ++ #define uninitialized_var(x) x = x ++- ++-#ifndef __always_inline ++-#define __always_inline inline __attribute__((always_inline)) ++-#endif ++diff --git b/include/linux/compiler-gcc3.h a/include/linux/compiler-gcc3.h ++deleted file mode 100644 ++index 7d89feb..0000000 ++--- b/include/linux/compiler-gcc3.h +++++ /dev/null ++@@ -1,23 +0,0 @@ ++-#ifndef __LINUX_COMPILER_H ++-#error "Please don't include directly, include instead." ++-#endif ++- ++-#if GCC_VERSION < 30200 ++-# error Sorry, your compiler is too old - please upgrade it. ++-#endif ++- ++-#if GCC_VERSION >= 30300 ++-# define __used __attribute__((__used__)) ++-#else ++-# define __used __attribute__((__unused__)) ++-#endif ++- ++-#if GCC_VERSION >= 30400 ++-#define __must_check __attribute__((warn_unused_result)) ++-#endif ++- ++-#ifdef CONFIG_GCOV_KERNEL ++-# if GCC_VERSION < 30400 ++-# error "GCOV profiling support for gcc versions below 3.4 not included" ++-# endif /* __GNUC_MINOR__ */ ++-#endif /* CONFIG_GCOV_KERNEL */ ++diff --git b/include/linux/compiler-gcc4.h a/include/linux/compiler-gcc4.h ++deleted file mode 100644 ++index c982a09..0000000 ++--- b/include/linux/compiler-gcc4.h +++++ /dev/null ++@@ -1,81 +0,0 @@ ++-#ifndef __LINUX_COMPILER_H ++-#error "Please don't include directly, include instead." ++-#endif ++- ++-#define __used __attribute__((__used__)) ++-#define __must_check __attribute__((warn_unused_result)) ++-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) ++- ++-#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 ++-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) ++-#endif ++- ++-#if GCC_VERSION >= 40300 ++-/* Mark functions as cold. gcc will assume any path leading to a call ++- to them will be unlikely. This means a lot of manual unlikely()s ++- are unnecessary now for any paths leading to the usual suspects ++- like BUG(), printk(), panic() etc. [but let's keep them for now for ++- older compilers] ++- ++- Early snapshots of gcc 4.3 don't support this and we can't detect this ++- in the preprocessor, but we can live with this because they're unreleased. ++- Maketime probing would be overkill here. ++- ++- gcc also has a __attribute__((__hot__)) to move hot functions into ++- a special section, but I don't see any sense in this right now in ++- the kernel context */ ++-#define __cold __attribute__((__cold__)) ++- ++-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++- ++-#ifndef __CHECKER__ ++-# define __compiletime_warning(message) __attribute__((warning(message))) ++-# define __compiletime_error(message) __attribute__((error(message))) ++-#endif /* __CHECKER__ */ ++-#endif /* GCC_VERSION >= 40300 */ ++- ++-#if GCC_VERSION >= 40500 ++-/* ++- * Mark a position in code as unreachable. This can be used to ++- * suppress control flow warnings after asm blocks that transfer ++- * control elsewhere. ++- * ++- * Early snapshots of gcc 4.5 don't support this and we can't detect ++- * this in the preprocessor, but we can live with this because they're ++- * unreleased. Really, we need to have autoconf for the kernel. ++- */ ++-#define unreachable() __builtin_unreachable() ++- ++-/* Mark a function definition as prohibited from being cloned. */ ++-#define __noclone __attribute__((__noclone__)) ++- ++-#endif /* GCC_VERSION >= 40500 */ ++- ++-#if GCC_VERSION >= 40600 ++-/* ++- * Tell the optimizer that something else uses this function or variable. ++- */ ++-#define __visible __attribute__((externally_visible)) ++-#endif ++- ++-/* ++- * GCC 'asm goto' miscompiles certain code sequences: ++- * ++- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++- * ++- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++- * Fixed in GCC 4.8.2 and later versions. ++- * ++- * (asm goto is automatically volatile - the naming reflects this.) ++- */ ++-#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++- ++-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++-#if GCC_VERSION >= 40400 ++-#define __HAVE_BUILTIN_BSWAP32__ ++-#define __HAVE_BUILTIN_BSWAP64__ ++-#endif ++-#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) ++-#define __HAVE_BUILTIN_BSWAP16__ ++-#endif ++-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ++diff --git b/include/linux/compiler-intel.h a/include/linux/compiler-intel.h ++index ba147a1..d4c7113 100644 ++--- b/include/linux/compiler-intel.h +++++ a/include/linux/compiler-intel.h ++@@ -13,9 +13,14 @@ ++ /* Intel ECC compiler doesn't support gcc specific asm stmts. ++ * It uses intrinsics to do the equivalent things. ++ */ +++#undef barrier +++#undef barrier_data ++ #undef RELOC_HIDE ++ #undef OPTIMIZER_HIDE_VAR ++ +++#define barrier() __memory_barrier() +++#define barrier_data(ptr) barrier() +++ ++ #define RELOC_HIDE(ptr, off) \ ++ ({ unsigned long __ptr; \ ++ __ptr = (unsigned long) (ptr); \ ++diff --git b/include/linux/compiler.h a/include/linux/compiler.h ++index d5ad7b1..020ad16 100644 ++--- b/include/linux/compiler.h +++++ a/include/linux/compiler.h ++@@ -17,6 +17,7 @@ ++ # define __release(x) __context__(x,-1) ++ # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) ++ # define __percpu __attribute__((noderef, address_space(3))) +++# define __pmem __attribute__((noderef, address_space(5))) ++ #ifdef CONFIG_SPARSE_RCU_POINTER ++ # define __rcu __attribute__((noderef, address_space(4))) ++ #else ++@@ -42,6 +43,7 @@ extern void __chk_io_ptr(const volatile void __iomem *); ++ # define __cond_lock(x,c) (c) ++ # define __percpu ++ # define __rcu +++# define __pmem ++ #endif ++ ++ /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ ++@@ -54,7 +56,11 @@ extern void __chk_io_ptr(const volatile void __iomem *); ++ #include ++ #endif ++ +++#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) +++#define notrace __attribute__((hotpatch(0,0))) +++#else ++ #define notrace __attribute__((no_instrument_function)) +++#endif ++ ++ /* Intel compiler defines __GNUC__. So we will overwrite implementations ++ * coming from above header files here ++@@ -138,7 +144,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ */ ++ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ++ #define __trace_if(cond) \ ++- if (__builtin_constant_p((cond)) ? !!(cond) : \ +++ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ++ ({ \ ++ int ______r; \ ++ static struct ftrace_branch_data \ ++@@ -165,6 +171,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ # define barrier() __memory_barrier() ++ #endif ++ +++#ifndef barrier_data +++# define barrier_data(ptr) barrier() +++#endif +++ ++ /* Unreachable code */ ++ #ifndef unreachable ++ # define unreachable() do { } while (1) ++@@ -186,6 +196,126 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) ++ #endif ++ +++#include +++ +++#define __READ_ONCE_SIZE \ +++({ \ +++ switch (size) { \ +++ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ +++ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ +++ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ +++ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ +++ default: \ +++ barrier(); \ +++ __builtin_memcpy((void *)res, (const void *)p, size); \ +++ barrier(); \ +++ } \ +++}) +++ +++static __always_inline +++void __read_once_size(const volatile void *p, void *res, int size) +++{ +++ __READ_ONCE_SIZE; +++} +++ +++#ifdef CONFIG_KASAN +++/* +++ * This function is not 'inline' because __no_sanitize_address confilcts +++ * with inlining. Attempt to inline it may cause a build failure. +++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 +++ * '__maybe_unused' allows us to avoid defined-but-not-used warnings. +++ */ +++static __no_sanitize_address __maybe_unused +++void __read_once_size_nocheck(const volatile void *p, void *res, int size) +++{ +++ __READ_ONCE_SIZE; +++} +++#else +++static __always_inline +++void __read_once_size_nocheck(const volatile void *p, void *res, int size) +++{ +++ __READ_ONCE_SIZE; +++} +++#endif +++ +++static __always_inline void __write_once_size(volatile void *p, void *res, int size) +++{ +++ switch (size) { +++ case 1: *(volatile __u8 *)p = *(__u8 *)res; break; +++ case 2: *(volatile __u16 *)p = *(__u16 *)res; break; +++ case 4: *(volatile __u32 *)p = *(__u32 *)res; break; +++ case 8: *(volatile __u64 *)p = *(__u64 *)res; break; +++ default: +++ barrier(); +++ __builtin_memcpy((void *)p, (const void *)res, size); +++ barrier(); +++ } +++} +++ +++/* +++ * Prevent the compiler from merging or refetching reads or writes. The +++ * compiler is also forbidden from reordering successive instances of +++ * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the +++ * compiler is aware of some particular ordering. One way to make the +++ * compiler aware of ordering is to put the two invocations of READ_ONCE, +++ * WRITE_ONCE or ACCESS_ONCE() in different C statements. +++ * +++ * In contrast to ACCESS_ONCE these two macros will also work on aggregate +++ * data types like structs or unions. If the size of the accessed data +++ * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) +++ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a +++ * compile-time warning. +++ * +++ * Their two major use cases are: (1) Mediating communication between +++ * process-level code and irq/NMI handlers, all running on the same CPU, +++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise +++ * mutilate accesses that either do not require ordering or that interact +++ * with an explicit memory barrier or atomic instruction that provides the +++ * required ordering. +++ */ +++ +++#define __READ_ONCE(x, check) \ +++({ \ +++ union { typeof(x) __val; char __c[1]; } __u; \ +++ if (check) \ +++ __read_once_size(&(x), __u.__c, sizeof(x)); \ +++ else \ +++ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ +++ __u.__val; \ +++}) +++#define READ_ONCE(x) __READ_ONCE(x, 1) +++ +++/* +++ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need +++ * to hide memory access from KASAN. +++ */ +++#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0) +++ +++#define WRITE_ONCE(x, val) \ +++({ \ +++ union { typeof(x) __val; char __c[1]; } __u = \ +++ { .__val = (__force typeof(x)) (val) }; \ +++ __write_once_size(&(x), __u.__c, sizeof(x)); \ +++ __u.__val; \ +++}) +++ +++/** +++ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering +++ * @cond: boolean expression to wait for +++ * +++ * Equivalent to using smp_load_acquire() on the condition variable but employs +++ * the control dependency of the wait to reduce the barrier on many platforms. +++ * +++ * The control dependency provides a LOAD->STORE order, the additional RMB +++ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order, +++ * aka. ACQUIRE. +++ */ +++#define smp_cond_acquire(cond) do { \ +++ while (!(cond)) \ +++ cpu_relax(); \ +++ smp_rmb(); /* ctrl + rmb := acquire */ \ +++} while (0) +++ ++ #endif /* __KERNEL__ */ ++ ++ #endif /* __ASSEMBLY__ */ ++@@ -304,6 +434,14 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ #define __visible ++ #endif ++ +++/* +++ * Assume alignment of return value. +++ */ +++#ifndef __assume_aligned +++#define __assume_aligned(a, ...) +++#endif +++ +++ ++ /* Are two types/vars the same type (ignoring qualifiers)? */ ++ #ifndef __same_type ++ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) ++@@ -311,7 +449,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ ++ /* Is this type a native word size -- useful for atomic operations */ ++ #ifndef __native_word ++-# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) +++# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) ++ #endif ++ ++ /* Compile time object size, -1 for unknown */ ++@@ -373,12 +511,38 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); ++ * to make the compiler aware of ordering is to put the two invocations of ++ * ACCESS_ONCE() in different C statements. ++ * ++- * This macro does absolutely -nothing- to prevent the CPU from reordering, ++- * merging, or refetching absolutely anything at any time. Its main intended ++- * use is to mediate communication between process-level code and irq/NMI ++- * handlers, all running on the same CPU. +++ * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE +++ * on a union member will work as long as the size of the member matches the +++ * size of the union and the size is smaller than word size. +++ * +++ * The major use cases of ACCESS_ONCE used to be (1) Mediating communication +++ * between process-level code and irq/NMI handlers, all running on the same CPU, +++ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise +++ * mutilate accesses that either do not require ordering or that interact +++ * with an explicit memory barrier or atomic instruction that provides the +++ * required ordering. +++ * +++ * If possible use READ_ONCE()/WRITE_ONCE() instead. +++ */ +++#define __ACCESS_ONCE(x) ({ \ +++ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ +++ (volatile typeof(x) *)&(x); }) +++#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) +++ +++/** +++ * lockless_dereference() - safely load a pointer for later dereference +++ * @p: The pointer to load +++ * +++ * Similar to rcu_dereference(), but for situations where the pointed-to +++ * object's lifetime is managed by something other than RCU. That +++ * "something other" might be reference counting or simple immortality. ++ */ ++-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +++#define lockless_dereference(p) \ +++({ \ +++ typeof(p) _________p1 = READ_ONCE(p); \ +++ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ +++ (_________p1); \ +++}) ++ ++ /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ ++ #ifdef CONFIG_KPROBES +diff --git a/tools/mkimage/patches/200-gcc5_compat.patch b/tools/mkimage/patches/200-gcc5_compat.patch +deleted file mode 100644 +index 4d55f00..0000000 +--- a/tools/mkimage/patches/200-gcc5_compat.patch ++++ /dev/null +@@ -1,93 +0,0 @@ +-From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001 +-From: Hans de Goede +-Date: Sat, 7 Feb 2015 22:52:40 +0100 +-Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5 +- +-Add linux/compiler-gcc5/h from the kernel sources at: +- +-commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b +-Author: Steven Noonan +-Date: Sat Oct 25 15:09:42 2014 -0700 +- +- compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles +- +-Signed-off-by: Hans de Goede +---- +- include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++ +- 1 file changed, 65 insertions(+) +- create mode 100644 include/linux/compiler-gcc5.h +- +-diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h +-new file mode 100644 +-index 0000000..c8c5659 +---- /dev/null +-+++ b/include/linux/compiler-gcc5.h +-@@ -0,0 +1,65 @@ +-+#ifndef __LINUX_COMPILER_H +-+#error "Please don't include directly, include instead." +-+#endif +-+ +-+#define __used __attribute__((__used__)) +-+#define __must_check __attribute__((warn_unused_result)) +-+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) +-+ +-+/* Mark functions as cold. gcc will assume any path leading to a call +-+ to them will be unlikely. This means a lot of manual unlikely()s +-+ are unnecessary now for any paths leading to the usual suspects +-+ like BUG(), printk(), panic() etc. [but let's keep them for now for +-+ older compilers] +-+ +-+ Early snapshots of gcc 4.3 don't support this and we can't detect this +-+ in the preprocessor, but we can live with this because they're unreleased. +-+ Maketime probing would be overkill here. +-+ +-+ gcc also has a __attribute__((__hot__)) to move hot functions into +-+ a special section, but I don't see any sense in this right now in +-+ the kernel context */ +-+#define __cold __attribute__((__cold__)) +-+ +-+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) +-+ +-+#ifndef __CHECKER__ +-+# define __compiletime_warning(message) __attribute__((warning(message))) +-+# define __compiletime_error(message) __attribute__((error(message))) +-+#endif /* __CHECKER__ */ +-+ +-+/* +-+ * Mark a position in code as unreachable. This can be used to +-+ * suppress control flow warnings after asm blocks that transfer +-+ * control elsewhere. +-+ * +-+ * Early snapshots of gcc 4.5 don't support this and we can't detect +-+ * this in the preprocessor, but we can live with this because they're +-+ * unreleased. Really, we need to have autoconf for the kernel. +-+ */ +-+#define unreachable() __builtin_unreachable() +-+ +-+/* Mark a function definition as prohibited from being cloned. */ +-+#define __noclone __attribute__((__noclone__)) +-+ +-+/* +-+ * Tell the optimizer that something else uses this function or variable. +-+ */ +-+#define __visible __attribute__((externally_visible)) +-+ +-+/* +-+ * GCC 'asm goto' miscompiles certain code sequences: +-+ * +-+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 +-+ * +-+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. +-+ * +-+ * (asm goto is automatically volatile - the naming reflects this.) +-+ */ +-+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) +-+ +-+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +-+#define __HAVE_BUILTIN_BSWAP32__ +-+#define __HAVE_BUILTIN_BSWAP64__ +-+#define __HAVE_BUILTIN_BSWAP16__ +-+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ +--- +-1.7.10.4 +- diff --git a/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch b/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch new file mode 100644 index 00000000..e828631b --- /dev/null +++ b/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch @@ -0,0 +1,144 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 00:16:38 +0200 +Subject: toolchain: gcc: fix build with GCC 6 + +At least for GCC 4.8, which is used by most targets. + +Signed-off-by: Matthias Schiffer + +diff --git a/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch +new file mode 100644 +index 0000000..c74f2aa +--- /dev/null ++++ b/toolchain/gcc/patches/4.8-linaro/030-gcc-6-compile.patch +@@ -0,0 +1,130 @@ ++Upstream commit r233721 ++ ++diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in ++index bd1c1d7..a0ea0d4 100644 ++--- a/gcc/cp/Make-lang.in +++++ b/gcc/cp/Make-lang.in ++@@ -111,7 +111,7 @@ else ++ # deleting the $(srcdir)/cp/cfns.h file. ++ $(srcdir)/cp/cfns.h: ++ endif ++- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \ +++ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \ ++ $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h ++ ++ # ++diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf ++index 05ca753..d9b16b8 100644 ++--- a/gcc/cp/cfns.gperf +++++ b/gcc/cp/cfns.gperf ++@@ -1,3 +1,5 @@ +++%language=C++ +++%define class-name libc_name ++ %{ ++ /* Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ ++@@ -16,14 +18,6 @@ for more details. ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ . */ ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-static unsigned int hash (const char *, unsigned int); ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-const char * libc_name_p (const char *, unsigned int); ++ %} ++ %% ++ # The standard C library functions, for feeding to gperf; the result is used ++diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h ++index c845ddf..65801d1 100644 ++--- a/gcc/cp/cfns.h +++++ b/gcc/cp/cfns.h ++@@ -1,5 +1,5 @@ ++-/* ANSI-C code produced by gperf version 3.0.3 */ ++-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */ +++/* C++ code produced by gperf version 3.0.4 */ +++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */ ++ ++ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ ++ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ ++@@ -28,7 +28,7 @@ ++ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." ++ #endif ++ ++-#line 1 "cfns.gperf" +++#line 3 "cfns.gperf" ++ ++ /* Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ ++@@ -47,25 +47,18 @@ for more details. ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ . */ ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-static unsigned int hash (const char *, unsigned int); ++-#ifdef __GNUC__ ++-__inline ++-#endif ++-const char * libc_name_p (const char *, unsigned int); ++ /* maximum key range = 391, duplicates = 0 */ ++ ++-#ifdef __GNUC__ ++-__inline ++-#else ++-#ifdef __cplusplus ++-inline ++-#endif ++-#endif ++-static unsigned int ++-hash (register const char *str, register unsigned int len) +++class libc_name +++{ +++private: +++ static inline unsigned int hash (const char *str, unsigned int len); +++public: +++ static const char *libc_name_p (const char *str, unsigned int len); +++}; +++ +++inline unsigned int +++libc_name::hash (register const char *str, register unsigned int len) ++ { ++ static const unsigned short asso_values[] = ++ { ++@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len) ++ return hval + asso_values[(unsigned char)str[len - 1]]; ++ } ++ ++-#ifdef __GNUC__ ++-__inline ++-#ifdef __GNUC_STDC_INLINE__ ++-__attribute__ ((__gnu_inline__)) ++-#endif ++-#endif ++ const char * ++-libc_name_p (register const char *str, register unsigned int len) +++libc_name::libc_name_p (register const char *str, register unsigned int len) ++ { ++ enum ++ { ++diff --git a/gcc/cp/except.c b/gcc/cp/except.c ++index 221971a..32340f5 100644 ++--- a/gcc/cp/except.c +++++ b/gcc/cp/except.c ++@@ -1030,7 +1030,8 @@ nothrow_libfn_p (const_tree fn) ++ unless the system headers are playing rename tricks, and if ++ they are, we don't want to be confused by them. */ ++ id = DECL_NAME (fn); ++- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id)); +++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id), +++ IDENTIFIER_LENGTH (id)); ++ } ++ ++ /* Returns nonzero if an exception of type FROM will be caught by a ++-- ++1.7.1 ++ diff --git a/patches/packages/openwrt/0005-node-update-to-v4.4.4.patch b/patches/packages/openwrt/0005-node-update-to-v4.4.4.patch new file mode 100644 index 00000000..8c431944 --- /dev/null +++ b/patches/packages/openwrt/0005-node-update-to-v4.4.4.patch @@ -0,0 +1,110 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 15:57:18 +0200 +Subject: node: update to v4.4.4 + +While we're at it, also enable parallel builds. + +Signed-off-by: Matthias Schiffer + +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 243c8a5..71cf55b 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -8,17 +8,21 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=node +-PKG_VERSION:=v0.12.7 ++PKG_VERSION:=v4.4.4 + PKG_RELEASE:=1 + +-PKG_SOURCE:=node-$(PKG_VERSION).tar.gz ++PKG_SOURCE:=node-$(PKG_VERSION).tar.xz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} ++PKG_MD5SUM:=1ad7915688df85f62a57f43860dc54c6 + + HOST_BUILD_DEPENDS:=python/host + PKG_BUILD_DEPENDS:=python/host + PKG_INSTALL:=1 + PKG_USE_MIPS16:=0 + ++HOST_BUILD_PARALLEL:=1 ++PKG_BUILD_PARALLEL:=1 ++ + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:= + +@@ -31,7 +35,7 @@ define Package/node + SUBMENU:=Node.js + TITLE:=Node.js is a platform built on Chrome's JavaScript runtime + URL:=http://nodejs.org/ +- DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv ++ DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv +zlib + endef + + define Package/node/description +diff --git a/lang/node/patches/001-hardfloat.patch b/lang/node/patches/001-hardfloat.patch +new file mode 100644 +index 0000000..1bb2493 +--- /dev/null ++++ b/lang/node/patches/001-hardfloat.patch +@@ -0,0 +1,12 @@ ++diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc ++index 4f58720..1f3071e 100644 ++--- a/deps/v8/src/base/cpu.cc +++++ b/deps/v8/src/base/cpu.cc ++@@ -143,6 +143,7 @@ int __detect_fp64_mode(void) { ++ ".set push\n\t" ++ ".set noreorder\n\t" ++ ".set oddspreg\n\t" +++ ".set hardfloat\n\t" ++ "lui $t0, 0x3FF0\n\t" ++ "ldc1 $f0, %0\n\t" ++ "mtc1 $t0, $f1\n\t" +diff --git a/lang/node/patches/001-mips-no-fpu.patch b/lang/node/patches/001-mips-no-fpu.patch +deleted file mode 100644 +index 5bf8142..0000000 +--- a/lang/node/patches/001-mips-no-fpu.patch ++++ /dev/null +@@ -1,15 +0,0 @@ +---- a/deps/v8/build/toolchain.gypi +-+++ b/deps/v8/build/toolchain.gypi +-@@ -50,10 +50,10 @@ +- 'arm_test_noprobe%': 'off', +- +- # Similar to vfp but on MIPS. +-- 'v8_can_use_fpu_instructions%': 'true', +-+ 'v8_can_use_fpu_instructions%': 'false', +- +- # Similar to the ARM hard float ABI but on MIPS. +-- 'v8_use_mips_abi_hardfloat%': 'true', +-+ 'v8_use_mips_abi_hardfloat%': 'false', +- +- # Default arch variant for MIPS. +- 'mips_arch_variant%': 'r2', +diff --git a/lang/node/patches/002-addr_info.patch b/lang/node/patches/002-addr_info.patch +index 78225db..0aa02da 100644 +--- a/lang/node/patches/002-addr_info.patch ++++ b/lang/node/patches/002-addr_info.patch +@@ -1,6 +1,6 @@ + --- a/deps/uv/src/unix/getaddrinfo.c + +++ b/deps/uv/src/unix/getaddrinfo.c +-@@ -99,6 +99,7 @@ ++@@ -99,6 +99,7 @@ static void uv__getaddrinfo_work(struct + int err; + + req = container_of(w, uv_getaddrinfo_t, work_req); +diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch +index 723fe9d..01a71c6 100644 +--- a/lang/node/patches/003-path.patch ++++ b/lang/node/patches/003-path.patch +@@ -1,7 +1,7 @@ + --- a/lib/module.js + +++ b/lib/module.js +-@@ -512,7 +512,8 @@ +- var homeDir = process.env.HOME; ++@@ -453,7 +453,8 @@ Module._initPaths = function() { ++ homeDir = process.env.HOME; + } + + - var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')]; diff --git a/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch b/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch new file mode 100644 index 00000000..12d6bcd2 --- /dev/null +++ b/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch @@ -0,0 +1,80 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 16:21:57 +0200 +Subject: node: fix undefined behaviour leading to broken code with GCC 6 + +Fixes segfaults occuring in the node host build when GCC 6 is used. + +Backport of upstream commit 96198d5bc710a4e3ca49eeeb3b3fa7b8cb61547d. + +Signed-off-by: Matthias Schiffer + +diff --git a/lang/node/patches/004-gcc6-undefined-behaviour.patch b/lang/node/patches/004-gcc6-undefined-behaviour.patch +new file mode 100644 +index 0000000..11b0132 +--- /dev/null ++++ b/lang/node/patches/004-gcc6-undefined-behaviour.patch +@@ -0,0 +1,64 @@ ++diff --git a/deps/v8/src/heap/incremental-marking.cc b/deps/v8/src/heap/incremental-marking.cc ++index 58eb0aa..b2b796f 100644 ++--- a/deps/v8/src/heap/incremental-marking.cc +++++ b/deps/v8/src/heap/incremental-marking.cc ++@@ -364,7 +364,7 @@ void IncrementalMarking::DeactivateIncrementalWriteBarrier() { ++ DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); ++ ++ LargePage* lop = heap_->lo_space()->first_page(); ++- while (lop->is_valid()) { +++ while (LargePage::IsValid(lop)) { ++ SetOldSpacePageFlags(lop, false, false); ++ lop = lop->next_page(); ++ } ++@@ -396,7 +396,7 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() { ++ ActivateIncrementalWriteBarrier(heap_->new_space()); ++ ++ LargePage* lop = heap_->lo_space()->first_page(); ++- while (lop->is_valid()) { +++ while (LargePage::IsValid(lop)) { ++ SetOldSpacePageFlags(lop, true, is_compacting_); ++ lop = lop->next_page(); ++ } ++diff --git a/deps/v8/src/heap/spaces-inl.h b/deps/v8/src/heap/spaces-inl.h ++index c2c4d12..d63ee63 100644 ++--- a/deps/v8/src/heap/spaces-inl.h +++++ b/deps/v8/src/heap/spaces-inl.h ++@@ -155,7 +155,7 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, ++ ++ bool PagedSpace::Contains(Address addr) { ++ Page* p = Page::FromAddress(addr); ++- if (!p->is_valid()) return false; +++ if (!Page::IsValid(p)) return false; ++ return p->owner() == this; ++ } ++ ++diff --git a/deps/v8/src/heap/spaces.cc b/deps/v8/src/heap/spaces.cc ++index 0806b25..c0e109b 100644 ++--- a/deps/v8/src/heap/spaces.cc +++++ b/deps/v8/src/heap/spaces.cc ++@@ -2953,7 +2953,7 @@ LargePage* LargeObjectSpace::FindPage(Address a) { ++ if (e != NULL) { ++ DCHECK(e->value != NULL); ++ LargePage* page = reinterpret_cast(e->value); ++- DCHECK(page->is_valid()); +++ DCHECK(LargePage::IsValid(page)); ++ if (page->Contains(a)) { ++ return page; ++ } ++diff --git a/deps/v8/src/heap/spaces.h b/deps/v8/src/heap/spaces.h ++index 3461de3..e35c057 100644 ++--- a/deps/v8/src/heap/spaces.h +++++ b/deps/v8/src/heap/spaces.h ++@@ -278,9 +278,9 @@ class MemoryChunk { ++ // Only works for addresses in pointer spaces, not data or code spaces. ++ static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); ++ ++- Address address() { return reinterpret_cast
(this); } +++ static bool IsValid(MemoryChunk* chunk) { return chunk != nullptr; } ++ ++- bool is_valid() { return address() != NULL; } +++ Address address() { return reinterpret_cast
(this); } ++ ++ MemoryChunk* next_chunk() const { ++ return reinterpret_cast(base::Acquire_Load(&next_chunk_)); From 97fc1aef2dafaded55865c8eab357bf2a195855f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 11 May 2016 12:01:57 +0200 Subject: [PATCH 015/184] mpc85xx-generic: fix flash detection after spi-nor backport --- ...-kernel-backport-spi-nor-driver-from-4.4.9.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch b/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch index f66699ca..7e3ca845 100644 --- a/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch +++ b/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch @@ -1901,6 +1901,19 @@ index 203eb94..0000000 - - /* For some (historical?) reason many platforms provide two different - * names in flash_platform_data: "name" and "type". Quite often name is +diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +index 2beb39c..21f823d 100644 +--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts ++++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +@@ -37,7 +37,7 @@ + flash@0 { + #address-cells = <1>; + #size-cells = <1>; +- compatible = "spansion,s25fl129p1"; ++ compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + diff --git a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch deleted file mode 100644 index 1716e1c..0000000 From 5150b49dfbd2557a769759d2cb38807556b928b7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 14 May 2016 00:15:23 +0200 Subject: [PATCH 016/184] Fix creation of IBSS interfaces on devices with two radios Lua's tables are 1-based, so we must decrement the index by 1 to get the desired MAC addresses. By not doing this, the second IBSS interface would get the address with index 8, but only indices 0..7 are available. Fixes: c73a12e0ea9fd6bb48927f0a03367354b5897ddc --- .../files/lib/gluon/upgrade/320-gluon-client-bridge-wireless | 2 +- .../lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless b/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless index 6fc8a72a..3edb39d8 100755 --- a/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless +++ b/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless @@ -21,7 +21,7 @@ local function configure_client(config, radio, index, suffix) uci:delete('wireless', name) - macaddr = util.generate_mac(3*index) + macaddr = util.generate_mac(3*(index-1)) if config and macaddr then uci:section('wireless', 'wifi-iface', name, diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless index 05462c6f..dd3354de 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless +++ b/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless @@ -29,7 +29,7 @@ local function configure_ibss(config, radio, index, suffix, disabled) uci:delete('network', name .. '_vlan') uci:delete('wireless', name) - macaddr = util.generate_mac(3*index+2) + macaddr = util.generate_mac(3*(index-1)+2) if config and macaddr then if config.vlan then @@ -79,7 +79,7 @@ local function configure_mesh(config, radio, index, suffix, disabled) uci:delete('network', name) uci:delete('wireless', name) - macaddr = util.generate_mac(3*index+1) + macaddr = util.generate_mac(3*(index-1)+1) if config and macaddr then uci:section('network', 'interface', name, From 7c0f77b566fde9de4f35d2ad170b5227639d4198 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 14 May 2016 00:13:15 +0200 Subject: [PATCH 017/184] ar71xx-generic: add support for UniFi AC PRO/LITE (LITE untested) Also backport some patches improving QCA956x support. --- .../files/lib/gluon/upgrade/020-interfaces | 2 +- .../files/lib/gluon/upgrade/320-setup-ifname | 2 +- ...9561-set-phy-interface-mode-and-mask.patch | 46 ++ ...ion-register-bitmask-for-QCA956x-SoC.patch | 33 + .../0038-ar71xx-update-QCA956x-support.patch | 381 ++++++++++++ ...or-QCA956x-ethernet.patch-into-files.patch | 176 ++++++ ...ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch | 22 + ...-fix-qca956x-ethernet-initialization.patch | 64 ++ ...upport-for-Ubiquiti-UniFi-AP-AC-LITE.patch | 562 ++++++++++++++++++ ...th0-support-for-Ubiquiti-UniFi-AP-AC.patch | 21 + ...r71xx-Rename-unifiac-to-unifiac-lite.patch | 192 ++++++ ...support-for-Ubiquiti-UniFi-AP-AC-PRO.patch | 274 +++++++++ targets/ar71xx-generic/profiles.mk | 12 +- 13 files changed, 1784 insertions(+), 3 deletions(-) create mode 100644 patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch create mode 100644 patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch create mode 100644 patches/openwrt/0038-ar71xx-update-QCA956x-support.patch create mode 100644 patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch create mode 100644 patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch create mode 100644 patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch create mode 100644 patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch create mode 100644 patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch create mode 100644 patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch create mode 100644 patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch diff --git a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces index 1818ad00..49831266 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces @@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then local lan_ifname = uci:get('network', 'lan', 'ifname') local wan_ifname = uci:get('network', 'wan', 'ifname') - if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then + if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'unifiac-pro'}) then lan_ifname, wan_ifname = wan_ifname, lan_ifname end diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname index 3c4a8afe..cae60e71 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname @@ -8,7 +8,7 @@ if sysconfig.setup_ifname then os.exit(0) end -if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then +if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'unifiac-pro'}) then sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname else sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname diff --git a/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch b/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch new file mode 100644 index 00000000..f7c393a3 --- /dev/null +++ b/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch @@ -0,0 +1,46 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 20:59:44 +0200 +Subject: ath79: dev-eth: fix QCA9561 set phy interface mode and mask + +QCA9563 and QCA9561 are two series of Qualcomm SoC Dragonfly. The only different +is QCA9563 w/o internal switch. It has one GMAC with SGMII interface. But they +have the same device ID(0x1150). So they share the same codes. + +Signed-off-by: Miaoqing Pan + +Backport of OpenWrt r46971 + +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 ff94e2e..31d2438 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -633,7 +633,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; + break; +@@ -667,6 +666,11 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + } + break; + ++ case ATH79_SOC_QCA9561: ++ if (!pdata->phy_if_mode) ++ pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; ++ break; ++ + default: + BUG(); + } +@@ -1035,7 +1039,8 @@ void __init ath79_register_eth(unsigned int id) + AR933X_RESET_GE0_MDIO; + pdata->set_speed = ath79_set_speed_dummy; + +- pdata->phy_mask = BIT(4); ++ if (!pdata->phy_mask) ++ pdata->phy_mask = BIT(4); + } else { + pdata->reset_bit = AR933X_RESET_GE1_MAC | + AR933X_RESET_GE1_MDIO; diff --git a/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch b/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch new file mode 100644 index 00000000..3a9968e3 --- /dev/null +++ b/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch @@ -0,0 +1,33 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 22:58:50 +0200 +Subject: ar71xx: use correct PLL configuration register bitmask for QCA956x SoC. + +Incorrect value causes clock inaccuracy as huge as 1/60. + +Signed-off-by: Dmitry Ivanov +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r47363 + +diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +index b5c88e9..d3a14b2 100644 +--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +@@ -529,7 +529,7 @@ + +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0 + +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f + +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5 +-+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x3fff +++#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff + +#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18 + +#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff + + +@@ -541,7 +541,7 @@ + +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0 + +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f + +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5 +-+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x3fff +++#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff + +#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18 + +#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff + + diff --git a/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch b/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch new file mode 100644 index 00000000..3ae6c249 --- /dev/null +++ b/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch @@ -0,0 +1,381 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 22:18:40 +0200 +Subject: ar71xx: update QCA956x support + +- separate qca956x and tp9343 (they use different IDs) +- rename qca9561->qca956x for consistency +- add missing bits (device reset, gpio output select) +- fix wmac setup + +Signed-off-by: Roman Yeryomin + +Backport of OpenWrt r47981 + +diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +index d3a14b2..61b8976 100644 +--- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch +@@ -105,7 +105,7 @@ + qca953x_clocks_init(); + else if (soc_is_qca955x()) + qca955x_clocks_init(); +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + qca956x_clocks_init(); + else + BUG(); +@@ -116,7 +116,7 @@ + reg = QCA953X_RESET_REG_RESET_MODULE; + else if (soc_is_qca955x()) + reg = QCA955X_RESET_REG_RESET_MODULE; +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + reg = QCA956X_RESET_REG_RESET_MODULE; + else + panic("Reset register not defined for this SOC"); +@@ -125,20 +125,30 @@ + reg = QCA953X_RESET_REG_RESET_MODULE; + else if (soc_is_qca955x()) + reg = QCA955X_RESET_REG_RESET_MODULE; +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + reg = QCA956X_RESET_REG_RESET_MODULE; + else + panic("Reset register not defined for this SOC"); + ++@@ -133,6 +137,8 @@ u32 ath79_device_reset_get(u32 mask) ++ reg = AR933X_RESET_REG_RESET_MODULE; ++ else if (soc_is_ar934x()) ++ reg = AR934X_RESET_REG_RESET_MODULE; +++ else if (soc_is_qca956x() || soc_is_tp9343()) +++ reg = QCA956X_RESET_REG_RESET_MODULE; ++ else ++ BUG(); ++ + --- a/arch/mips/ath79/dev-common.c + +++ b/arch/mips/ath79/dev-common.c +-@@ -94,7 +94,8 @@ void __init ath79_register_uart(void) ++@@ -94,7 +94,9 @@ void __init ath79_register_uart(void) + soc_is_ar913x() || + soc_is_ar934x() || + soc_is_qca953x() || + - soc_is_qca955x()) { + + soc_is_qca955x() || +-+ soc_is_qca956x()) { +++ soc_is_qca956x() || +++ soc_is_tp9343()) { + ath79_uart_data[0].uartclk = uart_clk_rate; + platform_device_register(&ath79_uart_device); + } else if (soc_is_ar933x()) { +@@ -168,14 +178,14 @@ + qca953x_usb_setup(); + else if (soc_is_qca955x()) + qca955x_usb_setup(); +-+ else if (soc_is_qca9561()) +++ else if (soc_is_qca956x()) + + qca956x_usb_setup(); + else + BUG(); + } + --- a/arch/mips/ath79/dev-wmac.c + +++ b/arch/mips/ath79/dev-wmac.c +-@@ -189,6 +189,24 @@ static void qca955x_wmac_setup(void) ++@@ -189,6 +189,26 @@ static void qca955x_wmac_setup(void) + ath79_wmac_data.is_clk_25mhz = true; + } + +@@ -195,16 +205,18 @@ + + ath79_wmac_data.is_clk_25mhz = false; + + else + + ath79_wmac_data.is_clk_25mhz = true; +++ +++ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; + +} + + + static bool __init + ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data) + { +-@@ -392,6 +410,8 @@ void __init ath79_register_wmac(u8 *cal_ ++@@ -392,6 +412,8 @@ void __init ath79_register_wmac(u8 *cal_ + qca953x_wmac_setup(); + else if (soc_is_qca955x()) + qca955x_wmac_setup(); +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + qca956x_wmac_setup(); + else + BUG(); +@@ -216,27 +228,38 @@ + case REV_ID_MAJOR_QCA9556: + case REV_ID_MAJOR_QCA9558: + + case REV_ID_MAJOR_TP9343: +-+ case REV_ID_MAJOR_QCA9561: +++ case REV_ID_MAJOR_QCA956X: + _prom_putchar = prom_putchar_ar71xx; + break; + + --- a/arch/mips/ath79/gpio.c + +++ b/arch/mips/ath79/gpio.c +-@@ -148,7 +148,8 @@ static void __iomem *ath79_gpio_get_func ++@@ -148,7 +148,10 @@ static void __iomem *ath79_gpio_get_func + soc_is_ar913x() || + soc_is_ar933x()) + reg = AR71XX_GPIO_REG_FUNC; + - else if (soc_is_ar934x() || soc_is_qca953x()) + + else if (soc_is_ar934x() || +-+ soc_is_qca953x() || soc_is_qca956x()) +++ soc_is_qca953x() || +++ soc_is_qca956x() || +++ soc_is_tp9343()) + reg = AR934X_GPIO_REG_FUNC; + else + BUG(); +-@@ -228,12 +229,15 @@ void __init ath79_gpio_init(void) ++@@ -187,7 +190,7 @@ void __init ath79_gpio_output_select(uns ++ unsigned int reg; ++ u32 t, s; ++ ++- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x()); +++ BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x()); ++ ++ if (gpio >= AR934X_GPIO_COUNT) ++ return; ++@@ -228,12 +231,15 @@ void __init ath79_gpio_init(void) + ath79_gpio_count = QCA953X_GPIO_COUNT; + else if (soc_is_qca955x()) + ath79_gpio_count = QCA955X_GPIO_COUNT; +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + ath79_gpio_count = QCA956X_GPIO_COUNT; + else + BUG(); +@@ -245,23 +268,24 @@ + ath79_gpio_chip.ngpio = ath79_gpio_count; + - if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x()) { + + if (soc_is_ar934x() || soc_is_qca953x() || soc_is_qca955x() || +-+ soc_is_qca956x()) { +++ soc_is_qca956x() || soc_is_tp9343()) { + ath79_gpio_chip.direction_input = ar934x_gpio_direction_input; + ath79_gpio_chip.direction_output = ar934x_gpio_direction_output; + } + --- a/arch/mips/ath79/irq.c + +++ b/arch/mips/ath79/irq.c +-@@ -107,7 +107,8 @@ static void __init ath79_misc_irq_init(v ++@@ -107,7 +107,9 @@ static void __init ath79_misc_irq_init(v + soc_is_ar933x() || + soc_is_ar934x() || + soc_is_qca953x() || + - soc_is_qca955x()) + + soc_is_qca955x() || +-+ soc_is_qca956x()) +++ soc_is_qca956x() || +++ soc_is_tp9343()) + ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; + else + BUG(); +-@@ -268,6 +269,97 @@ static void qca955x_irq_init(void) ++@@ -268,6 +270,97 @@ static void qca955x_irq_init(void) + irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); + } + +@@ -359,21 +383,21 @@ + asmlinkage void plat_irq_dispatch(void) + { + unsigned long pending; +-@@ -397,6 +489,9 @@ void __init arch_init_irq(void) ++@@ -397,6 +490,9 @@ void __init arch_init_irq(void) + } else if (soc_is_qca955x()) { + ath79_ip2_handler = ath79_default_ip2_handler; + ath79_ip3_handler = ath79_default_ip3_handler; +-+ } else if (soc_is_qca956x()) { +++ } else if (soc_is_qca956x() || soc_is_tp9343()) { + + ath79_ip2_handler = ath79_default_ip2_handler; + + ath79_ip3_handler = ath79_default_ip3_handler; + } else { + BUG(); + } +-@@ -411,4 +506,6 @@ void __init arch_init_irq(void) ++@@ -411,4 +507,6 @@ void __init arch_init_irq(void) + qca953x_irq_init(); + else if (soc_is_qca955x()) + qca955x_irq_init(); +-+ else if (soc_is_qca956x()) +++ else if (soc_is_qca956x() || soc_is_tp9343()) + + qca956x_irq_init(); + } + --- a/arch/mips/ath79/Kconfig +@@ -428,7 +452,7 @@ + } else if (soc_is_qca955x()) { + ath79_pci_irq_map = qca955x_pci_irq_map; + ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); +-+ } else if (soc_is_qca9561()) { +++ } else if (soc_is_qca956x()) { + + ath79_pci_irq_map = qca956x_pci_irq_map; + + ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); + } else { +@@ -438,7 +462,7 @@ + QCA955X_PCI_MEM_SIZE, + 1, + ATH79_IP3_IRQ(2)); +-+ } else if (soc_is_qca9561()) { +++ } else if (soc_is_qca956x()) { + + pdev = ath79_register_pci_ar724x(0, + + QCA956X_PCI_CFG_BASE1, + + QCA956X_PCI_CTRL_BASE1, +@@ -456,15 +480,15 @@ + rev = id & QCA955X_REV_ID_REVISION_MASK; + break; + +-+ case REV_ID_MAJOR_TP9343: +-+ ath79_soc = ATH79_SOC_TP9343; +-+ chip = "9343"; +++ case REV_ID_MAJOR_QCA956X: +++ ath79_soc = ATH79_SOC_QCA956X; +++ chip = "956X"; + + rev = id & QCA956X_REV_ID_REVISION_MASK; + + break; + + +-+ case REV_ID_MAJOR_QCA9561: +-+ ath79_soc = ATH79_SOC_QCA9561; +-+ chip = "9561"; +++ case REV_ID_MAJOR_TP9343: +++ ath79_soc = ATH79_SOC_TP9343; +++ chip = "9343"; + + rev = id & QCA956X_REV_ID_REVISION_MASK; + + break; + + +@@ -476,7 +500,7 @@ + ath79_soc_rev = rev; + + - if (soc_is_qca953x() || soc_is_qca955x()) +-+ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561()) +++ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x()) + sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", + chip, ver, rev); + + else if (soc_is_tp9343()) +@@ -511,7 +535,21 @@ + #define AR9300_OTP_BASE 0x14000 + #define AR9300_OTP_STATUS 0x15f18 + #define AR9300_OTP_STATUS_TYPE 0x7 +-@@ -375,6 +392,49 @@ ++@@ -152,6 +169,13 @@ ++ #define AR9300_OTP_READ_DATA 0x15f1c ++ ++ /* +++ * Hidden Registers +++ */ +++#define QCA956X_DAM_RESET_OFFSET 0xb90001bc +++#define QCA956X_DAM_RESET_SIZE 0x4 +++#define QCA956X_INLINE_CHKSUM_ENG BIT(27) +++ +++/* ++ * DDR_CTRL block ++ */ ++ #define AR71XX_DDR_REG_PCI_WIN0 0x7c ++@@ -375,6 +399,49 @@ + #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) + #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) + +@@ -561,7 +599,7 @@ + /* + * USB_CONFIG block + */ +-@@ -422,6 +482,11 @@ ++@@ -422,6 +489,11 @@ + #define QCA955X_RESET_REG_BOOTSTRAP 0xb0 + #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac + +@@ -573,7 +611,7 @@ + #define MISC_INT_ETHSW BIT(12) + #define MISC_INT_TIMER4 BIT(10) + #define MISC_INT_TIMER3 BIT(9) +-@@ -596,6 +661,8 @@ ++@@ -596,6 +668,8 @@ + + #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4) + +@@ -582,7 +620,7 @@ + #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) + #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) + #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) +-@@ -663,6 +730,37 @@ ++@@ -663,6 +737,37 @@ + QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \ + QCA955X_EXT_INT_PCIE_RC2_INT3) + +@@ -620,16 +658,16 @@ + #define REV_ID_MAJOR_MASK 0xfff0 + #define REV_ID_MAJOR_AR71XX 0x00a0 + #define REV_ID_MAJOR_AR913X 0x00b0 +-@@ -678,6 +776,8 @@ ++@@ -678,6 +783,8 @@ + #define REV_ID_MAJOR_QCA9533_V2 0x0160 + #define REV_ID_MAJOR_QCA9556 0x0130 + #define REV_ID_MAJOR_QCA9558 0x1130 + +#define REV_ID_MAJOR_TP9343 0x0150 +-+#define REV_ID_MAJOR_QCA9561 0x1150 +++#define REV_ID_MAJOR_QCA956X 0x1150 + + #define AR71XX_REV_ID_MINOR_MASK 0x3 + #define AR71XX_REV_ID_MINOR_AR7130 0x0 +-@@ -702,6 +802,8 @@ ++@@ -702,6 +809,8 @@ + + #define QCA955X_REV_ID_REVISION_MASK 0xf + +@@ -638,7 +676,7 @@ + /* + * SPI block + */ +-@@ -766,6 +868,19 @@ ++@@ -766,6 +875,19 @@ + #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 + #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 + +@@ -658,7 +696,7 @@ + #define AR71XX_GPIO_COUNT 16 + #define AR7240_GPIO_COUNT 18 + #define AR7241_GPIO_COUNT 20 +-@@ -774,6 +889,7 @@ ++@@ -774,6 +896,7 @@ + #define AR934X_GPIO_COUNT 23 + #define QCA953X_GPIO_COUNT 18 + #define QCA955X_GPIO_COUNT 24 +@@ -673,11 +711,11 @@ + ATH79_SOC_QCA9556, + ATH79_SOC_QCA9558, + + ATH79_SOC_TP9343, +-+ ATH79_SOC_QCA9561, +++ ATH79_SOC_QCA956X, + }; + + extern enum ath79_soc_type ath79_soc; +-@@ -126,6 +128,21 @@ static inline int soc_is_qca955x(void) ++@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void) + return soc_is_qca9556() || soc_is_qca9558(); + } + +@@ -685,15 +723,20 @@ + +{ + + return ath79_soc == ATH79_SOC_TP9343; + +} +-+ +++ + +static inline int soc_is_qca9561(void) + +{ +-+ return ath79_soc == ATH79_SOC_QCA9561; +++ return ath79_soc == ATH79_SOC_QCA956X; +++} +++ +++static inline int soc_is_qca9563(void) +++{ +++ return ath79_soc == ATH79_SOC_QCA956X; + +} + + + +static inline int soc_is_qca956x(void) + +{ +-+ return soc_is_tp9343() || soc_is_qca9561(); +++ return soc_is_qca9561() || soc_is_qca9563(); + +} + + + extern void __iomem *ath79_ddr_base; diff --git a/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch b/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch new file mode 100644 index 00000000..13161242 --- /dev/null +++ b/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch @@ -0,0 +1,176 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:00:16 +0200 +Subject: ar71xx: fold patch 622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch into files/ + +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r48650 + +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 31d2438..2efb9c7 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -198,7 +198,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + mdio_dev = &ath79_mdio1_device; + mdio_data = &ath79_mdio1_data; +@@ -209,6 +208,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + case ATH79_SOC_AR9344: + case ATH79_SOC_QCA9556: + case ATH79_SOC_QCA9558: ++ case ATH79_SOC_QCA956X: + if (id == 0) { + mdio_dev = &ath79_mdio0_device; + mdio_data = &ath79_mdio0_data; +@@ -258,7 +258,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + break; + + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + mdio_data->builtin_switch = 1; + break; +@@ -268,6 +267,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + mdio_data->is_ar934x = 1; + break; + ++ case ATH79_SOC_QCA956X: ++ if (id == 1) ++ mdio_data->builtin_switch = 1; ++ break; ++ + default: + break; + } +@@ -387,6 +391,16 @@ static void qca955x_set_speed_sgmii(int speed) + iounmap(base); + } + ++static void qca956x_set_speed_sgmii(int speed) ++{ ++ void __iomem *base; ++ u32 val = ath79_get_eth_pll(0, speed); ++ ++ base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); ++ __raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG); ++ iounmap(base); ++} ++ + static void ath79_set_speed_dummy(int speed) + { + } +@@ -517,6 +531,10 @@ struct ag71xx_switch_platform_data ath79_switch_data; + #define AR934X_PLL_VAL_100 0x00000101 + #define AR934X_PLL_VAL_10 0x00001616 + ++#define QCA956X_PLL_VAL_1000 0x03000000 ++#define QCA956X_PLL_VAL_100 0x00000101 ++#define QCA956X_PLL_VAL_10 0x00001919 ++ + static void __init ath79_init_eth_pll_data(unsigned int id) + { + struct ath79_eth_pll_data *pll_data; +@@ -575,13 +593,18 @@ static void __init ath79_init_eth_pll_data(unsigned int id) + case ATH79_SOC_QCA9533: + case ATH79_SOC_QCA9556: + case ATH79_SOC_QCA9558: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + pll_10 = AR934X_PLL_VAL_10; + pll_100 = AR934X_PLL_VAL_100; + pll_1000 = AR934X_PLL_VAL_1000; + break; + ++ case ATH79_SOC_QCA956X: ++ pll_10 = QCA956X_PLL_VAL_10; ++ pll_100 = QCA956X_PLL_VAL_100; ++ pll_1000 = QCA956X_PLL_VAL_1000; ++ break; ++ + default: + BUG(); + } +@@ -656,6 +679,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + + case ATH79_SOC_QCA9556: + case ATH79_SOC_QCA9558: ++ case ATH79_SOC_QCA956X: + switch (pdata->phy_if_mode) { + case PHY_INTERFACE_MODE_MII: + case PHY_INTERFACE_MODE_RGMII: +@@ -666,11 +690,6 @@ static int __init ath79_setup_phy_if_mode(unsigned int id, + } + break; + +- case ATH79_SOC_QCA9561: +- if (!pdata->phy_if_mode) +- pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; +- break; +- + default: + BUG(); + } +@@ -699,7 +718,7 @@ 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_QCA9561: ++ case ATH79_SOC_QCA956X: + case ATH79_SOC_TP9343: + pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII; + break; +@@ -1032,7 +1051,6 @@ void __init ath79_register_eth(unsigned int id) + pdata->fifo_cfg3 = 0x01f00140; + break; + +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + if (id == 0) { + pdata->reset_bit = AR933X_RESET_GE0_MAC | +@@ -1100,6 +1118,34 @@ void __init ath79_register_eth(unsigned int id) + pdata->fifo_cfg3 = 0x01f00140; + break; + ++ case ATH79_SOC_QCA956X: ++ if (id == 0) { ++ pdata->reset_bit = QCA955X_RESET_GE0_MAC | ++ QCA955X_RESET_GE0_MDIO; ++ if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) ++ pdata->set_speed = qca956x_set_speed_sgmii; ++ else ++ /* FIXME */ ++ pdata->set_speed = ath79_set_speed_dummy; ++ } else { ++ pdata->reset_bit = QCA955X_RESET_GE1_MAC | ++ QCA955X_RESET_GE1_MDIO; ++ /* FIXME */ ++ pdata->set_speed = ath79_set_speed_dummy; ++ } ++ ++ pdata->ddr_flush = ath79_ddr_no_flush; ++ pdata->has_gbit = 1; ++ pdata->is_ar724x = 1; ++ ++ if (!pdata->fifo_cfg1) ++ pdata->fifo_cfg1 = 0x0010ffff; ++ if (!pdata->fifo_cfg2) ++ pdata->fifo_cfg2 = 0x015500aa; ++ if (!pdata->fifo_cfg3) ++ pdata->fifo_cfg3 = 0x01f00140; ++ break; ++ + default: + BUG(); + } +@@ -1140,7 +1186,6 @@ void __init ath79_register_eth(unsigned int id) + case ATH79_SOC_AR9330: + case ATH79_SOC_AR9331: + case ATH79_SOC_QCA9533: +- case ATH79_SOC_QCA9561: + case ATH79_SOC_TP9343: + pdata->mii_bus_dev = &ath79_mdio1_device.dev; + break; diff --git a/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch b/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch new file mode 100644 index 00000000..7594cf2f --- /dev/null +++ b/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch @@ -0,0 +1,22 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:00:41 +0200 +Subject: ar71xx: fix MDIO bus probe on QCA956x + +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r48651 + +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 2efb9c7..12a376e 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -183,7 +183,8 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + ath79_soc == ATH79_SOC_AR9342 || + ath79_soc == ATH79_SOC_AR9344 || + ath79_soc == ATH79_SOC_QCA9556 || +- ath79_soc == ATH79_SOC_QCA9558) ++ ath79_soc == ATH79_SOC_QCA9558 || ++ ath79_soc == ATH79_SOC_QCA956X) + max_id = 1; + else + max_id = 0; diff --git a/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch b/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch new file mode 100644 index 00000000..6cc5e950 --- /dev/null +++ b/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch @@ -0,0 +1,64 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:01:19 +0200 +Subject: ar71xx: fix qca956x ethernet initialization + +Complete internal switch initialization for QCA956X. +Set default mdio device if the interface mode of GE0 is not SGMII (fix ticket #21520). + +Signed-off-by: Weijie Gao + +Backport of OpenWrt r48937 + +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 12a376e..b43c80a 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +@@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) + case ATH79_SOC_QCA956X: + if (id == 1) + mdio_data->builtin_switch = 1; ++ mdio_data->is_ar934x = 1; + break; + + default: +@@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id) + if (id == 0) { + pdata->reset_bit = QCA955X_RESET_GE0_MAC | + QCA955X_RESET_GE0_MDIO; ++ + if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) + pdata->set_speed = qca956x_set_speed_sgmii; + else +- /* FIXME */ +- pdata->set_speed = ath79_set_speed_dummy; ++ pdata->set_speed = ath79_set_speed_ge0; + } else { + pdata->reset_bit = QCA955X_RESET_GE1_MAC | + QCA955X_RESET_GE1_MDIO; +- /* FIXME */ ++ + pdata->set_speed = ath79_set_speed_dummy; ++ ++ pdata->switch_data = &ath79_switch_data; ++ ++ pdata->speed = SPEED_1000; ++ pdata->duplex = DUPLEX_FULL; ++ ++ /* reset the built-in switch */ ++ ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); ++ ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); + } + + pdata->ddr_flush = ath79_ddr_no_flush; +@@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id) + /* don't assign any MDIO device by default */ + break; + ++ case ATH79_SOC_QCA956X: ++ if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII) ++ pdata->mii_bus_dev = &ath79_mdio1_device.dev; ++ break; ++ + default: + pdata->mii_bus_dev = &ath79_mdio0_device.dev; + break; diff --git a/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch b/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch new file mode 100644 index 00000000..21390fc7 --- /dev/null +++ b/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch @@ -0,0 +1,562 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 20:47:26 +0200 +Subject: ar71xx: Support for Ubiquiti UniFi AP AC LITE + +Add support for the Ubiquiti UniFi AP AC LITE +Signed-off-by: P.Wassi + +Backport of OpenWrt r48711 + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 5a184cd..8c6ac9a 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -296,7 +296,8 @@ get_status_led() { + unifi) + status_led="ubnt:green:dome" + ;; +- uap-pro) ++ uap-pro | \ ++ unifiac) + status_led="ubnt:white:dome" + ;; + unifi-outdoor-plus) +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index b2e15bb..e4a1473 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -366,6 +366,7 @@ tl-wa901nd-v3 |\ + tl-wa901nd-v4 |\ + tl-wr703n |\ + tube2h |\ ++unifiac |\ + wndap360 |\ + mynet-rext |\ + wp543) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index ddd6611..8670583 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -881,6 +881,9 @@ ar71xx_board_detect() { + *UniFi) + name="unifi" + ;; ++ *"UniFi-AC") ++ name="unifiac" ++ ;; + *"UniFi AP Pro") + name="uap-pro" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index c5c1871..4c43166 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -251,6 +251,7 @@ platform_check_image() { + wlae-ag300n | \ + nbg460n_550n_550nh | \ + unifi | \ ++ unifiac | \ + unifi-outdoor | \ + carambola2 | \ + weio ) +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index e2ff826..9a81911 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -137,6 +137,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y + CONFIG_ATH79_MACH_TL_WR941ND_V6=y + CONFIG_ATH79_MACH_TUBE2H=y + CONFIG_ATH79_MACH_UBNT=y ++CONFIG_ATH79_MACH_UBNT_UNIFIAC=y + CONFIG_ATH79_MACH_UBNT_XM=y + CONFIG_ATH79_MACH_WEIO=y + CONFIG_ATH79_MACH_WHR_HP_G300N=y +@@ -320,7 +321,7 @@ CONFIG_SOC_AR933X=y + CONFIG_SOC_AR934X=y + CONFIG_SOC_QCA953X=y + CONFIG_SOC_QCA955X=y +-# CONFIG_SOC_QCA956X is not set ++CONFIG_SOC_QCA956X=y + CONFIG_SPI=y + CONFIG_SPI_AP83=y + CONFIG_SPI_ATH79=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +new file mode 100644 +index 0000000..3617ca7 +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -0,0 +1,109 @@ ++/* ++ * Ubiquiti UniFi AC (LITE) board support ++ * ++ * Copyright (C) 2015-2016 P. Wassi ++ * ++ * Derived from: mach-ubnt-xm.c ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-gpio-buttons.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++ ++ ++#define UNIFIAC_KEYS_POLL_INTERVAL 20 ++#define UNIFIAC_KEYS_DEBOUNCE_INTERVAL (3 * UNIFIAC_KEYS_POLL_INTERVAL) ++ ++#define UNIFIAC_GPIO_LED_WHITE 7 ++#define UNIFIAC_GPIO_LED_BLUE 8 ++ ++#define UNIFIAC_GPIO_BTN_RESET 2 ++ ++#define UNIFIAC_MAC0_OFFSET 0x0000 ++#define UNIFIAC_WMAC_CALDATA_OFFSET 0x1000 ++#define UNIFIAC_PCI_CALDATA_OFFSET 0x5000 ++ ++ ++static struct flash_platform_data ubnt_unifiac_flash_data = { ++ /* mx25l12805d and mx25l12835f have the same JEDEC ID */ ++ .type = "mx25l12805d", ++}; ++ ++static struct gpio_led ubnt_unifiac_leds_gpio[] __initdata = { ++ { ++ .name = "ubnt:white:dome", ++ .gpio = UNIFIAC_GPIO_LED_WHITE, ++ .active_low = 0, ++ }, { ++ .name = "ubnt:blue:dome", ++ .gpio = UNIFIAC_GPIO_LED_BLUE, ++ .active_low = 0, ++ } ++}; ++ ++static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = UNIFIAC_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = UNIFIAC_GPIO_BTN_RESET, ++ .active_low = 1, ++ } ++}; ++ ++static void __init ubnt_unifiac_setup(void) ++{ ++ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); ++ ++ ath79_register_m25p80(&ubnt_unifiac_flash_data); ++ ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ++ eeprom + UNIFIAC_MAC0_OFFSET, 0); ++ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth0_data.phy_mask = BIT(4); ++ ath79_eth0_pll_data.pll_10 = 0x00001313; ++ ++ ath79_register_mdio(0, ~BIT(4)); ++ ath79_register_eth(0); ++ ++ ++ ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); ++ ++ ++ ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); ++ ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), ++ ubnt_unifiac_leds_gpio); ++ ++ ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(ubnt_unifiac_gpio_keys), ++ ubnt_unifiac_gpio_keys); ++} ++ ++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC", ++ ubnt_unifiac_setup); +diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk +index d8e24d0..94eff18 100644 +--- a/target/linux/ar71xx/generic/profiles/ubnt.mk ++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk +@@ -38,6 +38,17 @@ endef + + $(eval $(call Profile,UBNTUNIFI)) + ++define Profile/UBNTUNIFIAC ++ NAME:=Ubiquiti UniFi AP AC ++ PACKAGES:=kmod-ath10k ath10k-firmware-qca988x ++endef ++ ++define Profile/UBNTUNIFIAC/Description ++ Package set optimized for the Ubiquiti UniFi AP AC. ++endef ++ ++$(eval $(call Profile,UBNTUNIFIAC)) ++ + define Profile/UBNTUNIFIOUTDOOR + NAME:=Ubiquiti UniFiAP Outdoor + PACKAGES:= +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index d42ceef..dd59f2d 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -740,6 +740,16 @@ define Device/oolite + endef + TARGET_DEVICES += oolite + ++define Device/ubnt-unifiac ++ DEVICE_PROFILE := UBNT UBNTUNIFIAC ++ 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 ++ IMAGES := sysupgrade.bin ++ IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) ++ BOARDNAME := UBNT-UF-AC ++endef ++TARGET_DEVICES += ubnt-unifiac ++ + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) + + # $(1): rootfs type. +diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default +index b8a7bf1..2b1fe24 100644 +--- a/target/linux/ar71xx/mikrotik/config-default ++++ b/target/linux/ar71xx/mikrotik/config-default +@@ -97,6 +97,7 @@ CONFIG_ATH79_MACH_RBSXTLITE=y + # CONFIG_ATH79_MACH_TUBE2H is not set + # CONFIG_ATH79_MACH_UBNT is not set + # CONFIG_ATH79_MACH_UBNT_XM is not set ++# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set + # CONFIG_ATH79_MACH_WHR_HP_G300N is not set + # CONFIG_ATH79_MACH_WLAE_AG300N is not set + # CONFIG_ATH79_MACH_WLR8100 is not set +diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default +index 626d676..f62cf1a 100644 +--- a/target/linux/ar71xx/nand/config-default ++++ b/target/linux/ar71xx/nand/config-default +@@ -59,6 +59,7 @@ + # CONFIG_ATH79_MACH_TL_WR941ND is not set + # CONFIG_ATH79_MACH_UBNT is not set + # CONFIG_ATH79_MACH_UBNT_XM is not set ++# CONFIG_ATH79_MACH_UBNT_UNIFIAC is not set + # CONFIG_ATH79_MACH_WHR_HP_G300N is not set + # CONFIG_ATH79_MACH_WLAE_AG300N is not set + # CONFIG_ATH79_MACH_WNDAP360 is not set +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index d6e786d..5a7a72c 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -1,6 +1,6 @@ + --- a/arch/mips/ath79/machtypes.h + +++ b/arch/mips/ath79/machtypes.h +-@@ -16,22 +16,199 @@ ++@@ -16,22 +16,200 @@ + + enum ath79_mach_type { + ATH79_MACH_GENERIC = 0, +@@ -164,6 +164,7 @@ + + ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */ + ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ +++ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +@@ -1097,10 +1098,7 @@ + + select ATH79_DEV_M25P80 + + select ATH79_DEV_USB + + select ATH79_DEV_WMAC +- +--config ATH79_MACH_AP136 +-- bool "Atheros AP136/AP135 reference board" +-- select SOC_QCA955X +++ + +config ATH79_MACH_TL_WA7210N_V2 + + bool "TP-LINK TL-WA7210N v2 support" + + select SOC_AR724X +@@ -1115,19 +1113,12 @@ + + bool "TP-LINK TL-WA830RE v2 support" + + select SOC_AR934X + + select ATH79_DEV_ETH +- select ATH79_DEV_GPIO_BUTTONS +- select ATH79_DEV_LEDS_GPIO +-- select ATH79_DEV_NFC +-- select ATH79_DEV_SPI +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 +- select ATH79_DEV_USB +- select ATH79_DEV_WMAC +-- help +-- Say 'Y' here if you want your kernel to support the +-- Atheros AP136 or AP135 reference boards. +- +--config ATH79_MACH_AP81 +-- bool "Atheros AP81 reference board" +++ select ATH79_DEV_USB +++ select ATH79_DEV_WMAC +++ + +config ATH79_MACH_TL_WA901ND + + bool "TP-LINK TL-WA901ND/TL-WA7510N support" + + select SOC_AR724X +@@ -1139,11 +1130,11 @@ + + + +config ATH79_MACH_TL_WA901ND_V2 + + bool "TP-LINK TL-WA901ND v2 support" +- select SOC_AR913X +- select ATH79_DEV_ETH +- select ATH79_DEV_GPIO_BUTTONS +- select ATH79_DEV_LEDS_GPIO +- select ATH79_DEV_M25P80 +++ select SOC_AR913X +++ 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_TL_WDR3500 +@@ -1154,34 +1145,13 @@ + + select ATH79_DEV_GPIO_BUTTONS + + select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 +- select ATH79_DEV_USB +- select ATH79_DEV_WMAC +-- help +-- Say 'Y' here if you want your kernel to support the +-- Atheros AP81 reference board. +- +--config ATH79_MACH_DB120 +-- bool "Atheros DB120 reference board" +++ select ATH79_DEV_USB +++ select ATH79_DEV_WMAC +++ + +config ATH79_MACH_TL_WDR4300 + + bool "TP-LINK TL-WDR3600/4300/4310 board support" +- select SOC_AR934X +- 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_NFC +- select ATH79_DEV_USB +- select ATH79_DEV_WMAC +-- help +-- Say 'Y' here if you want your kernel to support the +-- Atheros DB120 reference board. +- +--config ATH79_MACH_PB44 +-- bool "Atheros PB44 reference board" +-+config ATH79_MACH_TL_WR703N +-+ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" +-+ select SOC_AR933X +++ select SOC_AR934X +++ select ATH79_DEV_AP9X_PCI if PCI + + select ATH79_DEV_ETH + + select ATH79_DEV_GPIO_BUTTONS + + select ATH79_DEV_LEDS_GPIO +@@ -1189,8 +1159,8 @@ + + select ATH79_DEV_USB + + select ATH79_DEV_WMAC + + +-+config ATH79_MACH_TL_WR720N_V3 +-+ bool "TP-LINK TL-WR720N v3/v4 support" +++config ATH79_MACH_TL_WR703N +++ bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" + + select SOC_AR933X + + select ATH79_DEV_ETH + + select ATH79_DEV_GPIO_BUTTONS +@@ -1198,7 +1168,28 @@ + + select ATH79_DEV_M25P80 + + select ATH79_DEV_USB + + select ATH79_DEV_WMAC +-+ ++ ++-config ATH79_MACH_AP136 ++- bool "Atheros AP136/AP135 reference board" ++- select SOC_QCA955X +++config ATH79_MACH_TL_WR720N_V3 +++ bool "TP-LINK TL-WR720N v3/v4 support" +++ select SOC_AR933X +++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++- select ATH79_DEV_NFC ++- select ATH79_DEV_SPI +++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++- help ++- Say 'Y' here if you want your kernel to support the ++- Atheros AP136 or AP135 reference boards. ++ ++-config ATH79_MACH_AP81 ++- bool "Atheros AP81 reference board" ++- select SOC_AR913X + +config ATH79_MACH_TL_WR741ND + + bool "TP-LINK TL-WR741ND support" + + select SOC_AR724X +@@ -1211,21 +1202,25 @@ + +config ATH79_MACH_TL_WR741ND_V4 + + bool "TP-LINK TL-WR741ND v4/TL-MR3220 v2 support" + + select SOC_AR933X +-+ 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_TL_WR841N_V1 +-+ bool "TP-LINK TL-WR841N v1 support" +- select SOC_AR71XX +-+ select ATH79_DEV_DSA + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO +-- select ATH79_DEV_SPI ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++- help ++- Say 'Y' here if you want your kernel to support the ++- Atheros AP81 reference board. ++ ++-config ATH79_MACH_DB120 ++- bool "Atheros DB120 reference board" +++config ATH79_MACH_TL_WR841N_V1 +++ bool "TP-LINK TL-WR841N v1 support" +++ select SOC_AR71XX +++ select ATH79_DEV_DSA +++ select ATH79_DEV_ETH +++ select ATH79_DEV_GPIO_BUTTONS +++ select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 + + + +config ATH79_MACH_TL_WR841N_V8 +@@ -1268,15 +1263,21 @@ + + + +config ATH79_MACH_TL_WR1041N_V2 + + bool "TP-LINK TL-WR1041N v2 support" +-+ select SOC_AR934X +-+ 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 +-+ ++ select SOC_AR934X ++ 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_NFC ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++- help ++- Say 'Y' here if you want your kernel to support the ++- Atheros DB120 reference board. ++ ++-config ATH79_MACH_PB44 ++- bool "Atheros PB44 reference board" + +config ATH79_MACH_TL_WR1043ND + + bool "TP-LINK TL-WR1043ND support" + + select SOC_AR913X +@@ -1319,11 +1320,12 @@ + + + +config ATH79_MACH_TEW_673GRU + + bool "TRENDnet TEW-673GRU support" +-+ select SOC_AR71XX ++ select SOC_AR71XX + + select ATH79_DEV_AP9X_PCI if PCI +-+ select ATH79_DEV_ETH +-+ select ATH79_DEV_GPIO_BUTTONS +-+ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++- select ATH79_DEV_SPI + + select ATH79_DEV_M25P80 + + select ATH79_DEV_USB + + select ATH79_NVRAM +@@ -1361,10 +1363,20 @@ + + config ATH79_MACH_UBNT_XM + bool "Ubiquiti Networks XM/UniFi boards" +-@@ -83,6 +1144,106 @@ config ATH79_MACH_UBNT_XM ++@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM + Say 'Y' here if you want your kernel to support the + Ubiquiti Networks XM (rev 1.0) board. + +++config ATH79_MACH_UBNT_UNIFIAC +++ bool "Ubiquiti UniFi AC (LITE) 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_WEIO + + bool "WeIO board" + + select SOC_AR933X +@@ -1468,7 +1480,7 @@ + endmenu + + config SOC_AR71XX +-@@ -124,7 +1285,10 @@ config ATH79_DEV_DSA ++@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA + config ATH79_DEV_ETH + def_bool n + +@@ -1480,7 +1492,7 @@ + def_bool n + + config ATH79_DEV_GPIO_BUTTONS +-@@ -154,6 +1318,11 @@ config ATH79_PCI_ATH9K_FIXUP ++@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP + def_bool n + + config ATH79_ROUTERBOOT +@@ -1494,7 +1506,7 @@ + endif + --- a/arch/mips/ath79/Makefile + +++ b/arch/mips/ath79/Makefile +-@@ -38,9 +38,128 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route ++@@ -38,9 +38,129 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route + # + # Machines + # +@@ -1596,6 +1608,7 @@ + +obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3) += mach-tl-wr720n-v3.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 + obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o + +obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o + +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o diff --git a/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch b/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch new file mode 100644 index 00000000..bae7f32e --- /dev/null +++ b/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch @@ -0,0 +1,21 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:02:55 +0200 +Subject: ar71xx: Fix eth0 support for Ubiquiti UniFi AP AC + +Fix eth0 support for the Ubiquiti UniFi AP AC +Signed-off-by: Paul Wassi + +Backport of OpenWrt r49277 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +index 3617ca7..072cf12 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -84,6 +84,7 @@ static void __init ubnt_unifiac_setup(void) + eeprom + UNIFIAC_MAC0_OFFSET, 0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_pll_data.pll_10 = 0x00001313; + diff --git a/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch b/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch new file mode 100644 index 00000000..cbd40637 --- /dev/null +++ b/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch @@ -0,0 +1,192 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:24:44 +0200 +Subject: ar71xx: Rename unifiac to unifiac-lite + +To avoid confusion with different unifiac devices, rename existing target +"unifiac" to "unifiac-lite", before "unifiac-pro" is introduced. + +Signed-off-by: P.Wassi + +Backport of LEDE c855e70491fbd5d432915c4cbeb3b80f3a117e30 + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 8c6ac9a..3d711ca 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -297,7 +297,7 @@ get_status_led() { + status_led="ubnt:green:dome" + ;; + uap-pro | \ +- unifiac) ++ unifiac-lite) + status_led="ubnt:white:dome" + ;; + unifi-outdoor-plus) +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 e6fcec8..fa8a2c8 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 +@@ -75,7 +75,7 @@ case "$FIRMWARE" in + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; +- unifiac) ++ unifiac-lite) + ath10kcal_extract "EEPROM" 20480 2116 + ;; + esac +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index e4a1473..0269e6d 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -366,7 +366,7 @@ tl-wa901nd-v3 |\ + tl-wa901nd-v4 |\ + tl-wr703n |\ + tube2h |\ +-unifiac |\ ++unifiac-lite |\ + wndap360 |\ + mynet-rext |\ + wp543) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 8670583..d3e6db9 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -881,8 +881,8 @@ ar71xx_board_detect() { + *UniFi) + name="unifi" + ;; +- *"UniFi-AC") +- name="unifiac" ++ *"UniFi-AC-LITE") ++ name="unifiac-lite" + ;; + *"UniFi AP Pro") + name="uap-pro" +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 4c43166..a1b65b7 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -251,7 +251,7 @@ platform_check_image() { + wlae-ag300n | \ + nbg460n_550n_550nh | \ + unifi | \ +- unifiac | \ ++ unifiac-lite | \ + unifi-outdoor | \ + carambola2 | \ + weio ) +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +index 072cf12..31cbe30 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -73,7 +73,7 @@ static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = { + } + }; + +-static void __init ubnt_unifiac_setup(void) ++static void __init ubnt_unifiac_lite_setup(void) + { + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); + +@@ -81,7 +81,7 @@ static void __init ubnt_unifiac_setup(void) + + + ath79_init_mac(ath79_eth0_data.mac_addr, +- eeprom + UNIFIAC_MAC0_OFFSET, 0); ++ eeprom + UNIFIAC_MAC0_OFFSET, 0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; +@@ -99,12 +99,12 @@ static void __init ubnt_unifiac_setup(void) + + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), +- ubnt_unifiac_leds_gpio); ++ ubnt_unifiac_leds_gpio); + + ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, +- ARRAY_SIZE(ubnt_unifiac_gpio_keys), +- ubnt_unifiac_gpio_keys); ++ ARRAY_SIZE(ubnt_unifiac_gpio_keys), ++ ubnt_unifiac_gpio_keys); + } + +-MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC, "UBNT-UF-AC", "Ubiquiti UniFi-AC", +- ubnt_unifiac_setup); ++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE", ++ ubnt_unifiac_lite_setup); +diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk +index 94eff18..eac0240 100644 +--- a/target/linux/ar71xx/generic/profiles/ubnt.mk ++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk +@@ -38,16 +38,16 @@ endef + + $(eval $(call Profile,UBNTUNIFI)) + +-define Profile/UBNTUNIFIAC +- NAME:=Ubiquiti UniFi AP AC ++define Profile/UBNTUNIFIACLITE ++ NAME:=Ubiquiti UniFi AP AC LITE/LR + PACKAGES:=kmod-ath10k ath10k-firmware-qca988x + endef + +-define Profile/UBNTUNIFIAC/Description +- Package set optimized for the Ubiquiti UniFi AP AC. ++define Profile/UBNTUNIFIACLITE/Description ++ Package set optimized for the Ubiquiti UniFi AP AC LITE/LR. + endef + +-$(eval $(call Profile,UBNTUNIFIAC)) ++$(eval $(call Profile,UBNTUNIFIACLITE)) + + define Profile/UBNTUNIFIOUTDOOR + NAME:=Ubiquiti UniFiAP Outdoor +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index dd59f2d..31aff78 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -741,14 +741,19 @@ endef + TARGET_DEVICES += oolite + + define Device/ubnt-unifiac +- DEVICE_PROFILE := UBNT UBNTUNIFIAC ++ 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 + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) ++endef ++ ++define Device/ubnt-unifiac-lite ++ $(Device/ubnt-unifiac) ++ DEVICE_PROFILE := UBNT UBNTUNIFIACLITE + BOARDNAME := UBNT-UF-AC + endef +-TARGET_DEVICES += ubnt-unifiac ++TARGET_DEVICES += ubnt-unifiac-lite + + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) + +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index 5a7a72c..0ade403 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -164,7 +164,7 @@ + + ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */ + ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ +-+ ATH79_MACH_UBNT_UNIFIAC, /* Ubiquiti Unifi AC */ +++ ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +@@ -1368,7 +1368,7 @@ + Ubiquiti Networks XM (rev 1.0) board. + + +config ATH79_MACH_UBNT_UNIFIAC +-+ bool "Ubiquiti UniFi AC (LITE) support" +++ bool "Ubiquiti UniFi AC (LITE/LR) support" + + select SOC_QCA956X + + select ATH79_DEV_AP9X_PCI if PCI + + select ATH79_DEV_ETH diff --git a/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch b/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch new file mode 100644 index 00000000..30cf6d46 --- /dev/null +++ b/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch @@ -0,0 +1,274 @@ +From: Matthias Schiffer +Date: Fri, 13 May 2016 21:34:05 +0200 +Subject: ar71xx: Add support for Ubiquiti UniFi AP AC PRO + +Add support for the Ubiquiti UniFi AP AC PRO +Signed-off-by: P.Wassi + +Backport of LEDE 8307c2fe686ded345c80318359d5b6679e581fa2 + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 3d711ca..775aac6 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -297,7 +297,8 @@ get_status_led() { + status_led="ubnt:green:dome" + ;; + uap-pro | \ +- unifiac-lite) ++ unifiac-lite | \ ++ unifiac-pro) + status_led="ubnt:white:dome" + ;; + unifi-outdoor-plus) +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 fa8a2c8..cde7aaf 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 +@@ -75,7 +75,8 @@ case "$FIRMWARE" in + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; +- unifiac-lite) ++ unifiac-lite | \ ++ unifiac-pro) + ath10kcal_extract "EEPROM" 20480 2116 + ;; + esac +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 0269e6d..0a23756 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -398,6 +398,13 @@ wpj344) + ucidef_add_switch_vlan "switch0" "2" "0t 2" + ;; + ++unifiac-pro) ++ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ++ ucidef_add_switch "switch0" "1" "1" ++ ucidef_add_switch_vlan "switch0" "1" "0t 2" ++ ucidef_add_switch_vlan "switch0" "2" "0t 3" ++ ;; ++ + wpj531) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index d3e6db9..7fc951a 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -884,6 +884,9 @@ ar71xx_board_detect() { + *"UniFi-AC-LITE") + name="unifiac-lite" + ;; ++ *"UniFi-AC-PRO") ++ name="unifiac-pro" ++ ;; + *"UniFi AP Pro") + name="uap-pro" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index a1b65b7..0e9833d 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -252,6 +252,7 @@ platform_check_image() { + nbg460n_550n_550nh | \ + unifi | \ + unifiac-lite | \ ++ unifiac-pro | \ + unifi-outdoor | \ + carambola2 | \ + weio ) +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +index 31cbe30..9194bc1 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c +@@ -21,6 +21,7 @@ + #include + + #include ++#include + + #include "common.h" + #include "dev-ap9x-pci.h" +@@ -29,6 +30,7 @@ + #include "dev-leds-gpio.h" + #include "dev-m25p80.h" + #include "dev-wmac.h" ++#include "dev-usb.h" + #include "machtypes.h" + + +@@ -108,3 +110,70 @@ static void __init ubnt_unifiac_lite_setup(void) + + MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", "Ubiquiti UniFi-AC-LITE", + ubnt_unifiac_lite_setup); ++ ++static struct ar8327_pad_cfg ubnt_unifiac_pro_ar8327_pad0_cfg = { ++ .mode = AR8327_PAD_MAC_SGMII, ++ .sgmii_delay_en = true, ++}; ++ ++static struct ar8327_platform_data ubnt_unifiac_pro_ar8327_data = { ++ .pad0_cfg = &ubnt_unifiac_pro_ar8327_pad0_cfg, ++ .port0_cfg = { ++ .force_link = 1, ++ .speed = AR8327_PORT_SPEED_1000, ++ .duplex = 1, ++ .txpause = 1, ++ .rxpause = 1, ++ }, ++}; ++ ++ ++static struct mdio_board_info ubnt_unifiac_pro_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 0, ++ .platform_data = &ubnt_unifiac_pro_ar8327_data, ++ }, ++}; ++ ++static void __init ubnt_unifiac_pro_setup(void) ++{ ++ u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); ++ ++ ath79_register_m25p80(&ubnt_unifiac_flash_data); ++ ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ++ eeprom + UNIFIAC_MAC0_OFFSET, 0); ++ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_data.phy_mask = BIT(0); ++ ++ mdiobus_register_board_info(ubnt_unifiac_pro_mdio0_info, ++ ARRAY_SIZE(ubnt_unifiac_pro_mdio0_info)); ++ ++ ath79_register_mdio(0, 0x00); ++ ath79_register_eth(0); ++ ++ ++ ath79_register_usb(); ++ ++ ++ ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); ++ ++ ++ ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); ++ ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), ++ ubnt_unifiac_leds_gpio); ++ ++ ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(ubnt_unifiac_gpio_keys), ++ ubnt_unifiac_gpio_keys); ++} ++ ++ ++MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_PRO, "UBNT-UF-AC-PRO", "Ubiquiti UniFi-AC-PRO", ++ ubnt_unifiac_pro_setup); +diff --git a/target/linux/ar71xx/generic/profiles/ubnt.mk b/target/linux/ar71xx/generic/profiles/ubnt.mk +index eac0240..69b8398 100644 +--- a/target/linux/ar71xx/generic/profiles/ubnt.mk ++++ b/target/linux/ar71xx/generic/profiles/ubnt.mk +@@ -49,6 +49,17 @@ endef + + $(eval $(call Profile,UBNTUNIFIACLITE)) + ++define Profile/UBNTUNIFIACPRO ++ NAME:=Ubiquiti UniFi AP AC PRO ++ PACKAGES:=kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2 ++endef ++ ++define Profile/UBNTUNIFIACPRO/Description ++ Package set optimized for the Ubiquiti UniFi AP AC PRO. ++endef ++ ++$(eval $(call Profile,UBNTUNIFIACPRO)) ++ + define Profile/UBNTUNIFIOUTDOOR + NAME:=Ubiquiti UniFiAP Outdoor + PACKAGES:= +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 31aff78..916d4e2 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -753,7 +753,13 @@ define Device/ubnt-unifiac-lite + DEVICE_PROFILE := UBNT UBNTUNIFIACLITE + BOARDNAME := UBNT-UF-AC + endef +-TARGET_DEVICES += ubnt-unifiac-lite ++ ++define Device/ubnt-unifiac-pro ++ $(Device/ubnt-unifiac) ++ DEVICE_PROFILE := UBNT UBNTUNIFIACPRO ++ BOARDNAME := UBNT-UF-AC-PRO ++endef ++TARGET_DEVICES += ubnt-unifiac-lite ubnt-unifiac-pro + + rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) + +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index 0ade403..dbd3fca 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -1,6 +1,6 @@ + --- a/arch/mips/ath79/machtypes.h + +++ b/arch/mips/ath79/machtypes.h +-@@ -16,22 +16,200 @@ ++@@ -16,22 +16,201 @@ + + enum ath79_mach_type { + ATH79_MACH_GENERIC = 0, +@@ -165,6 +165,7 @@ + ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ + ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ + + ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR */ +++ ATH79_MACH_UBNT_UNIFIAC_PRO, /* Ubiquiti Unifi AC PRO */ + ATH79_MACH_UBNT_UNIFI_OUTDOOR, /* Ubiquiti UnifiAP Outdoor */ + + ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */ + ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ +@@ -1363,12 +1364,12 @@ + + config ATH79_MACH_UBNT_XM + bool "Ubiquiti Networks XM/UniFi boards" +-@@ -83,6 +1144,116 @@ config ATH79_MACH_UBNT_XM ++@@ -83,6 +1144,117 @@ config ATH79_MACH_UBNT_XM + Say 'Y' here if you want your kernel to support the + Ubiquiti Networks XM (rev 1.0) board. + + +config ATH79_MACH_UBNT_UNIFIAC +-+ bool "Ubiquiti UniFi AC (LITE/LR) support" +++ bool "Ubiquiti UniFi AC (LITE/LR/PRO) support" + + select SOC_QCA956X + + select ATH79_DEV_AP9X_PCI if PCI + + select ATH79_DEV_ETH +@@ -1376,6 +1377,7 @@ + + select ATH79_DEV_LEDS_GPIO + + select ATH79_DEV_M25P80 + + select ATH79_DEV_WMAC +++ select ATH79_DEV_USB + + + +config ATH79_MACH_WEIO + + bool "WeIO board" +@@ -1480,7 +1482,7 @@ + endmenu + + config SOC_AR71XX +-@@ -124,7 +1295,10 @@ config ATH79_DEV_DSA ++@@ -124,7 +1296,10 @@ config ATH79_DEV_DSA + config ATH79_DEV_ETH + def_bool n + +@@ -1492,7 +1494,7 @@ + def_bool n + + config ATH79_DEV_GPIO_BUTTONS +-@@ -154,6 +1328,11 @@ config ATH79_PCI_ATH9K_FIXUP ++@@ -154,6 +1329,11 @@ config ATH79_PCI_ATH9K_FIXUP + def_bool n + + config ATH79_ROUTERBOOT diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 78a75519..87bd40c6 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -164,7 +164,7 @@ $(eval $(call GluonModel,ARCHERC7,archer-c5,tp-link-archer-c5-v1)) # BROKEN: ath $(eval $(call GluonModel,ARCHERC7,archer-c7-v2,tp-link-archer-c7-v2)) # BROKEN: ath10k endif -## Ubiquiti (everything) +## Ubiquiti (almost everything) $(eval $(call GluonProfile,UBNT)) $(eval $(call GluonModel,UBNT,ubnt-air-gateway,ubiquiti-airgateway)) $(eval $(call GluonModel,UBNT,ubnt-airrouter,ubiquiti-airrouter)) @@ -194,6 +194,16 @@ ifneq ($(BROKEN),) $(eval $(call GluonModel,UBNT,ubnt-ls-sr71,ubiquiti-ls-sr71)) # BROKEN: Untested endif +# Ubiquiti (ath10k) +ifneq ($(BROKEN),) +$(eval $(call GluonProfile,UBNTUNIFIACLITE,kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonProfileFactorySuffix,UBNTUNIFIACLITE)) +$(eval $(call GluonModel,UBNTUNIFIACLITE,ubnt-unifiac-lite,ubiquiti-unifi-ac-lite)) # BROKEN: untested, ath10k + +$(eval $(call GluonProfile,UBNTUNIFIACPRO,kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonProfileFactorySuffix,UBNTUNIFIACPRO)) +$(eval $(call GluonModel,UBNTUNIFIACPRO,ubnt-unifiac-pro,ubiquiti-unifi-ac-pro)) # BROKEN: ath10k +endif ## D-Link From c6bdd68553309f1fe84f1ee2fc954ca7e5b63442 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 14 May 2016 01:02:25 +0200 Subject: [PATCH 018/184] ar71xx-generic: switch default WAN/LAN assignment on Ubiquiti UAP Pro Fixes #764 --- package/gluon-core/files/lib/gluon/upgrade/020-interfaces | 2 +- .../gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces index 49831266..34e1c8bb 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/files/lib/gluon/upgrade/020-interfaces @@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then local lan_ifname = uci:get('network', 'lan', 'ifname') local wan_ifname = uci:get('network', 'wan', 'ifname') - if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'unifiac-pro'}) then + if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then lan_ifname, wan_ifname = wan_ifname, lan_ifname end diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname index cae60e71..a2b4f796 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname @@ -8,7 +8,7 @@ if sysconfig.setup_ifname then os.exit(0) end -if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'unifiac-pro'}) then +if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname else sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname From 43f2adebef3e6b771a7c296390ccfe94d894f26a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 16 May 2016 02:17:39 +0200 Subject: [PATCH 019/184] Update Gluon packages --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 2a52cdf1..1336e245 100644 --- a/modules +++ b/modules @@ -8,7 +8,7 @@ PACKAGES_OPENWRT_COMMIT=9622fe984bba3a4547f48bc507ebaba7637eb2b0 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git -PACKAGES_GLUON_COMMIT=087eef9e684fdef066e63c8f64dddfbfd02141a5 +PACKAGES_GLUON_COMMIT=63376e23c81e53c21d3c5250c3fb7444a90dc019 PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc From 1159957dfc52a70d17eb5ce657dc083c9e513a2f Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 16 May 2016 13:17:29 +0200 Subject: [PATCH 020/184] gluon-luci-admin: Fix uploaded image validation The image validation currently fails on some devices (tested OpenMesh) because it isn't done via sysupgrade. But the checks depend partially on the integration in sysupgrade (e.g. via loops that can be stopped via "break statements"). Instead of hacking its own version check, it is easier and better tested to just use 'sysupgrade -T' like it is already done by LuCI. Signed-off-by: Sven Eckelmann --- .../files/usr/lib/lua/luci/controller/admin/upgrade.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua index 29aecb95..2365f02c 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua @@ -101,9 +101,7 @@ end function image_supported(tmpfile) -- XXX: yay... return ( 0 == os.execute( - ". /lib/functions.sh; " .. - "include /lib/upgrade; " .. - "platform_check_image %q >/dev/null" + "/sbin/sysupgrade -T %q >/dev/null" % tmpfile ) ) end From e0894a7780cc2fbd3145950c90d8d81ce4b7eab5 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sat, 14 May 2016 21:59:23 +0200 Subject: [PATCH 021/184] ar71xx-generic: Add support for OpenMesh devices Integrate OpenMesh devices available in OpenWrt Chaos Calmer: - MR600 - MR600v2 - MR900 - MR900v2 - OM2P - OM2P-HS - OM2P-HSv2 - OM2P-LC - OM2Pv2 - OM5P - OM5P-AN Signed-off-by: Sven Eckelmann --- docs/index.rst | 10 ++++++++++ targets/ar71xx-generic/profiles.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index c24152da..6b047b33 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -131,6 +131,16 @@ ar71xx-generic - Omega +* OpenMesh + + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2) + - OM2P-LC + - OM5P + - OM5P-AN + * TP-Link - CPE210 (v1.0, v1.1) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 87bd40c6..625cdae0 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -299,6 +299,35 @@ $(eval $(call GluonModel,MYNETN750,mynet-n750,wd-my-net-n750)) $(eval $(call GluonProfile,OMEGA)) $(eval $(call GluonModel,OMEGA,onion-omega,onion-omega)) +## OpenMesh + +# MR600 +$(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools)) +$(eval $(call GluonProfileSysupgradeSuffix,MR600,-squashfs-factory,.bin)) +$(eval $(call GluonModel,MR600,mr600,openmesh-mr600)) +$(eval $(call GluonModelAlias,MR600,openmesh-mr600,openmesh-mr600-v2)) + +# MR900 +$(eval $(call GluonProfile,MR900,om-watchdog uboot-envtools)) +$(eval $(call GluonProfileSysupgradeSuffix,MR900,-squashfs-factory,.bin)) +$(eval $(call GluonModel,MR900,mr900,openmesh-mr900)) +$(eval $(call GluonModelAlias,MR900,openmesh-mr900,openmesh-mr900-v2)) + +# OM2P +$(eval $(call GluonProfile,OM2P,om-watchdog uboot-envtools)) +$(eval $(call GluonProfileSysupgradeSuffix,OM2P,-squashfs-factory,.bin)) +$(eval $(call GluonModel,OM2P,om2p,openmesh-om2p)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-v2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs-v2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-lc)) + +# OM5P +$(eval $(call GluonProfile,OM5P,om-watchdog uboot-envtools)) +$(eval $(call GluonProfileSysupgradeSuffix,OM5P,-squashfs-factory,.bin)) +$(eval $(call GluonModel,OM5P,om5p,openmesh-om5p)) +$(eval $(call GluonModelAlias,OM5P,openmesh-om5p,openmesh-om5p-an)) + ## ALFA # Hornet-UB From bbd86a8ae973cce716ed36cce97435874afc8650 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 18 May 2016 01:24:11 +0200 Subject: [PATCH 022/184] gluon-mesh-vpn-fastd: add missing iptables dependency confusing Kconfig This was causing "recursive dependency" errors and potentially broken configurations. --- package/gluon-mesh-vpn-fastd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 0875e485..bb33257e 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -12,7 +12,7 @@ define Package/gluon-mesh-vpn-fastd SECTION:=gluon CATEGORY:=Gluon TITLE:=Support for connecting batman-adv meshes via fastd - DEPENDS:=+gluon-core +libgluonutil gluon-mesh-batman-adv +gluon-wan-dnsmasq +fastd +iptables-mod-extra +simple-tc + DEPENDS:=+gluon-core +libgluonutil gluon-mesh-batman-adv +gluon-wan-dnsmasq +fastd +iptables +iptables-mod-extra +simple-tc endef define Build/Prepare From fe00c4ea53e0873aac9e3162c0c1ea92f3eb980d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 May 2016 15:31:47 +0200 Subject: [PATCH 023/184] gluon-config-mode-core: clean up reboot handling Don't fork reboot process before all package hooks have been handled and rendering is complete. Replace debug.setfenv hack to close stdout with nixio.dup. Fixes #772 --- .../controller/gluon-config-mode/index.lua | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 39ba00a9..68c14746 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -48,43 +48,42 @@ function action_reboot() uci:save("gluon-setup-mode") uci:commit("gluon-setup-mode") - if nixio.fork() ~= 0 then - local fs = require "nixio.fs" - local util = require "nixio.util" + local fs = require "nixio.fs" + local util = require "nixio.util" - local parts_dir = "/lib/gluon/config-mode/reboot/" - local files = util.consume(fs.dir(parts_dir)) + local parts_dir = "/lib/gluon/config-mode/reboot/" + local files = util.consume(fs.dir(parts_dir)) - table.sort(files) + table.sort(files) - local parts = {} + local parts = {} - for _, entry in ipairs(files) do - if entry:sub(1, 1) ~= '.' then - local f = dofile(parts_dir .. '/' .. entry) - if f ~= nil then - table.insert(parts, f) - end + for _, entry in ipairs(files) do + if entry:sub(1, 1) ~= '.' then + local f = dofile(parts_dir .. '/' .. entry) + if f ~= nil then + table.insert(parts, f) end end + end - local hostname = uci:get_first("system", "system", "hostname") + local hostname = uci:get_first("system", "system", "hostname") - luci.template.render("gluon/config-mode/reboot", { parts=parts - , hostname=hostname - }) - else - debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) - io.stdout:close() + luci.template.render("gluon/config-mode/reboot", + { + parts = parts, + hostname = hostname, + } + ) + + if nixio.fork() == 0 then + -- Replace stdout with /dev/null + nixio.dup(nixio.open('/dev/null', 'w'), nixio.stdout) -- Sleep a little so the browser can fetch everything required to -- display the reboot page, then reboot the device. - nixio.nanosleep(2) + nixio.nanosleep(1) - -- Run reboot with popen so it gets its own std filehandles. - io.popen("reboot") - - -- Prevent any further execution in this child. - os.exit() + nixio.execp("reboot") end end From 052a81d8819d67c60323578adfec7aa0cf55f45b Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 19 May 2016 20:59:34 +0200 Subject: [PATCH 024/184] ar71xx-generic: Generate OpenMesh sysupgrades in OpenWrt The workaround to generate sysupgrade images for OpenMesh devices in gluon is replaced in LEDE/OpenWrt by a special patch. It is therefore better to drop the workaround and use the upstream version. Reported-by: Matthias Schiffer Signed-off-by: Sven Eckelmann --- ...sysupgrade-images-for-OpenMesh-devic.patch | 30 +++++++++++++++++++ targets/ar71xx-generic/profiles.mk | 4 --- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch diff --git a/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch new file mode 100644 index 00000000..6470646d --- /dev/null +++ b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch @@ -0,0 +1,30 @@ +From: Sven Eckelmann +Date: Tue, 17 May 2016 16:38:29 +0200 +Subject: ar71xx: Generate sysupgrade images for OpenMesh devices + +Some OpenWrt based firmwares like Gluon expect that a sysupgrade image +exists when a device firmware can be updated via sysupgrade. This image +wasn't created until now because OpenMesh devices use the same image for +factory and sysupgrade flash. Copying the image from *factory.bin to +*sysupgrade.bin is therefore enough to make the sysupgrade functionality +visible. + +Reported-by: Matthias Schiffer +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/624172/ + +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 916d4e2..f91e20e 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -1877,6 +1877,9 @@ define Image/Build/OpenMesh + "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \ + "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \ + "$(KDIR)/root.$(1)" "rootfs" ++ if [ -e "$(call factoryname,$(1),$(2))" ]; then \ ++ cp "$(call factoryname,$(1),$(2))" "$(call sysupname,$(1),$(2))"; \ ++ fi + endef + + diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 625cdae0..9454de64 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -303,19 +303,16 @@ $(eval $(call GluonModel,OMEGA,onion-omega,onion-omega)) # MR600 $(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools)) -$(eval $(call GluonProfileSysupgradeSuffix,MR600,-squashfs-factory,.bin)) $(eval $(call GluonModel,MR600,mr600,openmesh-mr600)) $(eval $(call GluonModelAlias,MR600,openmesh-mr600,openmesh-mr600-v2)) # MR900 $(eval $(call GluonProfile,MR900,om-watchdog uboot-envtools)) -$(eval $(call GluonProfileSysupgradeSuffix,MR900,-squashfs-factory,.bin)) $(eval $(call GluonModel,MR900,mr900,openmesh-mr900)) $(eval $(call GluonModelAlias,MR900,openmesh-mr900,openmesh-mr900-v2)) # OM2P $(eval $(call GluonProfile,OM2P,om-watchdog uboot-envtools)) -$(eval $(call GluonProfileSysupgradeSuffix,OM2P,-squashfs-factory,.bin)) $(eval $(call GluonModel,OM2P,om2p,openmesh-om2p)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-v2)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs)) @@ -324,7 +321,6 @@ $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-lc)) # OM5P $(eval $(call GluonProfile,OM5P,om-watchdog uboot-envtools)) -$(eval $(call GluonProfileSysupgradeSuffix,OM5P,-squashfs-factory,.bin)) $(eval $(call GluonModel,OM5P,om5p,openmesh-om5p)) $(eval $(call GluonModelAlias,OM5P,openmesh-om5p,openmesh-om5p-an)) From 460e795f930fb6e52cba0e0bbf8b7e4e2f8e96b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Tue, 8 Mar 2016 08:10:19 +0100 Subject: [PATCH 025/184] ebtables-filter-mcast: Remove redundant allow-filter for hop-by-hop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ebtables actually skips any IPv6 extension headers like the hop-by-hop one. So this rule is actually void. The intend back then was to allow passing MLD messages into the mesh. Since extension headers are skipped, the general icmpv6 rule will actually match MLD messages. So the hop-by-hop rule is unnecessary, too. Signed-off-by: Linus Lüssing --- .../files/lib/gluon/ebtables/110-mcast-allow-icmpv6 | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 index 8d3b7ec2..cb358157 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 @@ -1,5 +1,3 @@ rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type echo-request -j DROP' rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 139 -j DROP' rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN' - -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol 0 -j RETURN' -- hop-by-hop From 0cd6f95e9ff17f595ffd5823289439547eb3091b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Tue, 8 Mar 2016 08:10:20 +0100 Subject: [PATCH 026/184] ebtables-segment-mld: Segment IGMP/MLD domain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a new gluon-ebtables package to filter IGMP/MLD messages via ebtables. For one thing this reduces multicast overhead: About one third of all ICMPv6 multicast traffic in Lübeck or Hamburg is MLD. Furthermore it removes a potential Distributed Denial-of-Service vector (see Gluon ticket #553). Finally, it is a prerequisite for enabling bridge multicast snooping in a decentral and robust fashion. Note that IGMP/MLD are filtered for multicast traffic coming from the mesh, too (new MULTICAST_IN), as unfortunately there seem to be other queriers somewhere in the mesh at least for Freifunk Lübeck. Also adding these rules to be prepared to anyone intentionally or unintentionally disabling these filters on his/her node. Node operators not running Gluon (for instance gateway nodes) should make sure to either enable multicast_router towards bat0 or disable multicast snooping entirely if they have a bridge on top of bat0. Signed-off-by: Linus Lüssing --- docs/package/gluon-ebtables-segment-mld.rst | 16 ++++++ .../files/lib/gluon/ebtables/100-mcast-chain | 1 - .../lib/gluon/ebtables/110-mcast-allow-icmpv6 | 6 +-- .../files/lib/gluon/ebtables/300-mcast | 2 - .../files/lib/gluon/ebtables/355-mcast-drop | 1 + package/gluon-ebtables-segment-mld/Makefile | 51 +++++++++++++++++++ .../lib/gluon/ebtables/100-mcast-in-chain | 2 + .../lib/gluon/ebtables/101-mcast-in-rule | 2 + .../lib/gluon/ebtables/105-mcast-drop-igmp | 2 + .../lib/gluon/ebtables/105-mcast-drop-mld | 9 ++++ .../files/etc/init.d/gluon-ebtables | 15 +++--- .../files/lib/gluon/ebtables/100-dir-chain | 3 ++ .../lib/gluon/ebtables/350-mcast-dir-rules | 4 ++ 13 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 docs/package/gluon-ebtables-segment-mld.rst delete mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain delete mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast create mode 100644 package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop create mode 100644 package/gluon-ebtables-segment-mld/Makefile create mode 100644 package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain create mode 100644 package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule create mode 100644 package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp create mode 100644 package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld create mode 100644 package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules diff --git a/docs/package/gluon-ebtables-segment-mld.rst b/docs/package/gluon-ebtables-segment-mld.rst new file mode 100644 index 00000000..7e197ece --- /dev/null +++ b/docs/package/gluon-ebtables-segment-mld.rst @@ -0,0 +1,16 @@ +gluon-ebtables-segment-mld +========================== + +These filters drop IGMP/MLD packets before they enter the mesh and +filter any IGMP/MLD packets coming from the mesh. + +IGMP/MLD have the concept of a local, elected Querier. For more +decentralization and increased robustness, the idea of this package is +to split the IGMP/MLD domain a querier is responsible for, allowing to +have a querier per node. The split IGMP/MLD domain will also reduce +overhead for this packet type, increasing scalability. + +Beware of the consequences of using this package though: You might need +to explicitly, manually mark ports on snooping switches leading towards +your mesh node as multicast router ports for now (Multicast Router +Discovery, MRD, not implemented yet). diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain deleted file mode 100644 index ec0013a3..00000000 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain +++ /dev/null @@ -1 +0,0 @@ -chain('MULTICAST_OUT', 'DROP') diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 index cb358157..0058ed86 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 @@ -1,3 +1,3 @@ -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type echo-request -j DROP' -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 139 -j DROP' -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN' +rule 'MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type echo-request -j RETURN' +rule 'MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 139 -j RETURN' -- ICMP Node Information Query +rule 'MULTICAST_OUT_ICMPV6 -j ACCEPT' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast deleted file mode 100644 index c52f122f..00000000 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast +++ /dev/null @@ -1,2 +0,0 @@ -rule 'FORWARD --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT' -rule 'OUTPUT --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop new file mode 100644 index 00000000..46ac01a5 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop @@ -0,0 +1 @@ +rule ('MULTICAST_OUT -j DROP') diff --git a/package/gluon-ebtables-segment-mld/Makefile b/package/gluon-ebtables-segment-mld/Makefile new file mode 100644 index 00000000..e3aacde1 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/Makefile @@ -0,0 +1,51 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-ebtables-segment-mld +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-ebtables-segment-mld + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Ebtables filters for IGMP/MLD packets + DEPENDS:=+gluon-core +gluon-ebtables +endef + +define Package/gluon-ebtables-segment-mld/description + Gluon community wifi mesh firmware framework: Ebtables filters for + IGMP/MLD packets + + These filters drop IGMP/MLD packets before they enter the mesh and + filter any IGMP/MLD packets coming from the mesh. + + IGMP/MLD have the concept of a local, elected Querier. For more + decentralization and increased robustness, the idea of this package is + to split the IGMP/MLD domain a querier is responsible for, allowing to + have a querier per node. The split IGMP/MLD domain will also reduce + overhead for this packet type, increasing scalability. + + Beware of the consequences of using this package though: You might need + to explicitly, manually mark ports on snooping switches leading towards + your mesh node as multicast router ports for now (Multicast Router + Discovery, MRD, not implemented yet). +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-ebtables-segment-mld/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-ebtables-segment-mld)) diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain new file mode 100644 index 00000000..69d6bf18 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain @@ -0,0 +1,2 @@ +chain('MULTICAST_IN', 'RETURN', 'nat') +chain('MULTICAST_IN_ICMPV6', 'RETURN', 'nat') diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule new file mode 100644 index 00000000..4eef2e7e --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule @@ -0,0 +1,2 @@ +rule ('PREROUTING -d Multicast --logical-in br-client -i bat0 -j MULTICAST_IN', 'nat') +rule ('MULTICAST_IN -p IPv6 --ip6-protocol ipv6-icmp -j MULTICAST_IN_ICMPV6', 'nat') diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp new file mode 100644 index 00000000..08052721 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp @@ -0,0 +1,2 @@ +rule('MULTICAST_OUT -p IPv4 --ip-protocol igmp -j DROP') +rule('MULTICAST_IN -p IPv4 --ip-protocol igmp -j DROP', 'nat') diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld new file mode 100644 index 00000000..b6090c22 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld @@ -0,0 +1,9 @@ +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 130 -j DROP') -- MLD Query +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 131 -j DROP') -- MLDv1 Report +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 132 -j DROP') -- MLDv1 Done +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 143 -j DROP') -- MLDv2 Report + +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 130 -j DROP', 'nat') -- MLD Query +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 131 -j DROP', 'nat') -- MLDv1 Report +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 132 -j DROP', 'nat') -- MLDv1 Done +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 143 -j DROP', 'nat') -- MLDv2 Report diff --git a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables index 5a770452..e6bffe96 100755 --- a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables +++ b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables @@ -24,12 +24,15 @@ exec_file() { local file="$1" /usr/bin/lua -e " - function rule(command) + function rule(command, table) + table = table or 'filter' os.execute($EBTABLES_RULE) end - function chain(name, policy) + function chain(name, policy, table) + table = table or 'filter' os.execute($EBTABLES_CHAIN) end + " "$file" } @@ -48,8 +51,8 @@ exec_all() { start() { ( - export EBTABLES_RULE='"ebtables -A " .. command' - export EBTABLES_CHAIN='"ebtables -N " .. name .. " -P " .. policy' + export EBTABLES_RULE='"ebtables -t " .. table .. " -A " .. command' + export EBTABLES_CHAIN='"ebtables -t " .. table .. " -N " .. name .. " -P " .. policy' if [ -z "$1" ]; then exec_all '' @@ -61,8 +64,8 @@ start() { stop() { ( - export EBTABLES_RULE='"ebtables -D " .. command' - export EBTABLES_CHAIN='"ebtables -X " .. name' + export EBTABLES_RULE='"ebtables -t " .. table .. " -D " .. command' + export EBTABLES_CHAIN='"ebtables -t " .. table .. " -X " .. name' if [ -z "$1" ]; then exec_all '-r' diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain index 31c19c53..e6bf98e3 100644 --- a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain @@ -1,2 +1,5 @@ chain('IN_ONLY', 'RETURN') chain('OUT_ONLY', 'RETURN') + +chain('MULTICAST_OUT', 'RETURN') +chain('MULTICAST_OUT_ICMPV6', 'RETURN') diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules b/package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules new file mode 100644 index 00000000..01609068 --- /dev/null +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules @@ -0,0 +1,4 @@ +rule 'OUTPUT -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT' +rule 'FORWARD -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT' + +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j MULTICAST_OUT_ICMPV6' From 2fac5b0cdcf411500d207eeecbe7ad573bb08f2f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 22 May 2016 19:06:01 +0200 Subject: [PATCH 027/184] docs: typo repositoy -> repository (#779) --- docs/user/getting_started.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index 6c614d70..abb8f8ba 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -130,7 +130,7 @@ not support IPv6. This is not true for kernel modules; the Gluon kernel is incompatible with the kernel of the default OpenWrt images. Therefore, Gluon will not only generate images, -but also an opkg repositoy containing all kernel modules provided by OpenWrt/Gluon +but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon for the kernel of the generated images. Signing keys From 33b4a9ce68e2f53a280beca6e7a9e8b5899bc02f Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 19 May 2016 21:09:10 +0200 Subject: [PATCH 028/184] ar71xx-generic: Add support for OpenMesh MR1750/OM5P-AC The new ath9k/ath10k based devices are only available in OpenWrt trunk. The relevant patches have to backported to add support for them in Gluon Signed-off-by: Sven Eckelmann --- docs/index.rst | 2 + ...l-support-for-the-OpenMesh-MR1750-bo.patch | 202 ++++++++++++ ...space-support-for-the-OpenMesh-MR175.patch | 67 ++++ ...radecfg-gen.sh-add-support-for-the-M.patch | 32 ++ ...e-sysupgrade-for-the-OpenMesh-MR1750.patch | 55 ++++ ...watchdog-add-OpenMesh-MR1750-support.patch | 23 ++ ...envtools-add-OpenMesh-MR1750-support.patch | 22 ++ ...ofile-and-build-image-for-the-OpenMe.patch | 57 ++++ ...e-list-of-bits-in-QCA955X_GMAC_REG_E.patch | 47 +++ ...cfg-helper-for-Open-Mesh-MR900-board.patch | 49 +++ ...use-ath79_gpio_output_select-on-QCA9.patch | 79 +++++ ...rt-for-ath79_gpio_function_-on-QCA95.patch | 32 ++ ...5X-GPIO-mux-and-function-definitions.patch | 159 ++++++++++ ...x-Use-PHY-fixups-for-Open-Mesh-MR900.patch | 78 +++++ ...-Use-PHY-fixups-for-Open-Mesh-MR1750.patch | 77 +++++ ...te-version-of-ath79_setup_qca955x_et.patch | 58 ++++ ...te-version-of-ath79_setup_qca955x_et.patch | 58 ++++ ...radecfg-gen.sh-Fix-u-boot-image-md5s.patch | 43 +++ ...radecfg-gen.sh-Generate-sha256sum-fo.patch | 50 +++ ...l-support-for-the-OpenMesh-OM5P-AC-b.patch | 265 ++++++++++++++++ ...space-support-for-the-OpenMesh-OM5P-.patch | 54 ++++ ...radecfg-gen.sh-add-support-for-the-O.patch | 32 ++ ...-sysupgrade-for-the-OpenMesh-OM5P-AC.patch | 59 ++++ ...atchdog-add-OpenMesh-OM5P-AC-support.patch | 24 ++ ...nvtools-add-OpenMesh-OM5P-AC-support.patch | 22 ++ ...th10k-wifi-board.bin-for-the-OpenMes.patch | 25 ++ ...ofile-and-build-image-for-the-OpenMe.patch | 53 ++++ ...l-support-for-the-OpenMesh-OM5P-ACv2.patch | 289 ++++++++++++++++++ ...space-support-for-the-OpenMesh-OM5P-.patch | 38 +++ ...ysupgrade-for-the-OpenMesh-OM5P-ACv2.patch | 46 +++ ...chdog-add-OpenMesh-OM5P-ACv2-support.patch | 23 ++ ...tools-add-OpenMesh-OM5P-ACv2-support.patch | 22 ++ ...th10k-wifi-board.bin-for-the-OpenMes.patch | 24 ++ ...add-OM5P-ACv2-to-the-OM5P-AC-profile.patch | 29 ++ targets/ar71xx-generic/profiles.mk | 9 + 35 files changed, 2204 insertions(+) create mode 100644 patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch create mode 100644 patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch create mode 100644 patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch create mode 100644 patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch create mode 100644 patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch create mode 100644 patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch create mode 100644 patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch create mode 100644 patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch create mode 100644 patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch create mode 100644 patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch create mode 100644 patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch create mode 100644 patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch create mode 100644 patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch create mode 100644 patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch create mode 100644 patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch create mode 100644 patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch create mode 100644 patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch create mode 100644 patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch create mode 100644 patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch create mode 100644 patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch create mode 100644 patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch create mode 100644 patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch create mode 100644 patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch create mode 100644 patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch create mode 100644 patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch create mode 100644 patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch create mode 100644 patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch create mode 100644 patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch create mode 100644 patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch create mode 100644 patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch create mode 100644 patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch create mode 100644 patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch create mode 100644 patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch diff --git a/docs/index.rst b/docs/index.rst index 6b047b33..37f8e0f1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -133,12 +133,14 @@ ar71xx-generic * OpenMesh + - MR1750 - MR600 (v1, v2) - MR900 (v1, v2) - OM2P (v1, v2) - OM2P-HS (v1, v2) - OM2P-LC - OM5P + - OM5P-AC (v1, v2) - OM5P-AN * TP-Link diff --git a/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch b/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch new file mode 100644 index 00000000..35dcac61 --- /dev/null +++ b/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch @@ -0,0 +1,202 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:10:43 +0000 +Subject: ar71xx: add kernel support for the OpenMesh MR1750 board + +Signed-off-by: Sven Eckelmann + +Backport of r46926 + +Forwarded: https://patchwork.ozlabs.org/patch/624173/ + +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index 9a81911..c5a3c9a 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -79,6 +79,7 @@ CONFIG_ATH79_MACH_JWAP003=y + CONFIG_ATH79_MACH_MC_MAC1200R=y + CONFIG_ATH79_MACH_MR16=y + CONFIG_ATH79_MACH_MR12=y ++CONFIG_ATH79_MACH_MR1750=y + CONFIG_ATH79_MACH_MR600=y + CONFIG_ATH79_MACH_MR900=y + CONFIG_ATH79_MACH_MYNET_N600=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +new file mode 100644 +index 0000000..8ace02f +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -0,0 +1,129 @@ ++/* ++ * MR1750 board support ++ * ++ * Copyright (c) 2012 Qualcomm Atheros ++ * Copyright (c) 2012-2013 Marek Lindner ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ * ++ */ ++ ++#include ++#include ++ ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-gpio-buttons.h" ++#include "dev-eth.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++#include "pci.h" ++ ++#define MR1750_GPIO_LED_LAN 12 ++#define MR1750_GPIO_LED_WLAN_2G 13 ++#define MR1750_GPIO_LED_STATUS_GREEN 19 ++#define MR1750_GPIO_LED_STATUS_RED 21 ++#define MR1750_GPIO_LED_POWER 22 ++#define MR1750_GPIO_LED_WLAN_5G 23 ++ ++#define MR1750_GPIO_BTN_RESET 17 ++ ++#define MR1750_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define MR1750_KEYS_DEBOUNCE_INTERVAL (3 * MR1750_KEYS_POLL_INTERVAL) ++ ++#define MR1750_MAC0_OFFSET 0 ++#define MR1750_WMAC_CALDATA_OFFSET 0x1000 ++ ++static struct gpio_led mr1750_leds_gpio[] __initdata = { ++ { ++ .name = "mr1750:blue:power", ++ .gpio = MR1750_GPIO_LED_POWER, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:blue:wan", ++ .gpio = MR1750_GPIO_LED_LAN, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:blue:wlan24", ++ .gpio = MR1750_GPIO_LED_WLAN_2G, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:blue:wlan58", ++ .gpio = MR1750_GPIO_LED_WLAN_5G, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:green:status", ++ .gpio = MR1750_GPIO_LED_STATUS_GREEN, ++ .active_low = 1, ++ }, ++ { ++ .name = "mr1750:red:status", ++ .gpio = MR1750_GPIO_LED_STATUS_RED, ++ .active_low = 1, ++ }, ++}; ++ ++static struct gpio_keys_button mr1750_gpio_keys[] __initdata = { ++ { ++ .desc = "Reset button", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = MR1750_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = MR1750_GPIO_BTN_RESET, ++ .active_low = 1, ++ }, ++}; ++ ++static void __init mr1750_setup(void) ++{ ++ u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); ++ u8 mac[6]; ++ ++ ath79_eth0_pll_data.pll_1000 = 0xbe000101; ++ ath79_eth0_pll_data.pll_100 = 0x80000101; ++ ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ++ ath79_register_m25p80(NULL); ++ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(mr1750_leds_gpio), ++ mr1750_leds_gpio); ++ ath79_register_gpio_keys_polled(-1, MR1750_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(mr1750_gpio_keys), ++ mr1750_gpio_keys); ++ ++ ath79_init_mac(mac, art + MR1750_MAC0_OFFSET, 1); ++ ath79_register_wmac(art + MR1750_WMAC_CALDATA_OFFSET, mac); ++ ath79_register_pci(); ++ ++ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); ++ ath79_register_mdio(0, 0x0); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art + MR1750_MAC0_OFFSET, 0); ++ ++ /* GMAC0 is connected to the RMGII interface */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.phy_mask = BIT(5); ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ++ ath79_register_eth(0); ++} ++ ++MIPS_MACHINE(ATH79_MACH_MR1750, "MR1750", "OpenMesh MR1750", mr1750_setup); +diff --git a/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch +new file mode 100644 +index 0000000..d802a12 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-mr1750-support.patch +@@ -0,0 +1,39 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -763,6 +763,16 @@ config ATH79_MACH_CAP4200AG ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_MR1750 +++ bool "OpenMesh MR1750 board support" +++ select SOC_QCA955X +++ 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_MR900 ++ bool "OpenMesh MR900 board support" ++ select SOC_QCA955X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -80,6 +80,7 @@ obj-$(CONFIG_ATH79_MACH_HORNET_UB) += ma ++ obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o ++ obj-$(CONFIG_ATH79_MACH_MR12) += mach-mr12.o ++ obj-$(CONFIG_ATH79_MACH_MR16) += mach-mr16.o +++obj-$(CONFIG_ATH79_MACH_MR1750) += mach-mr1750.o ++ obj-$(CONFIG_ATH79_MACH_MR600) += mach-mr600.o ++ obj-$(CONFIG_ATH79_MACH_MR900) += mach-mr900.o ++ obj-$(CONFIG_ATH79_MACH_MYNET_N600) += mach-mynet-n600.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -69,6 +69,7 @@ enum ath79_mach_type { ++ ATH79_MACH_HORNET_UB, /* ALFA Networks Hornet-UB */ ++ ATH79_MACH_MR12, /* Cisco Meraki MR12 */ ++ ATH79_MACH_MR16, /* Cisco Meraki MR16 */ +++ ATH79_MACH_MR1750, /* OpenMesh MR1750 */ ++ ATH79_MACH_MR600V2, /* OpenMesh MR600v2 */ ++ ATH79_MACH_MR600, /* OpenMesh MR600 */ ++ ATH79_MACH_MR900, /* OpenMesh MR900 */ diff --git a/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch b/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch new file mode 100644 index 00000000..3e6363c7 --- /dev/null +++ b/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch @@ -0,0 +1,67 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:01 +0000 +Subject: ar71xx: add user-space support for the OpenMesh MR1750 board + +Signed-off-by: Sven Eckelmann + +Backport of r46927 + +Forwarded: https://patchwork.ozlabs.org/patch/624174/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 775aac6..44d2ddf 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -143,6 +143,9 @@ get_status_led() { + mr600v2) + status_led="mr600:blue:power" + ;; ++ mr1750) ++ status_led="mr1750:blue:power" ++ ;; + mr900 | \ + mr900v2) + status_led="mr900:blue:power" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index a4b355a..c451124 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -239,6 +239,12 @@ mr600) + ucidef_set_led_wlan "wlan58" "WLAN58" "mr600:green:wlan58" "phy0tpt" + ;; + ++mr1750) ++ ucidef_set_led_netdev "lan" "LAN" "mr1750:blue:wan" "eth0" ++ ucidef_set_led_wlan "wlan58" "WLAN58" "mr1750:blue:wlan58" "phy0tpt" ++ ucidef_set_led_wlan "wlan24" "WLAN24" "mr1750:blue:wlan24" "phy1tpt" ++ ;; ++ + mr900 | \ + mr900v2) + ucidef_set_led_netdev "lan" "LAN" "mr900:blue:wan" "eth0" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 0a23756..4066506 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -334,6 +334,7 @@ eap300v2 |\ + eap7660d |\ + el-mini |\ + loco-m-xw |\ ++mr1750 |\ + mr600 |\ + mr600v2 |\ + mr900 |\ +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 7fc951a..587d029 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -562,6 +562,9 @@ ar71xx_board_detect() { + *MR600v2) + name="mr600v2" + ;; ++ *MR1750) ++ name="mr1750" ++ ;; + *MR600) + name="mr600" + ;; diff --git a/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch b/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch new file mode 100644 index 00000000..66b0bc4f --- /dev/null +++ b/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch @@ -0,0 +1,32 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:18 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: add support for the MR1750 + +Signed-off-by: Sven Eckelmann + +Backport of r46928 + +Forwarded: https://patchwork.ozlabs.org/patch/624175/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index e132954..c790214 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -7,7 +7,7 @@ + # + + usage() { +- echo "Usage: $0 " ++ echo "Usage: $0 " + rm -f $CFG_OUT + exit 1 + } +@@ -26,7 +26,7 @@ case $CE_TYPE in + FLASH_BS=262144 + MD5_SKIP_BLOCKS=1 + ;; +- OM5P|MR600|MR900) ++ OM5P|MR600|MR900|MR1750) + MAX_PART_SIZE=7808 + KERNEL_FLASH_ADDR=0xb0000 + FLASH_BS=65536 diff --git a/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch b/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch new file mode 100644 index 00000000..dc595593 --- /dev/null +++ b/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch @@ -0,0 +1,55 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:24 +0000 +Subject: ar71xx: enable sysupgrade for the OpenMesh MR1750 + +Signed-off-by: Sven Eckelmann + +Backport of r46929 + +Forwarded: https://patchwork.ozlabs.org/patch/624176/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 547116e..9ca0f5b 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -72,6 +72,11 @@ platform_check_image_openmesh() + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; ++ MR1750) ++ [ "$board" = "mr1750" ] && break ++ echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" ++ return 1 ++ ;; + MR600) + [ "$board" = "mr600" ] && break + [ "$board" = "mr600v2" ] && break +@@ -157,7 +162,7 @@ platform_do_upgrade_openmesh() + kernel_start_addr1=0x9f1c0000 + kernel_start_addr2=0x9f8c0000 + ;; +- OM5P|MR600|MR900) ++ OM5P|MR600|MR900|MR1750) + block_size=$((64 * 1024)) + total_size=7995392 + kernel_start_addr1=0x9f0b0000 +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 0e9833d..ac060ea 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -296,6 +296,7 @@ platform_check_image() { + + return 0; + ;; ++ mr1750 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ +@@ -528,6 +529,7 @@ platform_do_upgrade() { + tew-673gru) + platform_do_upgrade_dir825b "$ARGV" + ;; ++ mr1750 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ diff --git a/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch b/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch new file mode 100644 index 00000000..e16fb3ef --- /dev/null +++ b/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch @@ -0,0 +1,23 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:35 +0000 +Subject: package/om-watchdog: add OpenMesh MR1750 support + +Signed-off-by: Sven Eckelmann + +Backport of r46930 + +Forwarded: https://patchwork.ozlabs.org/patch/624177/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index 135fef7..c792968 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -25,7 +25,7 @@ boot() { + "mr600v2") + service_start /sbin/om-watchdog 15 + ;; +- "mr900"|"mr900v2") ++ "mr900"|"mr900v2"|"mr1750") + service_start /sbin/om-watchdog 16 + ;; + esac diff --git a/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch b/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch new file mode 100644 index 00000000..8e975a1c --- /dev/null +++ b/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch @@ -0,0 +1,22 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:43 +0000 +Subject: package/uboot-envtools: add OpenMesh MR1750 support + +Signed-off-by: Sven Eckelmann + +Backport of r46931 + +Forwarded: https://patchwork.ozlabs.org/patch/624178/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index ec8541c..ef00f17 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -21,6 +21,7 @@ carambola2 | \ + eap300v2 | \ + hornet-ub | \ + hornet-ub-x2 | \ ++mr1750 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ diff --git a/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch b/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch new file mode 100644 index 00000000..2a166e16 --- /dev/null +++ b/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch @@ -0,0 +1,57 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:11:51 +0000 +Subject: ar71xx: create profile and build image for the OpenMesh MR1750 board + +Signed-off-by: Sven Eckelmann + +Backport of r46932 + +Forwarded: https://patchwork.ozlabs.org/patch/624179/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index 41b462e..06cf135 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -49,9 +49,20 @@ endef + + $(eval $(call Profile,MR900)) + ++define Profile/MR1750 ++ NAME:=OpenMesh MR1750 ++ PACKAGES:=kmod-ath9k kmod-ath10k ath10k-firmware-qca988x ++endef ++ ++define Profile/MR1750/Description ++ Package set optimized for the OpenMesh MR1750. ++endef ++ ++$(eval $(call Profile,MR1750)) ++ + define Profile/OPENMESH + NAME:=OpenMesh products +- PACKAGES:=kmod-ath9k om-watchdog ++ PACKAGES:=kmod-ath9k kmod-ath10k om-watchdog + endef + + define Profile/OPENMESH/Description +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index f91e20e..b74aa45 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2045,6 +2045,7 @@ $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900)) ++$(eval $(call SingleProfile,OpenMesh,squashfs-only,MR1750,mr1750,,,,MR1750)) + + $(eval $(call SingleProfile,PB4X,128k,ALL0305,all0305,ALL0305,ttyS0,115200)) + $(eval $(call SingleProfile,PB4X,128k,EAP7660D,eap7660d,EAP7660D,ttyS0,115200)) +@@ -2138,7 +2139,7 @@ $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M)) + $(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3)) + $(eval $(call MultiProfile,AP136,AP136_010 AP136_020)) + $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M)) +-$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900)) ++$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900 MR1750)) + $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY)) + $(eval $(call MultiProfile,TLMR3220,TLMR3220V1)) + $(eval $(call MultiProfile,TLMR3420,TLMR3420V1)) diff --git a/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch b/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch new file mode 100644 index 00000000..efe4b609 --- /dev/null +++ b/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch @@ -0,0 +1,47 @@ +From: Sven Eckelmann +Date: Wed, 16 Mar 2016 09:27:01 +0000 +Subject: ar71xx: Extend the list of bits in QCA955X_GMAC_REG_ETH_CFG + +Signed-off-by: Sven Eckelmann + +Backport of r49027 + +Forwarded: https://patchwork.ozlabs.org/patch/624180/ + +diff --git a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +index 8bf7658..797977f 100644 +--- a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch ++++ b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +@@ -207,7 +207,7 @@ + #define AR934X_GPIO_REG_FUNC 0x6c + + #define AR71XX_GPIO_COUNT 16 +-@@ -560,4 +663,153 @@ ++@@ -560,4 +663,170 @@ + #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 + #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 + +@@ -358,6 +358,23 @@ + +#define QCA955X_GMAC_REG_ETH_CFG 0x00 + + + +#define QCA955X_ETH_CFG_RGMII_EN BIT(0) +++#define QCA955X_ETH_CFG_MII_GE0 BIT(1) +++#define QCA955X_ETH_CFG_GMII_GE0 BIT(2) +++#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3) +++#define QCA955X_ETH_CFG_MII_GE0_SLAVE BIT(4) +++#define QCA955X_ETH_CFG_GE0_ERR_EN BIT(5) + +#define QCA955X_ETH_CFG_GE0_SGMII BIT(6) +++#define QCA955X_ETH_CFG_RMII_GE0 BIT(10) +++#define QCA955X_ETH_CFG_MII_CNTL_SPEED BIT(11) +++#define QCA955X_ETH_CFG_RMII_GE0_MASTER BIT(12) +++#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14 +++#define QCA955X_ETH_CFG_RDV_DELAY BIT(16) +++#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16 +++#define QCA955X_ETH_CFG_TXD_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_TXD_DELAY_SHIFT 18 +++#define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 +++#define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 + + + #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch b/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch new file mode 100644 index 00000000..43a876d2 --- /dev/null +++ b/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch @@ -0,0 +1,49 @@ +From: Sven Eckelmann +Date: Tue, 7 Jul 2015 13:47:39 +0000 +Subject: ar71xx: Use *_eth_cfg helper for Open Mesh MR900 boards + +Signed-off-by: Sven Eckelmann + +Backport of r46241 + +Forwarded: https://patchwork.ozlabs.org/patch/624181/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +index fe3e1fa..9c3164d 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +@@ -94,24 +94,6 @@ static struct gpio_keys_button mr900_gpio_keys[] __initdata = { + }, + }; + +- +-static void __init mr900_gmac_setup(void) +-{ +- void __iomem *base; +- u32 t; +- +- base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); +- +- t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG); +- +- t &= ~(QCA955X_ETH_CFG_RGMII_EN | QCA955X_ETH_CFG_GE0_SGMII); +- t |= QCA955X_ETH_CFG_RGMII_EN; +- +- __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); +- +- iounmap(base); +-} +- + static void __init mr900_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); +@@ -141,8 +123,7 @@ static void __init mr900_setup(void) + } + pdata->use_eeprom = true; + +- mr900_gmac_setup(); +- ++ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + ath79_register_mdio(0, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR900_MAC0_OFFSET, 0); diff --git a/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch b/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch new file mode 100644 index 00000000..137aa9d4 --- /dev/null +++ b/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch @@ -0,0 +1,79 @@ +From: Sven Eckelmann +Date: Fri, 24 Jul 2015 09:10:00 +0000 +Subject: ar71xx: Allow to use ath79_gpio_output_select on QCA955x + +Signed-off-by: Sven Eckelmann + +Backport of r46459 + +Forwarded: https://patchwork.ozlabs.org/patch/624182/ + +diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +new file mode 100644 +index 0000000..e71b6e2 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +@@ -0,0 +1,63 @@ ++--- a/arch/mips/ath79/gpio.c +++++ b/arch/mips/ath79/gpio.c ++@@ -187,15 +187,30 @@ void __init ath79_gpio_output_select(uns ++ { ++ void __iomem *base = ath79_gpio_base; ++ unsigned long flags; ++- unsigned int reg; +++ unsigned int reg, reg_base; +++ unsigned long gpio_count; ++ u32 t, s; ++ ++- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x()); +++ if (soc_is_ar934x()) { +++ gpio_count = AR934X_GPIO_COUNT; +++ reg_base = AR934X_GPIO_REG_OUT_FUNC0; +++ } else if (soc_is_qca953x()) { +++ gpio_count = QCA953X_GPIO_COUNT; +++ reg_base = QCA953X_GPIO_REG_OUT_FUNC0; +++ } else if (soc_is_qca955x()) { +++ gpio_count = QCA955X_GPIO_COUNT; +++ reg_base = QCA955X_GPIO_REG_OUT_FUNC0; +++ } else if (soc_is_qca956x()) { +++ gpio_count = QCA956X_GPIO_COUNT; +++ reg_base = QCA956X_GPIO_REG_OUT_FUNC0; +++ } else { +++ BUG(); +++ } ++ ++- if (gpio >= AR934X_GPIO_COUNT) +++ if (gpio >= gpio_count) ++ return; ++ ++- reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4); +++ reg = reg_base + 4 * (gpio / 4); ++ s = 8 * (gpio % 4); ++ ++ spin_lock_irqsave(&ath79_gpio_lock, flags); ++--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++@@ -875,6 +875,14 @@ ++ #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 ++ #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 ++ +++#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c +++#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 +++#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 +++#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 +++#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c +++#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 +++#define QCA955X_GPIO_REG_FUNC 0x6c +++ ++ #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c ++ #define QCA956X_GPIO_REG_OUT_FUNC1 0x30 ++ #define QCA956X_GPIO_REG_OUT_FUNC2 0x34 ++@@ -1014,6 +1022,8 @@ ++ #define AR934X_GPIO_OUT_EXT_LNA0 46 ++ #define AR934X_GPIO_OUT_EXT_LNA1 47 ++ +++#define QCA955X_GPIO_OUT_GPIO 0 +++ ++ /* ++ * MII_CTRL block ++ */ diff --git a/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch b/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch new file mode 100644 index 00000000..23b42cb6 --- /dev/null +++ b/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch @@ -0,0 +1,32 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:27 +0000 +Subject: ar71xx: Add support for ath79_gpio_function_* on QCA955X + +Signed-off-by: Sven Eckelmann + +Backport of r49074 + +Forwarded: https://patchwork.ozlabs.org/patch/624183/ + +diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +index e71b6e2..0e87357 100644 +--- a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +@@ -1,6 +1,16 @@ + --- a/arch/mips/ath79/gpio.c + +++ b/arch/mips/ath79/gpio.c +-@@ -187,15 +187,30 @@ void __init ath79_gpio_output_select(uns ++@@ -146,7 +146,8 @@ static void __iomem *ath79_gpio_get_func ++ if (soc_is_ar71xx() || ++ soc_is_ar724x() || ++ soc_is_ar913x() || ++- soc_is_ar933x()) +++ soc_is_ar933x() || +++ soc_is_qca955x()) ++ reg = AR71XX_GPIO_REG_FUNC; ++ else if (soc_is_ar934x() || ++ soc_is_qca953x() || ++@@ -187,15 +188,30 @@ void __init ath79_gpio_output_select(uns + { + void __iomem *base = ath79_gpio_base; + unsigned long flags; diff --git a/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch b/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch new file mode 100644 index 00000000..ee3c3674 --- /dev/null +++ b/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch @@ -0,0 +1,159 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:31 +0000 +Subject: ar71xx: Add QCA955X GPIO mux and function definitions + +Signed-off-by: Sven Eckelmann + +Backport of r49075 + +Forwarded: https://patchwork.ozlabs.org/patch/624184/ + +diff --git a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +index 797977f..0126f6a 100644 +--- a/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch ++++ b/target/linux/ar71xx/patches-3.18/601-MIPS-ath79-add-more-register-defines.patch +@@ -194,7 +194,7 @@ + #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) + + #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) +-@@ -529,6 +626,12 @@ ++@@ -529,8 +626,22 @@ + #define AR71XX_GPIO_REG_INT_ENABLE 0x24 + #define AR71XX_GPIO_REG_FUNC 0x28 + +@@ -206,8 +206,18 @@ + +#define AR934X_GPIO_REG_OUT_FUNC5 0x40 + #define AR934X_GPIO_REG_FUNC 0x6c + +++#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c +++#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 +++#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 +++#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 +++#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c +++#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 +++#define QCA955X_GPIO_REG_FUNC 0x6c +++ + #define AR71XX_GPIO_COUNT 16 +-@@ -560,4 +663,170 @@ ++ #define AR7240_GPIO_COUNT 18 ++ #define AR7241_GPIO_COUNT 20 ++@@ -560,4 +671,235 @@ + #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 + #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 + +@@ -288,6 +298,71 @@ + +#define AR934X_GPIO_OUT_EXT_LNA0 46 + +#define AR934X_GPIO_OUT_EXT_LNA1 47 + + +++#define QCA955X_GPIO_FUNC_CLK_OBS7_EN BIT(9) +++#define QCA955X_GPIO_FUNC_CLK_OBS6_EN BIT(8) +++#define QCA955X_GPIO_FUNC_CLK_OBS5_EN BIT(7) +++#define QCA955X_GPIO_FUNC_CLK_OBS4_EN BIT(6) +++#define QCA955X_GPIO_FUNC_CLK_OBS3_EN BIT(5) +++#define QCA955X_GPIO_FUNC_CLK_OBS2_EN BIT(4) +++#define QCA955X_GPIO_FUNC_CLK_OBS1_EN BIT(3) +++#define QCA955X_GPIO_FUNC_JTAG_DISABLE BIT(1) +++ +++#define QCA955X_GPIO_OUT_GPIO 0 +++#define QCA955X_MII_EXT_MDI 1 +++#define QCA955X_SLIC_DATA_OUT 3 +++#define QCA955X_SLIC_PCM_FS 4 +++#define QCA955X_SLIC_PCM_CLK 5 +++#define QCA955X_SPI_CLK 8 +++#define QCA955X_SPI_CS_0 9 +++#define QCA955X_SPI_CS_1 10 +++#define QCA955X_SPI_CS_2 11 +++#define QCA955X_SPI_MISO 12 +++#define QCA955X_I2S_CLK 13 +++#define QCA955X_I2S_WS 14 +++#define QCA955X_I2S_SD 15 +++#define QCA955X_I2S_MCK 16 +++#define QCA955X_SPDIF_OUT 17 +++#define QCA955X_UART1_TD 18 +++#define QCA955X_UART1_RTS 19 +++#define QCA955X_UART1_RD 20 +++#define QCA955X_UART1_CTS 21 +++#define QCA955X_UART0_SOUT 22 +++#define QCA955X_SPDIF2_OUT 23 +++#define QCA955X_LED_SGMII_SPEED0 24 +++#define QCA955X_LED_SGMII_SPEED1 25 +++#define QCA955X_LED_SGMII_DUPLEX 26 +++#define QCA955X_LED_SGMII_LINK_UP 27 +++#define QCA955X_SGMII_SPEED0_INVERT 28 +++#define QCA955X_SGMII_SPEED1_INVERT 29 +++#define QCA955X_SGMII_DUPLEX_INVERT 30 +++#define QCA955X_SGMII_LINK_UP_INVERT 31 +++#define QCA955X_GE1_MII_MDO 32 +++#define QCA955X_GE1_MII_MDC 33 +++#define QCA955X_SWCOM2 38 +++#define QCA955X_SWCOM3 39 +++#define QCA955X_MAC2_GPIO 40 +++#define QCA955X_MAC3_GPIO 41 +++#define QCA955X_ATT_LED 42 +++#define QCA955X_PWR_LED 43 +++#define QCA955X_TX_FRAME 44 +++#define QCA955X_RX_CLEAR_EXTERNAL 45 +++#define QCA955X_LED_NETWORK_EN 46 +++#define QCA955X_LED_POWER_EN 47 +++#define QCA955X_WMAC_GLUE_WOW 68 +++#define QCA955X_RX_CLEAR_EXTENSION 70 +++#define QCA955X_CP_NAND_CS1 73 +++#define QCA955X_USB_SUSPEND 74 +++#define QCA955X_ETH_TX_ERR 75 +++#define QCA955X_DDR_DQ_OE 76 +++#define QCA955X_CLKREQ_N_EP 77 +++#define QCA955X_CLKREQ_N_RC 78 +++#define QCA955X_CLK_OBS0 79 +++#define QCA955X_CLK_OBS1 80 +++#define QCA955X_CLK_OBS2 81 +++#define QCA955X_CLK_OBS3 82 +++#define QCA955X_CLK_OBS4 83 +++#define QCA955X_CLK_OBS5 84 +++ + +/* + + * MII_CTRL block + + */ +diff --git a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +index 0e87357..8a54859 100644 +--- a/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch ++++ b/target/linux/ar71xx/patches-3.18/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +@@ -37,37 +37,12 @@ + + } + + - if (gpio >= AR934X_GPIO_COUNT) ++- return; + + if (gpio >= gpio_count) +- return; +++ return; + + - reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4); + + reg = reg_base + 4 * (gpio / 4); + s = 8 * (gpio % 4); + + spin_lock_irqsave(&ath79_gpio_lock, flags); +---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +-+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +-@@ -875,6 +875,14 @@ +- #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 +- #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 +- +-+#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c +-+#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 +-+#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 +-+#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 +-+#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c +-+#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 +-+#define QCA955X_GPIO_REG_FUNC 0x6c +-+ +- #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c +- #define QCA956X_GPIO_REG_OUT_FUNC1 0x30 +- #define QCA956X_GPIO_REG_OUT_FUNC2 0x34 +-@@ -1014,6 +1022,8 @@ +- #define AR934X_GPIO_OUT_EXT_LNA0 46 +- #define AR934X_GPIO_OUT_EXT_LNA1 47 +- +-+#define QCA955X_GPIO_OUT_GPIO 0 +-+ +- /* +- * MII_CTRL block +- */ diff --git a/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch b/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch new file mode 100644 index 00000000..6a32c80b --- /dev/null +++ b/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch @@ -0,0 +1,78 @@ +From: Sven Eckelmann +Date: Wed, 16 Mar 2016 09:27:11 +0000 +Subject: ar71xx: Use PHY fixups for Open Mesh MR900 + +The delays of PHY/MAC on the MR900 are done by u-boot and OpenWrt in +different ways. u-boot only modifies the ETH_CFG of the QCA955x based on +the link speed. But OpenWrt can only modify the PHY delays based on the +link speed. + +This can lead to communication problems when u-boot initializes the ETH_CFG +for a specific link speed (e.g. 10BASE-T) but then OpenWrt the sets the PHY +delays to an incompatible value. + +Instead reset the ETH_CFG delay bits of the QCA955x to a specific value and +only rely on the AT803x PHY settings. + +Signed-off-by: Sven Eckelmann + +Backport of r49030 + +Forwarded: https://patchwork.ozlabs.org/patch/624185/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +index 9c3164d..3634bf0 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +@@ -23,6 +23,7 @@ + #include + + #include ++#include + + #include "common.h" + #include "dev-ap9x-pci.h" +@@ -94,15 +95,30 @@ static struct gpio_keys_button mr900_gpio_keys[] __initdata = { + }, + }; + ++static struct at803x_platform_data mr900_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 0, ++ .fixup_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info mr900_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 5, ++ .platform_data = &mr900_at803x_data, ++ }, ++}; ++ + static void __init mr900_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); + u8 mac[6], pcie_mac[6]; + struct ath9k_platform_data *pdata; + +- ath79_eth0_pll_data.pll_1000 = 0xbe000101; +- ath79_eth0_pll_data.pll_100 = 0x80000101; +- ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_eth0_pll_data.pll_1000 = 0xae000000; ++ ath79_eth0_pll_data.pll_100 = 0xa0000101; ++ ath79_eth0_pll_data.pll_10 = 0xa0001313; + + ath79_register_m25p80(NULL); + +@@ -126,6 +142,9 @@ static void __init mr900_setup(void) + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + ath79_register_mdio(0, 0x0); + ++ mdiobus_register_board_info(mr900_mdio0_info, ++ ARRAY_SIZE(mr900_mdio0_info)); ++ + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR900_MAC0_OFFSET, 0); + + /* GMAC0 is connected to the RMGII interface */ diff --git a/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch b/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch new file mode 100644 index 00000000..50ff879c --- /dev/null +++ b/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch @@ -0,0 +1,77 @@ +From: Sven Eckelmann +Date: Wed, 16 Mar 2016 09:27:14 +0000 +Subject: ar71xx: Use PHY fixups for Open Mesh MR1750 + +The delays of PHY/MAC on the MR1750 are done by u-boot and OpenWrt in +different ways. u-boot only modifies the ETH_CFG of the QCA955x based on +the link speed. But OpenWrt can only modify the PHY delays based on the +link speed. + +This can lead to communication problems when u-boot initializes the ETH_CFG +for a specific link speed (e.g. 10BASE-T) but then OpenWrt the sets the PHY +delays to an incompatible value. + +Instead reset the ETH_CFG delay bits of the QCA955x to a specific value and +only rely on the AT803x PHY settings. + +Signed-off-by: Sven Eckelmann + +Backport of r49031 + +Forwarded: https://patchwork.ozlabs.org/patch/624186/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +index 8ace02f..f9e45bd 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include "common.h" + #include "dev-ap9x-pci.h" +@@ -92,14 +93,29 @@ static struct gpio_keys_button mr1750_gpio_keys[] __initdata = { + }, + }; + ++static struct at803x_platform_data mr1750_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 0, ++ .fixup_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info mr1750_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 5, ++ .platform_data = &mr1750_at803x_data, ++ }, ++}; ++ + static void __init mr1750_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); + u8 mac[6]; + +- ath79_eth0_pll_data.pll_1000 = 0xbe000101; +- ath79_eth0_pll_data.pll_100 = 0x80000101; +- ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_eth0_pll_data.pll_1000 = 0xae000000; ++ ath79_eth0_pll_data.pll_100 = 0xa0000101; ++ ath79_eth0_pll_data.pll_10 = 0xa0001313; + + ath79_register_m25p80(NULL); + +@@ -116,6 +132,9 @@ static void __init mr1750_setup(void) + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + ath79_register_mdio(0, 0x0); + ++ mdiobus_register_board_info(mr1750_mdio0_info, ++ ARRAY_SIZE(mr1750_mdio0_info)); ++ + ath79_init_mac(ath79_eth0_data.mac_addr, art + MR1750_MAC0_OFFSET, 0); + + /* GMAC0 is connected to the RMGII interface */ diff --git a/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch b/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch new file mode 100644 index 00000000..3567a32f --- /dev/null +++ b/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch @@ -0,0 +1,58 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:09 +0000 +Subject: ar71xx: Use private version of ath79_setup_qca955x_eth_cfg for MR900 + +The MR900 must unset some bits in ETH_CFG which were set by u-boot to work +correctly under OpenWrt. But the global function +ath79_setup_qca955x_eth_cfg will not unset all of them to increase the +backward compatiblity with older mach-* files. A private (simplified) +version for MR900 can be used instead. + +Signed-off-by: Sven Eckelmann + +Backport of r49069 + +Forwarded: https://patchwork.ozlabs.org/patch/624187/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +index 3634bf0..b439f58 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c +@@ -110,6 +110,28 @@ static struct mdio_board_info mr900_mdio0_info[] = { + }, + }; + ++static void __init mr900_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ + static void __init mr900_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); +@@ -139,7 +161,7 @@ static void __init mr900_setup(void) + } + pdata->use_eeprom = true; + +- ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); ++ mr900_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); + ath79_register_mdio(0, 0x0); + + mdiobus_register_board_info(mr900_mdio0_info, diff --git a/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch b/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch new file mode 100644 index 00000000..8ea16499 --- /dev/null +++ b/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch @@ -0,0 +1,58 @@ +From: Sven Eckelmann +Date: Wed, 23 Mar 2016 12:52:12 +0000 +Subject: ar71xx: Use private version of ath79_setup_qca955x_eth_cfg for MR1750 + +The MR1750 must unset some bits in ETH_CFG which were set by u-boot to work +correctly under OpenWrt. But the global function +ath79_setup_qca955x_eth_cfg will not unset all of them to increase the +backward compatiblity with older mach-* files. A private (simplified) +version for MR1750 can be used instead. + +Signed-off-by: Sven Eckelmann + +Backport of r49070 + +Forwarded: https://patchwork.ozlabs.org/patch/624188/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +index f9e45bd..e3c04e7 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -108,6 +108,28 @@ static struct mdio_board_info mr1750_mdio0_info[] = { + }, + }; + ++static void __init mr1750_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ + static void __init mr1750_setup(void) + { + u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); +@@ -129,7 +151,7 @@ static void __init mr1750_setup(void) + ath79_register_wmac(art + MR1750_WMAC_CALDATA_OFFSET, mac); + ath79_register_pci(); + +- ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); ++ mr1750_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); + ath79_register_mdio(0, 0x0); + + mdiobus_register_board_info(mr1750_mdio0_info, diff --git a/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch b/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch new file mode 100644 index 00000000..30658cdb --- /dev/null +++ b/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch @@ -0,0 +1,43 @@ +From: Sven Eckelmann +Date: Mon, 14 Sep 2015 20:10:10 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: Fix u-boot image md5sum check + +The u-boot on Open Mesh devices checks the whole transfered image against a +md5sum. This is stored inside the option filemd5sum inside the +fwupgrade.cfg. The bootloader will not check it when this setting is +missing and could therefore write invalid images to the flash. + +Signed-off-by: Sven Eckelmann + +Backport of r46925 + +Forwarded: https://patchwork.ozlabs.org/patch/624189/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index c790214..fab1582 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -48,6 +48,7 @@ ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); p + ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") + ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS)) + ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *}) ++ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *}) + ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) + ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) + +@@ -55,6 +56,7 @@ cat << EOF > $CFG_OUT + [vmlinux] + filename=kernel + md5sum=$KERNEL_MD5 ++filemd5sum=$KERNEL_MD5 + flashaddr=$KERNEL_FLASH_ADDR + checksize=0x0 + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv +@@ -63,6 +65,7 @@ cmd_fail=reset + [rootfs] + filename=rootfs + md5sum=$ROOTFS_MD5 ++filemd5sum=$ROOTFS_MD5_FULL + flashaddr=$ROOTFS_FLASH_ADDR + checksize=$ROOTFS_CHECK_SIZE + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; setenv rootfs_size_1 $ROOTFS_PART_SIZE; saveenv diff --git a/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch b/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch new file mode 100644 index 00000000..01bb37b5 --- /dev/null +++ b/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch @@ -0,0 +1,50 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:42 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: Generate sha256sum for uboot verification + +Future Open Mesh u-boot versions are changing the check of the image files +(vmlinux, rootfs) from md5 to sha256. Having both in them should be enough +to ensure backward and forward compatibility. + +Signed-off-by: Sven Eckelmann + +Backport of r49140 + +Forwarded: https://patchwork.ozlabs.org/patch/624190/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index fab1582..e208e6d 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -42,6 +42,7 @@ CHECK_BS=65536 + + KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") + KERNEL_MD5=$(md5=$(md5sum $KERNEL_PATH); echo ${md5%% *}) ++KERNEL_SHA256=$(openssl dgst -sha256 $KERNEL_PATH | awk '{print $2}') + KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024))) + + ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr) +@@ -49,6 +50,7 @@ ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") + ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS)) + ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *}) + ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *}) ++ROOTFS_SHA256_FULL=$(openssl dgst -sha256 $ROOTFS_PATH | awk '{print $2}') + ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) + ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) + +@@ -57,6 +59,7 @@ cat << EOF > $CFG_OUT + filename=kernel + md5sum=$KERNEL_MD5 + filemd5sum=$KERNEL_MD5 ++filesha256sum=$KERNEL_SHA256 + flashaddr=$KERNEL_FLASH_ADDR + checksize=0x0 + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv +@@ -66,6 +69,7 @@ cmd_fail=reset + filename=rootfs + md5sum=$ROOTFS_MD5 + filemd5sum=$ROOTFS_MD5_FULL ++filesha256sum=$ROOTFS_SHA256_FULL + flashaddr=$ROOTFS_FLASH_ADDR + checksize=$ROOTFS_CHECK_SIZE + cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; setenv rootfs_size_1 $ROOTFS_PART_SIZE; saveenv diff --git a/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch b/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch new file mode 100644 index 00000000..f3f8b253 --- /dev/null +++ b/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch @@ -0,0 +1,265 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:47 +0000 +Subject: ar71xx: add kernel support for the OpenMesh OM5P-AC board + +Signed-off-by: Sven Eckelmann + +Backport of r49141 + +Forwarded: https://patchwork.ozlabs.org/patch/624191/ + +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index c5a3c9a..dd89357 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -91,6 +91,7 @@ CONFIG_ATH79_MACH_NBG460N=y + CONFIG_ATH79_MACH_NBG6716=y + CONFIG_ATH79_MACH_OM2P=y + CONFIG_ATH79_MACH_OM5P=y ++CONFIG_ATH79_MACH_OM5P_AC=y + CONFIG_ATH79_MACH_ONION_OMEGA=y + CONFIG_ATH79_MACH_PB42=y + CONFIG_ATH79_MACH_PB44=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c +new file mode 100644 +index 0000000..f6974af +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c +@@ -0,0 +1,193 @@ ++/* ++ * OpenMesh OM5P-AC support ++ * ++ * Copyright (C) 2013 Marek Lindner ++ * Copyright (C) 2014 Sven Eckelmann ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++#include "pci.h" ++ ++#define OM5PAC_GPIO_LED_POWER 18 ++#define OM5PAC_GPIO_LED_GREEN 21 ++#define OM5PAC_GPIO_LED_RED 23 ++#define OM5PAC_GPIO_LED_YELLOW 22 ++#define OM5PAC_GPIO_LED_LAN 20 ++#define OM5PAC_GPIO_LED_WAN 19 ++#define OM5PAC_GPIO_I2C_SCL 12 ++#define OM5PAC_GPIO_I2C_SDA 11 ++ ++#define OM5PAC_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define OM5PAC_KEYS_DEBOUNCE_INTERVAL (3 * OM5PAC_KEYS_POLL_INTERVAL) ++ ++#define OM5PAC_WMAC_CALDATA_OFFSET 0x1000 ++ ++static struct gpio_led om5pac_leds_gpio[] __initdata = { ++ { ++ .name = "om5pac:blue:power", ++ .gpio = OM5PAC_GPIO_LED_POWER, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:red:wifi", ++ .gpio = OM5PAC_GPIO_LED_RED, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:yellow:wifi", ++ .gpio = OM5PAC_GPIO_LED_YELLOW, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:green:wifi", ++ .gpio = OM5PAC_GPIO_LED_GREEN, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:blue:lan", ++ .gpio = OM5PAC_GPIO_LED_LAN, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:blue:wan", ++ .gpio = OM5PAC_GPIO_LED_WAN, ++ .active_low = 1, ++ } ++}; ++ ++static struct flash_platform_data om5pac_flash_data = { ++ .type = "mx25l12805d", ++}; ++ ++static struct i2c_gpio_platform_data om5pac_i2c_device_platdata = { ++ .sda_pin = OM5PAC_GPIO_I2C_SDA, ++ .scl_pin = OM5PAC_GPIO_I2C_SCL, ++ .udelay = 10, ++ .sda_is_open_drain = 1, ++ .scl_is_open_drain = 1, ++}; ++ ++static struct platform_device om5pac_i2c_device = { ++ .name = "i2c-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &om5pac_i2c_device_platdata, ++ }, ++}; ++ ++static struct i2c_board_info om5pac_i2c_devs[] __initdata = { ++ { ++ I2C_BOARD_INFO("tmp423", 0x4c), ++ }, ++}; ++ ++static struct at803x_platform_data om5pac_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info om5pac_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 1, ++ .platform_data = &om5pac_at803x_data, ++ }, ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 2, ++ .platform_data = &om5pac_at803x_data, ++ }, ++}; ++ ++static void __init om5p_ac_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ ++static void __init om5p_ac_setup(void) ++{ ++ u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); ++ u8 mac[6]; ++ ++ /* temperature sensor */ ++ platform_device_register(&om5pac_i2c_device); ++ i2c_register_board_info(0, om5pac_i2c_devs, ++ ARRAY_SIZE(om5pac_i2c_devs)); ++ ++ ath79_gpio_output_select(OM5PAC_GPIO_LED_WAN, QCA955X_GPIO_OUT_GPIO); ++ ++ ath79_register_m25p80(&om5pac_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(om5pac_leds_gpio), ++ om5pac_leds_gpio); ++ ++ ath79_init_mac(mac, art, 0x02); ++ ath79_register_wmac(art + OM5PAC_WMAC_CALDATA_OFFSET, mac); ++ ++ om5p_ac_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); ++ ath79_register_mdio(0, 0x0); ++ ++ mdiobus_register_board_info(om5pac_mdio0_info, ++ ARRAY_SIZE(om5pac_mdio0_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); ++ ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); ++ ++ /* GMAC0 is connected to the PHY1 */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_data.phy_mask = BIT(1); ++ ath79_eth0_pll_data.pll_1000 = 0x82000101; ++ ath79_eth0_pll_data.pll_100 = 0x80000101; ++ ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_register_eth(0); ++ ++ /* GMAC1 is connected to MDIO1 in SGMII mode */ ++ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth1_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth1_data.phy_mask = BIT(2); ++ ath79_eth1_pll_data.pll_1000 = 0x03000101; ++ ath79_eth1_pll_data.pll_100 = 0x80000101; ++ ath79_eth1_pll_data.pll_10 = 0x80001313; ++ ath79_eth1_data.speed = SPEED_1000; ++ ath79_eth1_data.duplex = DUPLEX_FULL; ++ ath79_register_eth(1); ++ ++ ath79_register_pci(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_OM5P_AC, "OM5P-AC", "OpenMesh OM5P AC", om5p_ac_setup); +diff --git a/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-om5pac-support.patch b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-om5pac-support.patch +new file mode 100644 +index 0000000..4accd03 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/815-MIPS-ath79-add-om5pac-support.patch +@@ -0,0 +1,38 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -799,6 +799,15 @@ config ATH79_MACH_OM5P ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_OM5P_AC +++ bool "OpenMesh OM5P-AC board support" +++ select SOC_QCA955X +++ select ATH79_DEV_AP9X_PCI if PCI +++ select ATH79_DEV_ETH +++ select ATH79_DEV_LEDS_GPIO +++ select ATH79_DEV_M25P80 +++ select ATH79_DEV_WMAC +++ ++ config ATH79_MACH_ONION_OMEGA ++ bool "ONION OMEGA support" ++ select SOC_AR933X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -100,6 +100,7 @@ obj-$(CONFIG_ATH79_MACH_MZK_W300NH) += m ++ obj-$(CONFIG_ATH79_MACH_NBG460N) += mach-nbg460n.o ++ obj-$(CONFIG_ATH79_MACH_OM2P) += mach-om2p.o ++ obj-$(CONFIG_ATH79_MACH_OM5P) += mach-om5p.o +++obj-$(CONFIG_ATH79_MACH_OM5P_AC) += mach-om5pac.o ++ obj-$(CONFIG_ATH79_MACH_ONION_OMEGA) += mach-onion-omega.o ++ obj-$(CONFIG_ATH79_MACH_PB42) += mach-pb42.o ++ obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -95,6 +95,7 @@ enum ath79_mach_type { ++ ATH79_MACH_OM2P_LC, /* OpenMesh OM2P-LC */ ++ ATH79_MACH_OM2Pv2, /* OpenMesh OM2Pv2 */ ++ ATH79_MACH_OM2P, /* OpenMesh OM2P */ +++ ATH79_MACH_OM5P_AC, /* OpenMesh OM5P-AC */ ++ ATH79_MACH_OM5P_AN, /* OpenMesh OM5P-AN */ ++ ATH79_MACH_OM5P, /* OpenMesh OM5P */ ++ ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ diff --git a/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch b/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch new file mode 100644 index 00000000..7161fdca --- /dev/null +++ b/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch @@ -0,0 +1,54 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:51 +0000 +Subject: ar71xx: add user-space support for the OpenMesh OM5P-AC + +Signed-off-by: Sven Eckelmann + +Backport of r49142 + +Forwarded: https://patchwork.ozlabs.org/patch/624192/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index 44d2ddf..a4051f2 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -178,6 +178,9 @@ get_status_led() { + om5p-an) + status_led="om5p:blue:power" + ;; ++ om5p-ac) ++ status_led="om5pac:blue:power" ++ ;; + onion-omega) + status_led="onion:amber:system" + ;; +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index c451124..9a768cd 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -304,6 +304,11 @@ om5p-an) + ucidef_set_led_netdev "port2" "port2" "om5p:blue:lan" "eth1" + ;; + ++om5p-ac) ++ ucidef_set_led_netdev "port1" "port1" "om5pac:blue:lan" "eth0" ++ ucidef_set_led_netdev "port2" "port2" "om5pac:blue:wan" "eth1" ++ ;; ++ + qihoo-c301) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:red:status" "phy1tpt" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 587d029..10b8048 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -616,6 +616,9 @@ ar71xx_board_detect() { + *"OM5P AN") + name="om5p-an" + ;; ++ *"OM5P AC") ++ name="om5p-ac" ++ ;; + *"Onion Omega") + name="onion-omega" + ;; diff --git a/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch b/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch new file mode 100644 index 00000000..4b6311e2 --- /dev/null +++ b/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch @@ -0,0 +1,32 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:54 +0000 +Subject: scripts/om-fwupgradecfg-gen.sh: add support for the OM5P-AC + +Signed-off-by: Sven Eckelmann + +Backport of r49143 + +Forwarded: https://patchwork.ozlabs.org/patch/624193/ + +diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh +index e208e6d..6c3b74c 100644 +--- a/scripts/om-fwupgradecfg-gen.sh ++++ b/scripts/om-fwupgradecfg-gen.sh +@@ -7,7 +7,7 @@ + # + + usage() { +- echo "Usage: $0 " ++ echo "Usage: $0 " + rm -f $CFG_OUT + exit 1 + } +@@ -26,7 +26,7 @@ case $CE_TYPE in + FLASH_BS=262144 + MD5_SKIP_BLOCKS=1 + ;; +- OM5P|MR600|MR900|MR1750) ++ OM5P|OM5PAC|MR600|MR900|MR1750) + MAX_PART_SIZE=7808 + KERNEL_FLASH_ADDR=0xb0000 + FLASH_BS=65536 diff --git a/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch b/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch new file mode 100644 index 00000000..ae08198a --- /dev/null +++ b/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch @@ -0,0 +1,59 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:25:57 +0000 +Subject: ar71xx: enable sysupgrade for the OpenMesh OM5P-AC + +Signed-off-by: Sven Eckelmann + +Backport of r49144 + +Forwarded: https://patchwork.ozlabs.org/patch/624194/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 9ca0f5b..1cfead9 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -72,6 +72,11 @@ platform_check_image_openmesh() + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; ++ OM5PAC) ++ [ "$board" = "om5p-ac" ] && break ++ echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" ++ return 1 ++ ;; + MR1750) + [ "$board" = "mr1750" ] && break + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" +@@ -162,7 +167,7 @@ platform_do_upgrade_openmesh() + kernel_start_addr1=0x9f1c0000 + kernel_start_addr2=0x9f8c0000 + ;; +- OM5P|MR600|MR900|MR1750) ++ OM5P|OM5PAC|MR600|MR900|MR1750) + block_size=$((64 * 1024)) + total_size=7995392 + kernel_start_addr1=0x9f0b0000 +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index ac060ea..67c0661 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -307,7 +307,8 @@ platform_check_image() { + om2p-hsv2 | \ + om2p-lc | \ + om5p | \ +- om5p-an) ++ om5p-an | \ ++ om5p-ac) + platform_check_image_openmesh "$magic_long" "$1" && return 0 + return 1 + ;; +@@ -540,7 +541,8 @@ platform_do_upgrade() { + om2p-hsv2 | \ + om2p-lc | \ + om5p | \ +- om5p-an) ++ om5p-an | \ ++ om5p-ac) + platform_do_upgrade_openmesh "$ARGV" + ;; + unifi-outdoor-plus | \ diff --git a/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch b/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch new file mode 100644 index 00000000..c2d2e225 --- /dev/null +++ b/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch @@ -0,0 +1,24 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:01 +0000 +Subject: om-watchdog: add OpenMesh OM5P-AC support + +Signed-off-by: Sven Eckelmann + +Backport of r49145 + +Forwarded: https://patchwork.ozlabs.org/patch/624195/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index c792968..8cec13b 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -22,6 +22,9 @@ boot() { + "om5p"|"om5p-an") + service_start /sbin/om-watchdog 11 + ;; ++ "om5p-ac") ++ service_start /sbin/om-watchdog 17 ++ ;; + "mr600v2") + service_start /sbin/om-watchdog 15 + ;; diff --git a/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch b/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch new file mode 100644 index 00000000..0d7b312e --- /dev/null +++ b/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch @@ -0,0 +1,22 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:04 +0000 +Subject: uboot-envtools: add OpenMesh OM5P-AC support + +Signed-off-by: Sven Eckelmann + +Backport of r49146 + +Forwarded: https://patchwork.ozlabs.org/patch/624196/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index ef00f17..657b25f 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -28,6 +28,7 @@ mr900 | \ + mr900v2 | \ + nbg6716 | \ + om5p-an | \ ++om5p-ac | \ + om5p | \ + tube2h | \ + wndr3700) diff --git a/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch b/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch new file mode 100644 index 00000000..0cd9fec5 --- /dev/null +++ b/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch @@ -0,0 +1,25 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:08 +0000 +Subject: ar71xx: extract ath10k wifi board.bin for the OpenMesh OM5P-AC board + +Signed-off-by: Sven Eckelmann + +Backport of r49147 + +Forwarded: https://patchwork.ozlabs.org/patch/624197/ + +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 cde7aaf..c1f4b85 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 +@@ -96,6 +96,10 @@ case "$FIRMWARE" in + rb-911g-5hpacd) + ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 + ;; ++ om5p-ac) ++ ath10kcal_extract "ART" 20480 2116 ++ ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ++ ;; + esac + ;; + *) diff --git a/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch b/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch new file mode 100644 index 00000000..ce03a85f --- /dev/null +++ b/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch @@ -0,0 +1,53 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:11 +0000 +Subject: ar71xx: create profile and build image for the OpenMesh OM5P-AC board + +Signed-off-by: Sven Eckelmann + +Backport of r49148 + +Forwarded: https://patchwork.ozlabs.org/patch/624198/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index 06cf135..64aaa24 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -27,6 +27,17 @@ endef + + $(eval $(call Profile,OM5P)) + ++define Profile/OM5PAC ++ NAME:=OpenMesh OM5P-AC ++ PACKAGES:=kmod-ath9k kmod-ath10k om-watchdog ath10k-firmware-qca988x ++endef ++ ++define Profile/OM5PAC/Description ++ Package set optimized for the OpenMesh OM5P-AC. ++endef ++ ++$(eval $(call Profile,OM5PAC)) ++ + define Profile/MR600 + NAME:=OpenMesh MR600 + PACKAGES:=kmod-ath9k om-watchdog +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index b74aa45..06dbb77 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2043,6 +2043,7 @@ $(eval $(call SingleProfile,Netgear,64kraw,WPN824N,wpn824n,WPN824N,ttyS0,115200, + + $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P)) ++$(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5PAC,om5pac,,,,OM5PAC)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900)) + $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR1750,mr1750,,,,MR1750)) +@@ -2139,7 +2140,7 @@ $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M)) + $(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3)) + $(eval $(call MultiProfile,AP136,AP136_010 AP136_020)) + $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M)) +-$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900 MR1750)) ++$(eval $(call MultiProfile,OPENMESH,OM2P OM5P OM5PAC MR600 MR900 MR1750)) + $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY)) + $(eval $(call MultiProfile,TLMR3220,TLMR3220V1)) + $(eval $(call MultiProfile,TLMR3420,TLMR3420V1)) diff --git a/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch new file mode 100644 index 00000000..d2e2cd60 --- /dev/null +++ b/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch @@ -0,0 +1,289 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:15 +0000 +Subject: ar71xx: add kernel support for the OpenMesh OM5P-ACv2 board + +Signed-off-by: Sven Eckelmann + +Backport of r49149 + +Forwarded: https://patchwork.ozlabs.org/patch/624199/ + +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index dd89357..514f7d5 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -92,6 +92,7 @@ CONFIG_ATH79_MACH_NBG6716=y + CONFIG_ATH79_MACH_OM2P=y + CONFIG_ATH79_MACH_OM5P=y + CONFIG_ATH79_MACH_OM5P_AC=y ++CONFIG_ATH79_MACH_OM5P_ACv2=y + CONFIG_ATH79_MACH_ONION_OMEGA=y + CONFIG_ATH79_MACH_PB42=y + CONFIG_ATH79_MACH_PB44=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c +new file mode 100644 +index 0000000..587ca32 +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c +@@ -0,0 +1,216 @@ ++/* ++ * OpenMesh OM5P-ACv2 support ++ * ++ * Copyright (C) 2013 Marek Lindner ++ * Copyright (C) 2014-2016 Sven Eckelmann ++ * Copyright (C) 2015 Open-Mesh - Jim Collar ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "common.h" ++#include "dev-ap9x-pci.h" ++#include "dev-eth.h" ++#include "dev-gpio-buttons.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++#include "pci.h" ++ ++#define OM5PACV2_GPIO_LED_POWER 14 ++#define OM5PACV2_GPIO_LED_GREEN 13 ++#define OM5PACV2_GPIO_LED_RED 23 ++#define OM5PACV2_GPIO_LED_YELLOW 15 ++#define OM5PACV2_GPIO_BTN_RESET 1 ++#define OM5PACV2_GPIO_I2C_SCL 18 ++#define OM5PACV2_GPIO_I2C_SDA 19 ++#define OM5PACV2_GPIO_PA_DCDC 2 ++#define OM5PACV2_GPIO_PA_HIGH 16 ++ ++#define OM5PACV2_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define OM5PACV2_KEYS_DEBOUNCE_INTERVAL (3 * OM5PACV2_KEYS_POLL_INTERVAL) ++ ++#define OM5PACV2_WMAC_CALDATA_OFFSET 0x1000 ++ ++static struct gpio_led om5pacv2_leds_gpio[] __initdata = { ++ { ++ .name = "om5pac:blue:power", ++ .gpio = OM5PACV2_GPIO_LED_POWER, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:red:wifi", ++ .gpio = OM5PACV2_GPIO_LED_RED, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:yellow:wifi", ++ .gpio = OM5PACV2_GPIO_LED_YELLOW, ++ .active_low = 1, ++ }, { ++ .name = "om5pac:green:wifi", ++ .gpio = OM5PACV2_GPIO_LED_GREEN, ++ .active_low = 1, ++ } ++}; ++ ++static struct gpio_keys_button om5pacv2_gpio_keys[] __initdata = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = OM5PACV2_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = OM5PACV2_GPIO_BTN_RESET, ++ .active_low = 1, ++ } ++}; ++ ++static struct i2c_gpio_platform_data om5pacv2_i2c_device_platdata = { ++ .sda_pin = OM5PACV2_GPIO_I2C_SDA, ++ .scl_pin = OM5PACV2_GPIO_I2C_SCL, ++ .udelay = 10, ++ .sda_is_open_drain = 1, ++ .scl_is_open_drain = 1, ++}; ++ ++static struct platform_device om5pacv2_i2c_device = { ++ .name = "i2c-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &om5pacv2_i2c_device_platdata, ++ }, ++}; ++ ++static struct i2c_board_info om5pacv2_i2c_devs[] __initdata = { ++ { ++ I2C_BOARD_INFO("tmp423", 0x4e), ++ }, ++}; ++ ++static struct flash_platform_data om5pacv2_flash_data = { ++ .type = "mx25l12805d", ++}; ++ ++static struct at803x_platform_data om5pacv2_an_at803x_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 1, ++}; ++ ++static struct at803x_platform_data om5pacv2_an_at8031_data = { ++ .disable_smarteee = 1, ++ .enable_rgmii_rx_delay = 1, ++ .enable_rgmii_tx_delay = 1, ++}; ++ ++static struct mdio_board_info om5pacv2_an_mdio0_info[] = { ++ { ++ .bus_id = "ag71xx-mdio.0", ++ .phy_addr = 4, ++ .platform_data = &om5pacv2_an_at803x_data, ++ }, ++ { ++ .bus_id = "ag71xx-mdio.1", ++ .phy_addr = 1, ++ .platform_data = &om5pacv2_an_at8031_data, ++ }, ++}; ++ ++static void __init om5p_acv2_setup_qca955x_eth_cfg(u32 mask, ++ unsigned int rxd, ++ unsigned int rxdv, ++ unsigned int txd, ++ unsigned int txe) ++{ ++ void __iomem *base; ++ u32 t; ++ ++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); ++ ++ t = mask; ++ t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; ++ t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; ++ t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; ++ t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; ++ ++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); ++ ++ iounmap(base); ++} ++ ++static void __init om5p_acv2_setup(void) ++{ ++ u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); ++ u8 mac[6]; ++ ++ /* power amplifier high power, 4.2V at RFFM4203/4503 instead of 3.3 */ ++ ath79_gpio_function_enable(QCA955X_GPIO_FUNC_JTAG_DISABLE); ++ ath79_gpio_output_select(OM5PACV2_GPIO_PA_DCDC, QCA955X_GPIO_OUT_GPIO); ++ ath79_gpio_output_select(OM5PACV2_GPIO_PA_HIGH, QCA955X_GPIO_OUT_GPIO); ++ gpio_request_one(OM5PACV2_GPIO_PA_DCDC, GPIOF_OUT_INIT_HIGH, ++ "PA DC/DC"); ++ gpio_request_one(OM5PACV2_GPIO_PA_HIGH, GPIOF_OUT_INIT_HIGH, "PA HIGH"); ++ ++ /* temperature sensor */ ++ platform_device_register(&om5pacv2_i2c_device); ++ i2c_register_board_info(0, om5pacv2_i2c_devs, ++ ARRAY_SIZE(om5pacv2_i2c_devs)); ++ ++ ath79_register_m25p80(&om5pacv2_flash_data); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(om5pacv2_leds_gpio), ++ om5pacv2_leds_gpio); ++ ath79_register_gpio_keys_polled(-1, OM5PACV2_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(om5pacv2_gpio_keys), ++ om5pacv2_gpio_keys); ++ ++ ath79_init_mac(mac, art, 0x02); ++ ath79_register_wmac(art + OM5PACV2_WMAC_CALDATA_OFFSET, mac); ++ ++ om5p_acv2_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 2, 2, 0, 0); ++ ath79_register_mdio(0, 0x0); ++ ath79_register_mdio(1, 0x0); ++ ++ mdiobus_register_board_info(om5pacv2_an_mdio0_info, ++ ARRAY_SIZE(om5pacv2_an_mdio0_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); ++ ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); ++ ++ /* GMAC0 is connected to the PHY4 */ ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ++ ath79_eth0_data.phy_mask = BIT(4); ++ ath79_eth0_pll_data.pll_1000 = 0x82000101; ++ ath79_eth0_pll_data.pll_100 = 0x80000101; ++ ath79_eth0_pll_data.pll_10 = 0x80001313; ++ ath79_register_eth(0); ++ ++ /* GMAC1 is connected to MDIO1 in SGMII mode */ ++ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; ++ ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; ++ ath79_eth1_data.phy_mask = BIT(1); ++ ath79_eth1_pll_data.pll_1000 = 0x03000101; ++ ath79_eth1_pll_data.pll_100 = 0x80000101; ++ ath79_eth1_pll_data.pll_10 = 0x80001313; ++ ath79_eth1_data.speed = SPEED_1000; ++ ath79_eth1_data.duplex = DUPLEX_FULL; ++ ath79_register_eth(1); ++ ++ ath79_register_pci(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_OM5P_ACv2, "OM5P-ACv2", "OpenMesh OM5P ACv2", om5p_acv2_setup); +diff --git a/target/linux/ar71xx/patches-3.18/816-MIPS-ath79-add-om5pacv-support.patch b/target/linux/ar71xx/patches-3.18/816-MIPS-ath79-add-om5pacv-support.patch +new file mode 100644 +index 0000000..fbbf171 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/816-MIPS-ath79-add-om5pacv-support.patch +@@ -0,0 +1,39 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -808,6 +808,16 @@ config ATH79_MACH_OM5P_AC ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_OM5P_ACv2 +++ bool "OpenMesh OM5P-ACv2 board support" +++ select SOC_QCA955X +++ 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_ONION_OMEGA ++ bool "ONION OMEGA support" ++ select SOC_AR933X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -101,6 +101,7 @@ obj-$(CONFIG_ATH79_MACH_NBG460N) += mach ++ obj-$(CONFIG_ATH79_MACH_OM2P) += mach-om2p.o ++ obj-$(CONFIG_ATH79_MACH_OM5P) += mach-om5p.o ++ obj-$(CONFIG_ATH79_MACH_OM5P_AC) += mach-om5pac.o +++obj-$(CONFIG_ATH79_MACH_OM5P_ACv2) += mach-om5pacv2.o ++ obj-$(CONFIG_ATH79_MACH_ONION_OMEGA) += mach-onion-omega.o ++ obj-$(CONFIG_ATH79_MACH_PB42) += mach-pb42.o ++ obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -96,6 +96,7 @@ enum ath79_mach_type { ++ ATH79_MACH_OM2Pv2, /* OpenMesh OM2Pv2 */ ++ ATH79_MACH_OM2P, /* OpenMesh OM2P */ ++ ATH79_MACH_OM5P_AC, /* OpenMesh OM5P-AC */ +++ ATH79_MACH_OM5P_ACv2, /* OpenMesh OM5P-ACv2 */ ++ ATH79_MACH_OM5P_AN, /* OpenMesh OM5P-AN */ ++ ATH79_MACH_OM5P, /* OpenMesh OM5P */ ++ ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ diff --git a/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch b/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch new file mode 100644 index 00000000..2ea0cb6a --- /dev/null +++ b/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch @@ -0,0 +1,38 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:18 +0000 +Subject: ar71xx: add user-space support for the OpenMesh OM5P-ACv2 + +Signed-off-by: Sven Eckelmann + +Backport of r49150 + +Forwarded: https://patchwork.ozlabs.org/patch/624200/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index a4051f2..d4d8b4e 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -178,7 +178,8 @@ get_status_led() { + om5p-an) + status_led="om5p:blue:power" + ;; +- om5p-ac) ++ om5p-ac | \ ++ om5p-acv2) + status_led="om5pac:blue:power" + ;; + onion-omega) +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 10b8048..fbf76c8 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -619,6 +619,9 @@ ar71xx_board_detect() { + *"OM5P AC") + name="om5p-ac" + ;; ++ *"OM5P ACv2") ++ name="om5p-acv2" ++ ;; + *"Onion Omega") + name="onion-omega" + ;; diff --git a/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch new file mode 100644 index 00000000..0c4cf031 --- /dev/null +++ b/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch @@ -0,0 +1,46 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:22 +0000 +Subject: ar71xx: enable sysupgrade for the OpenMesh OM5P-ACv2 + +Signed-off-by: Sven Eckelmann + +Backport of r49151 + +Forwarded: https://patchwork.ozlabs.org/patch/624201/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 1cfead9..209cdaa 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -74,6 +74,7 @@ platform_check_image_openmesh() + ;; + OM5PAC) + [ "$board" = "om5p-ac" ] && break ++ [ "$board" = "om5p-acv2" ] && break + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 67c0661..4a4c476 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -308,7 +308,8 @@ platform_check_image() { + om2p-lc | \ + om5p | \ + om5p-an | \ +- om5p-ac) ++ om5p-ac | \ ++ om5p-acv2) + platform_check_image_openmesh "$magic_long" "$1" && return 0 + return 1 + ;; +@@ -542,7 +543,8 @@ platform_do_upgrade() { + om2p-lc | \ + om5p | \ + om5p-an | \ +- om5p-ac) ++ om5p-ac | \ ++ om5p-acv2) + platform_do_upgrade_openmesh "$ARGV" + ;; + unifi-outdoor-plus | \ diff --git a/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch b/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch new file mode 100644 index 00000000..b3c8c8fc --- /dev/null +++ b/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch @@ -0,0 +1,23 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:25 +0000 +Subject: om-watchdog: add OpenMesh OM5P-ACv2 support + +Signed-off-by: Sven Eckelmann + +Backport of r49152 + +Forwarded: https://patchwork.ozlabs.org/patch/624202/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index 8cec13b..6b96966 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -13,7 +13,7 @@ boot() { + local board=$(ar71xx_board_name) + + case "$board" in +- "om2p"|"om2p-hs"|"om2p-hsv2") ++ "om2p"|"om2p-hs"|"om2p-hsv2"|"om5p-acv2") + service_start /sbin/om-watchdog 12 + ;; + "om2pv2"|"om2p-lc") diff --git a/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch b/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch new file mode 100644 index 00000000..dd61c6fb --- /dev/null +++ b/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch @@ -0,0 +1,22 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:28 +0000 +Subject: uboot-envtools: add OpenMesh OM5P-ACv2 support + +Signed-off-by: Sven Eckelmann + +Backport of r49153 + +Forwarded: https://patchwork.ozlabs.org/patch/624203/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index 657b25f..9071c11 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -29,6 +29,7 @@ mr900v2 | \ + nbg6716 | \ + om5p-an | \ + om5p-ac | \ ++om5p-acv2 | \ + om5p | \ + tube2h | \ + wndr3700) diff --git a/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch b/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch new file mode 100644 index 00000000..90b634ce --- /dev/null +++ b/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch @@ -0,0 +1,24 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:31 +0000 +Subject: ar71xx: extract ath10k wifi board.bin for the OpenMesh OM5P-ACv2 board + +Signed-off-by: Sven Eckelmann + +Backport of r49154 + +Forwarded: https://patchwork.ozlabs.org/patch/624204/ + +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 c1f4b85..d925a85 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 +@@ -71,7 +71,8 @@ case "$FIRMWARE" in + ath10kcal_extract "caldata" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) + ;; +- mr1750) ++ mr1750 | \ ++ om5p-acv2) + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ;; diff --git a/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch b/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch new file mode 100644 index 00000000..d98a115f --- /dev/null +++ b/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch @@ -0,0 +1,29 @@ +From: Sven Eckelmann +Date: Sat, 9 Apr 2016 10:26:34 +0000 +Subject: ar71xx: add OM5P-ACv2 to the OM5P-AC profile + +Signed-off-by: Sven Eckelmann + +Backport of r49155 + +Forwarded: https://patchwork.ozlabs.org/patch/624205/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index 64aaa24..c0919ed 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -28,12 +28,12 @@ endef + $(eval $(call Profile,OM5P)) + + define Profile/OM5PAC +- NAME:=OpenMesh OM5P-AC ++ NAME:=OpenMesh OM5P-AC/OM5P-ACv2 + PACKAGES:=kmod-ath9k kmod-ath10k om-watchdog ath10k-firmware-qca988x + endef + + define Profile/OM5PAC/Description +- Package set optimized for the OpenMesh OM5P-AC. ++ Package set optimized for the OpenMesh OM5P-AC/OM5P-ACv2. + endef + + $(eval $(call Profile,OM5PAC)) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 9454de64..56fcaa56 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -301,6 +301,10 @@ $(eval $(call GluonModel,OMEGA,onion-omega,onion-omega)) ## OpenMesh +# MR1750 +$(eval $(call GluonProfile,MR1750,om-watchdog uboot-envtools kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonModel,MR1750,mr1750,openmesh-mr1750)) + # MR600 $(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools)) $(eval $(call GluonModel,MR600,mr600,openmesh-mr600)) @@ -324,6 +328,11 @@ $(eval $(call GluonProfile,OM5P,om-watchdog uboot-envtools)) $(eval $(call GluonModel,OM5P,om5p,openmesh-om5p)) $(eval $(call GluonModelAlias,OM5P,openmesh-om5p,openmesh-om5p-an)) +# OM5P-AC +$(eval $(call GluonProfile,OM5PAC,om-watchdog uboot-envtools kmod-ath10k ath10k-firmware-qca988x-ct)) +$(eval $(call GluonModel,OM5PAC,om5pac,openmesh-om5p-ac)) +$(eval $(call GluonModelAlias,OM5PAC,openmesh-om5p-ac,openmesh-om5p-acv2)) + ## ALFA # Hornet-UB From 63b8dfa8b6c5affb4af892ee075783c0da16b385 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 23 May 2016 17:13:51 +0200 Subject: [PATCH 029/184] ar71xx-generic: Remove extra dash between v2 and OpenMesh device name (#781) The returned name for OpenMesh devices with a an extra vX when calling lua -e 'print(require("platform_info").get_image_name())' doesn't contain a dash between the vX and the device name. Thus the image should also not contain a dash. Signed-off-by: Sven Eckelmann --- targets/ar71xx-generic/profiles.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 56fcaa56..c30a51f2 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -308,19 +308,19 @@ $(eval $(call GluonModel,MR1750,mr1750,openmesh-mr1750)) # MR600 $(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools)) $(eval $(call GluonModel,MR600,mr600,openmesh-mr600)) -$(eval $(call GluonModelAlias,MR600,openmesh-mr600,openmesh-mr600-v2)) +$(eval $(call GluonModelAlias,MR600,openmesh-mr600,openmesh-mr600v2)) # MR900 $(eval $(call GluonProfile,MR900,om-watchdog uboot-envtools)) $(eval $(call GluonModel,MR900,mr900,openmesh-mr900)) -$(eval $(call GluonModelAlias,MR900,openmesh-mr900,openmesh-mr900-v2)) +$(eval $(call GluonModelAlias,MR900,openmesh-mr900,openmesh-mr900v2)) # OM2P $(eval $(call GluonProfile,OM2P,om-watchdog uboot-envtools)) $(eval $(call GluonModel,OM2P,om2p,openmesh-om2p)) -$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-v2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2pv2)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs)) -$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs-v2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hsv2)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-lc)) # OM5P From bc318391e40f76b813674a520d89066d85821d5b Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 23 May 2016 21:02:05 +0200 Subject: [PATCH 030/184] docs: Fix path to script detecting the primary mac address (#782) Signed-off-by: Sven Eckelmann --- docs/dev/hardware.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/hardware.rst b/docs/dev/hardware.rst index 3bd62a3d..7f04d93d 100644 --- a/docs/dev/hardware.rst +++ b/docs/dev/hardware.rst @@ -51,7 +51,7 @@ may be defined arbitrarily. On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which -can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/core/initial/001-sysconfig`` +can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/010-primary-mac`` in ``gluon-core`` might need a fix. (There have also been cases in which the address was incorrect even on devices with only one WLAN adapter, in these cases an OpenWrt bug was the cause). From bdf5adc76cd954e48396e81071658132a1e214e9 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 23 May 2016 12:27:12 +0200 Subject: [PATCH 031/184] ar71xx-generic: Use eth0 as OpenMesh primary mac address The OpenMesh devices have a sticker with the eth0 mac address on the bottom. Also all other mac addresses are calculated based on this address. Therefore, it is better to use this as primary mac address instead of the WiFi mac address. Signed-off-by: Sven Eckelmann --- .../gluon-core/files/lib/gluon/upgrade/010-primary-mac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac index a913db90..144ee700 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac @@ -24,7 +24,15 @@ end if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress') -elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2'}) then +elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2', + 'mr600', 'mr600v2', + 'mr900', 'mr900v2', + 'mr1750', + 'om2p', 'om2pv2', + 'om2p-hs', 'om2p-hsv2', + 'om2p-lc', + 'om5p', 'om5p-an', + 'om5p-ac', 'om5p-acv2'}) then table.insert(try_files, 1, '/sys/class/net/eth0/address') elseif platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then table.insert(try_files, 1, '/sys/class/net/eth1/address') From ed2537be7f2545fae42632744aabbe8f8c4f919d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 19 May 2016 01:07:20 +0200 Subject: [PATCH 032/184] docs, README: Gluon v2016.1.5 --- README.md | 2 +- docs/index.rst | 1 + docs/releases/v2016.1.5.rst | 66 +++++++++++++++++++++++++++++++++++ docs/user/getting_started.rst | 4 +-- 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 docs/releases/v2016.1.5.rst diff --git a/README.md b/README.md index 321817b6..3ef1f420 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ the future development of Gluon. Please refrain from using the `master` branch for anything else but development purposes! Use the most recent release instead. You can list all relaseses by running `git branch -a` -and switch to one by running `git checkout v2016.1.4 && make update`. +and switch to one by running `git checkout v2016.1.5 && make update`. If you're using the autoupdater, do not autoupdate nodes with anything but releases. If you upgrade using random master commits the nodes *will break* eventually. diff --git a/docs/index.rst b/docs/index.rst index 37f8e0f1..8da9bb43 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -62,6 +62,7 @@ Releases .. toctree:: :maxdepth: 1 + releases/v2016.1.5 releases/v2016.1.4 releases/v2016.1.3 releases/v2016.1.2 diff --git a/docs/releases/v2016.1.5.rst b/docs/releases/v2016.1.5.rst new file mode 100644 index 00000000..e5ee1a00 --- /dev/null +++ b/docs/releases/v2016.1.5.rst @@ -0,0 +1,66 @@ +Gluon 2016.1.5 +============== + +Added hardware support +~~~~~~~~~~~~~~~~~~~~~~ + +ar71xx-generic +^^^^^^^^^^^^^^ + +* OpenMesh + + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2) + - OM2P-LC + - OM5P + - OM5P-AN + +* Ubiquiti + + - Rocket M XW + +* TP-LINK + + - TL-WR841N/ND v11 + +Bugfixes +~~~~~~~~ + +* build: fix race condition caused by using certain make targets (like *clean*, *images* or *package/\**) + with parallel build options without doing a full build before +* build: fix package dependency issue causing "recursive dependency" warning + + This dependency issue could lead to broken configurations and reportedly caused failed builds in some cases + when additional (site-specific) packages were used. +* build: Gluon will now build correctly with GCC 6 as host compiler +* Fix configuration of batman-adv when VLANs are used on top of IBSS interfaces (regression due to netifd update in :doc:`v2016.1.4`) +* Add back missing ath10k firmware (regression due to mac80211 update in :doc:`v2016.1.4`) +* Gluon can now be used on all supported Ubiquiti AirMAX devices without downgrading to AirOS 5.5.x before + + :doc:`v2016.1.1` added support for most Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS, + but left some devices (at least some PicoStations and Bullets) with unwritable flash. This issue has been + resolved (`#687 `_). +* Add upgrade script to automatically remove whitespace from configured geolocation + + The new respondd implementation included in :doc:`v2016.1` is stricter about the number format than the + old one and doesn't accept trailing whitespace (so one or both coordinates are missing from the output). + + The Config Mode has been fixed to strip whitespace from numeric fields in new configurations since :doc:`v2016.1.1`. + This still left old configurations, which are now fixed by this script. + +Known Issues +~~~~~~~~~~~~ + +* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 `_) + + Reducing the TX power in the Expert Mode is recommended. + +* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 `_) + + This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed). + +* Inconsistent respondd API (`#522 `_) + + The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while. diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index abb8f8ba..c7519cf0 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -8,7 +8,7 @@ Gluon's releases are managed using `Git tags`_. If you are just getting started with Gluon we recommend to use the latest stable release of Gluon. Take a look at the `list of gluon releases`_ and notice the latest release, -e.g. *v2016.1.4*. Always get Gluon using git and don't try to download it +e.g. *v2016.1.5*. Always get Gluon using git and don't try to download it as a Zip archive as the archive will be missing version information. Please keep in mind that there is no "default Gluon" build; a site configuration @@ -42,7 +42,7 @@ Building the images ------------------- To build Gluon, first check out the repository. Replace *RELEASE* with the -version you'd like to checkout, e.g. *v2016.1.4*. +version you'd like to checkout, e.g. *v2016.1.5*. :: From 138d0c022dab41e71be2dbc0bce48af59b142aba Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 26 May 2016 16:46:32 +0200 Subject: [PATCH 033/184] docs: autoupdater's fallback option (#786) --- docs/features/autoupdater.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/features/autoupdater.rst b/docs/features/autoupdater.rst index 873f6097..8c4ca73f 100644 --- a/docs/features/autoupdater.rst +++ b/docs/features/autoupdater.rst @@ -70,5 +70,11 @@ These commands can be used on a node: # Force update check, even when the updater is disabled autoupdater -f + +:: + + # If fallback is true the updater will perform an update only if + # the timespan given by the priority and another 24h have passed + autoupdater --fallback From 94d2fb6d22c88d032fafd36d7080e31c4361459e Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Fri, 6 May 2016 16:49:00 +0200 Subject: [PATCH 034/184] respondd modules: Use proper formatting of doubles Most doubles that are delivered via respondd have limited input precision, but are converted with up to 17 digits of precision. That can cause ugly blowups like 0.2800000000000001 in the output, which is avoided by specifying better format strings (like "%.2f" in most cases). --- .../gluon-mesh-batman-adv-core/src/respondd.c | 4 +- package/gluon-mesh-vpn-fastd/src/respondd.c | 4 +- package/gluon-node-info/src/respondd.c | 4 +- package/gluon-respondd/src/respondd.c | 17 ++- ...or-custom-format-strings-for-doubles.patch | 108 ++++++++++++++++++ 5 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch diff --git a/package/gluon-mesh-batman-adv-core/src/respondd.c b/package/gluon-mesh-batman-adv-core/src/respondd.c index f0085457..7c2ac6c7 100644 --- a/package/gluon-mesh-batman-adv-core/src/respondd.c +++ b/package/gluon-mesh-batman-adv-core/src/respondd.c @@ -501,7 +501,9 @@ static struct json_object * get_batadv(void) { struct json_object *obj = json_object_new_object(); json_object_object_add(obj, "tq", json_object_new_int(tq)); - json_object_object_add(obj, "lastseen", json_object_new_double(lastseen)); + struct json_object *jso = json_object_new_double(lastseen); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL); + json_object_object_add(obj, "lastseen", jso); json_object_object_add(interface, mac1, obj); } diff --git a/package/gluon-mesh-vpn-fastd/src/respondd.c b/package/gluon-mesh-vpn-fastd/src/respondd.c index 3045c77a..7354783a 100644 --- a/package/gluon-mesh-vpn-fastd/src/respondd.c +++ b/package/gluon-mesh-vpn-fastd/src/respondd.c @@ -192,7 +192,9 @@ static bool get_peer_connection(struct json_object **ret, struct json_object *co int64_t established_time = json_object_get_int64(established); *ret = json_object_new_object(); - json_object_object_add(*ret, "established", json_object_new_double(established_time/1000.0)); + struct json_object *jso = json_object_new_double(established_time/1000.0); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL); + json_object_object_add(*ret, "established", jso); } else { *ret = NULL; diff --git a/package/gluon-node-info/src/respondd.c b/package/gluon-node-info/src/respondd.c index dfbfd3f8..d74c69e6 100644 --- a/package/gluon-node-info/src/respondd.c +++ b/package/gluon-node-info/src/respondd.c @@ -64,7 +64,9 @@ static struct json_object * get_number(struct uci_context *ctx, struct uci_secti if (*end) return NULL; - return json_object_new_double(d); + struct json_object *jso = json_object_new_double(d); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.8f", NULL); + return jso; } static struct json_object * get_location(struct uci_context *ctx, struct uci_package *p) { diff --git a/package/gluon-respondd/src/respondd.c b/package/gluon-respondd/src/respondd.c index 85006d6f..be3c9a7a 100644 --- a/package/gluon-respondd/src/respondd.c +++ b/package/gluon-respondd/src/respondd.c @@ -107,13 +107,18 @@ static struct json_object * respondd_provider_nodeinfo(void) { static void add_uptime(struct json_object *obj) { FILE *f = fopen("/proc/uptime", "r"); + struct json_object* jso; if (!f) return; double uptime, idletime; if (fscanf(f, "%lf %lf", &uptime, &idletime) == 2) { - json_object_object_add(obj, "uptime", json_object_new_double(uptime)); - json_object_object_add(obj, "idletime", json_object_new_double(idletime)); + jso = json_object_new_double(uptime); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL); + json_object_object_add(obj, "uptime", jso); + jso = json_object_new_double(idletime); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL); + json_object_object_add(obj, "idletime", jso); } fclose(f); @@ -127,7 +132,9 @@ static void add_loadavg(struct json_object *obj) { double loadavg; unsigned proc_running, proc_total; if (fscanf(f, "%lf %*f %*f %u/%u", &loadavg, &proc_running, &proc_total) == 3) { - json_object_object_add(obj, "loadavg", json_object_new_double(loadavg)); + struct json_object *jso = json_object_new_double(loadavg); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.2f", NULL); + json_object_object_add(obj, "loadavg", jso); struct json_object *processes = json_object_new_object(); json_object_object_add(processes, "running", json_object_new_int(proc_running)); @@ -176,7 +183,9 @@ static struct json_object * get_rootfs_usage(void) { if (statfs("/", &s)) return NULL; - return json_object_new_double(1 - (double)s.f_bfree / s.f_blocks); + struct json_object *jso = json_object_new_double(1 - (double)s.f_bfree / s.f_blocks); + json_object_set_serializer(jso, json_object_double_to_json_string, "%.4f", NULL); + return jso; } static struct json_object * respondd_provider_statistics(void) { diff --git a/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch b/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch new file mode 100644 index 00000000..690d3ebb --- /dev/null +++ b/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch @@ -0,0 +1,108 @@ +From: Jan-Philipp Litza +Date: Fri, 6 May 2016 16:44:29 +0200 +Subject: libjson-c: Add support for custom format strings for doubles + +diff --git a/package/libs/libjson-c/patches/002-custom-format-string.patch b/package/libs/libjson-c/patches/002-custom-format-string.patch +new file mode 100644 +index 0000000..2f454c5 +--- /dev/null ++++ b/package/libs/libjson-c/patches/002-custom-format-string.patch +@@ -0,0 +1,98 @@ ++From 21dc5dc92bd56f5f4dc2c90b9ea6bf1e1407714e Mon Sep 17 00:00:00 2001 ++From: Jan-Philipp Litza ++Date: Fri, 6 May 2016 16:12:44 +0200 ++Subject: [PATCH] Export json_object_double_to_json_string() and use custom ++ format string ++BCC: janphilipp@litza.de ++ ++--- ++ json_object.c | 12 ++++++------ ++ json_object.h | 28 ++++++++++++++++++++++++++++ ++ 2 files changed, 34 insertions(+), 6 deletions(-) ++ ++diff --git a/json_object.c b/json_object.c ++index 7d60884..46701e7 100644 ++--- a/json_object.c +++++ b/json_object.c ++@@ -55,7 +55,6 @@ static struct json_object* json_object_new(enum json_type o_type); ++ static json_object_to_json_string_fn json_object_object_to_json_string; ++ static json_object_to_json_string_fn json_object_boolean_to_json_string; ++ static json_object_to_json_string_fn json_object_int_to_json_string; ++-static json_object_to_json_string_fn json_object_double_to_json_string; ++ static json_object_to_json_string_fn json_object_string_to_json_string; ++ static json_object_to_json_string_fn json_object_array_to_json_string; ++ ++@@ -644,10 +643,10 @@ int64_t json_object_get_int64(const struct json_object *jso) ++ ++ /* json_object_double */ ++ ++-static int json_object_double_to_json_string(struct json_object* jso, ++- struct printbuf *pb, ++- int level, ++- int flags) +++int json_object_double_to_json_string(struct json_object* jso, +++ struct printbuf *pb, +++ int level, +++ int flags) ++ { ++ char buf[128], *p, *q; ++ int size; ++@@ -663,7 +662,8 @@ static int json_object_double_to_json_string(struct json_object* jso, ++ else ++ size = snprintf(buf, sizeof(buf), "-Infinity"); ++ else ++- size = snprintf(buf, sizeof(buf), "%.17g", jso->o.c_double); +++ size = snprintf(buf, sizeof(buf), +++ jso->_userdata ? (const char*) jso->_userdata : "%.17g", jso->o.c_double); ++ ++ p = strchr(buf, ','); ++ if (p) { ++diff --git a/json_object.h b/json_object.h ++index 2bce454..a89de44 100644 ++--- a/json_object.h +++++ b/json_object.h ++@@ -614,6 +614,9 @@ extern int64_t json_object_get_int64(const struct json_object *obj); ++ /* double type methods */ ++ ++ /** Create a new empty json_object of type json_type_double +++ * +++ * @see json_object_double_to_json_string() for how to set a custom format string. +++ * ++ * @param d the double ++ * @returns a json_object of type json_type_double ++ */ ++@@ -642,6 +645,31 @@ extern struct json_object* json_object_new_double(double d); ++ */ ++ extern struct json_object* json_object_new_double_s(double d, const char *ds); ++ +++ +++/** Serialize a json_object of type json_type_double to a string. +++ * +++ * This function isn't meant to be called directly. Instead, you can set a +++ * custom format string for the serialization of this double using the +++ * following call (where "%.17g" actually is the default): +++ * +++ * @code +++ * jso = json_object_new_double(d); +++ * json_object_set_serializer(jso, json_object_double_to_json_string, +++ * "%.17g", NULL); +++ * @endcode +++ * +++ * @see printf(3) man page for format strings +++ * +++ * @param jso The json_type_double object that is serialized. +++ * @param pb The destination buffer. +++ * @param level Ignored. +++ * @param flags Ignored. +++ */ +++extern int json_object_double_to_json_string(struct json_object* jso, +++ struct printbuf *pb, +++ int level, +++ int flags); +++ ++ /** Get the double floating point value of a json_object ++ * ++ * The type is coerced to a double if the passed object is not a double. ++-- ++2.7.4 ++ From 471c11cd6dbc6b2e390bf5809b276ef512399ded Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Fri, 27 May 2016 00:13:37 +0200 Subject: [PATCH 035/184] docs: fix 404 error for nordwest site repo url --- docs/user/site.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/site.rst b/docs/user/site.rst index 7f56150d..4a702b3e 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -408,7 +408,7 @@ This is a non-exhaustive list of site-repos from various communities: * `site-ffmyk `_ (Mayen-Koblenz) * `site-ffm `_ (München) * `site-ffms `_ (Münsterland) -* `site-ffnw `_ (Nordwest) +* `site-ffnw `_ (Nordwest) * `site-ffka `_ (Karlsruhe) * `site-ffrl `_ (Rheinland) * `site-ffrg `_ (Ruhrgebiet) From 8546c3b8bd2b4408efcb82d8fc62a597b285d391 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Fri, 27 May 2016 22:40:17 +0200 Subject: [PATCH 036/184] gluon-node-info: simplify respondd module code a bit --- package/gluon-node-info/src/respondd.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/package/gluon-node-info/src/respondd.c b/package/gluon-node-info/src/respondd.c index d74c69e6..3b0e07dc 100644 --- a/package/gluon-node-info/src/respondd.c +++ b/package/gluon-node-info/src/respondd.c @@ -69,6 +69,12 @@ static struct json_object * get_number(struct uci_context *ctx, struct uci_secti return jso; } +static void maybe_add_number(struct uci_context *ctx, struct uci_section *s, const char *name, struct json_object *parent) { + struct json_object *jso = get_number(ctx, s, name); + if (jso) + json_object_object_add(parent, name, jso); +} + static struct json_object * get_location(struct uci_context *ctx, struct uci_package *p) { struct uci_section *s = get_first_section(p, "location"); if (!s) @@ -80,17 +86,9 @@ static struct json_object * get_location(struct uci_context *ctx, struct uci_pac struct json_object *ret = json_object_new_object(); - struct json_object *latitude = get_number(ctx, s, "latitude"); - if (latitude) - json_object_object_add(ret, "latitude", latitude); - - struct json_object *longitude = get_number(ctx, s, "longitude"); - if (longitude) - json_object_object_add(ret, "longitude", longitude); - - struct json_object *altitude = get_number(ctx, s, "altitude"); - if (altitude) - json_object_object_add(ret, "altitude", altitude); + maybe_add_number(ctx, s, "latitude", ret); + maybe_add_number(ctx, s, "longitude", ret); + maybe_add_number(ctx, s, "altitude", ret); return ret; } From 3e220613a36a7bb6fa769fea89aca0e971aa3134 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 May 2016 16:04:40 +0200 Subject: [PATCH 037/184] scripts/patch: never GPG-sign automated commits, regardless of the default configuration --- scripts/patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/patch.sh b/scripts/patch.sh index 6b0fa23f..90d2de7b 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -12,7 +12,7 @@ for module in $GLUON_MODULES; do git checkout -B patching base for patch in "$GLUONDIR"/patches/$module/*.patch; do - if ! git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' am --whitespace=nowarn --committer-date-is-author-date "$patch"; then + if ! git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date "$patch"; then git am --abort git checkout patched git branch -D patching From d2f26ce7b89af2bf84c5a0773ba8da2afd1ef2fd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 May 2016 16:06:43 +0200 Subject: [PATCH 038/184] node: downgrade to v0.12.14 Allow to build Gluon with GCC 4.7 (e.g. on Debian Wheezy) as host compiler again. --- .../0005-node-update-to-v0.12.14.patch | 36 ++++++ .../openwrt/0005-node-update-to-v4.4.4.patch | 110 ------------------ ...ur-leading-to-broken-code-with-GCC-6.patch | 20 ++-- 3 files changed, 46 insertions(+), 120 deletions(-) create mode 100644 patches/packages/openwrt/0005-node-update-to-v0.12.14.patch delete mode 100644 patches/packages/openwrt/0005-node-update-to-v4.4.4.patch diff --git a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch new file mode 100644 index 00000000..9b03cee4 --- /dev/null +++ b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch @@ -0,0 +1,36 @@ +From: Matthias Schiffer +Date: Mon, 9 May 2016 15:57:18 +0200 +Subject: node: update to v0.12.14 + +While we're at it, also enable parallel builds. + +Signed-off-by: Matthias Schiffer + +diff --git a/lang/node/Makefile b/lang/node/Makefile +index 243c8a5..e6fe843 100644 +--- a/lang/node/Makefile ++++ b/lang/node/Makefile +@@ -8,17 +8,21 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=node +-PKG_VERSION:=v0.12.7 ++PKG_VERSION:=v0.12.14 + PKG_RELEASE:=1 + +-PKG_SOURCE:=node-$(PKG_VERSION).tar.gz ++PKG_SOURCE:=node-$(PKG_VERSION).tar.xz + PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} ++PKG_MD5SUM:=27f1a2cf00af32cbfe9401ca4b1a805f + + HOST_BUILD_DEPENDS:=python/host + PKG_BUILD_DEPENDS:=python/host + PKG_INSTALL:=1 + PKG_USE_MIPS16:=0 + ++HOST_BUILD_PARALLEL:=1 ++PKG_BUILD_PARALLEL:=1 ++ + PKG_MAINTAINER:=John Crispin + PKG_LICENSE:= + diff --git a/patches/packages/openwrt/0005-node-update-to-v4.4.4.patch b/patches/packages/openwrt/0005-node-update-to-v4.4.4.patch deleted file mode 100644 index 8c431944..00000000 --- a/patches/packages/openwrt/0005-node-update-to-v4.4.4.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Matthias Schiffer -Date: Mon, 9 May 2016 15:57:18 +0200 -Subject: node: update to v4.4.4 - -While we're at it, also enable parallel builds. - -Signed-off-by: Matthias Schiffer - -diff --git a/lang/node/Makefile b/lang/node/Makefile -index 243c8a5..71cf55b 100644 ---- a/lang/node/Makefile -+++ b/lang/node/Makefile -@@ -8,17 +8,21 @@ - include $(TOPDIR)/rules.mk - - PKG_NAME:=node --PKG_VERSION:=v0.12.7 -+PKG_VERSION:=v4.4.4 - PKG_RELEASE:=1 - --PKG_SOURCE:=node-$(PKG_VERSION).tar.gz -+PKG_SOURCE:=node-$(PKG_VERSION).tar.xz - PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} -+PKG_MD5SUM:=1ad7915688df85f62a57f43860dc54c6 - - HOST_BUILD_DEPENDS:=python/host - PKG_BUILD_DEPENDS:=python/host - PKG_INSTALL:=1 - PKG_USE_MIPS16:=0 - -+HOST_BUILD_PARALLEL:=1 -+PKG_BUILD_PARALLEL:=1 -+ - PKG_MAINTAINER:=John Crispin - PKG_LICENSE:= - -@@ -31,7 +35,7 @@ define Package/node - SUBMENU:=Node.js - TITLE:=Node.js is a platform built on Chrome's JavaScript runtime - URL:=http://nodejs.org/ -- DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv -+ DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv +zlib - endef - - define Package/node/description -diff --git a/lang/node/patches/001-hardfloat.patch b/lang/node/patches/001-hardfloat.patch -new file mode 100644 -index 0000000..1bb2493 ---- /dev/null -+++ b/lang/node/patches/001-hardfloat.patch -@@ -0,0 +1,12 @@ -+diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc -+index 4f58720..1f3071e 100644 -+--- a/deps/v8/src/base/cpu.cc -++++ b/deps/v8/src/base/cpu.cc -+@@ -143,6 +143,7 @@ int __detect_fp64_mode(void) { -+ ".set push\n\t" -+ ".set noreorder\n\t" -+ ".set oddspreg\n\t" -++ ".set hardfloat\n\t" -+ "lui $t0, 0x3FF0\n\t" -+ "ldc1 $f0, %0\n\t" -+ "mtc1 $t0, $f1\n\t" -diff --git a/lang/node/patches/001-mips-no-fpu.patch b/lang/node/patches/001-mips-no-fpu.patch -deleted file mode 100644 -index 5bf8142..0000000 ---- a/lang/node/patches/001-mips-no-fpu.patch -+++ /dev/null -@@ -1,15 +0,0 @@ ----- a/deps/v8/build/toolchain.gypi --+++ b/deps/v8/build/toolchain.gypi --@@ -50,10 +50,10 @@ -- 'arm_test_noprobe%': 'off', -- -- # Similar to vfp but on MIPS. --- 'v8_can_use_fpu_instructions%': 'true', --+ 'v8_can_use_fpu_instructions%': 'false', -- -- # Similar to the ARM hard float ABI but on MIPS. --- 'v8_use_mips_abi_hardfloat%': 'true', --+ 'v8_use_mips_abi_hardfloat%': 'false', -- -- # Default arch variant for MIPS. -- 'mips_arch_variant%': 'r2', -diff --git a/lang/node/patches/002-addr_info.patch b/lang/node/patches/002-addr_info.patch -index 78225db..0aa02da 100644 ---- a/lang/node/patches/002-addr_info.patch -+++ b/lang/node/patches/002-addr_info.patch -@@ -1,6 +1,6 @@ - --- a/deps/uv/src/unix/getaddrinfo.c - +++ b/deps/uv/src/unix/getaddrinfo.c --@@ -99,6 +99,7 @@ -+@@ -99,6 +99,7 @@ static void uv__getaddrinfo_work(struct - int err; - - req = container_of(w, uv_getaddrinfo_t, work_req); -diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch -index 723fe9d..01a71c6 100644 ---- a/lang/node/patches/003-path.patch -+++ b/lang/node/patches/003-path.patch -@@ -1,7 +1,7 @@ - --- a/lib/module.js - +++ b/lib/module.js --@@ -512,7 +512,8 @@ -- var homeDir = process.env.HOME; -+@@ -453,7 +453,8 @@ Module._initPaths = function() { -+ homeDir = process.env.HOME; - } - - - var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')]; diff --git a/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch b/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch index 12d6bcd2..ae5162e2 100644 --- a/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch +++ b/patches/packages/openwrt/0006-node-fix-undefined-behaviour-leading-to-broken-code-with-GCC-6.patch @@ -10,15 +10,15 @@ Signed-off-by: Matthias Schiffer diff --git a/lang/node/patches/004-gcc6-undefined-behaviour.patch b/lang/node/patches/004-gcc6-undefined-behaviour.patch new file mode 100644 -index 0000000..11b0132 +index 0000000..dbbbcf0 --- /dev/null +++ b/lang/node/patches/004-gcc6-undefined-behaviour.patch @@ -0,0 +1,64 @@ +diff --git a/deps/v8/src/heap/incremental-marking.cc b/deps/v8/src/heap/incremental-marking.cc -+index 58eb0aa..b2b796f 100644 ++index c922e83..2ead8be 100644 +--- a/deps/v8/src/heap/incremental-marking.cc ++++ b/deps/v8/src/heap/incremental-marking.cc -+@@ -364,7 +364,7 @@ void IncrementalMarking::DeactivateIncrementalWriteBarrier() { ++@@ -379,7 +379,7 @@ void IncrementalMarking::DeactivateIncrementalWriteBarrier() { + DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); + + LargePage* lop = heap_->lo_space()->first_page(); @@ -27,7 +27,7 @@ index 0000000..11b0132 + SetOldSpacePageFlags(lop, false, false); + lop = lop->next_page(); + } -+@@ -396,7 +396,7 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() { ++@@ -414,7 +414,7 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() { + ActivateIncrementalWriteBarrier(heap_->new_space()); + + LargePage* lop = heap_->lo_space()->first_page(); @@ -37,10 +37,10 @@ index 0000000..11b0132 + lop = lop->next_page(); + } +diff --git a/deps/v8/src/heap/spaces-inl.h b/deps/v8/src/heap/spaces-inl.h -+index c2c4d12..d63ee63 100644 ++index 56c2bad..1a45096 100644 +--- a/deps/v8/src/heap/spaces-inl.h ++++ b/deps/v8/src/heap/spaces-inl.h -+@@ -155,7 +155,7 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, ++@@ -148,7 +148,7 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, + + bool PagedSpace::Contains(Address addr) { + Page* p = Page::FromAddress(addr); @@ -50,10 +50,10 @@ index 0000000..11b0132 + } + +diff --git a/deps/v8/src/heap/spaces.cc b/deps/v8/src/heap/spaces.cc -+index 0806b25..c0e109b 100644 ++index e197f5a..2fe10eb 100644 +--- a/deps/v8/src/heap/spaces.cc ++++ b/deps/v8/src/heap/spaces.cc -+@@ -2953,7 +2953,7 @@ LargePage* LargeObjectSpace::FindPage(Address a) { ++@@ -2918,7 +2918,7 @@ LargePage* LargeObjectSpace::FindPage(Address a) { + if (e != NULL) { + DCHECK(e->value != NULL); + LargePage* page = reinterpret_cast(e->value); @@ -63,10 +63,10 @@ index 0000000..11b0132 + return page; + } +diff --git a/deps/v8/src/heap/spaces.h b/deps/v8/src/heap/spaces.h -+index 3461de3..e35c057 100644 ++index 312d75f..1054672 100644 +--- a/deps/v8/src/heap/spaces.h ++++ b/deps/v8/src/heap/spaces.h -+@@ -278,9 +278,9 @@ class MemoryChunk { ++@@ -283,9 +283,9 @@ class MemoryChunk { + // Only works for addresses in pointer spaces, not data or code spaces. + static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); + From 314b1b8995b0b007c0d8d4a07bc53b362e11add5 Mon Sep 17 00:00:00 2001 From: Metatron321 Date: Fri, 27 May 2016 00:42:34 +0200 Subject: [PATCH 039/184] docs: added site for Regio Aachen --- docs/user/site.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/user/site.rst b/docs/user/site.rst index 4a702b3e..5b439646 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -394,6 +394,7 @@ site-repos in the wild This is a non-exhaustive list of site-repos from various communities: * `site-ffa `_ (Altdorf, Landshut & Umgebung) +* `site-ffac `_ (Regio Aachen) * `site-ffbs `_ (Braunschweig) * `site-ffhb `_ (Bremen) * `site-ffda `_ (Darmstadt) From dd5c898bba2656874345aa951e254590ed16df05 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 May 2016 11:59:12 +0200 Subject: [PATCH 040/184] Update patches For some reason, the filenames of the OpenMesh support patches were truncated. --- ...-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch} | 0 ...ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch} | 0 ...xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch} | 0 ...ripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch} | 0 ...e-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch} | 0 ...1xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch} | 0 ...5-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch} | 0 ...ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch} | 0 ...-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch} | 0 ...rivate-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch} | 0 ...ivate-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch} | 0 ...ts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch} | 0 ...adecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch} | 0 ...r71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch} | 0 ...-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch} | 0 ...ipts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch} | 0 ...ct-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch} | 0 ...-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch} | 0 ...1xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch} | 0 ...r71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch} | 0 ...-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch} | 0 21 files changed, 0 insertions(+), 0 deletions(-) rename patches/openwrt/{0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch => 0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch} (100%) rename patches/openwrt/{0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch => 0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch} (100%) rename patches/openwrt/{0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch => 0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch} (100%) rename patches/openwrt/{0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch => 0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch} (100%) rename patches/openwrt/{0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch => 0053-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch} (100%) rename patches/openwrt/{0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch => 0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch} (100%) rename patches/openwrt/{0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch => 0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch} (100%) rename patches/openwrt/{0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch => 0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch} (100%) rename patches/openwrt/{0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch => 0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch} (100%) rename patches/openwrt/{0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch => 0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch} (100%) rename patches/openwrt/{0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch => 0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch} (100%) rename patches/openwrt/{0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch => 0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch} (100%) rename patches/openwrt/{0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch => 0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch} (100%) rename patches/openwrt/{0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch => 0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch} (100%) rename patches/openwrt/{0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch => 0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch} (100%) rename patches/openwrt/{0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch => 0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch} (100%) rename patches/openwrt/{0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch => 0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch} (100%) rename patches/openwrt/{0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch => 0072-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch} (100%) rename patches/openwrt/{0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch => 0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch} (100%) rename patches/openwrt/{0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch => 0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch} (100%) rename patches/openwrt/{0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch => 0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch} (100%) diff --git a/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch b/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch similarity index 100% rename from patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devic.patch rename to patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch diff --git a/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch b/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch similarity index 100% rename from patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-bo.patch rename to patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch diff --git a/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch b/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch similarity index 100% rename from patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR175.patch rename to patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch diff --git a/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch b/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch similarity index 100% rename from patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-M.patch rename to patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch diff --git a/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch b/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch similarity index 100% rename from patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch rename to patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch diff --git a/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch b/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch similarity index 100% rename from patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_E.patch rename to patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch diff --git a/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch b/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch similarity index 100% rename from patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-board.patch rename to patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch diff --git a/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch b/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch similarity index 100% rename from patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA9.patch rename to patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch diff --git a/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch b/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch similarity index 100% rename from patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA95.patch rename to patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch diff --git a/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch b/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch similarity index 100% rename from patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch rename to patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch diff --git a/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch b/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch similarity index 100% rename from patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_et.patch rename to patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch diff --git a/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch b/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch similarity index 100% rename from patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5s.patch rename to patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch diff --git a/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch b/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch similarity index 100% rename from patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-fo.patch rename to patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch diff --git a/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch b/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch similarity index 100% rename from patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-b.patch rename to patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch diff --git a/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch b/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch similarity index 100% rename from patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch rename to patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch diff --git a/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch b/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch similarity index 100% rename from patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-O.patch rename to patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch diff --git a/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch b/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch similarity index 100% rename from patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch rename to patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch diff --git a/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch b/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch similarity index 100% rename from patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMe.patch rename to patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch diff --git a/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch similarity index 100% rename from patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2.patch rename to patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch diff --git a/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch b/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch similarity index 100% rename from patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-.patch rename to patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch diff --git a/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch b/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch similarity index 100% rename from patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMes.patch rename to patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch From a4615b5329d95f2e36ea0b04dabad491ed7bd061 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 May 2016 11:58:33 +0200 Subject: [PATCH 041/184] mac80211: backport ath9k GPIO support --- ...s-with-prohibited-blackholed-source.patch} | 0 ...tallation-of-headers-for-host-build.patch} | 0 ...alloc-instead-of-oom-kill-processes.patch} | 0 ...=> 0013-fix-UBNT-XM-model-detection.patch} | 0 ...iles-implemented-basic-GPIO-control.patch} | 0 ...pin-for-Ubiquiti-Nanostation-models.patch} | 0 ...-netifd-update-to-latest-git-master.patch} | 0 ...port_bootpart-for-Xen-virtual-disks.patch} | 0 ...ort-LibreSSL-as-provider-of-openssl.patch} | 0 ...WREV-on-upgrades-of-TP-LINK-devices.patch} | 0 ...-space-on-some-TP-LINK-like-devices.patch} | 0 ...X_MODEL-to-match-labels-image-names.patch} | 0 ...71xx-build-image-for-TL-WR710N-v2.1.patch} | 0 ...gure-compatiblity-with-POSIX-shells.patch} | 0 ...as-only-added-in-the-latest-version.patch} | 0 ...ompile-flock-before-everything-else.patch} | 0 ...fall-back-to-unlocked-shell-command.patch} | 0 ...e-conditions-with-multiple-variants.patch} | 0 ...x-packed-checkout-mirroring-support.patch} | 0 ...-backport-spi-nor-driver-from-4.4.9.patch} | 0 ...il-status-register-writes-are-ready.patch} | 0 ...l-mtd-spi-nor-unlock-Winbond-flashs.patch} | 0 ...ols-pkg-config-fix-build-with-GCC-6.patch} | 0 ...inux-compiler-.h-with-u-boot-master.patch} | 0 ...-toolchain-gcc-fix-build-with-GCC-6.patch} | 0 ...561-set-phy-interface-mode-and-mask.patch} | 0 ...on-register-bitmask-for-QCA956x-SoC.patch} | 0 ... 0037-ar71xx-update-QCA956x-support.patch} | 0 ...r-QCA956x-ethernet.patch-into-files.patch} | 0 ...r71xx-fix-MDIO-bus-probe-on-QCA956x.patch} | 0 ...fix-qca956x-ethernet-initialization.patch} | 0 ...pport-for-Ubiquiti-UniFi-AP-AC-LITE.patch} | 0 ...h0-support-for-Ubiquiti-UniFi-AP-AC.patch} | 0 ...71xx-Rename-unifiac-to-unifiac-lite.patch} | 0 ...upport-for-Ubiquiti-UniFi-AP-AC-PRO.patch} | 0 ...upgrade-images-for-OpenMesh-devices.patch} | 0 ...pport-for-the-OpenMesh-MR1750-board.patch} | 0 ...pport-for-the-OpenMesh-MR1750-board.patch} | 0 ...g-gen.sh-add-support-for-the-MR1750.patch} | 0 ...-sysupgrade-for-the-OpenMesh-MR1750.patch} | 0 ...atchdog-add-OpenMesh-MR1750-support.patch} | 0 ...nvtools-add-OpenMesh-MR1750-support.patch} | 0 ...image-for-the-OpenMesh-MR1750-board.patch} | 0 ...of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch} | 0 ...g-helper-for-Open-Mesh-MR900-boards.patch} | 0 ...ath79_gpio_output_select-on-QCA955x.patch} | 0 ...for-ath79_gpio_function_-on-QCA955X.patch} | 0 ...X-GPIO-mux-and-function-definitions.patch} | 0 ...-Use-PHY-fixups-for-Open-Mesh-MR900.patch} | 0 ...Use-PHY-fixups-for-Open-Mesh-MR1750.patch} | 0 ...h79_setup_qca955x_eth_cfg-for-MR900.patch} | 0 ...79_setup_qca955x_eth_cfg-for-MR1750.patch} | 0 ...en.sh-Fix-u-boot-image-md5sum-check.patch} | 0 ...te-sha256sum-for-uboot-verification.patch} | 0 ...port-for-the-OpenMesh-OM5P-AC-board.patch} | 0 ...ce-support-for-the-OpenMesh-OM5P-AC.patch} | 0 ...-gen.sh-add-support-for-the-OM5P-AC.patch} | 0 ...sysupgrade-for-the-OpenMesh-OM5P-AC.patch} | 0 ...tchdog-add-OpenMesh-OM5P-AC-support.patch} | 0 ...vtools-add-OpenMesh-OM5P-AC-support.patch} | 0 ....bin-for-the-OpenMesh-OM5P-AC-board.patch} | 0 ...mage-for-the-OpenMesh-OM5P-AC-board.patch} | 0 ...rt-for-the-OpenMesh-OM5P-ACv2-board.patch} | 0 ...-support-for-the-OpenMesh-OM5P-ACv2.patch} | 0 ...supgrade-for-the-OpenMesh-OM5P-ACv2.patch} | 0 ...hdog-add-OpenMesh-OM5P-ACv2-support.patch} | 0 ...ools-add-OpenMesh-OM5P-ACv2-support.patch} | 0 ...in-for-the-OpenMesh-OM5P-ACv2-board.patch} | 0 ...dd-OM5P-ACv2-to-the-OM5P-AC-profile.patch} | 0 ...r-custom-format-strings-for-doubles.patch} | 0 ...-ath9k-enable-platform-WLAN-LED-name.patch | 121 +++ ...-set-default-state-for-platform-LEDs.patch | 47 + ...mac80211-ath9k-enable-access-to-GPIO.patch | 261 ++++++ .../openwrt/0083-mac80211-refresh-patch.patch | 30 + ...4-mac80211-ath9k-enable-GPIO-buttons.patch | 259 ++++++ ...-on-platforms-without-CONFIG_GPIOLIB.patch | 827 ++++++++++++++++++ ...uner-support-for-UniFi-Outdoor-Plus.patch} | 43 +- 77 files changed, 1562 insertions(+), 26 deletions(-) rename patches/openwrt/{0011-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch => 0010-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch} (100%) rename patches/openwrt/{0012-lua-fix-installation-of-headers-for-host-build.patch => 0011-lua-fix-installation-of-headers-for-host-build.patch} (100%) rename patches/openwrt/{0013-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch => 0012-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch} (100%) rename patches/openwrt/{0014-fix-UBNT-XM-model-detection.patch => 0013-fix-UBNT-XM-model-detection.patch} (100%) rename patches/openwrt/{0015-base-files-implemented-basic-GPIO-control.patch => 0014-base-files-implemented-basic-GPIO-control.patch} (100%) rename patches/openwrt/{0016-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch => 0015-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch} (100%) rename patches/openwrt/{0017-netifd-update-to-latest-git-master.patch => 0016-netifd-update-to-latest-git-master.patch} (100%) rename patches/openwrt/{0018-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch => 0017-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch} (100%) rename patches/openwrt/{0019-Support-LibreSSL-as-provider-of-openssl.patch => 0018-Support-LibreSSL-as-provider-of-openssl.patch} (100%) rename patches/openwrt/{0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch => 0019-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch} (100%) rename patches/openwrt/{0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch => 0020-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch} (100%) rename patches/openwrt/{0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch => 0021-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch} (100%) rename patches/openwrt/{0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch => 0022-ar71xx-build-image-for-TL-WR710N-v2.1.patch} (100%) rename patches/openwrt/{0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch => 0023-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch} (100%) rename patches/openwrt/{0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch => 0024-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch} (100%) rename patches/openwrt/{0026-tools-compile-flock-before-everything-else.patch => 0025-tools-compile-flock-before-everything-else.patch} (100%) rename patches/openwrt/{0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch => 0026-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch} (100%) rename patches/openwrt/{0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch => 0027-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch} (100%) rename patches/openwrt/{0029-download.mk-fix-packed-checkout-mirroring-support.patch => 0028-download.mk-fix-packed-checkout-mirroring-support.patch} (100%) rename patches/openwrt/{0030-kernel-backport-spi-nor-driver-from-4.4.9.patch => 0029-kernel-backport-spi-nor-driver-from-4.4.9.patch} (100%) rename patches/openwrt/{0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch => 0030-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch} (100%) rename patches/openwrt/{0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch => 0031-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch} (100%) rename patches/openwrt/{0033-tools-pkg-config-fix-build-with-GCC-6.patch => 0032-tools-pkg-config-fix-build-with-GCC-6.patch} (100%) rename patches/openwrt/{0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch => 0033-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch} (100%) rename patches/openwrt/{0035-toolchain-gcc-fix-build-with-GCC-6.patch => 0034-toolchain-gcc-fix-build-with-GCC-6.patch} (100%) rename patches/openwrt/{0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch => 0035-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch} (100%) rename patches/openwrt/{0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch => 0036-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch} (100%) rename patches/openwrt/{0038-ar71xx-update-QCA956x-support.patch => 0037-ar71xx-update-QCA956x-support.patch} (100%) rename patches/openwrt/{0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch => 0038-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch} (100%) rename patches/openwrt/{0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch => 0039-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch} (100%) rename patches/openwrt/{0041-ar71xx-fix-qca956x-ethernet-initialization.patch => 0040-ar71xx-fix-qca956x-ethernet-initialization.patch} (100%) rename patches/openwrt/{0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch => 0041-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch} (100%) rename patches/openwrt/{0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch => 0042-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch} (100%) rename patches/openwrt/{0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch => 0043-ar71xx-Rename-unifiac-to-unifiac-lite.patch} (100%) rename patches/openwrt/{0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch => 0044-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch} (100%) rename patches/openwrt/{0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch => 0045-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch} (100%) rename patches/openwrt/{0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch => 0046-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch} (100%) rename patches/openwrt/{0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch => 0047-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch} (100%) rename patches/openwrt/{0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch => 0048-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch} (100%) rename patches/openwrt/{0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch => 0049-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch} (100%) rename patches/openwrt/{0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch => 0050-package-om-watchdog-add-OpenMesh-MR1750-support.patch} (100%) rename patches/openwrt/{0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch => 0051-package-uboot-envtools-add-OpenMesh-MR1750-support.patch} (100%) rename patches/openwrt/{0053-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch => 0052-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch} (100%) rename patches/openwrt/{0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch => 0053-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch} (100%) rename patches/openwrt/{0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch => 0054-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch} (100%) rename patches/openwrt/{0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch => 0055-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch} (100%) rename patches/openwrt/{0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch => 0056-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch} (100%) rename patches/openwrt/{0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch => 0057-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch} (100%) rename patches/openwrt/{0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch => 0058-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch} (100%) rename patches/openwrt/{0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch => 0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch} (100%) rename patches/openwrt/{0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch => 0060-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch} (100%) rename patches/openwrt/{0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch => 0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch} (100%) rename patches/openwrt/{0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch => 0062-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch} (100%) rename patches/openwrt/{0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch => 0063-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch} (100%) rename patches/openwrt/{0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch => 0064-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch} (100%) rename patches/openwrt/{0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch => 0065-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch} (100%) rename patches/openwrt/{0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch => 0066-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch} (100%) rename patches/openwrt/{0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch => 0067-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch} (100%) rename patches/openwrt/{0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch => 0068-om-watchdog-add-OpenMesh-OM5P-AC-support.patch} (100%) rename patches/openwrt/{0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch => 0069-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch} (100%) rename patches/openwrt/{0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch => 0070-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch} (100%) rename patches/openwrt/{0072-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch => 0071-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch} (100%) rename patches/openwrt/{0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch => 0072-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch} (100%) rename patches/openwrt/{0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch => 0073-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch} (100%) rename patches/openwrt/{0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch => 0074-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch} (100%) rename patches/openwrt/{0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch => 0075-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch} (100%) rename patches/openwrt/{0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch => 0076-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch} (100%) rename patches/openwrt/{0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch => 0077-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch} (100%) rename patches/openwrt/{0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch => 0078-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch} (100%) rename patches/openwrt/{0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch => 0079-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch} (100%) create mode 100644 patches/openwrt/0080-mac80211-ath9k-enable-platform-WLAN-LED-name.patch create mode 100644 patches/openwrt/0081-mac80211-ath9k-set-default-state-for-platform-LEDs.patch create mode 100644 patches/openwrt/0082-mac80211-ath9k-enable-access-to-GPIO.patch create mode 100644 patches/openwrt/0083-mac80211-refresh-patch.patch create mode 100644 patches/openwrt/0084-mac80211-ath9k-enable-GPIO-buttons.patch create mode 100644 patches/openwrt/0085-mac80211-rework-gpio-chip-button-support-to-build-on-platforms-without-CONFIG_GPIOLIB.patch rename patches/openwrt/{0010-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch => 0086-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch} (93%) diff --git a/patches/openwrt/0011-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch b/patches/openwrt/0010-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch similarity index 100% rename from patches/openwrt/0011-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch rename to patches/openwrt/0010-ipv6-fix-crash-on-ICMPv6-redirects-with-prohibited-blackholed-source.patch diff --git a/patches/openwrt/0012-lua-fix-installation-of-headers-for-host-build.patch b/patches/openwrt/0011-lua-fix-installation-of-headers-for-host-build.patch similarity index 100% rename from patches/openwrt/0012-lua-fix-installation-of-headers-for-host-build.patch rename to patches/openwrt/0011-lua-fix-installation-of-headers-for-host-build.patch diff --git a/patches/openwrt/0013-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch b/patches/openwrt/0012-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch similarity index 100% rename from patches/openwrt/0013-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch rename to patches/openwrt/0012-kernel-fs-seq_file-fallback-to-vmalloc-instead-of-oom-kill-processes.patch diff --git a/patches/openwrt/0014-fix-UBNT-XM-model-detection.patch b/patches/openwrt/0013-fix-UBNT-XM-model-detection.patch similarity index 100% rename from patches/openwrt/0014-fix-UBNT-XM-model-detection.patch rename to patches/openwrt/0013-fix-UBNT-XM-model-detection.patch diff --git a/patches/openwrt/0015-base-files-implemented-basic-GPIO-control.patch b/patches/openwrt/0014-base-files-implemented-basic-GPIO-control.patch similarity index 100% rename from patches/openwrt/0015-base-files-implemented-basic-GPIO-control.patch rename to patches/openwrt/0014-base-files-implemented-basic-GPIO-control.patch diff --git a/patches/openwrt/0016-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch b/patches/openwrt/0015-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch similarity index 100% rename from patches/openwrt/0016-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch rename to patches/openwrt/0015-ar71xx-assign-proper-GPIO-pin-for-Ubiquiti-Nanostation-models.patch diff --git a/patches/openwrt/0017-netifd-update-to-latest-git-master.patch b/patches/openwrt/0016-netifd-update-to-latest-git-master.patch similarity index 100% rename from patches/openwrt/0017-netifd-update-to-latest-git-master.patch rename to patches/openwrt/0016-netifd-update-to-latest-git-master.patch diff --git a/patches/openwrt/0018-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch b/patches/openwrt/0017-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch similarity index 100% rename from patches/openwrt/0018-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch rename to patches/openwrt/0017-x86-fix-platform_export_bootpart-for-Xen-virtual-disks.patch diff --git a/patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch b/patches/openwrt/0018-Support-LibreSSL-as-provider-of-openssl.patch similarity index 100% rename from patches/openwrt/0019-Support-LibreSSL-as-provider-of-openssl.patch rename to patches/openwrt/0018-Support-LibreSSL-as-provider-of-openssl.patch diff --git a/patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch b/patches/openwrt/0019-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch similarity index 100% rename from patches/openwrt/0020-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch rename to patches/openwrt/0019-ar71xx-check-both-HWID-and-HWREV-on-upgrades-of-TP-LINK-devices.patch diff --git a/patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch b/patches/openwrt/0020-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch similarity index 100% rename from patches/openwrt/0021-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch rename to patches/openwrt/0020-ar71xx-avoid-AR71XX_MODEL-ending-with-a-space-on-some-TP-LINK-like-devices.patch diff --git a/patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch b/patches/openwrt/0021-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch similarity index 100% rename from patches/openwrt/0022-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch rename to patches/openwrt/0021-ar71xx-fix-the-revision-of-a-few-TP-LINK-devices-in-AR71XX_MODEL-to-match-labels-image-names.patch diff --git a/patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch b/patches/openwrt/0022-ar71xx-build-image-for-TL-WR710N-v2.1.patch similarity index 100% rename from patches/openwrt/0023-ar71xx-build-image-for-TL-WR710N-v2.1.patch rename to patches/openwrt/0022-ar71xx-build-image-for-TL-WR710N-v2.1.patch diff --git a/patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch b/patches/openwrt/0023-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch similarity index 100% rename from patches/openwrt/0024-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch rename to patches/openwrt/0023-xtables-addons-build-fix-configure-compatiblity-with-POSIX-shells.patch diff --git a/patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch b/patches/openwrt/0024-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch similarity index 100% rename from patches/openwrt/0025-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch rename to patches/openwrt/0024-tools-add-tar-host-build-required-for-sort-name-which-was-only-added-in-the-latest-version.patch diff --git a/patches/openwrt/0026-tools-compile-flock-before-everything-else.patch b/patches/openwrt/0025-tools-compile-flock-before-everything-else.patch similarity index 100% rename from patches/openwrt/0026-tools-compile-flock-before-everything-else.patch rename to patches/openwrt/0025-tools-compile-flock-before-everything-else.patch diff --git a/patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch b/patches/openwrt/0026-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch similarity index 100% rename from patches/openwrt/0027-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch rename to patches/openwrt/0026-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch diff --git a/patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch b/patches/openwrt/0027-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch similarity index 100% rename from patches/openwrt/0028-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch rename to patches/openwrt/0027-build-add-locking-for-downloads-fixes-race-conditions-with-multiple-variants.patch diff --git a/patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch b/patches/openwrt/0028-download.mk-fix-packed-checkout-mirroring-support.patch similarity index 100% rename from patches/openwrt/0029-download.mk-fix-packed-checkout-mirroring-support.patch rename to patches/openwrt/0028-download.mk-fix-packed-checkout-mirroring-support.patch diff --git a/patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch b/patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch similarity index 100% rename from patches/openwrt/0030-kernel-backport-spi-nor-driver-from-4.4.9.patch rename to patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch diff --git a/patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch b/patches/openwrt/0030-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch similarity index 100% rename from patches/openwrt/0031-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch rename to patches/openwrt/0030-kernel-mtd-spi-nor-wait-until-status-register-writes-are-ready.patch diff --git a/patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch b/patches/openwrt/0031-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch similarity index 100% rename from patches/openwrt/0032-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch rename to patches/openwrt/0031-kernel-mtd-spi-nor-unlock-Winbond-flashs.patch diff --git a/patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch b/patches/openwrt/0032-tools-pkg-config-fix-build-with-GCC-6.patch similarity index 100% rename from patches/openwrt/0033-tools-pkg-config-fix-build-with-GCC-6.patch rename to patches/openwrt/0032-tools-pkg-config-fix-build-with-GCC-6.patch diff --git a/patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch b/patches/openwrt/0033-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch similarity index 100% rename from patches/openwrt/0034-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch rename to patches/openwrt/0033-tools-mkimage-sync-include-linux-compiler-.h-with-u-boot-master.patch diff --git a/patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch b/patches/openwrt/0034-toolchain-gcc-fix-build-with-GCC-6.patch similarity index 100% rename from patches/openwrt/0035-toolchain-gcc-fix-build-with-GCC-6.patch rename to patches/openwrt/0034-toolchain-gcc-fix-build-with-GCC-6.patch diff --git a/patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch b/patches/openwrt/0035-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch similarity index 100% rename from patches/openwrt/0036-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch rename to patches/openwrt/0035-ath79-dev-eth-fix-QCA9561-set-phy-interface-mode-and-mask.patch diff --git a/patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch b/patches/openwrt/0036-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch similarity index 100% rename from patches/openwrt/0037-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch rename to patches/openwrt/0036-ar71xx-use-correct-PLL-configuration-register-bitmask-for-QCA956x-SoC.patch diff --git a/patches/openwrt/0038-ar71xx-update-QCA956x-support.patch b/patches/openwrt/0037-ar71xx-update-QCA956x-support.patch similarity index 100% rename from patches/openwrt/0038-ar71xx-update-QCA956x-support.patch rename to patches/openwrt/0037-ar71xx-update-QCA956x-support.patch diff --git a/patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch b/patches/openwrt/0038-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch similarity index 100% rename from patches/openwrt/0039-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch rename to patches/openwrt/0038-ar71xx-fold-patch-622-MIPS-ath79-add-support-for-QCA956x-ethernet.patch-into-files.patch diff --git a/patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch b/patches/openwrt/0039-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch similarity index 100% rename from patches/openwrt/0040-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch rename to patches/openwrt/0039-ar71xx-fix-MDIO-bus-probe-on-QCA956x.patch diff --git a/patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch b/patches/openwrt/0040-ar71xx-fix-qca956x-ethernet-initialization.patch similarity index 100% rename from patches/openwrt/0041-ar71xx-fix-qca956x-ethernet-initialization.patch rename to patches/openwrt/0040-ar71xx-fix-qca956x-ethernet-initialization.patch diff --git a/patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch b/patches/openwrt/0041-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch similarity index 100% rename from patches/openwrt/0042-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch rename to patches/openwrt/0041-ar71xx-Support-for-Ubiquiti-UniFi-AP-AC-LITE.patch diff --git a/patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch b/patches/openwrt/0042-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch similarity index 100% rename from patches/openwrt/0043-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch rename to patches/openwrt/0042-ar71xx-Fix-eth0-support-for-Ubiquiti-UniFi-AP-AC.patch diff --git a/patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch b/patches/openwrt/0043-ar71xx-Rename-unifiac-to-unifiac-lite.patch similarity index 100% rename from patches/openwrt/0044-ar71xx-Rename-unifiac-to-unifiac-lite.patch rename to patches/openwrt/0043-ar71xx-Rename-unifiac-to-unifiac-lite.patch diff --git a/patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch b/patches/openwrt/0044-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch similarity index 100% rename from patches/openwrt/0045-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch rename to patches/openwrt/0044-ar71xx-Add-support-for-Ubiquiti-UniFi-AP-AC-PRO.patch diff --git a/patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch b/patches/openwrt/0045-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch similarity index 100% rename from patches/openwrt/0046-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch rename to patches/openwrt/0045-ar71xx-Generate-sysupgrade-images-for-OpenMesh-devices.patch diff --git a/patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch b/patches/openwrt/0046-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch similarity index 100% rename from patches/openwrt/0047-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch rename to patches/openwrt/0046-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750-board.patch diff --git a/patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch b/patches/openwrt/0047-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch similarity index 100% rename from patches/openwrt/0048-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch rename to patches/openwrt/0047-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750-board.patch diff --git a/patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch b/patches/openwrt/0048-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch similarity index 100% rename from patches/openwrt/0049-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch rename to patches/openwrt/0048-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-MR1750.patch diff --git a/patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch b/patches/openwrt/0049-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch similarity index 100% rename from patches/openwrt/0050-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch rename to patches/openwrt/0049-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750.patch diff --git a/patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch b/patches/openwrt/0050-package-om-watchdog-add-OpenMesh-MR1750-support.patch similarity index 100% rename from patches/openwrt/0051-package-om-watchdog-add-OpenMesh-MR1750-support.patch rename to patches/openwrt/0050-package-om-watchdog-add-OpenMesh-MR1750-support.patch diff --git a/patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch b/patches/openwrt/0051-package-uboot-envtools-add-OpenMesh-MR1750-support.patch similarity index 100% rename from patches/openwrt/0052-package-uboot-envtools-add-OpenMesh-MR1750-support.patch rename to patches/openwrt/0051-package-uboot-envtools-add-OpenMesh-MR1750-support.patch diff --git a/patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch b/patches/openwrt/0052-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch similarity index 100% rename from patches/openwrt/0053-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch rename to patches/openwrt/0052-ar71xx-create-profile-and-build-image-for-the-OpenMesh-MR1750-board.patch diff --git a/patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch b/patches/openwrt/0053-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch similarity index 100% rename from patches/openwrt/0054-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch rename to patches/openwrt/0053-ar71xx-Extend-the-list-of-bits-in-QCA955X_GMAC_REG_ETH_CFG.patch diff --git a/patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch b/patches/openwrt/0054-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch similarity index 100% rename from patches/openwrt/0055-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch rename to patches/openwrt/0054-ar71xx-Use-_eth_cfg-helper-for-Open-Mesh-MR900-boards.patch diff --git a/patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch b/patches/openwrt/0055-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch similarity index 100% rename from patches/openwrt/0056-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch rename to patches/openwrt/0055-ar71xx-Allow-to-use-ath79_gpio_output_select-on-QCA955x.patch diff --git a/patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch b/patches/openwrt/0056-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch similarity index 100% rename from patches/openwrt/0057-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch rename to patches/openwrt/0056-ar71xx-Add-support-for-ath79_gpio_function_-on-QCA955X.patch diff --git a/patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch b/patches/openwrt/0057-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch similarity index 100% rename from patches/openwrt/0058-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch rename to patches/openwrt/0057-ar71xx-Add-QCA955X-GPIO-mux-and-function-definitions.patch diff --git a/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch b/patches/openwrt/0058-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch similarity index 100% rename from patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch rename to patches/openwrt/0058-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR900.patch diff --git a/patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch b/patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch similarity index 100% rename from patches/openwrt/0060-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch rename to patches/openwrt/0059-ar71xx-Use-PHY-fixups-for-Open-Mesh-MR1750.patch diff --git a/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch b/patches/openwrt/0060-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch similarity index 100% rename from patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch rename to patches/openwrt/0060-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch diff --git a/patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch b/patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch similarity index 100% rename from patches/openwrt/0062-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch rename to patches/openwrt/0061-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR1750.patch diff --git a/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch b/patches/openwrt/0062-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch similarity index 100% rename from patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch rename to patches/openwrt/0062-scripts-om-fwupgradecfg-gen.sh-Fix-u-boot-image-md5sum-check.patch diff --git a/patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch b/patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch similarity index 100% rename from patches/openwrt/0064-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch rename to patches/openwrt/0063-scripts-om-fwupgradecfg-gen.sh-Generate-sha256sum-for-uboot-verification.patch diff --git a/patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch b/patches/openwrt/0064-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch similarity index 100% rename from patches/openwrt/0065-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch rename to patches/openwrt/0064-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-AC-board.patch diff --git a/patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch b/patches/openwrt/0065-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch similarity index 100% rename from patches/openwrt/0066-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch rename to patches/openwrt/0065-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-AC.patch diff --git a/patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch b/patches/openwrt/0066-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch similarity index 100% rename from patches/openwrt/0067-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch rename to patches/openwrt/0066-scripts-om-fwupgradecfg-gen.sh-add-support-for-the-OM5P-AC.patch diff --git a/patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch b/patches/openwrt/0067-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch similarity index 100% rename from patches/openwrt/0068-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch rename to patches/openwrt/0067-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-AC.patch diff --git a/patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch b/patches/openwrt/0068-om-watchdog-add-OpenMesh-OM5P-AC-support.patch similarity index 100% rename from patches/openwrt/0069-om-watchdog-add-OpenMesh-OM5P-AC-support.patch rename to patches/openwrt/0068-om-watchdog-add-OpenMesh-OM5P-AC-support.patch diff --git a/patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch b/patches/openwrt/0069-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch similarity index 100% rename from patches/openwrt/0070-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch rename to patches/openwrt/0069-uboot-envtools-add-OpenMesh-OM5P-AC-support.patch diff --git a/patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch b/patches/openwrt/0070-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch similarity index 100% rename from patches/openwrt/0071-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch rename to patches/openwrt/0070-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-AC-board.patch diff --git a/patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch b/patches/openwrt/0071-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch similarity index 100% rename from patches/openwrt/0072-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch rename to patches/openwrt/0071-ar71xx-create-profile-and-build-image-for-the-OpenMesh-OM5P-AC-board.patch diff --git a/patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch b/patches/openwrt/0072-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch similarity index 100% rename from patches/openwrt/0073-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch rename to patches/openwrt/0072-ar71xx-add-kernel-support-for-the-OpenMesh-OM5P-ACv2-board.patch diff --git a/patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0073-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch similarity index 100% rename from patches/openwrt/0074-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch rename to patches/openwrt/0073-ar71xx-add-user-space-support-for-the-OpenMesh-OM5P-ACv2.patch diff --git a/patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch b/patches/openwrt/0074-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch similarity index 100% rename from patches/openwrt/0075-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch rename to patches/openwrt/0074-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM5P-ACv2.patch diff --git a/patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch b/patches/openwrt/0075-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch similarity index 100% rename from patches/openwrt/0076-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch rename to patches/openwrt/0075-om-watchdog-add-OpenMesh-OM5P-ACv2-support.patch diff --git a/patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch b/patches/openwrt/0076-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch similarity index 100% rename from patches/openwrt/0077-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch rename to patches/openwrt/0076-uboot-envtools-add-OpenMesh-OM5P-ACv2-support.patch diff --git a/patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch b/patches/openwrt/0077-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch similarity index 100% rename from patches/openwrt/0078-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch rename to patches/openwrt/0077-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-OM5P-ACv2-board.patch diff --git a/patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch b/patches/openwrt/0078-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch similarity index 100% rename from patches/openwrt/0079-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch rename to patches/openwrt/0078-ar71xx-add-OM5P-ACv2-to-the-OM5P-AC-profile.patch diff --git a/patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch b/patches/openwrt/0079-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch similarity index 100% rename from patches/openwrt/0080-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch rename to patches/openwrt/0079-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch diff --git a/patches/openwrt/0080-mac80211-ath9k-enable-platform-WLAN-LED-name.patch b/patches/openwrt/0080-mac80211-ath9k-enable-platform-WLAN-LED-name.patch new file mode 100644 index 00000000..e3604a4a --- /dev/null +++ b/patches/openwrt/0080-mac80211-ath9k-enable-platform-WLAN-LED-name.patch @@ -0,0 +1,121 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 12:56:43 +0200 +Subject: mac80211: ath9k: enable platform WLAN LED name + +Enable platform-supplied WLAN LED name for ath9k device. + +Signed-off-by: Michal Cieslakiewicz +Acked-by: Hartmut Knaack + +Backport of r48879 + +diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch +new file mode 100644 +index 0000000..8d2d899 +--- /dev/null ++++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch +@@ -0,0 +1,48 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 20:45:57 +0100 ++Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name ++ ++Enable platform-supplied WLAN LED name for ath9k device. It replaces generic ++'ath9k-phy*' label with string set during platform initialization. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++ drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++--- ++ include/linux/ath9k_platform.h | 1 + ++ 2 files changed, 8 insertions(+), 3 deletions(-) ++ ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -132,15 +132,19 @@ void ath_init_leds(struct ath_softc *sc) ++ if (AR_SREV_9100(sc->sc_ah)) ++ return; ++ ++- snprintf(led_name, sizeof(led_name), "ath9k-%s", ++- wiphy_name(sc->hw->wiphy)); +++ if (pdata && pdata->led_name) +++ strncpy(led_name, pdata->led_name, sizeof(led_name)); +++ else +++ snprintf(led_name, sizeof(led_name), "ath9k-%s", +++ wiphy_name(sc->hw->wiphy)); ++ ++ if (ath9k_led_blink) ++ trigger = sc->led_default_trigger; ++ else ++ trigger = ieee80211_get_radio_led_name(sc->hw); ++ ++- ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high); +++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, +++ !sc->sc_ah->config.led_active_high); ++ ++ if (!pdata) ++ return; ++--- a/include/linux/ath9k_platform.h +++++ b/include/linux/ath9k_platform.h ++@@ -45,6 +45,7 @@ struct ath9k_platform_data { ++ ++ int num_leds; ++ const struct gpio_led *leds; +++ const char *led_name; ++ }; ++ ++ #endif /* _LINUX_ATH9K_PLATFORM_H */ +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c +index d382453..bf80d4d 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c +@@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin) + } + } + ++__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name) ++{ ++ switch (wmac) { ++ case 0: ++ ap9x_wmac0_data.led_name = led_name; ++ break; ++ case 1: ++ ap9x_wmac1_data.led_name = led_name; ++ break; ++ } ++} ++ + __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { + switch (wmac) { +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h +index ad288cb..dcfe541 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h +@@ -19,6 +19,7 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin); + void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val); + void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, + int num_leds); ++void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name); + struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac); + + void ap91_pci_init(u8 *cal_data, u8 *mac_addr); +@@ -33,6 +34,8 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac, + static inline void ap9x_pci_setup_wmac_leds(unsigned wmac, + struct gpio_led *leds, + int num_leds) {} ++static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac, ++ const char *led_name) {} + static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { + return NULL; +diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h +index 30ce216..823e5ac 100644 +--- a/target/linux/generic/files/include/linux/ath9k_platform.h ++++ b/target/linux/generic/files/include/linux/ath9k_platform.h +@@ -45,6 +45,7 @@ struct ath9k_platform_data { + + int num_leds; + const struct gpio_led *leds; ++ const char *led_name; + }; + + #endif /* _LINUX_ATH9K_PLATFORM_H */ diff --git a/patches/openwrt/0081-mac80211-ath9k-set-default-state-for-platform-LEDs.patch b/patches/openwrt/0081-mac80211-ath9k-set-default-state-for-platform-LEDs.patch new file mode 100644 index 00000000..0c49ef87 --- /dev/null +++ b/patches/openwrt/0081-mac80211-ath9k-set-default-state-for-platform-LEDs.patch @@ -0,0 +1,47 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 13:37:28 +0200 +Subject: mac80211: ath9k: set default state for platform LEDs + +Support default state for platform LEDs connected to ath9k device. +Now LEDs are correctly set on or off at ath9k module initialization. + +Signed-off-by: Michal Cieslakiewicz +Acked-by: Hartmut Knaack + +Backport of r48880 + +diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch +new file mode 100644 +index 0000000..db0b619 +--- /dev/null ++++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch +@@ -0,0 +1,29 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 20:48:49 +0100 ++Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs ++ ++Support default state for platform LEDs connected to ath9k device. ++Now LEDs are correctly set on or off at ath9k module initialization. ++Very useful if power LED is connected to wireless chip. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++ gpio.c | 7 +++++-- ++ 1 file changed, 5 insertions(+), 2 deletions(-) ++ ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -54,8 +54,11 @@ static int ath_add_led(struct ath_softc ++ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio, ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); ++ ++- /* LED off */ ++- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); +++ /* Set default LED state */ +++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON) +++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low); +++ else +++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); ++ ++ return 0; ++ } diff --git a/patches/openwrt/0082-mac80211-ath9k-enable-access-to-GPIO.patch b/patches/openwrt/0082-mac80211-ath9k-enable-access-to-GPIO.patch new file mode 100644 index 00000000..dddcadd6 --- /dev/null +++ b/patches/openwrt/0082-mac80211-ath9k-enable-access-to-GPIO.patch @@ -0,0 +1,261 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 13:37:59 +0200 +Subject: mac80211: ath9k: enable access to GPIO + +Enable access to GPIO chip and its pins for Atheros AR92xx +wireless devices. For now AR9285 and AR9287 are supported. + +Signed-off-by: Michal Cieslakiewicz +Acked-by: Hartmut Knaack + +Backport of r48881 + +diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch +new file mode 100644 +index 0000000..beee169 +--- /dev/null ++++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch +@@ -0,0 +1,243 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 21:01:31 +0100 ++Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO ++ ++Enable access to GPIO chip and its pins for Atheros AR92xx ++wireless devices. For now AR9285 and AR9287 are supported. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++ ath9k.h | 23 ++++++++++++ ++ gpio.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ init.c | 2 + ++ 3 files changed, 146 insertions(+) ++ ++--- a/drivers/net/wireless/ath/ath9k/ath9k.h +++++ b/drivers/net/wireless/ath/ath9k/ath9k.h ++@@ -24,6 +24,7 @@ ++ #include ++ #include ++ #include +++#include ++ ++ #include "common.h" ++ #include "debug.h" ++@@ -817,6 +818,13 @@ void ath_fill_led_pin(struct ath_softc * ++ int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name, ++ const char *trigger, bool active_low); ++ +++/***************/ +++/* GPIO Chip */ +++/***************/ +++ +++void ath9k_register_gpio_chip(struct ath_softc *sc); +++void ath9k_unregister_gpio_chip(struct ath_softc *sc); +++ ++ #else ++ static inline void ath_init_leds(struct ath_softc *sc) ++ { ++@@ -828,6 +836,14 @@ static inline void ath_deinit_leds(struc ++ static inline void ath_fill_led_pin(struct ath_softc *sc) ++ { ++ } +++ +++static inline void ath9k_register_gpio_chip(struct ath_softc *sc) +++{ +++} +++ +++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) +++{ +++} ++ #endif ++ ++ /************************/ ++@@ -963,6 +979,12 @@ struct ath_led { ++ struct led_classdev cdev; ++ }; ++ +++struct ath9k_gpio_chip { +++ struct ath_softc *sc; +++ char label[32]; +++ struct gpio_chip gchip; +++}; +++ ++ struct ath_softc { ++ struct ieee80211_hw *hw; ++ struct device *dev; ++@@ -1017,6 +1039,7 @@ struct ath_softc { ++ #ifdef CPTCFG_MAC80211_LEDS ++ const char *led_default_trigger; ++ struct list_head leds; +++ struct ath9k_gpio_chip *gpiochip; ++ #endif ++ ++ #ifdef CPTCFG_ATH9K_DEBUGFS ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -22,6 +22,9 @@ ++ /********************************/ ++ ++ #ifdef CPTCFG_MAC80211_LEDS +++ +++#include +++ ++ static void ath_led_brightness(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++ { ++@@ -60,6 +63,10 @@ static int ath_add_led(struct ath_softc ++ else ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); ++ +++ /* If there is GPIO chip configured, reserve LED pin */ +++ if (sc->gpiochip) +++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); +++ ++ return 0; ++ } ++ ++@@ -116,6 +123,9 @@ void ath_deinit_leds(struct ath_softc *s ++ ++ while (!list_empty(&sc->leds)) { ++ led = list_first_entry(&sc->leds, struct ath_led, list); +++ /* If there is GPIO chip configured, free LED pin */ +++ if (sc->gpiochip) +++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); ++ list_del(&led->list); ++ ath_led_brightness(&led->cdev, LED_OFF); ++ led_classdev_unregister(&led->cdev); ++@@ -186,6 +196,117 @@ void ath_fill_led_pin(struct ath_softc * ++ /* LED off, active low */ ++ ath9k_hw_set_gpio(ah, ah->led_pin, (ah->config.led_active_high) ? 0 : 1); ++ } +++ +++/***************/ +++/* GPIO Chip */ +++/***************/ +++ +++/* gpio_chip handler : set GPIO to input */ +++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_cfg_gpio_input(gc->sc->sc_ah, offset); +++ +++ return 0; +++} +++ +++/* gpio_chip handler : set GPIO to output */ +++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, +++ int value) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_cfg_output(gc->sc->sc_ah, offset, +++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); +++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +++ +++ return 0; +++} +++ +++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ +++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ struct ath_hw *ah = gc->sc->sc_ah; +++ +++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); +++} +++ +++/* gpio_chip handler : get GPIO pin value */ +++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); +++} +++ +++/* gpio_chip handler : set GPIO pin to value */ +++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, +++ int value) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +++} +++ +++/* register GPIO chip */ +++void ath9k_register_gpio_chip(struct ath_softc *sc) +++{ +++ struct ath9k_gpio_chip *gc; +++ u16 ng; +++ +++ /* for now only AR9285 and AR9287 are recognized */ +++ if (AR_SREV_9287(sc->sc_ah)) +++ ng = AR9287_NUM_GPIO; +++ else if (AR_SREV_9285(sc->sc_ah)) +++ ng = AR9285_NUM_GPIO; +++ else +++ return; +++ +++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); +++ if (!gc) +++ return; +++ +++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", +++ wiphy_name(sc->hw->wiphy)); +++ gc->gchip.label = gc->label; +++ gc->gchip.base = -1; /* determine base automatically */ +++ gc->gchip.ngpio = ng; +++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; +++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; +++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir; +++ gc->gchip.get = ath9k_gpio_pin_get; +++ gc->gchip.set = ath9k_gpio_pin_set; +++ gc->gchip.owner = THIS_MODULE; +++ +++ if (gpiochip_add(&gc->gchip)) { +++ kfree(gc); +++ return; +++ } +++ +++ sc->gpiochip = gc; +++ gc->sc = sc; +++} +++ +++/* remove GPIO chip */ +++void ath9k_unregister_gpio_chip(struct ath_softc *sc) +++{ +++ struct ath9k_gpio_chip *gc = sc->gpiochip; +++ +++ if (!gc) +++ return; +++ +++ gpiochip_remove(&gc->gchip); +++ kfree(gc); +++ sc->gpiochip = NULL; +++} +++ ++ #endif ++ ++ /*******************/ ++--- a/drivers/net/wireless/ath/ath9k/init.c +++++ b/drivers/net/wireless/ath/ath9k/init.c ++@@ -979,6 +979,7 @@ int ath9k_init_device(u16 devid, struct ++ goto debug_cleanup; ++ } ++ +++ ath9k_register_gpio_chip(sc); ++ ath_init_leds(sc); ++ ath_start_rfkill_poll(sc); ++ ++@@ -1026,6 +1027,7 @@ void ath9k_deinit_device(struct ath_soft ++ ++ wiphy_rfkill_stop_polling(sc->hw->wiphy); ++ ath_deinit_leds(sc); +++ ath9k_unregister_gpio_chip(sc); ++ ++ ath9k_ps_restore(sc); ++ diff --git a/patches/openwrt/0083-mac80211-refresh-patch.patch b/patches/openwrt/0083-mac80211-refresh-patch.patch new file mode 100644 index 00000000..79e409c9 --- /dev/null +++ b/patches/openwrt/0083-mac80211-refresh-patch.patch @@ -0,0 +1,30 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 13:38:19 +0200 +Subject: mac80211: refresh patch + +Signed-off-by: Felix Fietkau + +Backport of r48882 + +diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch +index beee169..55bb991 100644 +--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch ++++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch +@@ -225,7 +225,7 @@ Signed-off-by: Michal Cieslakiewicz + /*******************/ + --- a/drivers/net/wireless/ath/ath9k/init.c + +++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -979,6 +979,7 @@ int ath9k_init_device(u16 devid, struct ++@@ -975,6 +975,7 @@ int ath9k_init_device(u16 devid, struct + goto debug_cleanup; + } + +@@ -233,7 +233,7 @@ Signed-off-by: Michal Cieslakiewicz + ath_init_leds(sc); + ath_start_rfkill_poll(sc); + +-@@ -1026,6 +1027,7 @@ void ath9k_deinit_device(struct ath_soft ++@@ -1022,6 +1023,7 @@ void ath9k_deinit_device(struct ath_soft + + wiphy_rfkill_stop_polling(sc->hw->wiphy); + ath_deinit_leds(sc); diff --git a/patches/openwrt/0084-mac80211-ath9k-enable-GPIO-buttons.patch b/patches/openwrt/0084-mac80211-ath9k-enable-GPIO-buttons.patch new file mode 100644 index 00000000..f2eb5bc6 --- /dev/null +++ b/patches/openwrt/0084-mac80211-ath9k-enable-GPIO-buttons.patch @@ -0,0 +1,259 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 13:38:45 +0200 +Subject: mac80211: ath9k: enable GPIO buttons + +Enable platform-defined GPIO button support for ath9k device. +Key poller is activated for attached platform buttons. +Requires ath9k GPIO chip access. + +Signed-off-by: Michal Cieslakiewicz + +Backport of r48921 + +diff --git a/package/kernel/mac80211/patches/550-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/550-ath9k_enable_gpio_buttons.patch +new file mode 100644 +index 0000000..e3a8cec +--- /dev/null ++++ b/package/kernel/mac80211/patches/550-ath9k_enable_gpio_buttons.patch +@@ -0,0 +1,169 @@ ++From: Michal Cieslakiewicz ++Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons ++ ++Enable platform-defined GPIO button support for ath9k device. ++Key poller is activated for attached platform buttons. ++Requires ath9k GPIO chip access. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++ drivers/net/wireless/ath/ath9k/ath9k.h | 16 ++++++ ++ drivers/net/wireless/ath/ath9k/gpio.c | 77 +++++++++++++++++++++++++++++++++ ++ drivers/net/wireless/ath/ath9k/init.c | 2 ++ include/linux/ath9k_platform.h | 4 + ++ 4 files changed, 99 insertions(+) ++ ++--- a/drivers/net/wireless/ath/ath9k/ath9k.h +++++ b/drivers/net/wireless/ath/ath9k/ath9k.h ++@@ -825,6 +825,13 @@ int ath_create_gpio_led(struct ath_softc ++ void ath9k_register_gpio_chip(struct ath_softc *sc); ++ void ath9k_unregister_gpio_chip(struct ath_softc *sc); ++ +++/******************/ +++/* GPIO Buttons */ +++/******************/ +++ +++void ath9k_init_buttons(struct ath_softc *sc); +++void ath9k_deinit_buttons(struct ath_softc *sc); +++ ++ #else ++ static inline void ath_init_leds(struct ath_softc *sc) ++ { ++@@ -844,6 +851,14 @@ static inline void ath9k_register_gpio_c ++ static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) ++ { ++ } +++ +++static inline void ath9k_init_buttons(struct ath_softc *sc) +++{ +++} +++ +++static inline void ath9k_deinit_buttons(struct ath_softc *sc) +++{ +++} ++ #endif ++ ++ /************************/ ++@@ -1040,6 +1055,7 @@ struct ath_softc { ++ const char *led_default_trigger; ++ struct list_head leds; ++ struct ath9k_gpio_chip *gpiochip; +++ struct platform_device *btnpdev; /* gpio-keys-polled */ ++ #endif ++ ++ #ifdef CPTCFG_ATH9K_DEBUGFS ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -24,6 +24,8 @@ ++ #ifdef CPTCFG_MAC80211_LEDS ++ ++ #include +++#include +++#include ++ ++ static void ath_led_brightness(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++@@ -159,7 +161,7 @@ void ath_init_leds(struct ath_softc *sc) ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, ++ !sc->sc_ah->config.led_active_high); ++ ++- if (!pdata) +++ if (!pdata || !pdata->leds || !pdata->num_leds) ++ return; ++ ++ for (i = 0; i < pdata->num_leds; i++) ++@@ -307,6 +309,63 @@ void ath9k_unregister_gpio_chip(struct a ++ sc->gpiochip = NULL; ++ } ++ +++/******************/ +++/* GPIO Buttons */ +++/******************/ +++ +++/* add GPIO buttons */ +++void ath9k_init_buttons(struct ath_softc *sc) +++{ +++ struct ath9k_platform_data *pdata = sc->dev->platform_data; +++ struct platform_device *pdev; +++ struct gpio_keys_platform_data gkpdata; +++ struct gpio_keys_button *bt; +++ int i; +++ +++ if (!sc->gpiochip) +++ return; +++ +++ if (!pdata || !pdata->btns || !pdata->num_btns) +++ return; +++ +++ bt = devm_kmemdup(sc->dev, pdata->btns, +++ pdata->num_btns * sizeof(struct gpio_keys_button), +++ GFP_KERNEL); +++ if (!bt) +++ return; +++ +++ for (i = 0; i < pdata->num_btns; i++) { +++ ath9k_hw_cfg_gpio_input(sc->sc_ah, pdata->btns[i].gpio); +++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; +++ } +++ +++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); +++ gkpdata.buttons = bt; +++ gkpdata.nbuttons = pdata->num_btns; +++ gkpdata.poll_interval = pdata->btn_poll_interval; +++ +++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", +++ PLATFORM_DEVID_AUTO, &gkpdata, +++ sizeof(gkpdata)); +++ if (!IS_ERR_OR_NULL(pdev)) +++ sc->btnpdev = pdev; +++ else { +++ sc->btnpdev = NULL; +++ devm_kfree(sc->dev, bt); +++ } +++} +++ +++/* remove GPIO buttons */ +++void ath9k_deinit_buttons(struct ath_softc *sc) +++{ +++ if (!sc->gpiochip || !sc->btnpdev) +++ return; +++ +++ platform_device_unregister(sc->btnpdev); +++ +++ sc->btnpdev = NULL; +++} +++ ++ #endif ++ ++ /*******************/ ++--- a/drivers/net/wireless/ath/ath9k/init.c +++++ b/drivers/net/wireless/ath/ath9k/init.c ++@@ -977,6 +977,7 @@ int ath9k_init_device(u16 devid, struct ++ ++ ath9k_register_gpio_chip(sc); ++ ath_init_leds(sc); +++ ath9k_init_buttons(sc); ++ ath_start_rfkill_poll(sc); ++ ++ return 0; ++@@ -1022,6 +1023,7 @@ void ath9k_deinit_device(struct ath_soft ++ ath9k_ps_wakeup(sc); ++ ++ wiphy_rfkill_stop_polling(sc->hw->wiphy); +++ ath9k_deinit_buttons(sc); ++ ath_deinit_leds(sc); ++ ath9k_unregister_gpio_chip(sc); ++ ++--- a/include/linux/ath9k_platform.h +++++ b/include/linux/ath9k_platform.h ++@@ -46,6 +46,10 @@ struct ath9k_platform_data { ++ int num_leds; ++ const struct gpio_led *leds; ++ const char *led_name; +++ +++ unsigned num_btns; +++ const struct gpio_keys_button *btns; +++ unsigned btn_poll_interval; ++ }; ++ ++ #endif /* _LINUX_ATH9K_PLATFORM_H */ +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c +index bf80d4d..20bb06e 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c +@@ -93,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, + } + } + ++__init void ap9x_pci_setup_wmac_btns(unsigned wmac, ++ struct gpio_keys_button *btns, ++ unsigned num_btns, unsigned poll_interval) ++{ ++ struct ath9k_platform_data *ap9x_wmac_data; ++ ++ if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac))) ++ return; ++ ++ ap9x_wmac_data->btns = btns; ++ ap9x_wmac_data->num_btns = num_btns; ++ ap9x_wmac_data->btn_poll_interval = poll_interval; ++} ++ + static int ap91_pci_plat_dev_init(struct pci_dev *dev) + { + switch (PCI_SLOT(dev->devfn)) { +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h +index dcfe541..d7c0185 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h ++++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h +@@ -12,6 +12,7 @@ + #define _ATH79_DEV_AP9X_PCI_H + + struct gpio_led; ++struct gpio_keys_button; + struct ath9k_platform_data; + + #if defined(CONFIG_ATH79_DEV_AP9X_PCI) +@@ -20,6 +21,8 @@ void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val); + void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, + int num_leds); + void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name); ++void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns, ++ unsigned num_btns, unsigned poll_interval); + struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac); + + void ap91_pci_init(u8 *cal_data, u8 *mac_addr); +@@ -36,6 +39,10 @@ static inline void ap9x_pci_setup_wmac_leds(unsigned wmac, + int num_leds) {} + static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac, + const char *led_name) {} ++static inline void ap9x_pci_setup_wmac_btns(unsigned wmac, ++ struct gpio_keys_button *btns, ++ unsigned num_btns, ++ unsigned poll_interval) {} + static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { + return NULL; +diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h +index 823e5ac..e543a64 100644 +--- a/target/linux/generic/files/include/linux/ath9k_platform.h ++++ b/target/linux/generic/files/include/linux/ath9k_platform.h +@@ -46,6 +46,10 @@ struct ath9k_platform_data { + int num_leds; + const struct gpio_led *leds; + const char *led_name; ++ ++ unsigned num_btns; ++ const struct gpio_keys_button *btns; ++ unsigned btn_poll_interval; + }; + + #endif /* _LINUX_ATH9K_PLATFORM_H */ diff --git a/patches/openwrt/0085-mac80211-rework-gpio-chip-button-support-to-build-on-platforms-without-CONFIG_GPIOLIB.patch b/patches/openwrt/0085-mac80211-rework-gpio-chip-button-support-to-build-on-platforms-without-CONFIG_GPIOLIB.patch new file mode 100644 index 00000000..24cd5638 --- /dev/null +++ b/patches/openwrt/0085-mac80211-rework-gpio-chip-button-support-to-build-on-platforms-without-CONFIG_GPIOLIB.patch @@ -0,0 +1,827 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 13:39:10 +0200 +Subject: mac80211: rework gpio chip/button support to build on platforms without CONFIG_GPIOLIB + +Signed-off-by: Felix Fietkau + +Backport of r48938 + +diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch +new file mode 100644 +index 0000000..f91d85c +--- /dev/null ++++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch +@@ -0,0 +1,235 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 21:01:31 +0100 ++Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO ++ ++Enable access to GPIO chip and its pins for Atheros AR92xx ++wireless devices. For now AR9285 and AR9287 are supported. ++ ++Signed-off-by: Michal Cieslakiewicz ++Signed-off-by: Felix Fietkau ++--- ++--- a/drivers/net/wireless/ath/ath9k/ath9k.h +++++ b/drivers/net/wireless/ath/ath9k/ath9k.h ++@@ -24,6 +24,7 @@ ++ #include ++ #include ++ #include +++#include ++ ++ #include "common.h" ++ #include "debug.h" ++@@ -963,6 +964,14 @@ struct ath_led { ++ struct led_classdev cdev; ++ }; ++ +++#ifdef CONFIG_GPIOLIB +++struct ath9k_gpio_chip { +++ struct ath_softc *sc; +++ char label[32]; +++ struct gpio_chip gchip; +++}; +++#endif +++ ++ struct ath_softc { ++ struct ieee80211_hw *hw; ++ struct device *dev; ++@@ -1017,6 +1026,9 @@ struct ath_softc { ++ #ifdef CPTCFG_MAC80211_LEDS ++ const char *led_default_trigger; ++ struct list_head leds; +++#ifdef CONFIG_GPIOLIB +++ struct ath9k_gpio_chip *gpiochip; +++#endif ++ #endif ++ ++ #ifdef CPTCFG_ATH9K_DEBUGFS ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -16,12 +16,138 @@ ++ ++ #include "ath9k.h" ++ #include +++#include +++ +++#ifdef CPTCFG_MAC80211_LEDS +++ +++#ifdef CONFIG_GPIOLIB +++ +++/***************/ +++/* GPIO Chip */ +++/***************/ +++ +++/* gpio_chip handler : set GPIO to input */ +++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_cfg_gpio_input(gc->sc->sc_ah, offset); +++ +++ return 0; +++} +++ +++/* gpio_chip handler : set GPIO to output */ +++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, +++ int value) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_cfg_output(gc->sc->sc_ah, offset, +++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); +++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +++ +++ return 0; +++} +++ +++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ +++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ struct ath_hw *ah = gc->sc->sc_ah; +++ +++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); +++} +++ +++/* gpio_chip handler : get GPIO pin value */ +++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); +++} +++ +++/* gpio_chip handler : set GPIO pin to value */ +++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, +++ int value) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +++} +++ +++/* register GPIO chip */ +++static void ath9k_register_gpio_chip(struct ath_softc *sc) +++{ +++ struct ath9k_gpio_chip *gc; +++ u16 ng; +++ +++ /* for now only AR9285 and AR9287 are recognized */ +++ if (AR_SREV_9287(sc->sc_ah)) +++ ng = AR9287_NUM_GPIO; +++ else if (AR_SREV_9285(sc->sc_ah)) +++ ng = AR9285_NUM_GPIO; +++ else +++ return; +++ +++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); +++ if (!gc) +++ return; +++ +++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", +++ wiphy_name(sc->hw->wiphy)); +++ gc->gchip.label = gc->label; +++ gc->gchip.base = -1; /* determine base automatically */ +++ gc->gchip.ngpio = ng; +++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; +++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; +++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir; +++ gc->gchip.get = ath9k_gpio_pin_get; +++ gc->gchip.set = ath9k_gpio_pin_set; +++ gc->gchip.owner = THIS_MODULE; +++ +++ if (gpiochip_add(&gc->gchip)) { +++ kfree(gc); +++ return; +++ } +++ +++ sc->gpiochip = gc; +++ gc->sc = sc; +++} +++ +++/* remove GPIO chip */ +++static void ath9k_unregister_gpio_chip(struct ath_softc *sc) +++{ +++ struct ath9k_gpio_chip *gc = sc->gpiochip; +++ +++ if (!gc) +++ return; +++ +++ gpiochip_remove(&gc->gchip); +++ kfree(gc); +++ sc->gpiochip = NULL; +++} +++ +++#else /* CONFIG_GPIOLIB */ +++ +++static inline void ath9k_register_gpio_chip(struct ath_softc *sc) +++{ +++} +++ +++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) +++{ +++} +++ +++#endif /* CONFIG_GPIOLIB */ ++ ++ /********************************/ ++ /* LED functions */ ++ /********************************/ ++ ++-#ifdef CPTCFG_MAC80211_LEDS ++ static void ath_led_brightness(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++ { ++@@ -60,6 +186,12 @@ static int ath_add_led(struct ath_softc ++ else ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); ++ +++#ifdef CONFIG_GPIOLIB +++ /* If there is GPIO chip configured, reserve LED pin */ +++ if (sc->gpiochip) +++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); +++#endif +++ ++ return 0; ++ } ++ ++@@ -116,11 +248,17 @@ void ath_deinit_leds(struct ath_softc *s ++ ++ while (!list_empty(&sc->leds)) { ++ led = list_first_entry(&sc->leds, struct ath_led, list); +++#ifdef CONFIG_GPIOLIB +++ /* If there is GPIO chip configured, free LED pin */ +++ if (sc->gpiochip) +++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); +++#endif ++ list_del(&led->list); ++ ath_led_brightness(&led->cdev, LED_OFF); ++ led_classdev_unregister(&led->cdev); ++ kfree(led); ++ } +++ ath9k_unregister_gpio_chip(sc); ++ } ++ ++ void ath_init_leds(struct ath_softc *sc) ++@@ -135,6 +273,8 @@ void ath_init_leds(struct ath_softc *sc) ++ if (AR_SREV_9100(sc->sc_ah)) ++ return; ++ +++ ath9k_register_gpio_chip(sc); +++ ++ if (pdata && pdata->led_name) ++ strncpy(led_name, pdata->led_name, sizeof(led_name)); ++ else ++@@ -186,6 +326,7 @@ void ath_fill_led_pin(struct ath_softc * ++ /* LED off, active low */ ++ ath9k_hw_set_gpio(ah, ah->led_pin, (ah->config.led_active_high) ? 0 : 1); ++ } +++ ++ #endif ++ ++ /*******************/ +diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch +new file mode 100644 +index 0000000..0527406 +--- /dev/null ++++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch +@@ -0,0 +1,148 @@ ++From: Michal Cieslakiewicz ++Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons ++ ++Enable platform-defined GPIO button support for ath9k device. ++Key poller is activated for attached platform buttons. ++Requires ath9k GPIO chip access. ++ ++Signed-off-by: Michal Cieslakiewicz ++Signed-off-by: Felix Fietkau ++--- ++--- a/drivers/net/wireless/ath/ath9k/ath9k.h +++++ b/drivers/net/wireless/ath/ath9k/ath9k.h ++@@ -1028,6 +1028,7 @@ struct ath_softc { ++ struct list_head leds; ++ #ifdef CONFIG_GPIOLIB ++ struct ath9k_gpio_chip *gpiochip; +++ struct platform_device *btnpdev; /* gpio-keys-polled */ ++ #endif ++ #endif ++ ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -17,6 +17,8 @@ ++ #include "ath9k.h" ++ #include ++ #include +++#include +++#include ++ ++ #ifdef CPTCFG_MAC80211_LEDS ++ ++@@ -132,6 +134,63 @@ static void ath9k_unregister_gpio_chip(s ++ sc->gpiochip = NULL; ++ } ++ +++/******************/ +++/* GPIO Buttons */ +++/******************/ +++ +++/* add GPIO buttons */ +++static void ath9k_init_buttons(struct ath_softc *sc) +++{ +++ struct ath9k_platform_data *pdata = sc->dev->platform_data; +++ struct platform_device *pdev; +++ struct gpio_keys_platform_data gkpdata; +++ struct gpio_keys_button *bt; +++ int i; +++ +++ if (!sc->gpiochip) +++ return; +++ +++ if (!pdata || !pdata->btns || !pdata->num_btns) +++ return; +++ +++ bt = devm_kmemdup(sc->dev, pdata->btns, +++ pdata->num_btns * sizeof(struct gpio_keys_button), +++ GFP_KERNEL); +++ if (!bt) +++ return; +++ +++ for (i = 0; i < pdata->num_btns; i++) { +++ ath9k_hw_cfg_gpio_input(sc->sc_ah, pdata->btns[i].gpio); +++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; +++ } +++ +++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); +++ gkpdata.buttons = bt; +++ gkpdata.nbuttons = pdata->num_btns; +++ gkpdata.poll_interval = pdata->btn_poll_interval; +++ +++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", +++ PLATFORM_DEVID_AUTO, &gkpdata, +++ sizeof(gkpdata)); +++ if (!IS_ERR_OR_NULL(pdev)) +++ sc->btnpdev = pdev; +++ else { +++ sc->btnpdev = NULL; +++ devm_kfree(sc->dev, bt); +++ } +++} +++ +++/* remove GPIO buttons */ +++static void ath9k_deinit_buttons(struct ath_softc *sc) +++{ +++ if (!sc->gpiochip || !sc->btnpdev) +++ return; +++ +++ platform_device_unregister(sc->btnpdev); +++ +++ sc->btnpdev = NULL; +++} +++ ++ #else /* CONFIG_GPIOLIB */ ++ ++ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) ++@@ -142,6 +201,14 @@ static inline void ath9k_unregister_gpio ++ { ++ } ++ +++static inline void ath9k_init_buttons(struct ath_softc *sc) +++{ +++} +++ +++static inline void ath9k_deinit_buttons(struct ath_softc *sc) +++{ +++} +++ ++ #endif /* CONFIG_GPIOLIB */ ++ ++ /********************************/ ++@@ -246,6 +313,7 @@ void ath_deinit_leds(struct ath_softc *s ++ { ++ struct ath_led *led; ++ +++ ath9k_deinit_buttons(sc); ++ while (!list_empty(&sc->leds)) { ++ led = list_first_entry(&sc->leds, struct ath_led, list); ++ #ifdef CONFIG_GPIOLIB ++@@ -274,6 +342,7 @@ void ath_init_leds(struct ath_softc *sc) ++ return; ++ ++ ath9k_register_gpio_chip(sc); +++ ath9k_init_buttons(sc); ++ ++ if (pdata && pdata->led_name) ++ strncpy(led_name, pdata->led_name, sizeof(led_name)); ++@@ -289,7 +358,7 @@ void ath_init_leds(struct ath_softc *sc) ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, ++ !sc->sc_ah->config.led_active_high); ++ ++- if (!pdata) +++ if (!pdata || !pdata->leds || !pdata->num_leds) ++ return; ++ ++ for (i = 0; i < pdata->num_leds; i++) ++--- a/include/linux/ath9k_platform.h +++++ b/include/linux/ath9k_platform.h ++@@ -46,6 +46,10 @@ struct ath9k_platform_data { ++ int num_leds; ++ const struct gpio_led *leds; ++ const char *led_name; +++ +++ unsigned num_btns; +++ const struct gpio_keys_button *btns; +++ unsigned btn_poll_interval; ++ }; ++ ++ #endif /* _LINUX_ATH9K_PLATFORM_H */ +diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch +deleted file mode 100644 +index 55bb991..0000000 +--- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_chip.patch ++++ /dev/null +@@ -1,243 +0,0 @@ +-From: Michal Cieslakiewicz +-Date: Sun, 31 Jan 2016 21:01:31 +0100 +-Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO +- +-Enable access to GPIO chip and its pins for Atheros AR92xx +-wireless devices. For now AR9285 and AR9287 are supported. +- +-Signed-off-by: Michal Cieslakiewicz +---- +- ath9k.h | 23 ++++++++++++ +- gpio.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +- init.c | 2 + +- 3 files changed, 146 insertions(+) +- +---- a/drivers/net/wireless/ath/ath9k/ath9k.h +-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h +-@@ -24,6 +24,7 @@ +- #include +- #include +- #include +-+#include +- +- #include "common.h" +- #include "debug.h" +-@@ -817,6 +818,13 @@ void ath_fill_led_pin(struct ath_softc * +- int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name, +- const char *trigger, bool active_low); +- +-+/***************/ +-+/* GPIO Chip */ +-+/***************/ +-+ +-+void ath9k_register_gpio_chip(struct ath_softc *sc); +-+void ath9k_unregister_gpio_chip(struct ath_softc *sc); +-+ +- #else +- static inline void ath_init_leds(struct ath_softc *sc) +- { +-@@ -828,6 +836,14 @@ static inline void ath_deinit_leds(struc +- static inline void ath_fill_led_pin(struct ath_softc *sc) +- { +- } +-+ +-+static inline void ath9k_register_gpio_chip(struct ath_softc *sc) +-+{ +-+} +-+ +-+static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) +-+{ +-+} +- #endif +- +- /************************/ +-@@ -963,6 +979,12 @@ struct ath_led { +- struct led_classdev cdev; +- }; +- +-+struct ath9k_gpio_chip { +-+ struct ath_softc *sc; +-+ char label[32]; +-+ struct gpio_chip gchip; +-+}; +-+ +- struct ath_softc { +- struct ieee80211_hw *hw; +- struct device *dev; +-@@ -1017,6 +1039,7 @@ struct ath_softc { +- #ifdef CPTCFG_MAC80211_LEDS +- const char *led_default_trigger; +- struct list_head leds; +-+ struct ath9k_gpio_chip *gpiochip; +- #endif +- +- #ifdef CPTCFG_ATH9K_DEBUGFS +---- a/drivers/net/wireless/ath/ath9k/gpio.c +-+++ b/drivers/net/wireless/ath/ath9k/gpio.c +-@@ -22,6 +22,9 @@ +- /********************************/ +- +- #ifdef CPTCFG_MAC80211_LEDS +-+ +-+#include +-+ +- static void ath_led_brightness(struct led_classdev *led_cdev, +- enum led_brightness brightness) +- { +-@@ -60,6 +63,10 @@ static int ath_add_led(struct ath_softc +- else +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); +- +-+ /* If there is GPIO chip configured, reserve LED pin */ +-+ if (sc->gpiochip) +-+ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); +-+ +- return 0; +- } +- +-@@ -116,6 +123,9 @@ void ath_deinit_leds(struct ath_softc *s +- +- while (!list_empty(&sc->leds)) { +- led = list_first_entry(&sc->leds, struct ath_led, list); +-+ /* If there is GPIO chip configured, free LED pin */ +-+ if (sc->gpiochip) +-+ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); +- list_del(&led->list); +- ath_led_brightness(&led->cdev, LED_OFF); +- led_classdev_unregister(&led->cdev); +-@@ -186,6 +196,117 @@ void ath_fill_led_pin(struct ath_softc * +- /* LED off, active low */ +- ath9k_hw_set_gpio(ah, ah->led_pin, (ah->config.led_active_high) ? 0 : 1); +- } +-+ +-+/***************/ +-+/* GPIO Chip */ +-+/***************/ +-+ +-+/* gpio_chip handler : set GPIO to input */ +-+static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) +-+{ +-+ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +-+ gchip); +-+ +-+ ath9k_hw_cfg_gpio_input(gc->sc->sc_ah, offset); +-+ +-+ return 0; +-+} +-+ +-+/* gpio_chip handler : set GPIO to output */ +-+static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, +-+ int value) +-+{ +-+ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +-+ gchip); +-+ +-+ ath9k_hw_cfg_output(gc->sc->sc_ah, offset, +-+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); +-+ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +-+ +-+ return 0; +-+} +-+ +-+/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ +-+static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) +-+{ +-+ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +-+ gchip); +-+ struct ath_hw *ah = gc->sc->sc_ah; +-+ +-+ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); +-+} +-+ +-+/* gpio_chip handler : get GPIO pin value */ +-+static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) +-+{ +-+ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +-+ gchip); +-+ +-+ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); +-+} +-+ +-+/* gpio_chip handler : set GPIO pin to value */ +-+static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, +-+ int value) +-+{ +-+ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +-+ gchip); +-+ +-+ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +-+} +-+ +-+/* register GPIO chip */ +-+void ath9k_register_gpio_chip(struct ath_softc *sc) +-+{ +-+ struct ath9k_gpio_chip *gc; +-+ u16 ng; +-+ +-+ /* for now only AR9285 and AR9287 are recognized */ +-+ if (AR_SREV_9287(sc->sc_ah)) +-+ ng = AR9287_NUM_GPIO; +-+ else if (AR_SREV_9285(sc->sc_ah)) +-+ ng = AR9285_NUM_GPIO; +-+ else +-+ return; +-+ +-+ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); +-+ if (!gc) +-+ return; +-+ +-+ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", +-+ wiphy_name(sc->hw->wiphy)); +-+ gc->gchip.label = gc->label; +-+ gc->gchip.base = -1; /* determine base automatically */ +-+ gc->gchip.ngpio = ng; +-+ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; +-+ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; +-+ gc->gchip.get_direction = ath9k_gpio_pin_get_dir; +-+ gc->gchip.get = ath9k_gpio_pin_get; +-+ gc->gchip.set = ath9k_gpio_pin_set; +-+ gc->gchip.owner = THIS_MODULE; +-+ +-+ if (gpiochip_add(&gc->gchip)) { +-+ kfree(gc); +-+ return; +-+ } +-+ +-+ sc->gpiochip = gc; +-+ gc->sc = sc; +-+} +-+ +-+/* remove GPIO chip */ +-+void ath9k_unregister_gpio_chip(struct ath_softc *sc) +-+{ +-+ struct ath9k_gpio_chip *gc = sc->gpiochip; +-+ +-+ if (!gc) +-+ return; +-+ +-+ gpiochip_remove(&gc->gchip); +-+ kfree(gc); +-+ sc->gpiochip = NULL; +-+} +-+ +- #endif +- +- /*******************/ +---- a/drivers/net/wireless/ath/ath9k/init.c +-+++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -975,6 +975,7 @@ int ath9k_init_device(u16 devid, struct +- goto debug_cleanup; +- } +- +-+ ath9k_register_gpio_chip(sc); +- ath_init_leds(sc); +- ath_start_rfkill_poll(sc); +- +-@@ -1022,6 +1023,7 @@ void ath9k_deinit_device(struct ath_soft +- +- wiphy_rfkill_stop_polling(sc->hw->wiphy); +- ath_deinit_leds(sc); +-+ ath9k_unregister_gpio_chip(sc); +- +- ath9k_ps_restore(sc); +- +diff --git a/package/kernel/mac80211/patches/550-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/550-ath9k_enable_gpio_buttons.patch +deleted file mode 100644 +index e3a8cec..0000000 +--- a/package/kernel/mac80211/patches/550-ath9k_enable_gpio_buttons.patch ++++ /dev/null +@@ -1,169 +0,0 @@ +-From: Michal Cieslakiewicz +-Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons +- +-Enable platform-defined GPIO button support for ath9k device. +-Key poller is activated for attached platform buttons. +-Requires ath9k GPIO chip access. +- +-Signed-off-by: Michal Cieslakiewicz +---- +- drivers/net/wireless/ath/ath9k/ath9k.h | 16 ++++++ +- drivers/net/wireless/ath/ath9k/gpio.c | 77 +++++++++++++++++++++++++++++++++ +- drivers/net/wireless/ath/ath9k/init.c | 2 +- include/linux/ath9k_platform.h | 4 + +- 4 files changed, 99 insertions(+) +- +---- a/drivers/net/wireless/ath/ath9k/ath9k.h +-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h +-@@ -825,6 +825,13 @@ int ath_create_gpio_led(struct ath_softc +- void ath9k_register_gpio_chip(struct ath_softc *sc); +- void ath9k_unregister_gpio_chip(struct ath_softc *sc); +- +-+/******************/ +-+/* GPIO Buttons */ +-+/******************/ +-+ +-+void ath9k_init_buttons(struct ath_softc *sc); +-+void ath9k_deinit_buttons(struct ath_softc *sc); +-+ +- #else +- static inline void ath_init_leds(struct ath_softc *sc) +- { +-@@ -844,6 +851,14 @@ static inline void ath9k_register_gpio_c +- static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) +- { +- } +-+ +-+static inline void ath9k_init_buttons(struct ath_softc *sc) +-+{ +-+} +-+ +-+static inline void ath9k_deinit_buttons(struct ath_softc *sc) +-+{ +-+} +- #endif +- +- /************************/ +-@@ -1040,6 +1055,7 @@ struct ath_softc { +- const char *led_default_trigger; +- struct list_head leds; +- struct ath9k_gpio_chip *gpiochip; +-+ struct platform_device *btnpdev; /* gpio-keys-polled */ +- #endif +- +- #ifdef CPTCFG_ATH9K_DEBUGFS +---- a/drivers/net/wireless/ath/ath9k/gpio.c +-+++ b/drivers/net/wireless/ath/ath9k/gpio.c +-@@ -24,6 +24,8 @@ +- #ifdef CPTCFG_MAC80211_LEDS +- +- #include +-+#include +-+#include +- +- static void ath_led_brightness(struct led_classdev *led_cdev, +- enum led_brightness brightness) +-@@ -159,7 +161,7 @@ void ath_init_leds(struct ath_softc *sc) +- ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, +- !sc->sc_ah->config.led_active_high); +- +-- if (!pdata) +-+ if (!pdata || !pdata->leds || !pdata->num_leds) +- return; +- +- for (i = 0; i < pdata->num_leds; i++) +-@@ -307,6 +309,63 @@ void ath9k_unregister_gpio_chip(struct a +- sc->gpiochip = NULL; +- } +- +-+/******************/ +-+/* GPIO Buttons */ +-+/******************/ +-+ +-+/* add GPIO buttons */ +-+void ath9k_init_buttons(struct ath_softc *sc) +-+{ +-+ struct ath9k_platform_data *pdata = sc->dev->platform_data; +-+ struct platform_device *pdev; +-+ struct gpio_keys_platform_data gkpdata; +-+ struct gpio_keys_button *bt; +-+ int i; +-+ +-+ if (!sc->gpiochip) +-+ return; +-+ +-+ if (!pdata || !pdata->btns || !pdata->num_btns) +-+ return; +-+ +-+ bt = devm_kmemdup(sc->dev, pdata->btns, +-+ pdata->num_btns * sizeof(struct gpio_keys_button), +-+ GFP_KERNEL); +-+ if (!bt) +-+ return; +-+ +-+ for (i = 0; i < pdata->num_btns; i++) { +-+ ath9k_hw_cfg_gpio_input(sc->sc_ah, pdata->btns[i].gpio); +-+ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; +-+ } +-+ +-+ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); +-+ gkpdata.buttons = bt; +-+ gkpdata.nbuttons = pdata->num_btns; +-+ gkpdata.poll_interval = pdata->btn_poll_interval; +-+ +-+ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", +-+ PLATFORM_DEVID_AUTO, &gkpdata, +-+ sizeof(gkpdata)); +-+ if (!IS_ERR_OR_NULL(pdev)) +-+ sc->btnpdev = pdev; +-+ else { +-+ sc->btnpdev = NULL; +-+ devm_kfree(sc->dev, bt); +-+ } +-+} +-+ +-+/* remove GPIO buttons */ +-+void ath9k_deinit_buttons(struct ath_softc *sc) +-+{ +-+ if (!sc->gpiochip || !sc->btnpdev) +-+ return; +-+ +-+ platform_device_unregister(sc->btnpdev); +-+ +-+ sc->btnpdev = NULL; +-+} +-+ +- #endif +- +- /*******************/ +---- a/drivers/net/wireless/ath/ath9k/init.c +-+++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -977,6 +977,7 @@ int ath9k_init_device(u16 devid, struct +- +- ath9k_register_gpio_chip(sc); +- ath_init_leds(sc); +-+ ath9k_init_buttons(sc); +- ath_start_rfkill_poll(sc); +- +- return 0; +-@@ -1022,6 +1023,7 @@ void ath9k_deinit_device(struct ath_soft +- ath9k_ps_wakeup(sc); +- +- wiphy_rfkill_stop_polling(sc->hw->wiphy); +-+ ath9k_deinit_buttons(sc); +- ath_deinit_leds(sc); +- ath9k_unregister_gpio_chip(sc); +- +---- a/include/linux/ath9k_platform.h +-+++ b/include/linux/ath9k_platform.h +-@@ -46,6 +46,10 @@ struct ath9k_platform_data { +- int num_leds; +- const struct gpio_led *leds; +- const char *led_name; +-+ +-+ unsigned num_btns; +-+ const struct gpio_keys_button *btns; +-+ unsigned btn_poll_interval; +- }; +- +- #endif /* _LINUX_ATH9K_PLATFORM_H */ diff --git a/patches/openwrt/0010-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch b/patches/openwrt/0086-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch similarity index 93% rename from patches/openwrt/0010-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch rename to patches/openwrt/0086-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch index 3b74d88d..ba7ef419 100644 --- a/patches/openwrt/0010-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch +++ b/patches/openwrt/0086-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch @@ -6,7 +6,7 @@ Patch-by: Stefan Rompf diff --git a/package/kernel/mac80211/patches/931-ubnt-uap-plus-hsr.patch b/package/kernel/mac80211/patches/931-ubnt-uap-plus-hsr.patch new file mode 100644 -index 0000000..4533335 +index 0000000..14d63f1 --- /dev/null +++ b/package/kernel/mac80211/patches/931-ubnt-uap-plus-hsr.patch @@ -0,0 +1,346 @@ @@ -347,10 +347,10 @@ index 0000000..4533335 + ath9k-$(CPTCFG_ATH9K_PCI) += pci.o +--- a/include/linux/ath9k_platform.h ++++ b/include/linux/ath9k_platform.h -+@@ -44,6 +44,8 @@ struct ath9k_platform_data { -+ -+ int num_leds; -+ const struct gpio_led *leds; ++@@ -50,6 +50,8 @@ struct ath9k_platform_data { ++ unsigned num_btns; ++ const struct gpio_keys_button *btns; ++ unsigned btn_poll_interval; ++ ++ bool ubnt_hsr; + }; @@ -368,25 +368,16 @@ index 7803513..d865ed2 100644 + ap91_pci_init(ee, NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio), -diff --git a/target/linux/generic/patches-3.18/150-ath9k_ubnt_hsr_filter.patch b/target/linux/generic/patches-3.18/150-ath9k_ubnt_hsr_filter.patch -new file mode 100644 -index 0000000..a0ebbc7 ---- /dev/null -+++ b/target/linux/generic/patches-3.18/150-ath9k_ubnt_hsr_filter.patch -@@ -0,0 +1,16 @@ -+Flag that this platform is an Ubiquiti UniFi Outdoor Plus -+containing a RF filter in ath9k's receive path. +diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h +index e543a64..2cb0288 100644 +--- a/target/linux/generic/files/include/linux/ath9k_platform.h ++++ b/target/linux/generic/files/include/linux/ath9k_platform.h +@@ -50,6 +50,8 @@ struct ath9k_platform_data { + unsigned num_btns; + const struct gpio_keys_button *btns; + unsigned btn_poll_interval; + -+Signed-off-by: Stefan Rompf -+ -+--- a/include/linux/ath9k_platform.h -++++ b/include/linux/ath9k_platform.h -+@@ -44,6 +44,8 @@ struct ath9k_platform_data { -+ -+ int num_leds; -+ const struct gpio_led *leds; -++ -++ bool ubnt_hsr; -+ }; -+ -+ #endif /* _LINUX_ATH9K_PLATFORM_H */ ++ bool ubnt_hsr; + }; + + #endif /* _LINUX_ATH9K_PLATFORM_H */ From 742f3667c9982589f68c48f21d87c342ae1dfa8c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 May 2016 14:28:16 +0200 Subject: [PATCH 042/184] Backport fixes for the WNR2200 --- ...xx-Send-power-to-USB-port-on-WNR2200.patch | 41 +++ ...71xx-WNR2200-fix-for-random-WLAN-MAC.patch | 86 ++++++ ...able-control-of-all-LEDs-and-buttons.patch | 251 ++++++++++++++++++ 3 files changed, 378 insertions(+) create mode 100644 patches/openwrt/0087-ar71xx-Send-power-to-USB-port-on-WNR2200.patch create mode 100644 patches/openwrt/0088-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch create mode 100644 patches/openwrt/0089-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch diff --git a/patches/openwrt/0087-ar71xx-Send-power-to-USB-port-on-WNR2200.patch b/patches/openwrt/0087-ar71xx-Send-power-to-USB-port-on-WNR2200.patch new file mode 100644 index 00000000..42906fc8 --- /dev/null +++ b/patches/openwrt/0087-ar71xx-Send-power-to-USB-port-on-WNR2200.patch @@ -0,0 +1,41 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 11:37:08 +0200 +Subject: ar71xx: Send power to USB port on WNR2200 + +This patch fixes ticket #15267 by enabling power on the +WNR2200's USB port. At present, the USB port on the WNR2200 +is non-functional due to it not receiving power. + +This patch defines an additional GPIO pin, but none of the +current GPIO definitions have been modified. + +Signed-off-by: Riley Baird + +Backport of r47236 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +index 0087cac..5d23f21 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +@@ -36,7 +36,7 @@ + #define WNR2200_GPIO_LED_LAN4_GREEN 16 + #define WNR2200_GPIO_LED_PWR_AMBER 21 + #define WNR2200_GPIO_LED_PWR_GREEN 22 +- ++#define WNR2200_GPIO_USB_5V 4 + #define WNR2200_GPIO_USB_POWER 24 + + #define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */ +@@ -128,9 +128,9 @@ static void __init wnr2200_setup(void) + wnr2200_leds_gpio); + + /* enable power for the USB port */ +- gpio_request_one(WNR2200_GPIO_USB_POWER, +- GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, +- "USB power"); ++ ap9x_pci_setup_wmac_gpio(0, ++ BIT(WNR2200_GPIO_USB_5V), ++ BIT(WNR2200_GPIO_USB_5V)); + + ath79_register_usb(); + } diff --git a/patches/openwrt/0088-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch b/patches/openwrt/0088-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch new file mode 100644 index 00000000..b2fb55c1 --- /dev/null +++ b/patches/openwrt/0088-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch @@ -0,0 +1,86 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 11:45:14 +0200 +Subject: ar71xx: WNR2200: fix for random WLAN MAC + +Fix for invalid/random/duplicate WLAN MAC address in WNR2200. +Permanent platform MAC is calculated and assigned during system startup. +WLAN MAC follows wired Ethernet interface addresses. + +Signed-off-by: Michal Cieslakiewicz + +Backport of r49100 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +index 5d23f21..37ffc4c 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +@@ -12,6 +12,7 @@ + + #include + #include ++#include /* for max() macro */ + + #include + +@@ -45,6 +46,7 @@ + #define WNR2200_MAC0_OFFSET 0 + #define WNR2200_MAC1_OFFSET 6 + #define WNR2200_PCIE_CALDATA_OFFSET 0x1000 ++#define WNR2200_WMAC_OFFSET 0x108c /* wireless MAC is inside ART */ + + static struct gpio_led wnr2200_leds_gpio[] __initdata = { + { +@@ -102,9 +104,40 @@ static struct gpio_led wnr2200_leds_gpio[] __initdata = { + } + }; + ++/* ++ * For WNR2200 ART flash area used for WLAN MAC is usually empty (0xff) ++ * so ath9k driver uses random MAC instead each time module is loaded. ++ * OpenWrt's original fix was to copy eth1 address to WLAN interface. ++ * New solution does not duplicate hardware addresses and is taken from ++ * WNR2000v3 code. It assigns permanent WLAN MAC equal to ethN's MAC ++ * plus 1, so network interfaces get sequential addresses. ++ * If ART wireless MAC address field has been filled by user, use it. ++ */ ++static void __init wnr2200_get_wmac(u8 *wmac_gen_addr, int mac0_art_offset, ++ int mac1_art_offset, int wmac_art_offset) ++{ ++ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ++ u8 *eth0_mac_addr = (u8 *) (art + mac0_art_offset); ++ u8 *eth1_mac_addr = (u8 *) (art + mac1_art_offset); ++ u8 *wlan_mac_addr = (u8 *) (art + wmac_art_offset); ++ ++ /* only 0xff if all bits are set - address is invalid, empty area */ ++ if ((wlan_mac_addr[0] & wlan_mac_addr[1] & wlan_mac_addr[2] & ++ wlan_mac_addr[3] & wlan_mac_addr[4] & wlan_mac_addr[5]) == 0xff) { ++ memcpy(wmac_gen_addr, eth0_mac_addr, 5); ++ wmac_gen_addr[5] = max(eth0_mac_addr[5], eth1_mac_addr[5]) + 1; ++ ++ /* Avoid potential conflict in case max(0xff,0x00)+1==0x00 */ ++ if (!wmac_gen_addr[5]) ++ wmac_gen_addr[5] = 1; ++ } else ++ memcpy(wmac_gen_addr, wlan_mac_addr, 6); ++} ++ + static void __init wnr2200_setup(void) + { + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ++ u8 wlan_mac_addr[6]; + + ath79_register_mdio(0, 0x0); + +@@ -121,8 +154,10 @@ static void __init wnr2200_setup(void) + ath79_register_eth(1); + + ath79_register_m25p80(NULL); +- ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, +- art + WNR2200_MAC1_OFFSET); ++ ++ wnr2200_get_wmac(wlan_mac_addr, WNR2200_MAC0_OFFSET, ++ WNR2200_MAC1_OFFSET, WNR2200_WMAC_OFFSET); ++ ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, wlan_mac_addr); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio), + wnr2200_leds_gpio); diff --git a/patches/openwrt/0089-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch b/patches/openwrt/0089-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch new file mode 100644 index 00000000..853104ce --- /dev/null +++ b/patches/openwrt/0089-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch @@ -0,0 +1,251 @@ +From: Matthias Schiffer +Date: Sun, 29 May 2016 11:50:03 +0200 +Subject: ar71xx: WNR2200: enable control of all LEDs and buttons + +This patch provides full GPIO support for WNR2200 (LEDs and buttons). +It exposes all LEDs to operating system, including Ethernet ones. + +Signed-off-by: Michal Cieslakiewicz + +Backport of r49101 + +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index 9a768cd..ae17853 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -590,6 +590,21 @@ wnr2000-v4) + ucidef_set_led_usbdev "usb" "USB" "netgear:amber:status" "1-1" + ;; + ++wnr2200) ++ ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0" ++ ucidef_set_led_default "wan-green" "WAN (green)" "netgear:green:wan" "0" ++ ucidef_set_led_netdev "wlan" "WLAN" "netgear:blue:wlan" "wlan0" ++ ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04" ++ ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04" ++ ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04" ++ ucidef_set_led_switch "lan4green" "LAN4 (green)" "netgear:green:lan4" "switch0" "0x10" "0x04" ++ ucidef_set_led_switch "lan1amber" "LAN1 (amber)" "netgear:amber:lan1" "switch0" "0x02" "0x02" ++ ucidef_set_led_switch "lan2amber" "LAN2 (amber)" "netgear:amber:lan2" "switch0" "0x04" "0x02" ++ ucidef_set_led_switch "lan3amber" "LAN3 (amber)" "netgear:amber:lan3" "switch0" "0x08" "0x02" ++ ucidef_set_led_switch "lan4amber" "LAN4 (amber)" "netgear:amber:lan4" "switch0" "0x10" "0x02" ++ ucidef_set_led_usbdev "usb" "USB" "netgear:green:usb" "1-1" ++ ;; ++ + wpn824n) + ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0" + ucidef_set_led_wlan "wlan" "WLAN" "netgear:blue:wlan" "phy0tpt" +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +index 37ffc4c..258d254 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c +@@ -15,6 +15,8 @@ + #include /* for max() macro */ + + #include ++#include /* needed to disable switch LEDs */ ++#include "common.h" /* needed to disable switch LEDs */ + + #include "dev-ap9x-pci.h" + #include "dev-eth.h" +@@ -24,21 +26,28 @@ + #include "dev-usb.h" + #include "machtypes.h" + ++/* WNR2200 - connected through AR7241 */ + #define WNR2200_GPIO_LED_LAN2_AMBER 0 + #define WNR2200_GPIO_LED_LAN4_AMBER 1 +-#define WNR2200_GPIO_LED_WPS 5 +-#define WNR2200_GPIO_LED_WAN_GREEN 7 +-#define WNR2200_GPIO_LED_USB 8 ++#define WNR2200_GPIO_LED_LAN1_AMBER 6 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ ++#define WNR2200_GPIO_LED_WPS_GREEN 7 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ ++#define WNR2200_GPIO_LED_USB_GREEN 8 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ + #define WNR2200_GPIO_LED_LAN3_AMBER 11 + #define WNR2200_GPIO_LED_WAN_AMBER 12 +-#define WNR2200_GPIO_LED_LAN1_GREEN 13 +-#define WNR2200_GPIO_LED_LAN2_GREEN 14 +-#define WNR2200_GPIO_LED_LAN3_GREEN 15 +-#define WNR2200_GPIO_LED_LAN4_GREEN 16 +-#define WNR2200_GPIO_LED_PWR_AMBER 21 +-#define WNR2200_GPIO_LED_PWR_GREEN 22 +-#define WNR2200_GPIO_USB_5V 4 +-#define WNR2200_GPIO_USB_POWER 24 ++#define WNR2200_GPIO_LED_LAN1_GREEN 13 /* AR724X_..._ETH_SWITCH_LED0 */ ++#define WNR2200_GPIO_LED_LAN2_GREEN 14 /* AR724X_..._ETH_SWITCH_LED1 */ ++#define WNR2200_GPIO_LED_LAN3_GREEN 15 /* AR724X_..._ETH_SWITCH_LED2 */ ++#define WNR2200_GPIO_LED_LAN4_GREEN 16 /* AR724X_..._ETH_SWITCH_LED3 */ ++#define WNR2200_GPIO_LED_WAN_GREEN 17 /* AR724X_..._ETH_SWITCH_LED4 */ ++ ++/* WNR2200 - connected through AR9287 */ ++#define WNR2200_GPIO_WMAC_LED_WLAN_BLUE 0 ++#define WNR2200_GPIO_WMAC_LED_TEST_AMBER 1 ++#define WNR2200_GPIO_WMAC_LED_POWER_GREEN 2 ++#define WNR2200_GPIO_WMAC_BTN_RFKILL 3 ++#define WNR2200_GPIO_WMAC_USB_5V 4 ++#define WNR2200_GPIO_WMAC_BTN_WPS 5 ++#define WNR2200_GPIO_WMAC_BTN_RESET 6 + + #define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */ + #define WNR2200_KEYS_DEBOUNCE_INTERVAL (3 * WNR2200_KEYS_POLL_INTERVAL) +@@ -50,30 +59,22 @@ + + static struct gpio_led wnr2200_leds_gpio[] __initdata = { + { +- .name = "netgear:amber:lan2", +- .gpio = WNR2200_GPIO_LED_LAN2_AMBER, +- .active_low = 1, +- }, { +- .name = "netgear:amber:lan4", +- .gpio = WNR2200_GPIO_LED_LAN4_AMBER, +- .active_low = 1, +- }, { +- .name = "netgear:green:wps", +- .gpio = WNR2200_GPIO_LED_WPS, +- .active_low = 1, +- }, { +- .name = "netgear:green:wan", +- .gpio = WNR2200_GPIO_LED_WAN_GREEN, ++ .name = "netgear:amber:lan1", ++ .gpio = WNR2200_GPIO_LED_LAN1_AMBER, + .active_low = 1, + }, { +- .name = "netgear:green:usb", +- .gpio = WNR2200_GPIO_LED_USB, ++ .name = "netgear:amber:lan2", ++ .gpio = WNR2200_GPIO_LED_LAN2_AMBER, + .active_low = 1, + }, { + .name = "netgear:amber:lan3", + .gpio = WNR2200_GPIO_LED_LAN3_AMBER, + .active_low = 1, + }, { ++ .name = "netgear:amber:lan4", ++ .gpio = WNR2200_GPIO_LED_LAN4_AMBER, ++ .active_low = 1, ++ }, { + .name = "netgear:amber:wan", + .gpio = WNR2200_GPIO_LED_WAN_AMBER, + .active_low = 1, +@@ -94,12 +95,56 @@ static struct gpio_led wnr2200_leds_gpio[] __initdata = { + .gpio = WNR2200_GPIO_LED_LAN4_GREEN, + .active_low = 1, + }, { +- .name = "netgear:amber:power", +- .gpio = WNR2200_GPIO_LED_PWR_AMBER, ++ .name = "netgear:green:usb", ++ .gpio = WNR2200_GPIO_LED_USB_GREEN, ++ .active_low = 1, ++ }, { ++ .name = "netgear:green:wan", ++ .gpio = WNR2200_GPIO_LED_WAN_GREEN, ++ .active_low = 1, ++ }, { ++ .name = "netgear:green:wps", ++ .gpio = WNR2200_GPIO_LED_WPS_GREEN, ++ .active_low = 1, ++ } ++}; ++ ++static const char *wnr2200_wmac_led_name = "netgear:blue:wlan"; ++ ++static struct gpio_led wnr2200_wmac_leds_gpio[] = { ++ { ++ .name = "netgear:amber:test", ++ .gpio = WNR2200_GPIO_WMAC_LED_TEST_AMBER, + .active_low = 1, + }, { + .name = "netgear:green:power", +- .gpio = WNR2200_GPIO_LED_PWR_GREEN, ++ .gpio = WNR2200_GPIO_WMAC_LED_POWER_GREEN, ++ .active_low = 1, ++ .default_state = LEDS_GPIO_DEFSTATE_ON, ++ } ++}; ++ ++static struct gpio_keys_button wnr2200_wmac_keys_gpio[] = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = WNR2200_GPIO_WMAC_BTN_RESET, ++ .active_low = 1, ++ }, { ++ .desc = "rfkill", ++ .type = EV_KEY, ++ .code = KEY_RFKILL, ++ .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = WNR2200_GPIO_WMAC_BTN_RFKILL, ++ .active_low = 1, ++ }, { ++ .desc = "wps", ++ .type = EV_KEY, ++ .code = KEY_WPS_BUTTON, ++ .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = WNR2200_GPIO_WMAC_BTN_WPS, + .active_low = 1, + } + }; +@@ -139,14 +184,32 @@ static void __init wnr2200_setup(void) + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + u8 wlan_mac_addr[6]; + ++ /* ++ * Disable JTAG to use all AR724X GPIO LEDs. Disable CLKs. ++ * Allow OS to control all link LEDs. ++ */ ++ ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE | ++ AR724X_GPIO_FUNC_UART_EN, ++ AR724X_GPIO_FUNC_CLK_OBS1_EN | ++ AR724X_GPIO_FUNC_CLK_OBS2_EN | ++ AR724X_GPIO_FUNC_CLK_OBS3_EN | ++ AR724X_GPIO_FUNC_CLK_OBS4_EN | ++ AR724X_GPIO_FUNC_CLK_OBS5_EN | ++ AR724X_GPIO_FUNC_GE0_MII_CLK_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ + ath79_register_mdio(0, 0x0); + +- ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2200_MAC0_OFFSET, 0); ++ ath79_init_mac(ath79_eth0_data.mac_addr, art + WNR2200_MAC0_OFFSET, 0); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; + ath79_eth0_data.speed = SPEED_100; + ath79_eth0_data.duplex = DUPLEX_FULL; + +- ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2200_MAC1_OFFSET, 0); ++ ath79_init_mac(ath79_eth1_data.mac_addr, art + WNR2200_MAC1_OFFSET, 0); + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; + ath79_eth1_data.phy_mask = 0x10; + +@@ -160,12 +223,22 @@ static void __init wnr2200_setup(void) + ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, wlan_mac_addr); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio), +- wnr2200_leds_gpio); ++ wnr2200_leds_gpio); ++ ++ ap9x_pci_setup_wmac_led_pin(0, WNR2200_GPIO_WMAC_LED_WLAN_BLUE); ++ ap9x_pci_setup_wmac_led_name(0, wnr2200_wmac_led_name); ++ ++ ap9x_pci_setup_wmac_leds(0, wnr2200_wmac_leds_gpio, ++ ARRAY_SIZE(wnr2200_wmac_leds_gpio)); ++ ++ /* All 3 buttons are connected to wireless chip */ ++ ap9x_pci_setup_wmac_btns(0, wnr2200_wmac_keys_gpio, ++ ARRAY_SIZE(wnr2200_wmac_keys_gpio), ++ WNR2200_KEYS_POLL_INTERVAL); + + /* enable power for the USB port */ +- ap9x_pci_setup_wmac_gpio(0, +- BIT(WNR2200_GPIO_USB_5V), +- BIT(WNR2200_GPIO_USB_5V)); ++ ap9x_pci_setup_wmac_gpio(0, BIT(WNR2200_GPIO_WMAC_USB_5V), ++ BIT(WNR2200_GPIO_WMAC_USB_5V)); + + ath79_register_usb(); + } From 439f2a4fda3ff2eea1d8adf51649d6c1e6200ebc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 May 2016 15:04:46 +0200 Subject: [PATCH 043/184] ar71xx-generic: add support for NETGEAR WNR2200 --- targets/ar71xx-generic/profiles.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index c30a51f2..a9d11a4c 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -269,6 +269,14 @@ $(eval $(call GluonModel,WNDR3700,wndrmac,netgear-wndrmac)) # BROKEN: untested endif $(eval $(call GluonModel,WNDR3700,wndrmacv2,netgear-wndrmacv2)) +ifneq ($(BROKEN),) +# WNR2200 +$(eval $(call GluonProfile,WNR2200)) # BROKEN: untested +$(eval $(call GluonModel,WNR2200,wnr2200,netgear-wnr2200)) +$(eval $(call GluonProfileFactorySuffix,WNR2200,.img)) +endif + + ## Allnet # ALL0315N From d77ab040072692c46172604e775e0d9ec2cadf39 Mon Sep 17 00:00:00 2001 From: Stefan Tabbert Date: Tue, 10 Nov 2015 17:57:18 +0100 Subject: [PATCH 044/184] sunxi: add Lamobo-R1 No sysupgrade support yet. --- targets/sunxi/profiles.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/targets/sunxi/profiles.mk b/targets/sunxi/profiles.mk index b54eea7b..55416c2a 100644 --- a/targets/sunxi/profiles.mk +++ b/targets/sunxi/profiles.mk @@ -1,4 +1,11 @@ +#Banana Pi/M1 $(eval $(call GluonProfile,Bananapi,uboot-sunxi-Bananapi kmod-rtc-sunxi)) $(eval $(call GluonProfileFactorySuffix,Bananapi,-sdcard-vfat-ext4,.img.gz)) $(eval $(call GluonProfileSysupgradeSuffix,Bananapi)) $(eval $(call GluonModel,Bananapi,Bananapi,lemaker-banana-pi)) + +#BananaPi R1 / Lamobo R1 +$(eval $(call GluonProfile,Lamobo_R1,uboot-sunxi-Lamobo_R1 kmod-ata-sunxi kmod-rtl8192cu kmod-rtc-sunxi swconfig)) +$(eval $(call GluonProfileFactorySuffix,Lamobo_R1,-sdcard-vfat-ext4,.img.gz)) +$(eval $(call GluonProfileSysupgradeSuffix,Lamobo_R1)) +$(eval $(call GluonModel,Lamobo_R1,Lamobo_R1,lemaker-lamobo-r1)) From 5c2896437a7aa61adc09427d91fdf5c8927ea2ad Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 May 2016 16:40:33 +0200 Subject: [PATCH 045/184] docs: add documentation about site modules --- docs/user/site.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/user/site.rst b/docs/user/site.rst index 5b439646..15cb8afb 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -355,6 +355,41 @@ utilities are installed. Depending on the context, you might be able to use comments like ```` as translations to effectively hide the text. +Site modules +------------ + +The file ``modules`` in the site repository is completely optional and can be used +to supply additional package feeds from which packages are built. The git repositories +specified here are retrieved in addition to the default feeds when ``make update`` +it called. + +This file's format is very similar to the toplevel ``modules`` file of the Gluon +tree, with the important different that the list of feeds must be assigned to +the variable ``GLUON_SITE_FEEDS``. Multiple feed names must be separated by spaces, +for example:: + + GLUON_SITE_FEEDS='foo bar' + +The feed names may only contain alphanumerical characters, underscores and slashes. +For each of the feeds, the following variables are used to specify how to update +the feed: + +PACKAGES_${feed}_REPO + The URL of the git repository to clone (usually ``git://`` or ``http(s)://``) + +PACKAGES_${feed}_COMMIT + The commit ID of the repository to use + +PACKAGES_${feed}_BRANCH + Optional: The branch of the repository the given commit ID can be found in. + Defaults to the default branch of the repository (usually ``master``) + +These variables are always all uppercase, so for an entry ``foo`` in GLUON_SITE_FEEDS, +the corresponding configuration variables would be ``PACKAGES_FOO_REPO``, +``PACKAGES_FOO_COMMIT`` and ``PACKAGES_FOO_BRANCH``. Slashes in feed names are +replaced by underscores to get valid shell variable identifiers. + + Examples -------- From 4838d36f862a36e186021d3374ace11bde1d1dfe Mon Sep 17 00:00:00 2001 From: copyrights Date: Sun, 8 May 2016 14:28:28 +0200 Subject: [PATCH 046/184] ar71xx-generic: add D-Link DIR-505 rev. A2 as alias of D-Link DIR-505 rev. A1 --- docs/index.rst | 2 +- targets/ar71xx-generic/profiles.mk | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 8da9bb43..cd421411 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -109,7 +109,7 @@ ar71xx-generic * D-Link - - DIR-505 (A1) + - DIR-505 (A1, A2) - DIR-615 (C1) - DIR-825 (B1) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index a9d11a4c..543f6bfe 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -207,10 +207,11 @@ endif ## D-Link -# D-Link DIR-505 rev. A1 +# D-Link DIR-505 rev. A1/A2 $(eval $(call GluonProfile,DIR505A1)) $(eval $(call GluonModel,DIR505A1,dir-505-a1,d-link-dir-505-rev-a1)) +$(eval $(call GluonModelAlias,DIR505A1,d-link-dir-505-rev-a1,d-link-dir-505-rev-a2)) # D-Link DIR-615 rev. C1 $(eval $(call GluonProfile,DIR615C1)) From f6fd439094aba752f39f6fe06a57697cc14c4cd3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 May 2016 20:19:21 +0200 Subject: [PATCH 047/184] node: fix build on Debian Jessie --- .../openwrt/0005-node-update-to-v0.12.14.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch index 9b03cee4..b748b636 100644 --- a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch +++ b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch @@ -7,7 +7,7 @@ While we're at it, also enable parallel builds. Signed-off-by: Matthias Schiffer diff --git a/lang/node/Makefile b/lang/node/Makefile -index 243c8a5..e6fe843 100644 +index 243c8a5..bde7906 100644 --- a/lang/node/Makefile +++ b/lang/node/Makefile @@ -8,17 +8,21 @@ @@ -34,3 +34,12 @@ index 243c8a5..e6fe843 100644 PKG_MAINTAINER:=John Crispin PKG_LICENSE:= +@@ -56,6 +60,8 @@ HOST_CONFIGURE_ARGS:= \ + + HOST_CONFIGURE_CMD:=python ./configure + ++HOST_MAKE_FLAGS += CXXFLAGS='-std=c++11' ++ + define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ From d007de142e332f4ed8dc3dd06a4687f5fc98648f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 May 2016 01:00:00 +0200 Subject: [PATCH 048/184] node: fix CXXFLAGS on host install Now really fixes the build on Debian Jessie... --- .../packages/openwrt/0005-node-update-to-v0.12.14.patch | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch index b748b636..be6b8a15 100644 --- a/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch +++ b/patches/packages/openwrt/0005-node-update-to-v0.12.14.patch @@ -7,7 +7,7 @@ While we're at it, also enable parallel builds. Signed-off-by: Matthias Schiffer diff --git a/lang/node/Makefile b/lang/node/Makefile -index 243c8a5..bde7906 100644 +index 243c8a5..ed35e17 100644 --- a/lang/node/Makefile +++ b/lang/node/Makefile @@ -8,17 +8,21 @@ @@ -34,11 +34,15 @@ index 243c8a5..bde7906 100644 PKG_MAINTAINER:=John Crispin PKG_LICENSE:= -@@ -56,6 +60,8 @@ HOST_CONFIGURE_ARGS:= \ +@@ -56,6 +60,12 @@ HOST_CONFIGURE_ARGS:= \ HOST_CONFIGURE_CMD:=python ./configure +HOST_MAKE_FLAGS += CXXFLAGS='-std=c++11' ++ ++define Host/Install ++ $(MAKE) -C $(HOST_BUILD_DIR) $(HOST_MAKE_FLAGS) install ++endef + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include From 0ad2b311cab63979fcc5029ff667197d8a1dc893 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 31 May 2016 17:33:51 +0200 Subject: [PATCH 049/184] Update Gluon packages --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 1336e245..f014b82b 100644 --- a/modules +++ b/modules @@ -8,7 +8,7 @@ PACKAGES_OPENWRT_COMMIT=9622fe984bba3a4547f48bc507ebaba7637eb2b0 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git -PACKAGES_GLUON_COMMIT=63376e23c81e53c21d3c5250c3fb7444a90dc019 +PACKAGES_GLUON_COMMIT=37c7cebf10d79f83151bb41cf6014a1d379ed3fe PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc From 529233e2b4203675f519325df585030477471059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Thu, 2 Jun 2016 14:14:13 +0000 Subject: [PATCH 050/184] gluon-batman-adv-core: respondd: add gateway_nexthop field --- package/gluon-mesh-batman-adv-core/src/respondd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv-core/src/respondd.c b/package/gluon-mesh-batman-adv-core/src/respondd.c index 7c2ac6c7..f21eb62e 100644 --- a/package/gluon-mesh-batman-adv-core/src/respondd.c +++ b/package/gluon-mesh-batman-adv-core/src/respondd.c @@ -212,11 +212,13 @@ static void add_gateway(struct json_object *obj) { while (getline(&line, &len, f) >= 0) { char addr[18]; + char nexthop[18]; - if (sscanf(line, "=> %17[0-9a-fA-F:]", addr) != 1) + if (sscanf(line, "=> %17[0-9a-fA-F:] ( %*u) %17[0-9a-fA-F:]", addr, nexthop) != 2) continue; json_object_object_add(obj, "gateway", json_object_new_string(addr)); + json_object_object_add(obj, "gateway_nexthop", json_object_new_string(nexthop)); break; } From 77ad8eed241b5fc2554d172dc49a395288a020a1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 9 Jun 2016 05:53:57 +0200 Subject: [PATCH 051/184] ar71xx: backport fixes for better CPE210/510 support This patchset enables the RX LNA for the CPE210/510, improving RX by about 20dB. The profiles for CPE210 and CPE510 is split into two images, so the CPE510 can use the correct ART offset, improving the TX power by 10dB. Fixes #796 --- ...10-enable-LNA-for-CPE210-220-510-520.patch | 35 ++++ ...le-into-2-profiles-cpe210-and-cpe510.patch | 169 ++++++++++++++++ ...10-use-second-wifi-calibration-table.patch | 24 +++ ...oader.c-Add-support-for-Archer-C2600.patch | 188 ++++++++++++++++++ ...der-split-CPE210-from-CPE510-profile.patch | 102 ++++++++++ targets/ar71xx-generic/profiles.mk | 13 +- 6 files changed, 525 insertions(+), 6 deletions(-) create mode 100644 patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch create mode 100644 patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch create mode 100644 patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch create mode 100644 patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch create mode 100644 patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch diff --git a/patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch b/patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch new file mode 100644 index 00000000..c5c278bc --- /dev/null +++ b/patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch @@ -0,0 +1,35 @@ +From: Matthias Schiffer +Date: Thu, 9 Jun 2016 04:39:08 +0200 +Subject: ar71xx/cpe510: enable LNA for CPE210/220/510/520 + +The LNA improves the rx path. Within a simple test setup +it improved the signal from -60dbm to -40dbm. + +Signed-off-by: Alexander Couzens + +Backport of LEDE 94e23bf7409d6cc4c9efb55ed32aba8e5a497966 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +index 8bf5c0f..5cb052a 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +@@ -30,6 +30,9 @@ + #define CPE510_GPIO_LED_L3 15 + #define CPE510_GPIO_LED_L4 16 + ++#define CPE510_GPIO_EXTERNAL_LNA0 18 ++#define CPE510_GPIO_EXTERNAL_LNA1 19 ++ + #define CPE510_GPIO_BTN_RESET 4 + + #define CPE510_KEYS_POLL_INTERVAL 20 /* msecs */ +@@ -93,6 +96,9 @@ static void __init cpe510_setup(void) + ARRAY_SIZE(cpe510_gpio_keys), + cpe510_gpio_keys); + ++ ath79_wmac_set_ext_lna_gpio(0, CPE510_GPIO_EXTERNAL_LNA0); ++ ath79_wmac_set_ext_lna_gpio(1, CPE510_GPIO_EXTERNAL_LNA1); ++ + ath79_register_m25p80(NULL); + + ath79_register_mdio(1, 0); diff --git a/patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch b/patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch new file mode 100644 index 00000000..98f4c273 --- /dev/null +++ b/patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch @@ -0,0 +1,169 @@ +From: Matthias Schiffer +Date: Thu, 9 Jun 2016 04:55:37 +0200 +Subject: ar71xx/cpe510: split profile into 2 profiles cpe210 and cpe510 + +Split profile into 2GHz and 5GHz. The 5GHz devices are +quite "special". The 2 GHz works perfect. + +Signed-off-by: Alexander Couzens + +Backport of LEDE c5ff273d85f69981e5b126eeaed3dee5b4061fb4 + +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches +index b41f275..0f7a415 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches +@@ -15,6 +15,7 @@ nanostation-m) + nanostation-m-xw) + ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2" + ;; ++cpe210|\ + cpe510) + ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "20" + ;; +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index ae17853..129f6b7 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -78,6 +78,7 @@ carambola2) + ucidef_set_led_wlan "wlan" "WLAN" "carambola2:green:wlan" "phy0tpt" + ;; + ++cpe210|\ + cpe510) + ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20" + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 4066506..1d0142f 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -71,6 +71,7 @@ bsb) + ucidef_set_interface_wlan + ;; + ++cpe210|\ + cpe510) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" "1" "1" +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index fbf76c8..4000b5b 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -438,7 +438,11 @@ ar71xx_board_detect() { + *CAP4200AG) + name="cap4200ag" + ;; +- *"CPE210/220/510/520") ++ *"CPE210/220") ++ name="cpe210" ++ tplink_pharos_board_detect ++ ;; ++ *"CPE510/520") + name="cpe510" + tplink_pharos_board_detect + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 4a4c476..eded91e 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -263,6 +263,7 @@ platform_check_image() { + return 0 + ;; + ++ cpe210|\ + cpe510) + tplink_pharos_check_image "$1" && return 0 + return 1 +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +index 5cb052a..74daf43 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +@@ -78,12 +78,8 @@ static struct gpio_keys_button cpe510_gpio_keys[] __initdata = { + } + }; + +- +-static void __init cpe510_setup(void) ++static void __init cpe_setup(u8 *mac) + { +- u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); +- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); +- + /* Disable JTAG, enabling GPIOs 0-3 */ + /* Configure OBS4 line, for GPIO 4*/ + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, +@@ -105,9 +101,31 @@ static void __init cpe510_setup(void) + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_register_eth(1); ++} ++ ++ ++static void __init cpe210_setup(void) ++{ ++ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); ++ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); ++ ++ cpe_setup(mac); + + ath79_register_wmac(ee, mac); + } + +-MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE210/220/510/520", ++static void __init cpe510_setup(void) ++{ ++ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); ++ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); ++ ++ cpe_setup(mac); ++ ++ ath79_register_wmac(ee, mac); ++} ++ ++MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220", ++ cpe210_setup); ++ ++MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520", + cpe510_setup); +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 06dbb77..272abe0 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2094,7 +2094,8 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR10 + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99)) + +-$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) ++$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) ++$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) + + $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x)) + $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240)) +@@ -2158,6 +2159,7 @@ $(eval $(call MultiProfile,TLWR842,TLWR842V1)) + $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4)) + $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2 TLWR1043V3)) + $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1)) ++$(eval $(call MultiProfile,CPE510,CPE210_220 CPE510_520)) + $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M)) + $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTROCKETMXW UBNTNANOM UBNTNANOMXW UBNTLOCOXW UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW)) + $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R)) +diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +index dbd3fca..b2f5366 100644 +--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch ++++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +@@ -1,6 +1,6 @@ + --- a/arch/mips/ath79/machtypes.h + +++ b/arch/mips/ath79/machtypes.h +-@@ -16,22 +16,201 @@ ++@@ -16,22 +16,202 @@ + + enum ath79_mach_type { + ATH79_MACH_GENERIC = 0, +@@ -26,6 +26,7 @@ + + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */ + + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */ + + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */ +++ ATH79_MACH_CPE210, /* TP-LINK CPE210 */ + + ATH79_MACH_CPE510, /* TP-LINK CPE510 */ + ATH79_MACH_DB120, /* Atheros DB120 reference board */ + ATH79_MACH_PB44, /* Atheros PB44 reference board */ diff --git a/patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch b/patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch new file mode 100644 index 00000000..7a5cd5d4 --- /dev/null +++ b/patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch @@ -0,0 +1,24 @@ +From: Matthias Schiffer +Date: Thu, 9 Jun 2016 04:57:24 +0200 +Subject: ar71xx/cpe510: use second wifi calibration table + +The cpe510 has two calibration tables. The first calibration +table requires to modify ath9k driver to work (patched tx gain table). + +Signed-off-by: Alexander Couzens + +Backport of LEDE bf27ac019c137e7baf90ca6ef0e40945ae871797 + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +index 74daf43..875589d 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +@@ -117,7 +117,7 @@ static void __init cpe210_setup(void) + static void __init cpe510_setup(void) + { + u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); +- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); ++ u8 *ee = (u8 *) KSEG1ADDR(0x1fff5000); + + cpe_setup(mac); + diff --git a/patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch b/patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch new file mode 100644 index 00000000..0c33a4d3 --- /dev/null +++ b/patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch @@ -0,0 +1,188 @@ +From: Matthias Schiffer +Date: Thu, 9 Jun 2016 05:02:18 +0200 +Subject: fw-utils/tplink-safeloader.c: Add support for Archer C2600 + +Signed-off-by: Ash Benz + +Backport of LEDE 955c341d3bec0eb4971a03924e99156367255d7b + +diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c +index 77a894b..2e204aa 100644 +--- a/tools/firmware-utils/src/tplink-safeloader.c ++++ b/tools/firmware-utils/src/tplink-safeloader.c +@@ -105,6 +105,8 @@ static const uint8_t md5_salt[16] = { + /** Vendor information for CPE210/220/510/520 */ + static const char cpe510_vendor[] = "CPE510(TP-LINK|UN|N300-5):1.0\r\n"; + ++/** Vendor information for C2600 */ ++static const char c2600_vendor[] = ""; + + /** + The flash partition table for CPE210/220/510/520; +@@ -128,6 +130,39 @@ static const struct flash_partition_entry cpe510_partitions[] = { + }; + + /** ++ The flash partition table for C2600; ++ it is the same as the one used by the stock images. ++*/ ++static const struct flash_partition_entry c2600_partitions[] = { ++ {"SBL1", 0x00000, 0x20000}, ++ {"MIBIB", 0x20000, 0x20000}, ++ {"SBL2", 0x40000, 0x20000}, ++ {"SBL3", 0x60000, 0x30000}, ++ {"DDRCONFIG", 0x90000, 0x10000}, ++ {"SSD", 0xa0000, 0x10000}, ++ {"TZ", 0xb0000, 0x30000}, ++ {"RPM", 0xe0000, 0x20000}, ++ {"fs-uboot", 0x100000, 0x70000}, ++ {"uboot-env", 0x170000, 0x40000}, ++ {"radio", 0x1b0000, 0x40000}, ++ {"os-image", 0x1f0000, 0x200000}, ++ {"file-system", 0x3f0000, 0x1b00000}, ++ {"default-mac", 0x1ef0000, 0x00200}, ++ {"pin", 0x1ef0200, 0x00200}, ++ {"product-info", 0x1ef0400, 0x0fc00}, ++ {"partition-table", 0x1f00000, 0x10000}, ++ {"soft-version", 0x1f10000, 0x10000}, ++ {"support-list", 0x1f20000, 0x10000}, ++ {"profile", 0x1f30000, 0x10000}, ++ {"default-config", 0x1f40000, 0x10000}, ++ {"user-config", 0x1f50000, 0x40000}, ++ {"qos-db", 0x1f90000, 0x40000}, ++ {"usb-config", 0x1fd0000, 0x10000}, ++ {"log", 0x1fe0000, 0x20000}, ++ {NULL, 0, 0} ++}; ++ ++/** + The support list for CPE210/220/510/520 + */ + static const char cpe510_support_list[] = +@@ -141,6 +176,13 @@ static const char cpe510_support_list[] = + "CPE220(TP-LINK|UN|N300-2):1.0\r\n" + "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; + ++/** ++ The support list for C2600 ++*/ ++static const char c2600_support_list[] = ++ "SupportList:\r\n" ++ "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n"; ++ + #define error(_ret, _errno, _str, ...) \ + do { \ + fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \ +@@ -240,14 +282,14 @@ static struct image_partition_entry make_soft_version(uint32_t rev) { + } + + /** Generates the support-list partition */ +-static struct image_partition_entry make_support_list(const char *support_list) { ++static struct image_partition_entry make_support_list(const char *support_list, bool trailzero) { + size_t len = strlen(support_list); + struct image_partition_entry entry = alloc_image_partition("support-list", len + 9); + + put32(entry.data, len); + memset(entry.data+4, 0, 4); + memcpy(entry.data+8, support_list, len); +- entry.data[len+8] = '\xff'; ++ entry.data[len+8] = trailzero ? '\x00' : '\xff'; + + return entry; + } +@@ -436,6 +478,37 @@ static void * generate_sysupgrade_image(const struct flash_partition_entry *flas + return image; + } + ++static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) { ++ const struct flash_partition_entry *flash_os_image = &flash_parts[11]; ++ const struct flash_partition_entry *flash_file_system = &flash_parts[12]; ++ ++ const struct image_partition_entry *image_os_image = &image_parts[3]; ++ const struct image_partition_entry *image_file_system = &image_parts[4]; ++ ++ assert(strcmp(flash_os_image->name, "os-image") == 0); ++ assert(strcmp(flash_file_system->name, "file-system") == 0); ++ ++ assert(strcmp(image_os_image->name, "os-image") == 0); ++ assert(strcmp(image_file_system->name, "file-system") == 0); ++ ++ if (image_os_image->size > flash_os_image->size) ++ error(1, 0, "kernel image too big (more than %u bytes)", (unsigned)flash_os_image->size); ++ if (image_file_system->size > flash_file_system->size) ++ error(1, 0, "rootfs image too big (more than %u bytes)", (unsigned)flash_file_system->size); ++ ++ *len = flash_file_system->base - flash_os_image->base + image_file_system->size; ++ ++ uint8_t *image = malloc(*len); ++ if (!image) ++ error(1, errno, "malloc"); ++ ++ memset(image, 0xff, *len); ++ ++ memcpy(image, image_os_image->data, image_os_image->size); ++ memcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size); ++ ++ return image; ++} + + /** Generates an image for CPE210/220/510/520 and writes it to a file */ + static void do_cpe510(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) { +@@ -443,7 +516,7 @@ static void do_cpe510(const char *output, const char *kernel_image, const char * + + parts[0] = make_partition_table(cpe510_partitions); + parts[1] = make_soft_version(rev); +- parts[2] = make_support_list(cpe510_support_list); ++ parts[2] = make_support_list(cpe510_support_list,false); + parts[3] = read_file("os-image", kernel_image, false); + parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); + +@@ -470,6 +543,39 @@ static void do_cpe510(const char *output, const char *kernel_image, const char * + free_image_partition(parts[i]); + } + ++/** Generates an image for C2600 and writes it to a file */ ++static void do_c2600(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) { ++ struct image_partition_entry parts[6] = {}; ++ ++ parts[0] = make_partition_table(c2600_partitions); ++ parts[1] = make_soft_version(rev); ++ parts[2] = make_support_list(c2600_support_list,true); ++ parts[3] = read_file("os-image", kernel_image, false); ++ parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); ++ ++ size_t len; ++ void *image; ++ if (sysupgrade) ++ image = generate_sysupgrade_image_c2600(c2600_partitions, parts, &len); ++ else ++ image = generate_factory_image(c2600_vendor, parts, &len); ++ ++ FILE *file = fopen(output, "wb"); ++ if (!file) ++ error(1, errno, "unable to open output file"); ++ ++ if (fwrite(image, len, 1, file) != 1) ++ error(1, 0, "unable to write output file"); ++ ++ fclose(file); ++ ++ free(image); ++ ++ size_t i; ++ for (i = 0; parts[i].name; i++) ++ free_image_partition(parts[i]); ++} ++ + + /** Usage output */ + static void usage(const char *argv0) { +@@ -552,6 +658,8 @@ int main(int argc, char *argv[]) { + + if (strcmp(board, "CPE510") == 0) + do_cpe510(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); ++ else if (strcmp(board, "C2600") == 0) ++ do_c2600(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); + else + error(1, 0, "unsupported board %s", board); + diff --git a/patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch b/patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch new file mode 100644 index 00000000..a6c13128 --- /dev/null +++ b/patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch @@ -0,0 +1,102 @@ +From: Matthias Schiffer +Date: Thu, 9 Jun 2016 05:03:35 +0200 +Subject: tools/tplink-safeloader: split CPE210 from CPE510 profile + +The CPE210 was still described for the OEM upgrade as compatible, +even the wireless configuration isn't compatible anymore between +both series (2ghz and 5ghz). +Update the CPE210 image profile to use the new profile. + +Signed-off-by: Alexander Couzens + +Backport of LEDE 824147960569f2c1cd22140c9074c62c3df911a5 + +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 272abe0..57f38a5 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -2094,7 +2094,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR10 + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M)) + $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99)) + +-$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) ++$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE210)) + $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) + + $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x)) +diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c +index 2e204aa..4938f74 100644 +--- a/tools/firmware-utils/src/tplink-safeloader.c ++++ b/tools/firmware-utils/src/tplink-safeloader.c +@@ -163,6 +163,15 @@ static const struct flash_partition_entry c2600_partitions[] = { + }; + + /** ++ The support list for CPE210/220 ++*/ ++static const char cpe210_support_list[] = ++ "SupportList:\r\n" ++ "CPE210(TP-LINK|UN|N300-2):1.0\r\n" ++ "CPE210(TP-LINK|UN|N300-2):1.1\r\n" ++ "CPE220(TP-LINK|UN|N300-2):1.0\r\n" ++ "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; ++/** + The support list for CPE210/220/510/520 + */ + static const char cpe510_support_list[] = +@@ -170,11 +179,7 @@ static const char cpe510_support_list[] = + "CPE510(TP-LINK|UN|N300-5):1.0\r\n" + "CPE510(TP-LINK|UN|N300-5):1.1\r\n" + "CPE520(TP-LINK|UN|N300-5):1.0\r\n" +- "CPE520(TP-LINK|UN|N300-5):1.1\r\n" +- "CPE210(TP-LINK|UN|N300-2):1.0\r\n" +- "CPE210(TP-LINK|UN|N300-2):1.1\r\n" +- "CPE220(TP-LINK|UN|N300-2):1.0\r\n" +- "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; ++ "CPE520(TP-LINK|UN|N300-5):1.1\r\n"; + + /** + The support list for C2600 +@@ -511,12 +516,18 @@ static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry + } + + /** Generates an image for CPE210/220/510/520 and writes it to a file */ +-static void do_cpe510(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) { ++static void do_cpe(const char *output, ++ const char *kernel_image, ++ const char *rootfs_image, ++ uint32_t rev, ++ bool add_jffs2_eof, ++ bool sysupgrade, ++ const char *support_list) { + struct image_partition_entry parts[6] = {}; + + parts[0] = make_partition_table(cpe510_partitions); + parts[1] = make_soft_version(rev); +- parts[2] = make_support_list(cpe510_support_list,false); ++ parts[2] = make_support_list(support_list, false); + parts[3] = read_file("os-image", kernel_image, false); + parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); + +@@ -549,7 +560,7 @@ static void do_c2600(const char *output, const char *kernel_image, const char *r + + parts[0] = make_partition_table(c2600_partitions); + parts[1] = make_soft_version(rev); +- parts[2] = make_support_list(c2600_support_list,true); ++ parts[2] = make_support_list(c2600_support_list, true); + parts[3] = read_file("os-image", kernel_image, false); + parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); + +@@ -656,8 +667,10 @@ int main(int argc, char *argv[]) { + if (!output) + error(1, 0, "no output filename has been specified"); + +- if (strcmp(board, "CPE510") == 0) +- do_cpe510(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); ++ if (strcmp(board, "CPE210") == 0) ++ do_cpe(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, cpe210_support_list); ++ else if (strcmp(board, "CPE510") == 0) ++ do_cpe(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, cpe510_support_list); + else if (strcmp(board, "C2600") == 0) + do_c2600(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); + else diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 543f6bfe..fed97d3e 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -4,14 +4,15 @@ # CPE210/220/510/520 $(eval $(call GluonProfile,CPE510,rssileds)) -$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe510-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe210-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe220-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe210-v1.1)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe220-v1.1)) +$(eval $(call GluonModel,CPE510,cpe210-220,tp-link-cpe210-v1.0)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe210-v1.0,tp-link-cpe210-v1.1)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe210-v1.0,tp-link-cpe220-v1.0)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe210-v1.0,tp-link-cpe220-v1.1)) + +$(eval $(call GluonModel,CPE510,cpe510-520,tp-link-cpe510-v1.0)) $(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe510-v1.1)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.0)) $(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.1)) # TL-WA701N/ND v1, v2 From 074cb5f8cb36c5e4aa133a6ee44bbb49bdf166fa Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Wed, 15 Jun 2016 15:04:04 +0200 Subject: [PATCH 052/184] ar71xx: add GL-AR150 support Mainly applying a vendor patch from https://github.com/domino-team/OpenWrt-patches (https://raw.githubusercontent.com/domino-team/OpenWrt-patches/master/AR150%2C%20AR300%2C%20Domino%20-%20CC1505/000-gl-ar150-cc.patch) --- .../0095-ar71xx-add-GL-AR150-support.patch | 326 ++++++++++++++++++ targets/ar71xx-generic/profiles.mk | 4 + 2 files changed, 330 insertions(+) create mode 100644 patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch diff --git a/patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch b/patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch new file mode 100644 index 00000000..ca4b803a --- /dev/null +++ b/patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch @@ -0,0 +1,326 @@ +From: Jan Niehusmann +Date: Wed, 15 Jun 2016 14:57:47 +0200 +Subject: ar71xx: add GL-AR150 support + +patch from https://github.com/domino-team/OpenWrt-patches + +https://raw.githubusercontent.com/domino-team/OpenWrt-patches/master/AR150%2C%20AR300%2C%20Domino%20-%20CC1505/000-gl-ar150-cc.patch + +(and fixed indentation in target/linux/ar71xx/base-files/lib/ar71xx.sh) + +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index 129f6b7..e29c1b5 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -182,6 +182,10 @@ dlan-pro-1200-ac) + ucidef_set_led_trigger_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0" + ;; + ++gl-ar150) ++ ucidef_set_led_wlan "wlan" "WLAN" "gl_ar150:wlan" "phy0tpt" ++ ;; ++ + gl-inet) + ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1" + ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 1d0142f..3895394 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -382,6 +382,7 @@ dir-505-a1) + alfa-ap96 |\ + alfa-nx |\ + ap83 |\ ++gl-ar150 |\ + gl-inet |\ + jwap003 |\ + pb42 |\ +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index 4000b5b..2cb884b 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -504,6 +504,9 @@ ar71xx_board_detect() { + name="gl-inet" + gl_inet_board_detect + ;; ++ *"GL AR150") ++ name="gl-ar150" ++ ;; + *"EnGenius EPG5000") + name="epg5000" + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index eded91e..5bd4c2b 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -215,6 +215,7 @@ platform_check_image() { + dlan-pro-500-wp | \ + dlan-pro-1200-ac | \ + dragino2 | \ ++ gl-ar150 | \ + epg5000 | \ + esr1750 | \ + esr900 | \ +diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 +index 514f7d5..0903ee9 100644 +--- a/target/linux/ar71xx/config-3.18 ++++ b/target/linux/ar71xx/config-3.18 +@@ -69,6 +69,7 @@ CONFIG_ATH79_MACH_ESR1750=y + CONFIG_ATH79_MACH_ESR900=y + CONFIG_ATH79_MACH_EW_DORIN=y + CONFIG_ATH79_MACH_F9K1115V2=y ++CONFIG_ATH79_MACH_GL_AR150=y + CONFIG_ATH79_MACH_GL_INET=y + CONFIG_ATH79_MACH_GS_MINIBOX_V1=y + CONFIG_ATH79_MACH_GS_OOLITE=y +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c +new file mode 100644 +index 0000000..310182c +--- /dev/null ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c +@@ -0,0 +1,125 @@ ++/* ++ * GL_ar150 board support ++ * ++ * Copyright (C) 2011 dongyuqi <729650915@qq.com> ++ * Copyright (C) 2011-2012 Gabor Juhos ++ * Copyright (C) 2013 alzhao ++ * Copyright (C) 2014 Michel Stempin ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++*/ ++ ++#include ++ ++#include ++ ++#include "dev-eth.h" ++#include "dev-gpio-buttons.h" ++#include "dev-leds-gpio.h" ++#include "dev-m25p80.h" ++#include "dev-usb.h" ++#include "dev-wmac.h" ++#include "machtypes.h" ++ ++#define GL_AR150_GPIO_LED_WLAN 0 ++#define GL_AR150_GPIO_LED_LAN 13 ++#define GL_AR150_GPIO_LED_WAN 15 ++ ++#define GL_AR150_GPIO_BIN_USB 6 ++#define GL_AR150_GPIO_BTN_MANUAL 7 ++#define GL_AR150_GPIO_BTN_AUTO 8 ++#define GL_AR150_GPIO_BTN_RESET 11 ++ ++#define GL_AR150_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define GL_AR150_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR150_KEYS_POLL_INTERVAL) ++ ++#define GL_AR150_MAC0_OFFSET 0x0000 ++#define GL_AR150_MAC1_OFFSET 0x0000 ++#define GL_AR150_CALDATA_OFFSET 0x1000 ++#define GL_AR150_WMAC_MAC_OFFSET 0x0000 ++ ++static struct gpio_led gl_ar150_leds_gpio[] __initdata = { ++ { ++ .name = "gl_ar150:wlan", ++ .gpio = GL_AR150_GPIO_LED_WLAN, ++ .active_low = 0, ++ }, ++ { ++ .name = "gl_ar150:lan", ++ .gpio = GL_AR150_GPIO_LED_LAN, ++ .active_low = 0, ++ }, ++ { ++ .name = "gl_ar150:wan", ++ .gpio = GL_AR150_GPIO_LED_WAN, ++ .active_low = 0, ++ .default_state = 1, ++ }, ++}; ++ ++static struct gpio_keys_button gl_ar150_gpio_keys[] __initdata = { ++ { ++ .desc = "BTN_7", ++ .type = EV_KEY, ++ .code = BTN_7, ++ .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = GL_AR150_GPIO_BTN_MANUAL, ++ .active_low = 0, ++ }, ++ { ++ .desc = "BTN_8", ++ .type = EV_KEY, ++ .code = BTN_8, ++ .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = GL_AR150_GPIO_BTN_AUTO, ++ .active_low = 0, ++ }, ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = GL_AR150_GPIO_BTN_RESET, ++ .active_low = 0, ++ }, ++}; ++ ++static void __init gl_ar150_setup(void) ++{ ++ ++ /* ART base address */ ++ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ++ ++ /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ ++ ath79_setup_ar933x_phy4_switch(false, false); ++ ++ /* register flash. */ ++ ath79_register_m25p80(NULL); ++ ++ /* register gpio LEDs and keys */ ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar150_leds_gpio), ++ gl_ar150_leds_gpio); ++ ath79_register_gpio_keys_polled(-1, GL_AR150_KEYS_POLL_INTERVAL, ++ ARRAY_SIZE(gl_ar150_gpio_keys), ++ gl_ar150_gpio_keys); ++ ++ /* enable usb */ ++ gpio_request_one(GL_AR150_GPIO_BIN_USB, ++ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, ++ "USB power"); ++ ath79_register_usb(); ++ ++ /* register eth0 as WAN, eth1 as LAN */ ++ ath79_init_mac(ath79_eth0_data.mac_addr, art+GL_AR150_MAC0_OFFSET, 0); ++ ath79_init_mac(ath79_eth1_data.mac_addr, art+GL_AR150_MAC1_OFFSET, 0); ++ ath79_register_mdio(0, 0x0); ++ ath79_register_eth(0); ++ ath79_register_eth(1); ++ ++ /* register wireless mac with cal data */ ++ ath79_register_wmac(art + GL_AR150_CALDATA_OFFSET, art + GL_AR150_WMAC_MAC_OFFSET); ++} ++ ++MIPS_MACHINE(ATH79_MACH_GL_AR150, "GL-AR150", "GL AR150",gl_ar150_setup); +diff --git a/target/linux/ar71xx/generic/profiles/gl-connect.mk b/target/linux/ar71xx/generic/profiles/gl-connect.mk +deleted file mode 100644 +index e9377db..0000000 +--- a/target/linux/ar71xx/generic/profiles/gl-connect.mk ++++ /dev/null +@@ -1,17 +0,0 @@ +-# +-# Copyright (C) 2014 OpenWrt.org +-# +-# This is free software, licensed under the GNU General Public License v2. +-# See /LICENSE for more information. +-# +- +-define Profile/GLINET +- NAME:=GL.iNet +- PACKAGES:=kmod-usb-core kmod-usb2 +-endef +- +-define Profile/GLINET/Description +- Package set optimized for the GL-Connect GL.iNet v1. +-endef +- +-$(eval $(call Profile,GLINET)) +diff --git a/target/linux/ar71xx/generic/profiles/gli.mk b/target/linux/ar71xx/generic/profiles/gli.mk +new file mode 100644 +index 0000000..a6ad661 +--- /dev/null ++++ b/target/linux/ar71xx/generic/profiles/gli.mk +@@ -0,0 +1,27 @@ ++# ++# Copyright (C) 2013 OpenWrt.org ++# ++# This is free software, licensed under the GNU General Public License v2. ++# See /LICENSE for more information. ++# ++define Profile/GLINET ++ NAME:=GL.iNet 6416 ++ PACKAGES:=kmod-usb-core kmod-usb2 ++endef ++ ++define Profile/GLINET/Description ++ Package set optimized for the GL-Connect GL.iNet v1. ++endef ++ ++$(eval $(call Profile,GLINET)) ++ ++define Profile/GL-AR150 ++ NAME:=GL AR150 ++ PACKAGES:=kmod-usb-core kmod-usb2 ++endef ++ ++define Profile/GL-AR150/Description ++ Configuration of GL AR150. ++endef ++ ++$(eval $(call Profile,GL-AR150)) +diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile +index 57f38a5..3ce1809 100644 +--- a/target/linux/ar71xx/image/Makefile ++++ b/target/linux/ar71xx/image/Makefile +@@ -144,6 +144,14 @@ define Device/weio + endef + TARGET_DEVICES += weio + ++define Device/gl-ar150 ++ BOARDNAME = GL-AR150 ++ IMAGE_SIZE = 16000k ++ CONSOLE = ttyATH0,115200 ++ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro ++endef ++TARGET_DEVICES += gl-ar150 ++ + define Device/wndr3700 + BOARDNAME = WNDR3700 + NETGEAR_KERNEL_MAGIC = 0x33373030 +diff --git a/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch b/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch +new file mode 100644 +index 0000000..31db581 +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/911-MIPS-ath79-add-gl_ar150.patch +@@ -0,0 +1,39 @@ ++--- a/arch/mips/ath79/Kconfig +++++ b/arch/mips/ath79/Kconfig ++@@ -533,6 +533,16 @@ config ATH79_MACH_GL_INET ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++ +++config ATH79_MACH_GL_AR150 +++ bool "GL AR150 support" +++ select SOC_AR933X +++ 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_EAP300V2 ++ bool "EnGenius EAP300 v2 support" ++ select SOC_AR934X ++--- a/arch/mips/ath79/Makefile +++++ b/arch/mips/ath79/Makefile ++@@ -78,6 +78,7 @@ obj-$(CONFIG_ATH79_MACH_EL_MINI) += mach ++ obj-$(CONFIG_ATH79_MACH_EPG5000) += mach-epg5000.o ++ obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o ++ obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o +++obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o ++ obj-$(CONFIG_ATH79_MACH_GL_INET) += mach-gl-inet.o ++ obj-$(CONFIG_ATH79_MACH_GS_MINIBOX_V1) += mach-gs-minibox-v1.o ++ obj-$(CONFIG_ATH79_MACH_GS_OOLITE) += mach-gs-oolite.o ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -67,6 +67,7 @@ enum ath79_mach_type { ++ ATH79_MACH_ESR1750, /* EnGenius ESR1750 */ ++ ATH79_MACH_EPG5000, /* EnGenius EPG5000 */ ++ ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */ +++ ATH79_MACH_GL_AR150, /* GL-AR150 support */ ++ ATH79_MACH_GL_INET, /* GL-CONNECT GL-INET */ ++ ATH79_MACH_GS_MINIBOX_V1, /* Gainstrong MiniBox V1.0 */ ++ ATH79_MACH_GS_OOLITE, /* GS OOLITE V1.0 */ diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index fed97d3e..3b8f4362 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -293,6 +293,10 @@ $(eval $(call GluonProfile,GLINET)) $(eval $(call GluonModel,GLINET,gl-inet-6408A-v1,gl-inet-6408a-v1)) $(eval $(call GluonModel,GLINET,gl-inet-6416A-v1,gl-inet-6416a-v1)) +$(eval $(call GluonProfile,GL-AR150)) +$(eval $(call GluonModel,GL-AR150,gl-ar150,gl-ar150)) +$(eval $(call GluonProfileFactorySuffix,GL-AR150)) + ## Western Digital # WD MyNet N600 From 577a0a9f991771549600706f236c0934183141a3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 15 Jun 2016 19:32:15 +0200 Subject: [PATCH 053/184] build: backport a few patches for better Make 4.2+ support --- ...fix-version-detection-for-Make-4.2.1.patch | 24 ++++++++++ ...-j-for-parallel-builds-with-Make-4.2.patch | 48 +++++++++++++++++++ ...ake-fix-parallel-build-with-Make-4.2.patch | 30 ++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 patches/openwrt/0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch create mode 100644 patches/openwrt/0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch create mode 100644 patches/openwrt/0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch diff --git a/patches/openwrt/0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch b/patches/openwrt/0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch new file mode 100644 index 00000000..94b0e4e3 --- /dev/null +++ b/patches/openwrt/0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch @@ -0,0 +1,24 @@ +From: Matthias Schiffer +Date: Wed, 15 Jun 2016 19:31:08 +0200 +Subject: scripts: feeds: fix version detection for Make >= 4.2.1 + +Signed-off-by: Jo-Philipp Wich + +Backport of LEDE df18b3756fef6a28d9194368d3156f0cd85fae19 + +diff --git a/scripts/feeds b/scripts/feeds +index f8f29cd..908e56c 100755 +--- a/scripts/feeds ++++ b/scripts/feeds +@@ -22,7 +22,10 @@ my @mkver = split /\s+/, `$mk -v`, 4; + my $valid_mk = 1; + $mkver[0] =~ /^GNU/ or $valid_mk = 0; + $mkver[1] =~ /^Make/ or $valid_mk = 0; +-$mkver[2] >= "3.81" or $valid_mk = 0; ++ ++my ($mkv1, $mkv2) = split /\./, $mkver[2]; ++($mkv1 >= 4 || ($mkv1 == 3 && $mkv2 >= 81)) or $valid_mk = 0; ++ + $valid_mk or die "Unsupported version of make found: $mk\n"; + + my @feeds; diff --git a/patches/openwrt/0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch b/patches/openwrt/0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch new file mode 100644 index 00000000..6cdf13ab --- /dev/null +++ b/patches/openwrt/0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch @@ -0,0 +1,48 @@ +From: Matthias Schiffer +Date: Wed, 15 Jun 2016 19:31:34 +0200 +Subject: build: don't add -j for parallel builds with Make 4.2+ + +Make usually passes -j and jobserver arguments as part of MAKEFLAGS. LEDE +removes MAKEFLAGS to have better control of the build, and re-adds the +jobserver arguments with -j to the Make commandline where desired. + +Make 4.2+ behave differently with these arguments passed on the commandline +than in MAKEFLAGS: -j will override the jobserver argument and the job +count will be unlimited. + +Moving the flags to MAKEFLAGS will need many packages to be changed and +tested; therefore, we opt for a less invasive change for now and just +remove -j for Make 4.2+, as the jobserver argument alone is enough to +enable parallel builds for these Make versions. + +Signed-off-by: Jo-Philipp Wich +Signed-off-by: Matthias Schiffer + +Backport of LEDE 6fb212f2933bbbdf2935124205717c9d0ca72b32 + +diff --git a/include/host-build.mk b/include/host-build.mk +index e2b5f2f..44401b8 100644 +--- a/include/host-build.mk ++++ b/include/host-build.mk +@@ -10,7 +10,7 @@ HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install + HOST_BUILD_PARALLEL ?= + + ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),) +- HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j) ++ HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) + else + HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS) + endif +diff --git a/include/package.mk b/include/package.mk +index c69d928..a99cdc6 100644 +--- a/include/package.mk ++++ b/include/package.mk +@@ -23,7 +23,7 @@ PKG_RELRO_PARTIAL ?= 1 + PKG_RELRO_FULL ?= 1 + + ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),) +- MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j) ++ MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) + else + MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS) + endif diff --git a/patches/openwrt/0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch b/patches/openwrt/0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch new file mode 100644 index 00000000..16709ae6 --- /dev/null +++ b/patches/openwrt/0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch @@ -0,0 +1,30 @@ +From: Matthias Schiffer +Date: Wed, 15 Jun 2016 19:31:49 +0200 +Subject: tools/cmake: fix parallel build with Make 4.2+ + +Avoid using the --parallel argument to the CMake bootstrap, as that doesn't +allow us to remove the -j argument. Instead, pass the HOST_JOBS arguments +in MAKEFLAGS. + +Signed-off-by: Matthias Schiffer + +Backport of LEDE 96db10752483cb07f822686482b44be6c21fbb5f + +diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile +index 08e2b02..6c211de 100644 +--- a/tools/cmake/Makefile ++++ b/tools/cmake/Makefile +@@ -18,10 +18,11 @@ HOST_CONFIGURE_PARALLEL:=1 + + include $(INCLUDE_DIR)/host-build.mk + ++HOST_CONFIGURE_CMD := MAKEFLAGS="$(HOST_JOBS)" $(BASH) ./configure ++ + HOST_CONFIGURE_VARS := + + HOST_CONFIGURE_ARGS := \ +- --prefix=$(STAGING_DIR_HOST) \ +- $(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") ++ --prefix=$(STAGING_DIR_HOST) + + $(eval $(call HostBuild)) From 036d02f462a44bb76ee7265ebad539273bd012a8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 16 Jun 2016 01:23:00 +0200 Subject: [PATCH 054/184] kernel: make IPv6 builtin Packages in the openwrt-routing master have adjusted to this upstream change, so we follow. Also saves a bit of space. --- include/gluon.mk | 2 +- ...-IPv6-builtin-if-selected-saves-30KB.patch | 143 ++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 patches/openwrt/0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch diff --git a/include/gluon.mk b/include/gluon.mk index d49dc13f..ef0f5311 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -75,7 +75,7 @@ GLUON_TARGET_$$(gluon_target)_BOARD := $(1) GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2) endef -GLUON_DEFAULT_PACKAGES := gluon-core kmod-ipv6 firewall ip6tables -uboot-envtools -wpad-mini hostapd-mini +GLUON_DEFAULT_PACKAGES := gluon-core firewall ip6tables -uboot-envtools -wpad-mini hostapd-mini override DEFAULT_PACKAGES.router := diff --git a/patches/openwrt/0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch b/patches/openwrt/0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch new file mode 100644 index 00000000..63a5ddb6 --- /dev/null +++ b/patches/openwrt/0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch @@ -0,0 +1,143 @@ +From: Matthias Schiffer +Date: Thu, 16 Jun 2016 00:51:07 +0200 +Subject: linux: make IPv6 builtin if selected (saves >30KB) + +Signed-off-by: Steven Barth + +Backport of OpenWrt r46834 + +kmod-ipv6 is added to the PROVIDES of the kernel package, so we don't have +to adjust all packages depending on kmod-ipv6. + +diff --git a/config/Config-build.in b/config/Config-build.in +index 4674d84..cd50290 100644 +--- a/config/Config-build.in ++++ b/config/Config-build.in +@@ -83,7 +83,7 @@ menu "Global build settings" + prompt "Enable IPv6 support in packages" + default y + help +- Enable IPv6 support in packages (passes --enable-ipv6 to configure scripts). ++ Enables IPv6 support in kernel (builtin) and packages. + + config PKG_BUILD_PARALLEL + bool +diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile +index 45ca9fa..b06c49a 100644 +--- a/package/kernel/linux/Makefile ++++ b/package/kernel/linux/Makefile +@@ -49,6 +49,7 @@ define Package/kernel + TITLE:=Virtual kernel package + VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC) + URL:=http://www.kernel.org/ ++ PROVIDES:=$(if $(CONFIG_IPV6),kmod-ipv6) + endef + + define Package/kernel/install +diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk +index cea8e47..8a2760d 100644 +--- a/package/kernel/linux/modules/netsupport.mk ++++ b/package/kernel/linux/modules/netsupport.mk +@@ -439,7 +439,7 @@ $(eval $(call KernelPackage,iptunnel4)) + define KernelPackage/iptunnel6 + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=IPv6 tunneling +- DEPENDS:= +kmod-ipv6 ++ DEPENDS:=@IPV6 + KCONFIG:= \ + CONFIG_INET6_TUNNEL + FILES:=$(LINUX_DIR)/net/ipv6/tunnel6.ko +@@ -456,15 +456,16 @@ $(eval $(call KernelPackage,iptunnel6)) + define KernelPackage/ipv6 + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=IPv6 support ++ DEPENDS:=@IPV6 ++ HIDDEN:=1 ++ DEFAULT:=y + KCONFIG:= \ +- CONFIG_IPV6 \ ++ CONFIG_IPV6=y \ + CONFIG_IPV6_PRIVACY=y \ + CONFIG_IPV6_MULTIPLE_TABLES=y \ + CONFIG_IPV6_MROUTE=y \ + CONFIG_IPV6_PIMSM_V2=n \ + CONFIG_IPV6_SUBTREES=y +- FILES:=$(LINUX_DIR)/net/ipv6/ipv6.ko +- AUTOLOAD:=$(call AutoLoad,20,ipv6) + endef + + define KernelPackage/ipv6/description +@@ -476,7 +477,7 @@ $(eval $(call KernelPackage,ipv6)) + + define KernelPackage/sit + SUBMENU:=$(NETWORK_SUPPORT_MENU) +- DEPENDS:=+kmod-ipv6 +kmod-iptunnel +kmod-iptunnel4 ++ DEPENDS:=@IPV6 +kmod-iptunnel +kmod-iptunnel4 + TITLE:=IPv6-in-IPv4 tunnel + KCONFIG:=CONFIG_IPV6_SIT \ + CONFIG_IPV6_SIT_6RD=y +@@ -494,7 +495,7 @@ $(eval $(call KernelPackage,sit)) + define KernelPackage/ip6-tunnel + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=IP-in-IPv6 tunnelling +- DEPENDS:= +kmod-ipv6 +kmod-iptunnel6 ++ DEPENDS:=@IPV6 +kmod-iptunnel6 + KCONFIG:= CONFIG_IPV6_TUNNEL + FILES:=$(LINUX_DIR)/net/ipv6/ip6_tunnel.ko + AUTOLOAD:=$(call AutoLoad,32,ip6_tunnel) +@@ -510,7 +511,7 @@ $(eval $(call KernelPackage,ip6-tunnel)) + define KernelPackage/gre + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=GRE support +- DEPENDS:=+PACKAGE_kmod-ipv6:kmod-ipv6 +kmod-iptunnel ++ DEPENDS:=+kmod-iptunnel + KCONFIG:=CONFIG_NET_IPGRE CONFIG_NET_IPGRE_DEMUX + FILES:=$(LINUX_DIR)/net/ipv4/ip_gre.ko $(LINUX_DIR)/net/ipv4/gre.ko + AUTOLOAD:=$(call AutoLoad,39,gre ip_gre) +@@ -526,7 +527,7 @@ $(eval $(call KernelPackage,gre)) + define KernelPackage/gre6 + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=GRE support over IPV6 +- DEPENDS:=+kmod-ipv6 +kmod-iptunnel +kmod-ip6-tunnel ++ DEPENDS:=@IPV6 +kmod-iptunnel +kmod-ip6-tunnel + KCONFIG:=CONFIG_IPV6_GRE + FILES:=$(LINUX_DIR)/net/ipv6/ip6_gre.ko + AUTOLOAD:=$(call AutoLoad,39,ip6_gre) +@@ -862,7 +863,6 @@ define KernelPackage/l2tp + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Layer Two Tunneling Protocol (L2TP) + DEPENDS:= \ +- +IPV6:kmod-ipv6 \ + +kmod-udptunnel4 \ + +IPV6:kmod-udptunnel6 + KCONFIG:=CONFIG_L2TP \ +@@ -898,7 +898,7 @@ $(eval $(call KernelPackage,l2tp-eth)) + define KernelPackage/l2tp-ip + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=L2TP IP encapsulation for L2TPv3 +- DEPENDS:=+kmod-l2tp +IPV6:kmod-ipv6 ++ DEPENDS:=+kmod-l2tp + KCONFIG:=CONFIG_L2TP_IP + FILES:= \ + $(LINUX_DIR)/net/l2tp/l2tp_ip.ko \ +@@ -930,7 +930,7 @@ define KernelPackage/sctp + CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y + FILES:= $(LINUX_DIR)/net/sctp/sctp.ko + AUTOLOAD:= $(call AutoLoad,32,sctp) +- DEPENDS:=+kmod-lib-crc32c +kmod-crypto-md5 +kmod-crypto-hmac +IPV6:kmod-ipv6 ++ DEPENDS:=+kmod-lib-crc32c +kmod-crypto-md5 +kmod-crypto-hmac + endef + + define KernelPackage/sctp/description +diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile +index 19a8df9..8fd51fe 100644 +--- a/package/network/services/dnsmasq/Makefile ++++ b/package/network/services/dnsmasq/Makefile +@@ -52,7 +52,6 @@ define Package/dnsmasq-full + $(call Package/dnsmasq/Default) + TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset enabled by default) + DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \ +- +PACKAGE_dnsmasq_full_dhcpv6:kmod-ipv6 \ + +PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset + VARIANT:=full + endef From 5eddfbe8b172feb61bad755d3f9b0700e8e074a5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 16 Jun 2016 04:12:40 +0200 Subject: [PATCH 055/184] kernel: change kmod-crypto-{core,arc4} to builtin Another backported upstream change. --- ...kages-with-multiple-PROVIDES-entries.patch | 21 +++ ...mod-crypto-core-and-kmod-crypto-arc4.patch | 167 ++++++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 patches/openwrt/0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch create mode 100644 patches/openwrt/0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch diff --git a/patches/openwrt/0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch b/patches/openwrt/0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch new file mode 100644 index 00000000..4fc1edd5 --- /dev/null +++ b/patches/openwrt/0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch @@ -0,0 +1,21 @@ +From: Matthias Schiffer +Date: Thu, 16 Jun 2016 04:28:44 +0200 +Subject: package-ipkg.mk: fix Provides for packages with multiple PROVIDES entries + +Signed-off-by: Matthias Schiffer + +Backport of LEDE 3ee6c17cd14ec1fed0b0491542c499c03fc6d211 + +diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk +index eb4c874..1830d64 100644 +--- a/include/package-ipkg.mk ++++ b/include/package-ipkg.mk +@@ -154,7 +154,7 @@ Package: $(1) + Version: $(VERSION) + $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) + )$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS)) +-)$$(call addfield,Provides,$(PROVIDES) ++)$$(call addfield,Provides,$$(call mergelist,$(PROVIDES)) + )$$(call addfield,Source,$(SOURCE) + )$$(call addfield,License,$$(PKG_LICENSE) + )$$(call addfield,LicenseFiles,$$(PKG_LICENSE_FILES) diff --git a/patches/openwrt/0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch b/patches/openwrt/0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch new file mode 100644 index 00000000..594c4724 --- /dev/null +++ b/patches/openwrt/0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch @@ -0,0 +1,167 @@ +From: Matthias Schiffer +Date: Thu, 16 Jun 2016 03:42:03 +0200 +Subject: kernel: remove packaging of kmod-crypto-core and kmod-crypto-arc4 + +Everything except for blkcipher was already built-in, so make blkcipher +built-in as well. + +Signed-off-by: Felix Fietkau + +Backport of OpenWrt r46820 + +The packages kmod-crypto-{core,arc4} are added to kernel PROVIDES to +satisfy dependencies of CC packages. + +diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile +index b06c49a..19bcbd5 100644 +--- a/package/kernel/linux/Makefile ++++ b/package/kernel/linux/Makefile +@@ -49,7 +49,7 @@ define Package/kernel + TITLE:=Virtual kernel package + VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC) + URL:=http://www.kernel.org/ +- PROVIDES:=$(if $(CONFIG_IPV6),kmod-ipv6) ++ PROVIDES:=kmod-crypto-core kmod-crypto-arc4 $(if $(CONFIG_IPV6),kmod-ipv6) + endef + + define Package/kernel/install +diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk +index c8e0fbb..926dab0 100644 +--- a/package/kernel/linux/modules/crypto.mk ++++ b/package/kernel/linux/modules/crypto.mk +@@ -15,24 +15,9 @@ crypto_confvar=CONFIG_CRYPTO_$(word 1,$(subst =,$(space),$(1))) + crypto_file=$(LINUX_DIR)/crypto/$(word 2,$(subst =,$(space),$(1))).ko + crypto_name=$(if $(findstring y,$($(call crypto_confvar,$(1)))),,$(word 2,$(subst =,$(space),$(1)))) + +-define KernelPackage/crypto-core +- SUBMENU:=$(CRYPTO_MENU) +- TITLE:=Core CryptoAPI modules +- KCONFIG:= \ +- CONFIG_CRYPTO=y \ +- CONFIG_CRYPTO_HW=y \ +- CONFIG_CRYPTO_BLKCIPHER \ +- CONFIG_CRYPTO_ALGAPI \ +- $(foreach mod,$(CRYPTO_MODULES),$(call crypto_confvar,$(mod))) +- FILES:=$(foreach mod,$(CRYPTO_MODULES),$(call crypto_file,$(mod))) +-endef +- +-$(eval $(call KernelPackage,crypto-core)) +- +- + define AddDepends/crypto + SUBMENU:=$(CRYPTO_MENU) +- DEPENDS+=+kmod-crypto-core $(1) ++ DEPENDS+= $(1) + endef + + define KernelPackage/crypto-aead +@@ -272,17 +257,6 @@ endif + $(eval $(call KernelPackage,crypto-aes)) + + +-define KernelPackage/crypto-arc4 +- TITLE:=ARC4 (RC4) cipher CryptoAPI module +- KCONFIG:=CONFIG_CRYPTO_ARC4 +- FILES:=$(LINUX_DIR)/crypto/arc4.ko +- AUTOLOAD:=$(call AutoLoad,09,arc4) +- $(call AddDepends/crypto) +-endef +- +-$(eval $(call KernelPackage,crypto-arc4)) +- +- + define KernelPackage/crypto-authenc + TITLE:=Combined mode wrapper for IPsec + DEPENDS:=+kmod-crypto-manager +diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk +index fa18237..cc87a45 100644 +--- a/package/kernel/linux/modules/fs.mk ++++ b/package/kernel/linux/modules/fs.mk +@@ -91,7 +91,6 @@ define KernelPackage/fs-cifs + AUTOLOAD:=$(call AutoLoad,30,cifs) + $(call AddDepends/nls) + DEPENDS+= \ +- +kmod-crypto-arc4 \ + +kmod-crypto-hmac \ + +kmod-crypto-md5 \ + +kmod-crypto-md4 \ +diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk +index 8a2760d..ab76946 100644 +--- a/package/kernel/linux/modules/netsupport.mk ++++ b/package/kernel/linux/modules/netsupport.mk +@@ -714,7 +714,7 @@ $(eval $(call KernelPackage,ipoa)) + define KernelPackage/mppe + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Microsoft PPP compression/encryption +- DEPENDS:=kmod-ppp +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-sha1 +kmod-crypto-ecb ++ DEPENDS:=kmod-ppp +kmod-crypto-sha1 +kmod-crypto-ecb + KCONFIG:= \ + CONFIG_PPP_MPPE_MPPC \ + CONFIG_PPP_MPPE +@@ -998,7 +998,7 @@ define KernelPackage/rxrpc + $(LINUX_DIR)/net/rxrpc/af-rxrpc.ko \ + $(LINUX_DIR)/net/rxrpc/rxkad.ko + AUTOLOAD:=$(call AutoLoad,30,rxkad af-rxrpc) +- DEPENDS:=+kmod-crypto-core +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt ++ DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt + endef + + define KernelPackage/rxrpc/description +diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile +index cd8d670..e82bdb0 100644 +--- a/package/kernel/mac80211/Makefile ++++ b/package/kernel/mac80211/Makefile +@@ -92,7 +92,7 @@ endef + define KernelPackage/mac80211 + $(call KernelPackage/mac80211/Default) + TITLE:=Linux 802.11 Wireless Networking Stack +- DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4 ++ DEPENDS+= +kmod-cfg80211 +hostapd-common + KCONFIG:=\ + CONFIG_AVERAGE=y + FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko +diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 +index 6038692..a0dc3c9 100644 +--- a/target/linux/generic/config-3.18 ++++ b/target/linux/generic/config-3.18 +@@ -700,9 +700,10 @@ CONFIG_CRYPTO_ALGAPI=y + CONFIG_CRYPTO_ALGAPI2=y + # CONFIG_CRYPTO_ANSI_CPRNG is not set + # CONFIG_CRYPTO_ANUBIS is not set +-# CONFIG_CRYPTO_ARC4 is not set ++CONFIG_CRYPTO_ARC4=y + # CONFIG_CRYPTO_AUTHENC is not set +-# CONFIG_CRYPTO_BLKCIPHER is not set ++CONFIG_CRYPTO_BLKCIPHER=y ++CONFIG_CRYPTO_BLKCIPHER2=y + # CONFIG_CRYPTO_BLOWFISH is not set + # CONFIG_CRYPTO_CAMELLIA is not set + # CONFIG_CRYPTO_CAST5 is not set +diff --git a/target/linux/omap/config-3.18 b/target/linux/omap/config-3.18 +index a06a350..d5003c2 100644 +--- a/target/linux/omap/config-3.18 ++++ b/target/linux/omap/config-3.18 +@@ -114,9 +114,6 @@ CONFIG_CPU_V7=y + CONFIG_CRC16=y + CONFIG_CRYPTO_AEAD=m + CONFIG_CRYPTO_AEAD2=m +-CONFIG_CRYPTO_ARC4=m +-CONFIG_CRYPTO_BLKCIPHER=m +-CONFIG_CRYPTO_BLKCIPHER2=m + CONFIG_CRYPTO_CCM=m + CONFIG_CRYPTO_CRC32C=y + CONFIG_CRYPTO_CTR=m +diff --git a/target/linux/sunxi/config-3.18 b/target/linux/sunxi/config-3.18 +index ddc3f7a..57651bb 100644 +--- a/target/linux/sunxi/config-3.18 ++++ b/target/linux/sunxi/config-3.18 +@@ -110,9 +110,6 @@ CONFIG_CPU_TLB_V7=y + CONFIG_CPU_V7=y + CONFIG_CRC16=y + CONFIG_CRC_T10DIF=y +-CONFIG_CRYPTO_ARC4=y +-CONFIG_CRYPTO_BLKCIPHER=y +-CONFIG_CRYPTO_BLKCIPHER2=y + CONFIG_CRYPTO_CRC32C=y + CONFIG_CRYPTO_CRCT10DIF=y + CONFIG_CRYPTO_DES=y From 907924de237ceffef8187c157f6483986a1b44e3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 16 Jun 2016 04:40:45 +0200 Subject: [PATCH 056/184] Update OpenWrt and LuCI packages --- modules | 4 ++-- ...ult-language-if-none-provided-by-the-browser-matches.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules b/modules index f014b82b..6123d0a6 100644 --- a/modules +++ b/modules @@ -4,7 +4,7 @@ OPENWRT_REPO=git://git.openwrt.org/15.05/openwrt.git OPENWRT_COMMIT=eadf19c0b43d2f75f196ea8d875a08c7c348530c PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git -PACKAGES_OPENWRT_COMMIT=9622fe984bba3a4547f48bc507ebaba7637eb2b0 +PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git @@ -14,5 +14,5 @@ PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc PACKAGES_LUCI_REPO=git://github.com/openwrt/luci.git -PACKAGES_LUCI_COMMIT=cdcdfd2594634804ab09dc8105e46116edce0cd6 +PACKAGES_LUCI_COMMIT=70a4d43cc895b7d728b4fc201f2b6fd9f4b8aaec PACKAGES_LUCI_BRANCH=for-15.05 diff --git a/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch b/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch index 745e6cef..2a64ef95 100644 --- a/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch +++ b/patches/packages/luci/0002-modules-base-dispatcher-set-default-language-if-none-provided-by-the-browser-matches.patch @@ -3,7 +3,7 @@ Date: Thu, 19 Mar 2015 18:44:52 +0100 Subject: modules/base: dispatcher: set default language if none provided by the browser matches diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua -index 8b8d1fa..27f9a15 100644 +index 2526950..be2fc34 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -182,6 +182,7 @@ function dispatch(request) From c4c3c6d015655163f5042f3d867cad580e34881d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 16 Jun 2016 06:03:09 +0200 Subject: [PATCH 057/184] Update routing packages batman-adv & alfred 2016.2. --- modules | 2 +- .../0001-alfred-adjust-intervals.patch | 4 +- ...-adv-introduce-no_rebroadcast-option.patch | 87 ++++++++++--------- ...n-adv-decrease-maximum-fragment-size.patch | 16 ++-- 4 files changed, 58 insertions(+), 51 deletions(-) diff --git a/modules b/modules index 6123d0a6..7cefc617 100644 --- a/modules +++ b/modules @@ -11,7 +11,7 @@ PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git PACKAGES_GLUON_COMMIT=37c7cebf10d79f83151bb41cf6014a1d379ed3fe PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git -PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc +PACKAGES_ROUTING_COMMIT=85e771d2f1ca1981983238073ffc602981acbb40 PACKAGES_LUCI_REPO=git://github.com/openwrt/luci.git PACKAGES_LUCI_COMMIT=70a4d43cc895b7d728b4fc201f2b6fd9f4b8aaec diff --git a/patches/packages/routing/0001-alfred-adjust-intervals.patch b/patches/packages/routing/0001-alfred-adjust-intervals.patch index aabb1659..d44b32a7 100644 --- a/patches/packages/routing/0001-alfred-adjust-intervals.patch +++ b/patches/packages/routing/0001-alfred-adjust-intervals.patch @@ -4,13 +4,13 @@ Subject: alfred: adjust intervals diff --git a/alfred/patches/0001-alfred-adjust-intervals.patch b/alfred/patches/0001-alfred-adjust-intervals.patch new file mode 100644 -index 0000000..df70eea +index 0000000..a5860db --- /dev/null +++ b/alfred/patches/0001-alfred-adjust-intervals.patch @@ -0,0 +1,15 @@ +--- a/alfred.h ++++ b/alfred.h -+@@ -33,10 +33,10 @@ ++@@ -34,10 +34,10 @@ + #include "list.h" + #include "packet.h" + diff --git a/patches/packages/routing/0002-batman-adv-introduce-no_rebroadcast-option.patch b/patches/packages/routing/0002-batman-adv-introduce-no_rebroadcast-option.patch index f6d1646a..f564a011 100644 --- a/patches/packages/routing/0002-batman-adv-introduce-no_rebroadcast-option.patch +++ b/patches/packages/routing/0002-batman-adv-introduce-no_rebroadcast-option.patch @@ -3,13 +3,13 @@ Date: Thu, 2 Apr 2015 20:24:14 +0200 Subject: batman-adv: introduce 'no_rebroadcast' option diff --git a/batman-adv/files/lib/netifd/proto/batadv.sh b/batman-adv/files/lib/netifd/proto/batadv.sh -index 632a209..01f567f 100644 +index 1e0c9d0..d0ab238 100644 --- a/batman-adv/files/lib/netifd/proto/batadv.sh +++ b/batman-adv/files/lib/netifd/proto/batadv.sh -@@ -6,16 +6,19 @@ init_proto "$@" - +@@ -7,19 +7,22 @@ init_proto "$@" proto_batadv_init_config() { proto_config_add_string "mesh" + proto_config_add_string "routing_algo" + proto_config_add_string "mesh_no_rebroadcast" } @@ -17,10 +17,13 @@ index 632a209..01f567f 100644 local config="$1" local iface="$2" -- local mesh -- json_get_vars mesh -+ local mesh mesh_no_rebroadcast -+ json_get_vars mesh mesh_no_rebroadcast +- local mesh routing_algo +- json_get_vars mesh routing_algo ++ local mesh routing_algo mesh_no_rebroadcast ++ json_get_vars mesh routing_algo mesh_no_rebroadcast + + [ -n "$routing_algo" ] || routing_algo="BATMAN_IV" + echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo" echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" + [ -n "$mesh_no_rebroadcast" ] && echo "$mesh_no_rebroadcast" > "/sys/class/net/$iface/batman_adv/no_rebroadcast" @@ -30,12 +33,12 @@ index 632a209..01f567f 100644 } diff --git a/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch b/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch new file mode 100644 -index 0000000..3324102 +index 0000000..e9f5ffb --- /dev/null +++ b/batman-adv/patches/1001-batman-adv-introduce-no_rebroadcast-option.patch -@@ -0,0 +1,185 @@ -+From bb9feeed3b49a55034cce90be996b11cd095b1ce Mon Sep 17 00:00:00 2001 -+Message-Id: +@@ -0,0 +1,189 @@ ++From bb66988dc6972d5400b4ff4f0b49ed090007d635 Mon Sep 17 00:00:00 2001 ++Message-Id: +From: =?UTF-8?q?Linus=20L=C3=BCssing?= +Date: Tue, 24 Sep 2013 04:36:27 +0200 +Subject: [PATCH 1/2] batman-adv: introduce 'no_rebroadcast' option @@ -63,21 +66,22 @@ index 0000000..3324102 + +Signed-off-by: Linus Lüssing +--- -+ .../ABI/testing/sysfs-class-net-batman-adv | 10 ++++ ++ .../ABI/testing/sysfs-class-net-batman-adv | 11 ++++ + net/batman-adv/hard-interface.c | 2 + + net/batman-adv/send.c | 4 ++ + net/batman-adv/sysfs.c | 59 ++++++++++++++++++++++ + net/batman-adv/types.h | 1 + -+ 5 files changed, 76 insertions(+) ++ 5 files changed, 77 insertions(+) + +diff --git a/Documentation/ABI/testing/sysfs-class-net-batman-adv b/Documentation/ABI/testing/sysfs-class-net-batman-adv -+index 7f34a95..cf7fe00 100644 ++index 518f6a1..896c480 100644 +--- a/Documentation/ABI/testing/sysfs-class-net-batman-adv ++++ b/Documentation/ABI/testing/sysfs-class-net-batman-adv -+@@ -13,3 +13,13 @@ Description: ++@@ -28,3 +28,14 @@ Description: ++ The /sys/class/net//batman-adv/mesh_iface file + displays the batman mesh interface this + currently is associated with. -+ +++ ++What: /sys/class/net//batman-adv/no_rebroadcast ++Date: Sep 2013 ++Contact: Linus Lüssing @@ -89,12 +93,12 @@ index 0000000..3324102 ++ or wired links. Using this option wrongly is going to ++ break your mesh network, use at your own risk! +diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c -+index aea4d06..66a703d 100644 ++index 8c2f399..48e53d0 100644 +--- a/net/batman-adv/hard-interface.c ++++ b/net/batman-adv/hard-interface.c -+@@ -657,6 +657,8 @@ batadv_hardif_add_interface(struct net_device *net_dev) -+ /* extra reference for return */ -+ atomic_set(&hard_iface->refcount, 2); ++@@ -690,6 +690,8 @@ batadv_hardif_add_interface(struct net_device *net_dev) ++ kref_init(&hard_iface->refcount); ++ kref_get(&hard_iface->refcount); + ++ atomic_set(&hard_iface->no_rebroadcast, 0); ++ @@ -102,10 +106,10 @@ index 0000000..3324102 + list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list); + +diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c -+index c188f46..145f7cb 100644 ++index f2f1256..3736d75 100644 +--- a/net/batman-adv/send.c ++++ b/net/batman-adv/send.c -+@@ -535,6 +535,10 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work) ++@@ -578,6 +578,10 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work) + if (forw_packet->num_packets >= hard_iface->num_bcasts) + continue; + @@ -113,14 +117,14 @@ index 0000000..3324102 ++ forw_packet->skb->dev == hard_iface->net_dev) ++ continue; ++ -+ /* send a copy of the saved skb */ -+ skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC); -+ if (skb1) ++ if (!kref_get_unless_zero(&hard_iface->refcount)) ++ continue; ++ +diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c -+index f38d7b7..600633c 100644 ++index 414b207..9aa043f 100644 +--- a/net/batman-adv/sysfs.c ++++ b/net/batman-adv/sysfs.c -+@@ -131,6 +131,17 @@ struct batadv_attribute batadv_attr_vlan_##_name = { \ ++@@ -134,6 +134,17 @@ struct batadv_attribute batadv_attr_vlan_##_name = { \ + .store = _store, \ + } + @@ -138,9 +142,9 @@ index 0000000..3324102 + /* Use this, if you have customized show and store functions */ + #define BATADV_ATTR(_name, _mode, _show, _store) \ + struct batadv_attribute batadv_attr_##_name = { \ -+@@ -241,6 +252,52 @@ ssize_t batadv_show_vlan_##_name(struct kobject *kobj, \ -+ static BATADV_ATTR_VLAN(_name, _mode, batadv_show_vlan_##_name, \ -+ batadv_store_vlan_##_name) ++@@ -293,6 +304,52 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ ++ static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ ++ batadv_store_##_name) + ++#define BATADV_ATTR_HIF_STORE_BOOL(_name, _post_func) \ ++ssize_t batadv_store_hif_##_name(struct kobject *kobj, \ @@ -158,7 +162,7 @@ index 0000000..3324102 ++ res = __batadv_store_bool_attr(buff, count, _post_func, \ ++ attr, &hard_iface->_name, \ ++ hard_iface->soft_iface); \ -++ batadv_hardif_free_ref(hard_iface); \ +++ batadv_hardif_put(hard_iface); \ ++ return res; \ ++} ++ @@ -177,7 +181,7 @@ index 0000000..3324102 ++ res = sprintf(buff, "%s\n", \ ++ atomic_read(&hard_iface->_name) == 0 ? \ ++ "disabled" : "enabled"); \ -++ batadv_hardif_free_ref(hard_iface); \ +++ batadv_hardif_put(hard_iface); \ ++ return res; \ ++} ++ @@ -191,24 +195,27 @@ index 0000000..3324102 + static int batadv_store_bool_attr(char *buff, size_t count, + struct net_device *net_dev, + const char *attr_name, atomic_t *attr, -+@@ -870,10 +927,12 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj, ++@@ -993,6 +1050,7 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj, + static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface, + batadv_store_mesh_iface); + static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); ++BATADV_ATTR_HIF_BOOL(no_rebroadcast, S_IRUGO | S_IWUSR, NULL); -+ ++ #ifdef CONFIG_BATMAN_ADV_BATMAN_V ++ BATADV_ATTR_HIF_UINT(elp_interval, bat_v.elp_interval, S_IRUGO | S_IWUSR, ++ 2 * BATADV_JITTER, INT_MAX, NULL); ++@@ -1004,6 +1062,7 @@ static BATADV_ATTR(throughput_override, S_IRUGO | S_IWUSR, + static struct batadv_attribute *batadv_batman_attrs[] = { + &batadv_attr_mesh_iface, + &batadv_attr_iface_status, ++ &batadv_attr_hif_no_rebroadcast, -+ NULL, -+ }; -+ ++ #ifdef CONFIG_BATMAN_ADV_BATMAN_V ++ &batadv_attr_elp_interval, ++ &batadv_attr_throughput_override, +diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h -+index 5e8c8df..913f104 100644 ++index ba846b0..1a596c5 100644 +--- a/net/batman-adv/types.h ++++ b/net/batman-adv/types.h -+@@ -120,6 +120,7 @@ struct batadv_hard_iface { ++@@ -156,6 +156,7 @@ struct batadv_hard_iface { + struct hlist_head neigh_list; + /* neigh_list_lock protects: neigh_list */ + spinlock_t neigh_list_lock; @@ -217,5 +224,5 @@ index 0000000..3324102 + + /** +-- -+2.7.0 ++2.8.3 + diff --git a/patches/packages/routing/0003-batman-adv-decrease-maximum-fragment-size.patch b/patches/packages/routing/0003-batman-adv-decrease-maximum-fragment-size.patch index a53bef28..ede150b3 100644 --- a/patches/packages/routing/0003-batman-adv-decrease-maximum-fragment-size.patch +++ b/patches/packages/routing/0003-batman-adv-decrease-maximum-fragment-size.patch @@ -4,14 +4,14 @@ Subject: batman-adv: decrease maximum fragment size diff --git a/batman-adv/patches/1002-batman-adv-decrease-maximum-fragment-size.patch b/batman-adv/patches/1002-batman-adv-decrease-maximum-fragment-size.patch new file mode 100644 -index 0000000..56311ea +index 0000000..a97146b --- /dev/null +++ b/batman-adv/patches/1002-batman-adv-decrease-maximum-fragment-size.patch @@ -0,0 +1,28 @@ -+From 3de3f885d441f9059a4d4c88504845851667a68c Mon Sep 17 00:00:00 2001 -+Message-Id: <3de3f885d441f9059a4d4c88504845851667a68c.1454958586.git.mschiffer@universe-factory.net> -+In-Reply-To: -+References: ++From 9e7384fde3c5a71f733221a137fdc4593a9638be Mon Sep 17 00:00:00 2001 ++Message-Id: <9e7384fde3c5a71f733221a137fdc4593a9638be.1466048916.git.mschiffer@universe-factory.net> ++In-Reply-To: <8e4c2084bbf2a65ad663a2b1ba27144e5dadfd5f.1466048916.git.mschiffer@universe-factory.net> ++References: <8e4c2084bbf2a65ad663a2b1ba27144e5dadfd5f.1466048916.git.mschiffer@universe-factory.net> +From: Matthias Schiffer +Date: Thu, 6 Aug 2015 22:27:01 +0200 +Subject: [PATCH 2/2] batman-adv: decrease maximum fragment size @@ -21,10 +21,10 @@ index 0000000..56311ea + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h -+index 34f56ef..81a7cc2 100644 ++index 7692526..d314e6c 100644 +--- a/net/batman-adv/main.h ++++ b/net/batman-adv/main.h -+@@ -147,7 +147,7 @@ enum batadv_uev_type { ++@@ -159,7 +159,7 @@ enum batadv_uev_type { + /* Maximum number of fragments for one packet */ + #define BATADV_FRAG_MAX_FRAGMENTS 16 + /* Maxumim size of each fragment */ @@ -34,5 +34,5 @@ index 0000000..56311ea + #define BATADV_FRAG_TIMEOUT 10000 + +-- -+2.7.0 ++2.8.3 + From 6441b85e5b61db8cdb47c6c5f06a4c4a2c436ba8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 17 Jun 2016 11:20:08 +0200 Subject: [PATCH 058/184] Revert "ar71xx: backport fixes for better CPE210/510 support" This reverts commit ffd1f0b3a5b2950d8c626a2de26fb1dc8e384408. --- ...=> 0090-ar71xx-add-GL-AR150-support.patch} | 16 +- ...10-enable-LNA-for-CPE210-220-510-520.patch | 35 ---- ...le-into-2-profiles-cpe210-and-cpe510.patch | 169 ---------------- ...ix-version-detection-for-Make-4.2.1.patch} | 0 ...10-use-second-wifi-calibration-table.patch | 24 --- ...j-for-parallel-builds-with-Make-4.2.patch} | 0 ...oader.c-Add-support-for-Archer-C2600.patch | 188 ------------------ ...ke-fix-parallel-build-with-Make-4.2.patch} | 0 ...IPv6-builtin-if-selected-saves-30KB.patch} | 0 ...der-split-CPE210-from-CPE510-profile.patch | 102 ---------- ...ages-with-multiple-PROVIDES-entries.patch} | 0 ...od-crypto-core-and-kmod-crypto-arc4.patch} | 0 targets/ar71xx-generic/profiles.mk | 13 +- 13 files changed, 14 insertions(+), 533 deletions(-) rename patches/openwrt/{0095-ar71xx-add-GL-AR150-support.patch => 0090-ar71xx-add-GL-AR150-support.patch} (97%) delete mode 100644 patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch delete mode 100644 patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch rename patches/openwrt/{0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch => 0091-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch} (100%) delete mode 100644 patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch rename patches/openwrt/{0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch => 0092-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch} (100%) delete mode 100644 patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch rename patches/openwrt/{0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch => 0093-tools-cmake-fix-parallel-build-with-Make-4.2.patch} (100%) rename patches/openwrt/{0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch => 0094-linux-make-IPv6-builtin-if-selected-saves-30KB.patch} (100%) delete mode 100644 patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch rename patches/openwrt/{0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch => 0095-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch} (100%) rename patches/openwrt/{0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch => 0096-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch} (100%) diff --git a/patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch b/patches/openwrt/0090-ar71xx-add-GL-AR150-support.patch similarity index 97% rename from patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch rename to patches/openwrt/0090-ar71xx-add-GL-AR150-support.patch index ca4b803a..d8787a52 100644 --- a/patches/openwrt/0095-ar71xx-add-GL-AR150-support.patch +++ b/patches/openwrt/0090-ar71xx-add-GL-AR150-support.patch @@ -9,10 +9,10 @@ https://raw.githubusercontent.com/domino-team/OpenWrt-patches/master/AR150%2C%20 (and fixed indentation in target/linux/ar71xx/base-files/lib/ar71xx.sh) diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds -index 129f6b7..e29c1b5 100644 +index ae17853..dc8b8d6 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds -@@ -182,6 +182,10 @@ dlan-pro-1200-ac) +@@ -181,6 +181,10 @@ dlan-pro-1200-ac) ucidef_set_led_trigger_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0" ;; @@ -24,10 +24,10 @@ index 129f6b7..e29c1b5 100644 ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1" ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt" diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network -index 1d0142f..3895394 100755 +index 4066506..89a2184 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network -@@ -382,6 +382,7 @@ dir-505-a1) +@@ -381,6 +381,7 @@ dir-505-a1) alfa-ap96 |\ alfa-nx |\ ap83 |\ @@ -36,10 +36,10 @@ index 1d0142f..3895394 100755 jwap003 |\ pb42 |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh -index 4000b5b..2cb884b 100755 +index fbf76c8..db908f9 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh -@@ -504,6 +504,9 @@ ar71xx_board_detect() { +@@ -500,6 +500,9 @@ ar71xx_board_detect() { name="gl-inet" gl_inet_board_detect ;; @@ -50,7 +50,7 @@ index 4000b5b..2cb884b 100755 name="epg5000" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh -index eded91e..5bd4c2b 100755 +index 4a4c476..aeb4577 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -215,6 +215,7 @@ platform_check_image() { @@ -261,7 +261,7 @@ index 0000000..a6ad661 + +$(eval $(call Profile,GL-AR150)) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile -index 57f38a5..3ce1809 100644 +index 06dbb77..a35ded9 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -144,6 +144,14 @@ define Device/weio diff --git a/patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch b/patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch deleted file mode 100644 index c5c278bc..00000000 --- a/patches/openwrt/0090-ar71xx-cpe510-enable-LNA-for-CPE210-220-510-520.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 9 Jun 2016 04:39:08 +0200 -Subject: ar71xx/cpe510: enable LNA for CPE210/220/510/520 - -The LNA improves the rx path. Within a simple test setup -it improved the signal from -60dbm to -40dbm. - -Signed-off-by: Alexander Couzens - -Backport of LEDE 94e23bf7409d6cc4c9efb55ed32aba8e5a497966 - -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -index 8bf5c0f..5cb052a 100644 ---- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -@@ -30,6 +30,9 @@ - #define CPE510_GPIO_LED_L3 15 - #define CPE510_GPIO_LED_L4 16 - -+#define CPE510_GPIO_EXTERNAL_LNA0 18 -+#define CPE510_GPIO_EXTERNAL_LNA1 19 -+ - #define CPE510_GPIO_BTN_RESET 4 - - #define CPE510_KEYS_POLL_INTERVAL 20 /* msecs */ -@@ -93,6 +96,9 @@ static void __init cpe510_setup(void) - ARRAY_SIZE(cpe510_gpio_keys), - cpe510_gpio_keys); - -+ ath79_wmac_set_ext_lna_gpio(0, CPE510_GPIO_EXTERNAL_LNA0); -+ ath79_wmac_set_ext_lna_gpio(1, CPE510_GPIO_EXTERNAL_LNA1); -+ - ath79_register_m25p80(NULL); - - ath79_register_mdio(1, 0); diff --git a/patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch b/patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch deleted file mode 100644 index 98f4c273..00000000 --- a/patches/openwrt/0091-ar71xx-cpe510-split-profile-into-2-profiles-cpe210-and-cpe510.patch +++ /dev/null @@ -1,169 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 9 Jun 2016 04:55:37 +0200 -Subject: ar71xx/cpe510: split profile into 2 profiles cpe210 and cpe510 - -Split profile into 2GHz and 5GHz. The 5GHz devices are -quite "special". The 2 GHz works perfect. - -Signed-off-by: Alexander Couzens - -Backport of LEDE c5ff273d85f69981e5b126eeaed3dee5b4061fb4 - -diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches -index b41f275..0f7a415 100644 ---- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches -+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_gpio-switches -@@ -15,6 +15,7 @@ nanostation-m) - nanostation-m-xw) - ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "2" - ;; -+cpe210|\ - cpe510) - ucidef_set_gpio_switch "poe_passthrough" "PoE Passthrough" "20" - ;; -diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds -index ae17853..129f6b7 100644 ---- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds -+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds -@@ -78,6 +78,7 @@ carambola2) - ucidef_set_led_wlan "wlan" "WLAN" "carambola2:green:wlan" "phy0tpt" - ;; - -+cpe210|\ - cpe510) - ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20" - ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" -diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network -index 4066506..1d0142f 100755 ---- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network -+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network -@@ -71,6 +71,7 @@ bsb) - ucidef_set_interface_wlan - ;; - -+cpe210|\ - cpe510) - ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" - ucidef_add_switch "switch0" "1" "1" -diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh -index fbf76c8..4000b5b 100755 ---- a/target/linux/ar71xx/base-files/lib/ar71xx.sh -+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh -@@ -438,7 +438,11 @@ ar71xx_board_detect() { - *CAP4200AG) - name="cap4200ag" - ;; -- *"CPE210/220/510/520") -+ *"CPE210/220") -+ name="cpe210" -+ tplink_pharos_board_detect -+ ;; -+ *"CPE510/520") - name="cpe510" - tplink_pharos_board_detect - ;; -diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh -index 4a4c476..eded91e 100755 ---- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh -+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh -@@ -263,6 +263,7 @@ platform_check_image() { - return 0 - ;; - -+ cpe210|\ - cpe510) - tplink_pharos_check_image "$1" && return 0 - return 1 -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -index 5cb052a..74daf43 100644 ---- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -@@ -78,12 +78,8 @@ static struct gpio_keys_button cpe510_gpio_keys[] __initdata = { - } - }; - -- --static void __init cpe510_setup(void) -+static void __init cpe_setup(u8 *mac) - { -- u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); -- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); -- - /* Disable JTAG, enabling GPIOs 0-3 */ - /* Configure OBS4 line, for GPIO 4*/ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, -@@ -105,9 +101,31 @@ static void __init cpe510_setup(void) - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); -+} -+ -+ -+static void __init cpe210_setup(void) -+{ -+ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); -+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); -+ -+ cpe_setup(mac); - - ath79_register_wmac(ee, mac); - } - --MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE210/220/510/520", -+static void __init cpe510_setup(void) -+{ -+ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); -+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); -+ -+ cpe_setup(mac); -+ -+ ath79_register_wmac(ee, mac); -+} -+ -+MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220", -+ cpe210_setup); -+ -+MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520", - cpe510_setup); -diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile -index 06dbb77..272abe0 100644 ---- a/target/linux/ar71xx/image/Makefile -+++ b/target/linux/ar71xx/image/Makefile -@@ -2094,7 +2094,8 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR10 - $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M)) - $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99)) - --$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) -+$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) -+$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) - - $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x)) - $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240)) -@@ -2158,6 +2159,7 @@ $(eval $(call MultiProfile,TLWR842,TLWR842V1)) - $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4)) - $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2 TLWR1043V3)) - $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1)) -+$(eval $(call MultiProfile,CPE510,CPE210_220 CPE510_520)) - $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M)) - $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTROCKETMXW UBNTNANOM UBNTNANOMXW UBNTLOCOXW UBNTUNIFI UBNTUNIFIOUTDOOR UBNTUNIFIOUTDOORPLUS UAPPRO UBNTAIRGW)) - $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R)) -diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch -index dbd3fca..b2f5366 100644 ---- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch -+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch -@@ -1,6 +1,6 @@ - --- a/arch/mips/ath79/machtypes.h - +++ b/arch/mips/ath79/machtypes.h --@@ -16,22 +16,201 @@ -+@@ -16,22 +16,202 @@ - - enum ath79_mach_type { - ATH79_MACH_GENERIC = 0, -@@ -26,6 +26,7 @@ - + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */ - + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */ - + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */ -++ ATH79_MACH_CPE210, /* TP-LINK CPE210 */ - + ATH79_MACH_CPE510, /* TP-LINK CPE510 */ - ATH79_MACH_DB120, /* Atheros DB120 reference board */ - ATH79_MACH_PB44, /* Atheros PB44 reference board */ diff --git a/patches/openwrt/0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch b/patches/openwrt/0091-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch similarity index 100% rename from patches/openwrt/0096-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch rename to patches/openwrt/0091-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch diff --git a/patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch b/patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch deleted file mode 100644 index 7a5cd5d4..00000000 --- a/patches/openwrt/0092-ar71xx-cpe510-use-second-wifi-calibration-table.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 9 Jun 2016 04:57:24 +0200 -Subject: ar71xx/cpe510: use second wifi calibration table - -The cpe510 has two calibration tables. The first calibration -table requires to modify ath9k driver to work (patched tx gain table). - -Signed-off-by: Alexander Couzens - -Backport of LEDE bf27ac019c137e7baf90ca6ef0e40945ae871797 - -diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -index 74daf43..875589d 100644 ---- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c -@@ -117,7 +117,7 @@ static void __init cpe210_setup(void) - static void __init cpe510_setup(void) - { - u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); -- u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); -+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff5000); - - cpe_setup(mac); - diff --git a/patches/openwrt/0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch b/patches/openwrt/0092-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch similarity index 100% rename from patches/openwrt/0097-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch rename to patches/openwrt/0092-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch diff --git a/patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch b/patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch deleted file mode 100644 index 0c33a4d3..00000000 --- a/patches/openwrt/0093-fw-utils-tplink-safeloader.c-Add-support-for-Archer-C2600.patch +++ /dev/null @@ -1,188 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 9 Jun 2016 05:02:18 +0200 -Subject: fw-utils/tplink-safeloader.c: Add support for Archer C2600 - -Signed-off-by: Ash Benz - -Backport of LEDE 955c341d3bec0eb4971a03924e99156367255d7b - -diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c -index 77a894b..2e204aa 100644 ---- a/tools/firmware-utils/src/tplink-safeloader.c -+++ b/tools/firmware-utils/src/tplink-safeloader.c -@@ -105,6 +105,8 @@ static const uint8_t md5_salt[16] = { - /** Vendor information for CPE210/220/510/520 */ - static const char cpe510_vendor[] = "CPE510(TP-LINK|UN|N300-5):1.0\r\n"; - -+/** Vendor information for C2600 */ -+static const char c2600_vendor[] = ""; - - /** - The flash partition table for CPE210/220/510/520; -@@ -128,6 +130,39 @@ static const struct flash_partition_entry cpe510_partitions[] = { - }; - - /** -+ The flash partition table for C2600; -+ it is the same as the one used by the stock images. -+*/ -+static const struct flash_partition_entry c2600_partitions[] = { -+ {"SBL1", 0x00000, 0x20000}, -+ {"MIBIB", 0x20000, 0x20000}, -+ {"SBL2", 0x40000, 0x20000}, -+ {"SBL3", 0x60000, 0x30000}, -+ {"DDRCONFIG", 0x90000, 0x10000}, -+ {"SSD", 0xa0000, 0x10000}, -+ {"TZ", 0xb0000, 0x30000}, -+ {"RPM", 0xe0000, 0x20000}, -+ {"fs-uboot", 0x100000, 0x70000}, -+ {"uboot-env", 0x170000, 0x40000}, -+ {"radio", 0x1b0000, 0x40000}, -+ {"os-image", 0x1f0000, 0x200000}, -+ {"file-system", 0x3f0000, 0x1b00000}, -+ {"default-mac", 0x1ef0000, 0x00200}, -+ {"pin", 0x1ef0200, 0x00200}, -+ {"product-info", 0x1ef0400, 0x0fc00}, -+ {"partition-table", 0x1f00000, 0x10000}, -+ {"soft-version", 0x1f10000, 0x10000}, -+ {"support-list", 0x1f20000, 0x10000}, -+ {"profile", 0x1f30000, 0x10000}, -+ {"default-config", 0x1f40000, 0x10000}, -+ {"user-config", 0x1f50000, 0x40000}, -+ {"qos-db", 0x1f90000, 0x40000}, -+ {"usb-config", 0x1fd0000, 0x10000}, -+ {"log", 0x1fe0000, 0x20000}, -+ {NULL, 0, 0} -+}; -+ -+/** - The support list for CPE210/220/510/520 - */ - static const char cpe510_support_list[] = -@@ -141,6 +176,13 @@ static const char cpe510_support_list[] = - "CPE220(TP-LINK|UN|N300-2):1.0\r\n" - "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; - -+/** -+ The support list for C2600 -+*/ -+static const char c2600_support_list[] = -+ "SupportList:\r\n" -+ "{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\r\n"; -+ - #define error(_ret, _errno, _str, ...) \ - do { \ - fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \ -@@ -240,14 +282,14 @@ static struct image_partition_entry make_soft_version(uint32_t rev) { - } - - /** Generates the support-list partition */ --static struct image_partition_entry make_support_list(const char *support_list) { -+static struct image_partition_entry make_support_list(const char *support_list, bool trailzero) { - size_t len = strlen(support_list); - struct image_partition_entry entry = alloc_image_partition("support-list", len + 9); - - put32(entry.data, len); - memset(entry.data+4, 0, 4); - memcpy(entry.data+8, support_list, len); -- entry.data[len+8] = '\xff'; -+ entry.data[len+8] = trailzero ? '\x00' : '\xff'; - - return entry; - } -@@ -436,6 +478,37 @@ static void * generate_sysupgrade_image(const struct flash_partition_entry *flas - return image; - } - -+static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) { -+ const struct flash_partition_entry *flash_os_image = &flash_parts[11]; -+ const struct flash_partition_entry *flash_file_system = &flash_parts[12]; -+ -+ const struct image_partition_entry *image_os_image = &image_parts[3]; -+ const struct image_partition_entry *image_file_system = &image_parts[4]; -+ -+ assert(strcmp(flash_os_image->name, "os-image") == 0); -+ assert(strcmp(flash_file_system->name, "file-system") == 0); -+ -+ assert(strcmp(image_os_image->name, "os-image") == 0); -+ assert(strcmp(image_file_system->name, "file-system") == 0); -+ -+ if (image_os_image->size > flash_os_image->size) -+ error(1, 0, "kernel image too big (more than %u bytes)", (unsigned)flash_os_image->size); -+ if (image_file_system->size > flash_file_system->size) -+ error(1, 0, "rootfs image too big (more than %u bytes)", (unsigned)flash_file_system->size); -+ -+ *len = flash_file_system->base - flash_os_image->base + image_file_system->size; -+ -+ uint8_t *image = malloc(*len); -+ if (!image) -+ error(1, errno, "malloc"); -+ -+ memset(image, 0xff, *len); -+ -+ memcpy(image, image_os_image->data, image_os_image->size); -+ memcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size); -+ -+ return image; -+} - - /** Generates an image for CPE210/220/510/520 and writes it to a file */ - static void do_cpe510(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) { -@@ -443,7 +516,7 @@ static void do_cpe510(const char *output, const char *kernel_image, const char * - - parts[0] = make_partition_table(cpe510_partitions); - parts[1] = make_soft_version(rev); -- parts[2] = make_support_list(cpe510_support_list); -+ parts[2] = make_support_list(cpe510_support_list,false); - parts[3] = read_file("os-image", kernel_image, false); - parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); - -@@ -470,6 +543,39 @@ static void do_cpe510(const char *output, const char *kernel_image, const char * - free_image_partition(parts[i]); - } - -+/** Generates an image for C2600 and writes it to a file */ -+static void do_c2600(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) { -+ struct image_partition_entry parts[6] = {}; -+ -+ parts[0] = make_partition_table(c2600_partitions); -+ parts[1] = make_soft_version(rev); -+ parts[2] = make_support_list(c2600_support_list,true); -+ parts[3] = read_file("os-image", kernel_image, false); -+ parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); -+ -+ size_t len; -+ void *image; -+ if (sysupgrade) -+ image = generate_sysupgrade_image_c2600(c2600_partitions, parts, &len); -+ else -+ image = generate_factory_image(c2600_vendor, parts, &len); -+ -+ FILE *file = fopen(output, "wb"); -+ if (!file) -+ error(1, errno, "unable to open output file"); -+ -+ if (fwrite(image, len, 1, file) != 1) -+ error(1, 0, "unable to write output file"); -+ -+ fclose(file); -+ -+ free(image); -+ -+ size_t i; -+ for (i = 0; parts[i].name; i++) -+ free_image_partition(parts[i]); -+} -+ - - /** Usage output */ - static void usage(const char *argv0) { -@@ -552,6 +658,8 @@ int main(int argc, char *argv[]) { - - if (strcmp(board, "CPE510") == 0) - do_cpe510(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); -+ else if (strcmp(board, "C2600") == 0) -+ do_c2600(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); - else - error(1, 0, "unsupported board %s", board); - diff --git a/patches/openwrt/0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch b/patches/openwrt/0093-tools-cmake-fix-parallel-build-with-Make-4.2.patch similarity index 100% rename from patches/openwrt/0098-tools-cmake-fix-parallel-build-with-Make-4.2.patch rename to patches/openwrt/0093-tools-cmake-fix-parallel-build-with-Make-4.2.patch diff --git a/patches/openwrt/0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch b/patches/openwrt/0094-linux-make-IPv6-builtin-if-selected-saves-30KB.patch similarity index 100% rename from patches/openwrt/0099-linux-make-IPv6-builtin-if-selected-saves-30KB.patch rename to patches/openwrt/0094-linux-make-IPv6-builtin-if-selected-saves-30KB.patch diff --git a/patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch b/patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch deleted file mode 100644 index a6c13128..00000000 --- a/patches/openwrt/0094-tools-tplink-safeloader-split-CPE210-from-CPE510-profile.patch +++ /dev/null @@ -1,102 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 9 Jun 2016 05:03:35 +0200 -Subject: tools/tplink-safeloader: split CPE210 from CPE510 profile - -The CPE210 was still described for the OEM upgrade as compatible, -even the wireless configuration isn't compatible anymore between -both series (2ghz and 5ghz). -Update the CPE210 image profile to use the new profile. - -Signed-off-by: Alexander Couzens - -Backport of LEDE 824147960569f2c1cd22140c9074c62c3df911a5 - -diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile -index 272abe0..57f38a5 100644 ---- a/target/linux/ar71xx/image/Makefile -+++ b/target/linux/ar71xx/image/Makefile -@@ -2094,7 +2094,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR10 - $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V3,tl-wr1043nd-v3,TL-WR1043ND-v2,ttyS0,115200,0x10430003,1,8M)) - $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99)) - --$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) -+$(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE210_220,cpe210-220,CPE210,ttyS0,115200,$$(cpe510_mtdlayout),CPE210)) - $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510_520,cpe510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510)) - - $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x)) -diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c -index 2e204aa..4938f74 100644 ---- a/tools/firmware-utils/src/tplink-safeloader.c -+++ b/tools/firmware-utils/src/tplink-safeloader.c -@@ -163,6 +163,15 @@ static const struct flash_partition_entry c2600_partitions[] = { - }; - - /** -+ The support list for CPE210/220 -+*/ -+static const char cpe210_support_list[] = -+ "SupportList:\r\n" -+ "CPE210(TP-LINK|UN|N300-2):1.0\r\n" -+ "CPE210(TP-LINK|UN|N300-2):1.1\r\n" -+ "CPE220(TP-LINK|UN|N300-2):1.0\r\n" -+ "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; -+/** - The support list for CPE210/220/510/520 - */ - static const char cpe510_support_list[] = -@@ -170,11 +179,7 @@ static const char cpe510_support_list[] = - "CPE510(TP-LINK|UN|N300-5):1.0\r\n" - "CPE510(TP-LINK|UN|N300-5):1.1\r\n" - "CPE520(TP-LINK|UN|N300-5):1.0\r\n" -- "CPE520(TP-LINK|UN|N300-5):1.1\r\n" -- "CPE210(TP-LINK|UN|N300-2):1.0\r\n" -- "CPE210(TP-LINK|UN|N300-2):1.1\r\n" -- "CPE220(TP-LINK|UN|N300-2):1.0\r\n" -- "CPE220(TP-LINK|UN|N300-2):1.1\r\n"; -+ "CPE520(TP-LINK|UN|N300-5):1.1\r\n"; - - /** - The support list for C2600 -@@ -511,12 +516,18 @@ static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry - } - - /** Generates an image for CPE210/220/510/520 and writes it to a file */ --static void do_cpe510(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) { -+static void do_cpe(const char *output, -+ const char *kernel_image, -+ const char *rootfs_image, -+ uint32_t rev, -+ bool add_jffs2_eof, -+ bool sysupgrade, -+ const char *support_list) { - struct image_partition_entry parts[6] = {}; - - parts[0] = make_partition_table(cpe510_partitions); - parts[1] = make_soft_version(rev); -- parts[2] = make_support_list(cpe510_support_list,false); -+ parts[2] = make_support_list(support_list, false); - parts[3] = read_file("os-image", kernel_image, false); - parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); - -@@ -549,7 +560,7 @@ static void do_c2600(const char *output, const char *kernel_image, const char *r - - parts[0] = make_partition_table(c2600_partitions); - parts[1] = make_soft_version(rev); -- parts[2] = make_support_list(c2600_support_list,true); -+ parts[2] = make_support_list(c2600_support_list, true); - parts[3] = read_file("os-image", kernel_image, false); - parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof); - -@@ -656,8 +667,10 @@ int main(int argc, char *argv[]) { - if (!output) - error(1, 0, "no output filename has been specified"); - -- if (strcmp(board, "CPE510") == 0) -- do_cpe510(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); -+ if (strcmp(board, "CPE210") == 0) -+ do_cpe(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, cpe210_support_list); -+ else if (strcmp(board, "CPE510") == 0) -+ do_cpe(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade, cpe510_support_list); - else if (strcmp(board, "C2600") == 0) - do_c2600(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade); - else diff --git a/patches/openwrt/0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch b/patches/openwrt/0095-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch similarity index 100% rename from patches/openwrt/0100-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch rename to patches/openwrt/0095-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch diff --git a/patches/openwrt/0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch b/patches/openwrt/0096-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch similarity index 100% rename from patches/openwrt/0101-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch rename to patches/openwrt/0096-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 3b8f4362..73299dfe 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -4,15 +4,14 @@ # CPE210/220/510/520 $(eval $(call GluonProfile,CPE510,rssileds)) +$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe510-v1.0)) -$(eval $(call GluonModel,CPE510,cpe210-220,tp-link-cpe210-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe210-v1.0,tp-link-cpe210-v1.1)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe210-v1.0,tp-link-cpe220-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe210-v1.0,tp-link-cpe220-v1.1)) - -$(eval $(call GluonModel,CPE510,cpe510-520,tp-link-cpe510-v1.0)) -$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe510-v1.1)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe210-v1.0)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe220-v1.0)) $(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.0)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe210-v1.1)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe220-v1.1)) +$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe510-v1.1)) $(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.1)) # TL-WA701N/ND v1, v2 From 93e3cad4bde271b9845ad40aa0a56d8c81823377 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 17 Jun 2016 13:15:25 +0200 Subject: [PATCH 059/184] docs: Fix list alignment of OpenMesh devices Signed-off-by: Sven Eckelmann --- docs/index.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index cd421411..33745ad6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -134,15 +134,15 @@ ar71xx-generic * OpenMesh - - MR1750 - - MR600 (v1, v2) - - MR900 (v1, v2) - - OM2P (v1, v2) - - OM2P-HS (v1, v2) - - OM2P-LC - - OM5P - - OM5P-AC (v1, v2) - - OM5P-AN + - MR1750 + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2) + - OM2P-LC + - OM5P + - OM5P-AC (v1, v2) + - OM5P-AN * TP-Link From ef932b182569188224ed81fcf1557c15844eeac3 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 17 Jun 2016 15:34:28 +0200 Subject: [PATCH 060/184] ar71xx-generic: Add support for OpenMesh OM2P-HSv3 The new OM2P-HSv3 device support is only available in LEDE master. The relevant patches have to backported to add support for them in Gluon Signed-off-by: Sven Eckelmann --- docs/index.rst | 2 +- .../files/lib/gluon/upgrade/010-primary-mac | 2 +- ...l-support-for-the-OpenMesh-OM2P-HSv3.patch | 33 +++++++++++++ ...e-support-for-the-OpenMesh-OM2P-HSv3.patch | 46 +++++++++++++++++++ ...ysupgrade-for-the-OpenMesh-OM2P-HSv3.patch | 40 ++++++++++++++++ ...chdog-add-OpenMesh-OM2P-HSv3-support.patch | 21 +++++++++ ...tools-add-OpenMesh-OM2P-HSv3-support.patch | 20 ++++++++ ...xx-add-OM2P-HSv3-to-the-OM2P-profile.patch | 27 +++++++++++ targets/ar71xx-generic/profiles.mk | 1 + 9 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 patches/openwrt/0097-ar71xx-add-kernel-support-for-the-OpenMesh-OM2P-HSv3.patch create mode 100644 patches/openwrt/0098-ar71xx-add-user-space-support-for-the-OpenMesh-OM2P-HSv3.patch create mode 100644 patches/openwrt/0099-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM2P-HSv3.patch create mode 100644 patches/openwrt/0100-package-om-watchdog-add-OpenMesh-OM2P-HSv3-support.patch create mode 100644 patches/openwrt/0101-package-uboot-envtools-add-OpenMesh-OM2P-HSv3-support.patch create mode 100644 patches/openwrt/0102-ar71xx-add-OM2P-HSv3-to-the-OM2P-profile.patch diff --git a/docs/index.rst b/docs/index.rst index 33745ad6..2fddc3e2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -138,7 +138,7 @@ ar71xx-generic - MR600 (v1, v2) - MR900 (v1, v2) - OM2P (v1, v2) - - OM2P-HS (v1, v2) + - OM2P-HS (v1, v2, v3) - OM2P-LC - OM5P - OM5P-AC (v1, v2) diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac index 144ee700..849b7a34 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac @@ -29,7 +29,7 @@ elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2', 'mr900', 'mr900v2', 'mr1750', 'om2p', 'om2pv2', - 'om2p-hs', 'om2p-hsv2', + 'om2p-hs', 'om2p-hsv2', 'om2p-hsv3', 'om2p-lc', 'om5p', 'om5p-an', 'om5p-ac', 'om5p-acv2'}) then diff --git a/patches/openwrt/0097-ar71xx-add-kernel-support-for-the-OpenMesh-OM2P-HSv3.patch b/patches/openwrt/0097-ar71xx-add-kernel-support-for-the-OpenMesh-OM2P-HSv3.patch new file mode 100644 index 00000000..1bfdc8e3 --- /dev/null +++ b/patches/openwrt/0097-ar71xx-add-kernel-support-for-the-OpenMesh-OM2P-HSv3.patch @@ -0,0 +1,33 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:48 +0200 +Subject: ar71xx: add kernel support for the OpenMesh OM2P-HSv3 + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637052/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-om2p.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om2p.c +index 6b0bdc3..3b282a3 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-om2p.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-om2p.c +@@ -223,3 +223,4 @@ static void __init om2p_hs_setup(void) + + MIPS_MACHINE(ATH79_MACH_OM2P_HS, "OM2P-HS", "OpenMesh OM2P HS", om2p_hs_setup); + MIPS_MACHINE(ATH79_MACH_OM2P_HSv2, "OM2P-HSv2", "OpenMesh OM2P HSv2", om2p_hs_setup); ++MIPS_MACHINE(ATH79_MACH_OM2P_HSv3, "OM2P-HSv3", "OpenMesh OM2P HSv3", om2p_hs_setup); +diff --git a/target/linux/ar71xx/patches-3.18/817-MIPS-ath79-add-om2phsv3-support.patch b/target/linux/ar71xx/patches-3.18/817-MIPS-ath79-add-om2phsv3-support.patch +new file mode 100644 +index 0000000..7305b2e +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/817-MIPS-ath79-add-om2phsv3-support.patch +@@ -0,0 +1,10 @@ ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -88,6 +88,7 @@ enum ath79_mach_type { ++ ATH79_MACH_NBG460N, /* Zyxel NBG460N/550N/550NH */ ++ ATH79_MACH_NBG6716, /* Zyxel NBG6716 */ ++ ATH79_MACH_OM2P_HSv2, /* OpenMesh OM2P-HSv2 */ +++ ATH79_MACH_OM2P_HSv3, /* OpenMesh OM2P-HSv3 */ ++ ATH79_MACH_OM2P_HS, /* OpenMesh OM2P-HS */ ++ ATH79_MACH_OM2P_LC, /* OpenMesh OM2P-LC */ ++ ATH79_MACH_OM2Pv2, /* OpenMesh OM2Pv2 */ diff --git a/patches/openwrt/0098-ar71xx-add-user-space-support-for-the-OpenMesh-OM2P-HSv3.patch b/patches/openwrt/0098-ar71xx-add-user-space-support-for-the-OpenMesh-OM2P-HSv3.patch new file mode 100644 index 00000000..ab3273a2 --- /dev/null +++ b/patches/openwrt/0098-ar71xx-add-user-space-support-for-the-OpenMesh-OM2P-HSv3.patch @@ -0,0 +1,46 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:49 +0200 +Subject: ar71xx: add user-space support for the OpenMesh OM2P-HSv3 + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637053/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index d4d8b4e..aa02212 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -171,6 +171,7 @@ get_status_led() { + om2pv2 | \ + om2p-hs | \ + om2p-hsv2 | \ ++ om2p-hsv3 | \ + om2p-lc) + status_led="om2p:blue:power" + ;; +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index dc8b8d6..5767f48 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -297,6 +297,7 @@ om2p | \ + om2pv2 | \ + om2p-hs | \ + om2p-hsv2 | \ ++om2p-hsv3 | \ + om2p-lc) + ucidef_set_led_netdev "port1" "port1" "om2p:blue:wan" "eth0" + ucidef_set_led_netdev "port2" "port2" "om2p:blue:lan" "eth1" +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index db908f9..dc51b03 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -610,6 +610,9 @@ ar71xx_board_detect() { + *"OM2P HSv2") + name="om2p-hsv2" + ;; ++ *"OM2P HSv3") ++ name="om2p-hsv3" ++ ;; + *"OM2P LC") + name="om2p-lc" + ;; diff --git a/patches/openwrt/0099-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM2P-HSv3.patch b/patches/openwrt/0099-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM2P-HSv3.patch new file mode 100644 index 00000000..ad60c151 --- /dev/null +++ b/patches/openwrt/0099-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM2P-HSv3.patch @@ -0,0 +1,40 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:50 +0200 +Subject: ar71xx: enable sysupgrade for the OpenMesh OM2P-HSv3 + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637054/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 209cdaa..0e8ea27 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -63,6 +63,7 @@ platform_check_image_openmesh() + [ "$board" = "om2p-lc" ] && break + [ "$board" = "om2p-hs" ] && break + [ "$board" = "om2p-hsv2" ] && break ++ [ "$board" = "om2p-hsv3" ] && break + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index aeb4577..9b26e73 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -306,6 +306,7 @@ platform_check_image() { + om2pv2 | \ + om2p-hs | \ + om2p-hsv2 | \ ++ om2p-hsv3 | \ + om2p-lc | \ + om5p | \ + om5p-an | \ +@@ -541,6 +542,7 @@ platform_do_upgrade() { + om2pv2 | \ + om2p-hs | \ + om2p-hsv2 | \ ++ om2p-hsv3 | \ + om2p-lc | \ + om5p | \ + om5p-an | \ diff --git a/patches/openwrt/0100-package-om-watchdog-add-OpenMesh-OM2P-HSv3-support.patch b/patches/openwrt/0100-package-om-watchdog-add-OpenMesh-OM2P-HSv3-support.patch new file mode 100644 index 00000000..95433670 --- /dev/null +++ b/patches/openwrt/0100-package-om-watchdog-add-OpenMesh-OM2P-HSv3-support.patch @@ -0,0 +1,21 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:51 +0200 +Subject: package/om-watchdog: add OpenMesh OM2P-HSv3 support + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637055/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index 6b96966..bf8a124 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -13,7 +13,7 @@ boot() { + local board=$(ar71xx_board_name) + + case "$board" in +- "om2p"|"om2p-hs"|"om2p-hsv2"|"om5p-acv2") ++ "om2p"|"om2p-hs"|"om2p-hsv2"|"om2p-hsv3"|"om5p-acv2") + service_start /sbin/om-watchdog 12 + ;; + "om2pv2"|"om2p-lc") diff --git a/patches/openwrt/0101-package-uboot-envtools-add-OpenMesh-OM2P-HSv3-support.patch b/patches/openwrt/0101-package-uboot-envtools-add-OpenMesh-OM2P-HSv3-support.patch new file mode 100644 index 00000000..1fee2332 --- /dev/null +++ b/patches/openwrt/0101-package-uboot-envtools-add-OpenMesh-OM2P-HSv3-support.patch @@ -0,0 +1,20 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:52 +0200 +Subject: package/uboot-envtools: add OpenMesh OM2P-HSv3 support + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637056/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index 9071c11..81c6481 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -41,6 +41,7 @@ om2p | \ + om2pv2 | \ + om2p-hs | \ + om2p-hsv2 | \ ++om2p-hsv3 | \ + om2p-lc) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x40000" + ;; diff --git a/patches/openwrt/0102-ar71xx-add-OM2P-HSv3-to-the-OM2P-profile.patch b/patches/openwrt/0102-ar71xx-add-OM2P-HSv3-to-the-OM2P-profile.patch new file mode 100644 index 00000000..0ad77fc4 --- /dev/null +++ b/patches/openwrt/0102-ar71xx-add-OM2P-HSv3-to-the-OM2P-profile.patch @@ -0,0 +1,27 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:53 +0200 +Subject: ar71xx: add OM2P-HSv3 to the OM2P profile + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637057/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index c0919ed..ddd3f8d 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -6,12 +6,12 @@ + # + + define Profile/OM2P +- NAME:=OpenMesh OM2P/OM2Pv2/OM2P-HS/OM2P-HSv2/OM2P-LC ++ NAME:=OpenMesh OM2P/OM2Pv2/OM2P-HS/OM2P-HSv2/OM2P-HSv3/OM2P-LC + PACKAGES:=kmod-ath9k om-watchdog + endef + + define Profile/OM2P/Description +- Package set optimized for the OpenMesh OM2P/OM2Pv2/OM2P-HS/OM2P-HSv2/OM2P-LC. ++ Package set optimized for the OpenMesh OM2P/OM2Pv2/OM2P-HS/OM2P-HSv2/OM2P-HSv3/OM2P-LC. + endef + + $(eval $(call Profile,OM2P)) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 73299dfe..18129fb6 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -334,6 +334,7 @@ $(eval $(call GluonModel,OM2P,om2p,openmesh-om2p)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2pv2)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hs)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hsv2)) +$(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-hsv3)) $(eval $(call GluonModelAlias,OM2P,openmesh-om2p,openmesh-om2p-lc)) # OM5P From 2b46abac1c12160562b3887f43e3be3914839273 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 17 Jun 2016 15:35:49 +0200 Subject: [PATCH 061/184] ar71xx-generic: Add support for OpenMesh MR1750v2 The new MR1750v2 device support is only available in LEDE master. The relevant patches have to backported to add support for them in Gluon Signed-off-by: Sven Eckelmann --- docs/index.rst | 2 +- .../files/lib/gluon/upgrade/010-primary-mac | 2 +- ...el-support-for-the-OpenMesh-MR1750v2.patch | 33 ++++++++++ ...ce-support-for-the-OpenMesh-MR1750v2.patch | 62 +++++++++++++++++++ ...sysupgrade-for-the-OpenMesh-MR1750v2.patch | 40 ++++++++++++ ...tchdog-add-OpenMesh-MR1750v2-support.patch | 21 +++++++ ...vtools-add-OpenMesh-MR1750v2-support.patch | 20 ++++++ ....bin-for-the-OpenMesh-MR1750v2-board.patch | 20 ++++++ ...x-add-MR1750v2-to-the-MR1750-profile.patch | 27 ++++++++ targets/ar71xx-generic/profiles.mk | 1 + 10 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 patches/openwrt/0103-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750v2.patch create mode 100644 patches/openwrt/0104-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750v2.patch create mode 100644 patches/openwrt/0105-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750v2.patch create mode 100644 patches/openwrt/0106-package-om-watchdog-add-OpenMesh-MR1750v2-support.patch create mode 100644 patches/openwrt/0107-package-uboot-envtools-add-OpenMesh-MR1750v2-support.patch create mode 100644 patches/openwrt/0108-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-MR1750v2-board.patch create mode 100644 patches/openwrt/0109-ar71xx-add-MR1750v2-to-the-MR1750-profile.patch diff --git a/docs/index.rst b/docs/index.rst index 2fddc3e2..a487319b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -134,7 +134,7 @@ ar71xx-generic * OpenMesh - - MR1750 + - MR1750 (v1, v2) - MR600 (v1, v2) - MR900 (v1, v2) - OM2P (v1, v2) diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac index 849b7a34..75d60d16 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac @@ -27,7 +27,7 @@ if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2', 'mr600', 'mr600v2', 'mr900', 'mr900v2', - 'mr1750', + 'mr1750', 'mr1750v2', 'om2p', 'om2pv2', 'om2p-hs', 'om2p-hsv2', 'om2p-hsv3', 'om2p-lc', diff --git a/patches/openwrt/0103-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750v2.patch b/patches/openwrt/0103-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750v2.patch new file mode 100644 index 00000000..1122b7b9 --- /dev/null +++ b/patches/openwrt/0103-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750v2.patch @@ -0,0 +1,33 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:54 +0200 +Subject: ar71xx: add kernel support for the OpenMesh MR1750v2 + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637058/ + +diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +index e3c04e7..18101ce 100644 +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c +@@ -168,3 +168,4 @@ static void __init mr1750_setup(void) + } + + MIPS_MACHINE(ATH79_MACH_MR1750, "MR1750", "OpenMesh MR1750", mr1750_setup); ++MIPS_MACHINE(ATH79_MACH_MR1750V2, "MR1750v2", "OpenMesh MR1750v2", mr1750_setup); +diff --git a/target/linux/ar71xx/patches-3.18/818-MIPS-ath79-add-mr1750v2-support.patch b/target/linux/ar71xx/patches-3.18/818-MIPS-ath79-add-mr1750v2-support.patch +new file mode 100644 +index 0000000..de732ec +--- /dev/null ++++ b/target/linux/ar71xx/patches-3.18/818-MIPS-ath79-add-mr1750v2-support.patch +@@ -0,0 +1,10 @@ ++--- a/arch/mips/ath79/machtypes.h +++++ b/arch/mips/ath79/machtypes.h ++@@ -76,6 +76,7 @@ enum ath79_mach_type { ++ ATH79_MACH_MR12, /* Cisco Meraki MR12 */ ++ ATH79_MACH_MR16, /* Cisco Meraki MR16 */ ++ ATH79_MACH_MR1750, /* OpenMesh MR1750 */ +++ ATH79_MACH_MR1750V2, /* OpenMesh MR1750v2 */ ++ ATH79_MACH_MR600V2, /* OpenMesh MR600v2 */ ++ ATH79_MACH_MR600, /* OpenMesh MR600 */ ++ ATH79_MACH_MR900, /* OpenMesh MR900 */ diff --git a/patches/openwrt/0104-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750v2.patch b/patches/openwrt/0104-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750v2.patch new file mode 100644 index 00000000..3c99224d --- /dev/null +++ b/patches/openwrt/0104-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750v2.patch @@ -0,0 +1,62 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:55 +0200 +Subject: ar71xx: add user-space support for the OpenMesh MR1750v2 + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637059/ + +diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh +index aa02212..f182d60 100644 +--- a/target/linux/ar71xx/base-files/etc/diag.sh ++++ b/target/linux/ar71xx/base-files/etc/diag.sh +@@ -143,7 +143,8 @@ get_status_led() { + mr600v2) + status_led="mr600:blue:power" + ;; +- mr1750) ++ mr1750 | \ ++ mr1750v2) + status_led="mr1750:blue:power" + ;; + mr900 | \ +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +index 5767f48..032acc9 100644 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +@@ -243,7 +243,8 @@ mr600) + ucidef_set_led_wlan "wlan58" "WLAN58" "mr600:green:wlan58" "phy0tpt" + ;; + +-mr1750) ++mr1750 | \ ++mr1750v2) + ucidef_set_led_netdev "lan" "LAN" "mr1750:blue:wan" "eth0" + ucidef_set_led_wlan "wlan58" "WLAN58" "mr1750:blue:wlan58" "phy0tpt" + ucidef_set_led_wlan "wlan24" "WLAN24" "mr1750:blue:wlan24" "phy1tpt" +diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +index 89a2184..b8ae576 100755 +--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network ++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +@@ -335,6 +335,7 @@ eap7660d |\ + el-mini |\ + loco-m-xw |\ + mr1750 |\ ++mr1750v2 |\ + mr600 |\ + mr600v2 |\ + mr900 |\ +diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh +index dc51b03..5119b36 100755 +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -568,6 +568,9 @@ ar71xx_board_detect() { + *MR1750) + name="mr1750" + ;; ++ *MR1750v2) ++ name="mr1750v2" ++ ;; + *MR600) + name="mr600" + ;; diff --git a/patches/openwrt/0105-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750v2.patch b/patches/openwrt/0105-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750v2.patch new file mode 100644 index 00000000..51ba8566 --- /dev/null +++ b/patches/openwrt/0105-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750v2.patch @@ -0,0 +1,40 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:56 +0200 +Subject: ar71xx: enable sysupgrade for the OpenMesh MR1750v2 + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637060/ + +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +index 0e8ea27..95d39bf 100644 +--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh +@@ -81,6 +81,7 @@ platform_check_image_openmesh() + ;; + MR1750) + [ "$board" = "mr1750" ] && break ++ [ "$board" = "mr1750v2" ] && break + echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform" + return 1 + ;; +diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +index 9b26e73..f33419f 100755 +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -298,6 +298,7 @@ platform_check_image() { + return 0; + ;; + mr1750 | \ ++ mr1750v2 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ +@@ -534,6 +535,7 @@ platform_do_upgrade() { + platform_do_upgrade_dir825b "$ARGV" + ;; + mr1750 | \ ++ mr1750v2 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ diff --git a/patches/openwrt/0106-package-om-watchdog-add-OpenMesh-MR1750v2-support.patch b/patches/openwrt/0106-package-om-watchdog-add-OpenMesh-MR1750v2-support.patch new file mode 100644 index 00000000..c5ee90df --- /dev/null +++ b/patches/openwrt/0106-package-om-watchdog-add-OpenMesh-MR1750v2-support.patch @@ -0,0 +1,21 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:57 +0200 +Subject: package/om-watchdog: add OpenMesh MR1750v2 support + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637062/ + +diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init +index bf8a124..8a1b66e 100644 +--- a/package/kernel/om-watchdog/files/om-watchdog.init ++++ b/package/kernel/om-watchdog/files/om-watchdog.init +@@ -28,7 +28,7 @@ boot() { + "mr600v2") + service_start /sbin/om-watchdog 15 + ;; +- "mr900"|"mr900v2"|"mr1750") ++ "mr900"|"mr900v2"|"mr1750"|"mr1750v2") + service_start /sbin/om-watchdog 16 + ;; + esac diff --git a/patches/openwrt/0107-package-uboot-envtools-add-OpenMesh-MR1750v2-support.patch b/patches/openwrt/0107-package-uboot-envtools-add-OpenMesh-MR1750v2-support.patch new file mode 100644 index 00000000..5b51bfda --- /dev/null +++ b/patches/openwrt/0107-package-uboot-envtools-add-OpenMesh-MR1750v2-support.patch @@ -0,0 +1,20 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:58 +0200 +Subject: package/uboot-envtools: add OpenMesh MR1750v2 support + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637064/ + +diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx +index 81c6481..459e73d 100644 +--- a/package/boot/uboot-envtools/files/ar71xx ++++ b/package/boot/uboot-envtools/files/ar71xx +@@ -22,6 +22,7 @@ eap300v2 | \ + hornet-ub | \ + hornet-ub-x2 | \ + mr1750 | \ ++mr1750v2 | \ + mr600 | \ + mr600v2 | \ + mr900 | \ diff --git a/patches/openwrt/0108-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-MR1750v2-board.patch b/patches/openwrt/0108-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-MR1750v2-board.patch new file mode 100644 index 00000000..ad8aaca9 --- /dev/null +++ b/patches/openwrt/0108-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-MR1750v2-board.patch @@ -0,0 +1,20 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:03:59 +0200 +Subject: ar71xx: extract ath10k wifi board.bin for the OpenMesh MR1750v2 board + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637063/ + +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 d925a85..0e93feb 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 +@@ -72,6 +72,7 @@ case "$FIRMWARE" in + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) + ;; + mr1750 | \ ++ mr1750v2 | \ + om5p-acv2) + ath10kcal_extract "ART" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) diff --git a/patches/openwrt/0109-ar71xx-add-MR1750v2-to-the-MR1750-profile.patch b/patches/openwrt/0109-ar71xx-add-MR1750v2-to-the-MR1750-profile.patch new file mode 100644 index 00000000..dfcb7b43 --- /dev/null +++ b/patches/openwrt/0109-ar71xx-add-MR1750v2-to-the-MR1750-profile.patch @@ -0,0 +1,27 @@ +From: Sven Eckelmann +Date: Fri, 20 May 2016 18:04:00 +0200 +Subject: ar71xx: add MR1750v2 to the MR1750 profile + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.ozlabs.org/patch/637065/ + +diff --git a/target/linux/ar71xx/generic/profiles/openmesh.mk b/target/linux/ar71xx/generic/profiles/openmesh.mk +index ddd3f8d..e245e6c 100644 +--- a/target/linux/ar71xx/generic/profiles/openmesh.mk ++++ b/target/linux/ar71xx/generic/profiles/openmesh.mk +@@ -61,12 +61,12 @@ endef + $(eval $(call Profile,MR900)) + + define Profile/MR1750 +- NAME:=OpenMesh MR1750 ++ NAME:=OpenMesh MR1750/MR1750v2 + PACKAGES:=kmod-ath9k kmod-ath10k ath10k-firmware-qca988x + endef + + define Profile/MR1750/Description +- Package set optimized for the OpenMesh MR1750. ++ Package set optimized for the OpenMesh MR1750/MR1750v2. + endef + + $(eval $(call Profile,MR1750)) diff --git a/targets/ar71xx-generic/profiles.mk b/targets/ar71xx-generic/profiles.mk index 18129fb6..6736f05c 100644 --- a/targets/ar71xx-generic/profiles.mk +++ b/targets/ar71xx-generic/profiles.mk @@ -317,6 +317,7 @@ $(eval $(call GluonModel,OMEGA,onion-omega,onion-omega)) # MR1750 $(eval $(call GluonProfile,MR1750,om-watchdog uboot-envtools kmod-ath10k ath10k-firmware-qca988x-ct)) $(eval $(call GluonModel,MR1750,mr1750,openmesh-mr1750)) +$(eval $(call GluonModelAlias,MR1750,openmesh-mr1750,openmesh-mr1750v2)) # MR600 $(eval $(call GluonProfile,MR600,om-watchdog uboot-envtools)) From f51667c76f1d6371286bf5d96bc914c12184bd05 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 21 Jun 2016 12:26:46 +0200 Subject: [PATCH 062/184] batman-adv: Fix speedy join in gateway client mode Speedy join only works when the received packet is either broadcast or an 4addr unicast packet. Thus packets converted from broadcast to unicast via the gateway handling code have to be converted to 4addr packets to allow the receiving gateway server to add the sender address as temporary entry to the translation table. Not doing it will make the batman-adv gateway server drop the DHCP response in many situations because it doesn't yet have the TT entry for the destination of the DHCP response. Signed-off-by: Sven Eckelmann --- ...x-speedy-join-in-gateway-client-mode.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 patches/packages/routing/0004-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch diff --git a/patches/packages/routing/0004-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch b/patches/packages/routing/0004-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch new file mode 100644 index 00000000..0ce45b9e --- /dev/null +++ b/patches/packages/routing/0004-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch @@ -0,0 +1,57 @@ +From: Sven Eckelmann +Date: Fri, 17 Jun 2016 15:54:03 +0200 +Subject: batman-adv: Fix speedy join in gateway client mode + +Speedy join only works when the received packet is either broadcast or an +4addr unicast packet. Thus packets converted from broadcast to unicast via +the gateway handling code have to be converted to 4addr packets to allow +the receiving gateway server to add the sender address as temporary entry +to the translation table. + +Not doing it will make the batman-adv gateway server drop the DHCP response +in many situations because it doesn't yet have the TT entry for the +destination of the DHCP response. + +Signed-off-by: Sven Eckelmann + +diff --git a/batman-adv/patches/0001-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch b/batman-adv/patches/0001-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch +new file mode 100644 +index 0000000..e63b782 +--- /dev/null ++++ b/batman-adv/patches/0001-batman-adv-Fix-speedy-join-in-gateway-client-mode.patch +@@ -0,0 +1,35 @@ ++From: Sven Eckelmann ++Date: Sun, 12 Jun 2016 10:43:19 +0200 ++Subject: [PATCH] batman-adv: Fix speedy join in gateway client mode ++ ++Speedy join only works when the received packet is either broadcast or an ++4addr unicast packet. Thus packets converted from broadcast to unicast via ++the gateway handling code have to be converted to 4addr packets to allow ++the receiving gateway server to add the sender address as temporary entry ++to the translation table. ++ ++Not doing it will make the batman-adv gateway server drop the DHCP response ++in many situations because it doesn't yet have the TT entry for the ++destination of the DHCP response. ++ ++Fixes: 9cbc67d9da47 ("batman-adv: change interface_rx to get orig node") ++Signed-off-by: Sven Eckelmann ++--- ++ net/batman-adv/send.c | 4 ++-- ++ 1 file changed, 2 insertions(+), 2 deletions(-) ++ ++diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c ++index f2f1256..0103976 100644 ++--- a/net/batman-adv/send.c +++++ b/net/batman-adv/send.c ++@@ -424,8 +424,8 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, ++ struct batadv_orig_node *orig_node; ++ ++ orig_node = batadv_gw_get_selected_orig(bat_priv); ++- return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0, ++- orig_node, vid); +++ return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST_4ADDR, +++ BATADV_P_DATA, orig_node, vid); ++ } ++ ++ void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface) From 95a05d5dd76ff229c3cf1cca80b44fd9fad951a5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jun 2016 23:11:20 +0200 Subject: [PATCH 063/184] Update Gluon packages --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 7cefc617..b5a96e92 100644 --- a/modules +++ b/modules @@ -8,7 +8,7 @@ PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git -PACKAGES_GLUON_COMMIT=37c7cebf10d79f83151bb41cf6014a1d379ed3fe +PACKAGES_GLUON_COMMIT=0e391753d32be91bb457a0f75c7ced0670e97aea PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_COMMIT=85e771d2f1ca1981983238073ffc602981acbb40 From 5bfb8e4ef6a7252a4e2955cb221128072425dadf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 23 Jun 2016 00:06:18 +0200 Subject: [PATCH 064/184] gluon-core: make gluon.platform.match() match all boards when no boards are given --- package/gluon-core/files/usr/lib/lua/gluon/platform.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-core/files/usr/lib/lua/gluon/platform.lua b/package/gluon-core/files/usr/lib/lua/gluon/platform.lua index 3d56f081..6483ad2e 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/platform.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/platform.lua @@ -21,7 +21,7 @@ function match(target, subtarget, boards) return false end - if not util.contains(boards, get_board_name()) then + if boards and not util.contains(boards, get_board_name()) then return false end From a889185d90315a0af5b9b4e268f80f30cbc4bdaa Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 23 Jun 2016 00:24:00 +0200 Subject: [PATCH 065/184] build: allow profiles to supply an additional file to be copied to the image directory --- Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Makefile b/Makefile index 90ea36f3..5c02c752 100644 --- a/Makefile +++ b/Makefile @@ -152,17 +152,21 @@ GLUON_$(1)_FACTORY_SUFFIX := -squashfs-factory GLUON_$(1)_SYSUPGRADE_SUFFIX := -squashfs-sysupgrade GLUON_$(1)_FACTORY_EXT := .bin GLUON_$(1)_SYSUPGRADE_EXT := .bin +GLUON_$(1)_FACTORY_EXTRA := +GLUON_$(1)_SYSUPGRADE_EXTRA := GLUON_$(1)_MODELS := endef define GluonProfileFactorySuffix GLUON_$(1)_FACTORY_SUFFIX := $(2) GLUON_$(1)_FACTORY_EXT := $(3) +GLUON_$(1)_FACTORY_EXTRA := $(4) endef define GluonProfileSysupgradeSuffix GLUON_$(1)_SYSUPGRADE_SUFFIX := $(2) GLUON_$(1)_SYSUPGRADE_EXT := $(3) +GLUON_$(1)_SYSUPGRADE_EXTRA := $(4) endef define GluonModel @@ -447,6 +451,15 @@ image: FORCE cp $(BIN_DIR)/gluon-$(GLUON_$(PROFILE)_MODEL_$(model))$(GLUON_$(PROFILE)_FACTORY_SUFFIX)$(GLUON_$(PROFILE)_FACTORY_EXT) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) && \ ) \ \ + $(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA), \ + rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \ + cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \ + ) \ + $(if $(GLUON_$(PROFILE)_FACTORY_EXTRA), \ + rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \ + cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_FACTORY_EXTRA) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \ + ) \ + \ $(foreach alias,$(GLUON_$(PROFILE)_MODEL_$(model)_ALIASES), \ $(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXT), \ rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \ From bfb0002bb58cc05e75e37fb7780b16ef4f770bfa Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jun 2016 23:22:19 +0200 Subject: [PATCH 066/184] Add target ar71xx-mikrotik Fixes #121 Based-on-patch-by: Tobias Hachmer --- .../files/lib/gluon/upgrade/010-primary-mac | 5 ++++- .../files/lib/gluon/upgrade/320-setup-ifname | 11 +++++++---- targets/ar71xx-mikrotik/profiles.mk | 10 ++++++++++ targets/targets.mk | 1 + 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 targets/ar71xx-mikrotik/profiles.mk diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac index 75d60d16..231bb861 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac @@ -18,7 +18,10 @@ local try_files = { '/sys/class/net/eth0/address' } -if not util.contains({'x86', 'brcm2708'}, platform.get_target()) then +if not ( + util.contains({'x86', 'brcm2708'}, platform.get_target()) or + platform.match('ar71xx', 'mikrotik') +) then table.insert(try_files, 1, '/sys/class/ieee80211/phy0/macaddress') end diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname index a2b4f796..3dba79a9 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/320-setup-ifname @@ -5,13 +5,16 @@ local sysconfig = require 'gluon.sysconfig' if sysconfig.setup_ifname then - os.exit(0) + os.exit(0) end -if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then - sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname +if + platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) or + platform.match('ar71xx', 'mikrotik') +then + sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname else - sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname + sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname end -- Remove the old sysconfig setting diff --git a/targets/ar71xx-mikrotik/profiles.mk b/targets/ar71xx-mikrotik/profiles.mk new file mode 100644 index 00000000..2dcc65fd --- /dev/null +++ b/targets/ar71xx-mikrotik/profiles.mk @@ -0,0 +1,10 @@ +# List of hardware profiles + +## Mikrotik + +# Will contain both ath5k and ath9k +# ath5k cards are commonly used with Mikrotik hardware +$(eval $(call GluonProfile,DefaultNoWifi,kmod-ath5k)) +$(eval $(call GluonProfileFactorySuffix,DefaultNoWifi,,-rootfs.tar.gz,-vmlinux-lzma.elf)) +$(eval $(call GluonProfileSysupgradeSuffix,DefaultNoWifi)) +$(eval $(call GluonModel,DefaultNoWifi,DefaultNoWifi,mikrotik)) diff --git a/targets/targets.mk b/targets/targets.mk index 95b868be..0e0f05a2 100644 --- a/targets/targets.mk +++ b/targets/targets.mk @@ -7,6 +7,7 @@ $(eval $(call GluonTarget,x86,64)) $(eval $(call GluonTarget,x86,xen_domu)) ifneq ($(BROKEN),) +$(eval $(call GluonTarget,ar71xx,mikrotik)) # BROKEN: no sysupgrade support $(eval $(call GluonTarget,ramips,rt305x)) # BROKEN: No AP+IBSS support $(eval $(call GluonTarget,brcm2708,bcm2708)) # BROKEN: Needs more testing $(eval $(call GluonTarget,brcm2708,bcm2709)) # BROKEN: Needs more testing From a95850af1a7bf3764e1826d23e5e53c6703ee516 Mon Sep 17 00:00:00 2001 From: Christian Tramnitz Date: Thu, 23 Jun 2016 01:05:54 +0200 Subject: [PATCH 067/184] sunxi: add Banana Pro (#802) build-tested with 2016.1.4, boots but packet loss on eth0 omitted ata due to build errors --- targets/sunxi/profiles.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/targets/sunxi/profiles.mk b/targets/sunxi/profiles.mk index 55416c2a..c1cb4515 100644 --- a/targets/sunxi/profiles.mk +++ b/targets/sunxi/profiles.mk @@ -9,3 +9,9 @@ $(eval $(call GluonProfile,Lamobo_R1,uboot-sunxi-Lamobo_R1 kmod-ata-sunxi kmod-r $(eval $(call GluonProfileFactorySuffix,Lamobo_R1,-sdcard-vfat-ext4,.img.gz)) $(eval $(call GluonProfileSysupgradeSuffix,Lamobo_R1)) $(eval $(call GluonModel,Lamobo_R1,Lamobo_R1,lemaker-lamobo-r1)) + +# Banana Pro +$(eval $(call GluonProfile,Bananapro,uboot-sunxi-Bananapro kmod-rtc-sunxi kmod-brcmfmac)) +$(eval $(call GluonProfileFactorySuffix,Bananapro,-sdcard-vfat-ext4,.img.gz)) +$(eval $(call GluonProfileSysupgradeSuffix,Bananapro)) +$(eval $(call GluonModel,Bananapro,Bananapro,lemaker-banana-pro)) From 68dbc8f58842e4212f6d497e1b96c70079d1db58 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 29 Jun 2016 16:50:54 +0200 Subject: [PATCH 068/184] brcm2708-*: remove BROKEN --- targets/targets.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/targets.mk b/targets/targets.mk index 0e0f05a2..4924db92 100644 --- a/targets/targets.mk +++ b/targets/targets.mk @@ -1,5 +1,7 @@ $(eval $(call GluonTarget,ar71xx,generic)) $(eval $(call GluonTarget,ar71xx,nand)) +$(eval $(call GluonTarget,brcm2708,bcm2708)) +$(eval $(call GluonTarget,brcm2708,bcm2709)) $(eval $(call GluonTarget,mpc85xx,generic)) $(eval $(call GluonTarget,x86,generic)) $(eval $(call GluonTarget,x86,kvm_guest)) @@ -9,7 +11,5 @@ $(eval $(call GluonTarget,x86,xen_domu)) ifneq ($(BROKEN),) $(eval $(call GluonTarget,ar71xx,mikrotik)) # BROKEN: no sysupgrade support $(eval $(call GluonTarget,ramips,rt305x)) # BROKEN: No AP+IBSS support -$(eval $(call GluonTarget,brcm2708,bcm2708)) # BROKEN: Needs more testing -$(eval $(call GluonTarget,brcm2708,bcm2709)) # BROKEN: Needs more testing $(eval $(call GluonTarget,sunxi)) # BROKEN: Untested, no sysupgrade support endif From 9410914cdc52dc2f8fd1f203af0006be7af41b34 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 1 Jul 2016 13:22:09 +0200 Subject: [PATCH 069/184] scripts/update-patches: disable rename detection git 2.9 enables rename detection by default, changing the content of some of our patch files. Explicitly disable it. --- scripts/update-patches.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-patches.sh b/scripts/update-patches.sh index cfdeb58e..f8b92025 100755 --- a/scripts/update-patches.sh +++ b/scripts/update-patches.sh @@ -16,6 +16,6 @@ for module in $GLUON_MODULES; do n=0 for commit in $(git rev-list --reverse --no-merges base..patched); do let n=n+1 - git show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' $commit > "$GLUONDIR"/patches/$module/"$(printf '%04u' $n)-$(git show -s --pretty=format:%f $commit).patch" + git show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' --no-renames $commit > "$GLUONDIR"/patches/$module/"$(printf '%04u' $n)-$(git show -s --pretty=format:%f $commit).patch" done done From dd195f7f70bb0b38a4f61db2583470fb65d82a4d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 1 Jul 2016 13:23:31 +0200 Subject: [PATCH 070/184] ramips: add missing patch to spi-nor backport to fix mt7621 support --- ...l-backport-spi-nor-driver-from-4.4.9.patch | 173 ++++++++++++------ 1 file changed, 122 insertions(+), 51 deletions(-) diff --git a/patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch b/patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch index 7e3ca845..c15073e9 100644 --- a/patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch +++ b/patches/openwrt/0029-kernel-backport-spi-nor-driver-from-4.4.9.patch @@ -1915,11 +1915,10 @@ index 2beb39c..21f823d 100644 spi-max-frequency = <25000000>; diff --git a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch -deleted file mode 100644 -index 1716e1c..0000000 +index 1716e1c..8dc181a 100644 --- a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch -+++ /dev/null -@@ -1,103 +0,0 @@ ++++ b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch +@@ -1,33 +1,18 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -19,6 +19,7 @@ @@ -1940,65 +1939,86 @@ index 1716e1c..0000000 - -@@ -157,6 +159,61 @@ static int m25p80_read(struct spi_nor *n - return 0; -- } -- ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -1016,6 +1016,66 @@ write_err: ++ return ret; + } + -+static void m25p80_chunked_write(struct spi_nor *nor, loff_t _from, size_t _len, -+ size_t *_retlen, const u_char *_buf) --+{ +++static int spi_nor_chunked_write(struct mtd_info *mtd, loff_t _to, size_t _len, +++ size_t *_retlen, const u_char *_buf) + +{ -+ struct m25p *flash = nor->priv; --+ int chunk_size; --+ int retlen = 0; --+ +++ struct spi_nor *nor = mtd_to_spi_nor(mtd); + + int chunk_size; + + int retlen = 0; +++ int ret; + + -+ chunk_size = flash->chunk_size; --+ if (!chunk_size) --+ chunk_size = _len; --+ --+ if (nor->addr_width > 3) --+ chunk_size -= nor->addr_width - 3; --+ --+ while (retlen < _len) { --+ size_t len = min_t(int, chunk_size, _len - retlen); --+ const u_char *buf = _buf + retlen; +++ chunk_size = nor->chunk_size; + + if (!chunk_size) + + chunk_size = _len; + + +@@ -37,35 +22,39 @@ + + while (retlen < _len) { + + size_t len = min_t(int, chunk_size, _len - retlen); + + const u_char *buf = _buf + retlen; -+ loff_t from = _from + retlen; -+ -+ nor->wait_till_ready(nor); -+ nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0); --+ +++ loff_t to = _to + retlen; + + -+ m25p80_write(nor, from, len, &retlen, buf); --+ } --+ *_retlen += retlen; --+} --+ +++ if (nor->flags & SNOR_F_SST) +++ ret = sst_write(mtd, to, len, &retlen, buf); +++ else +++ ret = spi_nor_write(mtd, to, len, &retlen, buf); +++ if (ret) +++ return ret; + + } +++ + + *_retlen += retlen; +++ return 0; + +} + + -+static int m25p80_chunked_read(struct spi_nor *nor, loff_t _from, size_t _len, -+ size_t *_retlen, u_char *_buf) --+{ +++static int spi_nor_chunked_read(struct mtd_info *mtd, loff_t _from, size_t _len, +++ size_t *_retlen, u_char *_buf) + +{ -+ struct m25p *flash = nor->priv; --+ int chunk_size; --+ +++ struct spi_nor *nor = mtd_to_spi_nor(mtd); + + int chunk_size; +++ int ret; + + -+ chunk_size = flash->chunk_size; --+ if (!chunk_size) --+ chunk_size = _len; +++ chunk_size = nor->chunk_size; + + if (!chunk_size) + + chunk_size = _len; + + + + *_retlen = 0; -+ --+ *_retlen = 0; --+ --+ while (*_retlen < _len) { --+ size_t len = min_t(int, chunk_size, _len - *_retlen); --+ u_char *buf = _buf + *_retlen; --+ loff_t from = _from + *_retlen; --+ int retlen = 0; + + while (*_retlen < _len) { + + size_t len = min_t(int, chunk_size, _len - *_retlen); + + u_char *buf = _buf + *_retlen; + + loff_t from = _from + *_retlen; + + int retlen = 0; -+ int ret = m25p80_read(nor, from, len, &retlen, buf); --+ --+ if (ret) --+ return ret; --+ --+ *_retlen += retlen; --+ } --+ --+ return 0; --+} --+ + + +++ ret = spi_nor_read(mtd, from, len, &retlen, buf); + + if (ret) + + return ret; + + +@@ -75,29 +64,60 @@ + + return 0; + +} + + - static int m25p80_erase(struct spi_nor *nor, loff_t offset) -- { ++ static int macronix_quad_enable(struct spi_nor *nor) + { - struct m25p *flash = nor->priv; -@@ -197,6 +254,7 @@ static int m25p_probe(struct spi_device - struct spi_nor *nor; @@ -2011,15 +2031,66 @@ index 1716e1c..0000000 -@@ -244,6 +302,14 @@ static int m25p_probe(struct spi_device - if (ret) - return ret; -- ++ int ret, val; ++@@ -1197,10 +1257,12 @@ int spi_nor_scan(struct spi_nor *nor, co ++ } + -+ if (spi->dev.of_node && -+ !of_property_read_u32(spi->dev.of_node, "m25p,chunked-io", &val)) { -+ dev_warn(&spi->dev, "using chunked io\n"); -+ nor->read = m25p80_chunked_read; -+ nor->write = m25p80_chunked_write; -+ flash->chunk_size = val; --+ } --+ ++ /* sst nor chips use AAI word program */ ++- if (info->flags & SST_WRITE) +++ if (info->flags & SST_WRITE) { ++ mtd->_write = sst_write; ++- else +++ nor->flags |= SNOR_F_SST; +++ } else { ++ mtd->_write = spi_nor_write; + + } ++ ++ if (info->flags & USE_FSR) ++ nor->flags |= SNOR_F_USE_FSR; ++@@ -1228,11 +1290,20 @@ int spi_nor_scan(struct spi_nor *nor, co ++ mtd->writebufsize = nor->page_size; ++ ++ if (np) { +++ u32 val; + + - ppdata.of_node = spi->dev.of_node; -- ++ /* If we were instantiated by DT, use it */ ++ if (of_property_read_bool(np, "m25p,fast-read")) ++ nor->flash_read = SPI_NOR_FAST; ++ else ++ nor->flash_read = SPI_NOR_NORMAL; +++ +++ if (!of_property_read_u32(np, "m25p,chunked-io", &val)) { +++ dev_info(dev, "using chunked io (size=%d)\n", val); +++ mtd->_read = spi_nor_chunked_read; +++ mtd->_write = spi_nor_chunked_write; +++ nor->chunk_size = val; +++ } ++ } else { ++ /* If we weren't instantiated by DT, default to fast-read */ ++ nor->flash_read = SPI_NOR_FAST; ++--- a/include/linux/mtd/spi-nor.h +++++ b/include/linux/mtd/spi-nor.h ++@@ -115,6 +115,7 @@ enum spi_nor_ops { ++ ++ enum spi_nor_option_flags { ++ SNOR_F_USE_FSR = BIT(0), +++ SNOR_F_SST = BIT(1), ++ }; + - return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, ++ struct mtd_info; ++@@ -157,6 +158,7 @@ struct spi_nor { ++ struct device *dev; ++ struct device_node *flash_node; ++ u32 page_size; +++ u16 chunk_size; ++ u8 addr_width; ++ u8 erase_opcode; ++ u8 read_opcode; From d3e182c2d7052f4c9c6612eefd72e014f9cb6fc1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 1 Jul 2016 14:28:52 +0200 Subject: [PATCH 071/184] Update gluon packages --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index b5a96e92..ca4e2800 100644 --- a/modules +++ b/modules @@ -8,7 +8,7 @@ PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git -PACKAGES_GLUON_COMMIT=0e391753d32be91bb457a0f75c7ced0670e97aea +PACKAGES_GLUON_COMMIT=390b221b51a490f41081a8a610dd161037547c48 PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git PACKAGES_ROUTING_COMMIT=85e771d2f1ca1981983238073ffc602981acbb40 From 3ab92d2f31905171531c2d070e202cf00f9bc6ef Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 3 Jul 2016 19:16:30 +0200 Subject: [PATCH 072/184] x86: stop relying on hexdump for image build signature Fixes #811 --- ...on-hexdump-for-image-build-signature.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/openwrt/0110-x86-stop-relying-on-hexdump-for-image-build-signature.patch diff --git a/patches/openwrt/0110-x86-stop-relying-on-hexdump-for-image-build-signature.patch b/patches/openwrt/0110-x86-stop-relying-on-hexdump-for-image-build-signature.patch new file mode 100644 index 00000000..e2972eb2 --- /dev/null +++ b/patches/openwrt/0110-x86-stop-relying-on-hexdump-for-image-build-signature.patch @@ -0,0 +1,24 @@ +From: Matthias Schiffer +Date: Sun, 3 Jul 2016 19:15:49 +0200 +Subject: x86: stop relying on hexdump for image build signature + +Use perl to generate random number instead. +See https://github.com/freifunk-gluon/gluon/issues/811 + +Signed-off-by: Felix Fietkau + +Backport of LEDE d5ee23ee275fcd6550b0051de59706cc928cdac8 + +diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile +index e7e02f1..6f64eba 100644 +--- a/target/linux/x86/image/Makefile ++++ b/target/linux/x86/image/Makefile +@@ -40,7 +40,7 @@ ifneq ($(GRUB_TERMINALS),) + GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS) + endif + +-SIGNATURE:=$(shell dd if=/dev/urandom bs=4 count=1 2>/dev/null | hexdump -v -e '"%08x"') ++SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0xFFFFFFFF))') + ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) + ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02) + From 3775ba2fa44c10eebf53260f1fe4e4ec6d19befd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 30 Jun 2016 21:07:25 +0200 Subject: [PATCH 073/184] mac80211: update to LEDE 0a0caa2656c8db73518a1783743ede772e3ac40f --- ...la-Technologies-firmware-for-QCA988X.patch | 72 - ...aa2656c8db73518a1783743ede772e3ac40f.patch | 9585 +++++++++++++++++ ...11-ath10k-allow-simultaneous-AP-IBSS.patch | 20 +- ...uner-support-for-UniFi-Outdoor-Plus.patch} | 56 +- ...-ath9k-enable-platform-WLAN-LED-name.patch | 121 - ...x-Send-power-to-USB-port-on-WNR2200.patch} | 0 ...-set-default-state-for-platform-LEDs.patch | 47 - ...1xx-WNR2200-fix-for-random-WLAN-MAC.patch} | 0 ...mac80211-ath9k-enable-access-to-GPIO.patch | 261 - ...ble-control-of-all-LEDs-and-buttons.patch} | 0 .../openwrt/0083-mac80211-refresh-patch.patch | 30 - ...=> 0084-ar71xx-add-GL-AR150-support.patch} | 0 ...4-mac80211-ath9k-enable-GPIO-buttons.patch | 259 - ...-on-platforms-without-CONFIG_GPIOLIB.patch | 827 -- ...ix-version-detection-for-Make-4.2.1.patch} | 0 ...j-for-parallel-builds-with-Make-4.2.patch} | 0 ...ke-fix-parallel-build-with-Make-4.2.patch} | 0 ...IPv6-builtin-if-selected-saves-30KB.patch} | 0 ...ages-with-multiple-PROVIDES-entries.patch} | 0 ...od-crypto-core-and-kmod-crypto-arc4.patch} | 13 - ...-support-for-the-OpenMesh-OM2P-HSv3.patch} | 0 ...-support-for-the-OpenMesh-OM2P-HSv3.patch} | 0 ...supgrade-for-the-OpenMesh-OM2P-HSv3.patch} | 0 ...hdog-add-OpenMesh-OM2P-HSv3-support.patch} | 0 ...ools-add-OpenMesh-OM2P-HSv3-support.patch} | 0 ...x-add-OM2P-HSv3-to-the-OM2P-profile.patch} | 0 ...l-support-for-the-OpenMesh-MR1750v2.patch} | 0 ...e-support-for-the-OpenMesh-MR1750v2.patch} | 0 ...ysupgrade-for-the-OpenMesh-MR1750v2.patch} | 0 ...chdog-add-OpenMesh-MR1750v2-support.patch} | 0 ...tools-add-OpenMesh-MR1750v2-support.patch} | 0 ...bin-for-the-OpenMesh-MR1750v2-board.patch} | 0 ...-add-MR1750v2-to-the-MR1750-profile.patch} | 0 ...n-hexdump-for-image-build-signature.patch} | 0 ...0105-mt76-fix-build-with-kernel-3.18.patch | 34 + 35 files changed, 9663 insertions(+), 1662 deletions(-) delete mode 100644 patches/openwrt/0006-ath10k-firmware-add-Candela-Technologies-firmware-for-QCA988X.patch create mode 100644 patches/openwrt/0006-mac80211-update-to-LEDE-0a0caa2656c8db73518a1783743ede772e3ac40f.patch rename patches/openwrt/{0086-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch => 0080-ath9k-add-HSR-tuner-support-for-UniFi-Outdoor-Plus.patch} (89%) delete mode 100644 patches/openwrt/0080-mac80211-ath9k-enable-platform-WLAN-LED-name.patch rename patches/openwrt/{0087-ar71xx-Send-power-to-USB-port-on-WNR2200.patch => 0081-ar71xx-Send-power-to-USB-port-on-WNR2200.patch} (100%) delete mode 100644 patches/openwrt/0081-mac80211-ath9k-set-default-state-for-platform-LEDs.patch rename patches/openwrt/{0088-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch => 0082-ar71xx-WNR2200-fix-for-random-WLAN-MAC.patch} (100%) delete mode 100644 patches/openwrt/0082-mac80211-ath9k-enable-access-to-GPIO.patch rename patches/openwrt/{0089-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch => 0083-ar71xx-WNR2200-enable-control-of-all-LEDs-and-buttons.patch} (100%) delete mode 100644 patches/openwrt/0083-mac80211-refresh-patch.patch rename patches/openwrt/{0090-ar71xx-add-GL-AR150-support.patch => 0084-ar71xx-add-GL-AR150-support.patch} (100%) delete mode 100644 patches/openwrt/0084-mac80211-ath9k-enable-GPIO-buttons.patch delete mode 100644 patches/openwrt/0085-mac80211-rework-gpio-chip-button-support-to-build-on-platforms-without-CONFIG_GPIOLIB.patch rename patches/openwrt/{0091-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch => 0085-scripts-feeds-fix-version-detection-for-Make-4.2.1.patch} (100%) rename patches/openwrt/{0092-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch => 0086-build-don-t-add-j-for-parallel-builds-with-Make-4.2.patch} (100%) rename patches/openwrt/{0093-tools-cmake-fix-parallel-build-with-Make-4.2.patch => 0087-tools-cmake-fix-parallel-build-with-Make-4.2.patch} (100%) rename patches/openwrt/{0094-linux-make-IPv6-builtin-if-selected-saves-30KB.patch => 0088-linux-make-IPv6-builtin-if-selected-saves-30KB.patch} (100%) rename patches/openwrt/{0095-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch => 0089-package-ipkg.mk-fix-Provides-for-packages-with-multiple-PROVIDES-entries.patch} (100%) rename patches/openwrt/{0096-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch => 0090-kernel-remove-packaging-of-kmod-crypto-core-and-kmod-crypto-arc4.patch} (90%) rename patches/openwrt/{0097-ar71xx-add-kernel-support-for-the-OpenMesh-OM2P-HSv3.patch => 0091-ar71xx-add-kernel-support-for-the-OpenMesh-OM2P-HSv3.patch} (100%) rename patches/openwrt/{0098-ar71xx-add-user-space-support-for-the-OpenMesh-OM2P-HSv3.patch => 0092-ar71xx-add-user-space-support-for-the-OpenMesh-OM2P-HSv3.patch} (100%) rename patches/openwrt/{0099-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM2P-HSv3.patch => 0093-ar71xx-enable-sysupgrade-for-the-OpenMesh-OM2P-HSv3.patch} (100%) rename patches/openwrt/{0100-package-om-watchdog-add-OpenMesh-OM2P-HSv3-support.patch => 0094-package-om-watchdog-add-OpenMesh-OM2P-HSv3-support.patch} (100%) rename patches/openwrt/{0101-package-uboot-envtools-add-OpenMesh-OM2P-HSv3-support.patch => 0095-package-uboot-envtools-add-OpenMesh-OM2P-HSv3-support.patch} (100%) rename patches/openwrt/{0102-ar71xx-add-OM2P-HSv3-to-the-OM2P-profile.patch => 0096-ar71xx-add-OM2P-HSv3-to-the-OM2P-profile.patch} (100%) rename patches/openwrt/{0103-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750v2.patch => 0097-ar71xx-add-kernel-support-for-the-OpenMesh-MR1750v2.patch} (100%) rename patches/openwrt/{0104-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750v2.patch => 0098-ar71xx-add-user-space-support-for-the-OpenMesh-MR1750v2.patch} (100%) rename patches/openwrt/{0105-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750v2.patch => 0099-ar71xx-enable-sysupgrade-for-the-OpenMesh-MR1750v2.patch} (100%) rename patches/openwrt/{0106-package-om-watchdog-add-OpenMesh-MR1750v2-support.patch => 0100-package-om-watchdog-add-OpenMesh-MR1750v2-support.patch} (100%) rename patches/openwrt/{0107-package-uboot-envtools-add-OpenMesh-MR1750v2-support.patch => 0101-package-uboot-envtools-add-OpenMesh-MR1750v2-support.patch} (100%) rename patches/openwrt/{0108-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-MR1750v2-board.patch => 0102-ar71xx-extract-ath10k-wifi-board.bin-for-the-OpenMesh-MR1750v2-board.patch} (100%) rename patches/openwrt/{0109-ar71xx-add-MR1750v2-to-the-MR1750-profile.patch => 0103-ar71xx-add-MR1750v2-to-the-MR1750-profile.patch} (100%) rename patches/openwrt/{0110-x86-stop-relying-on-hexdump-for-image-build-signature.patch => 0104-x86-stop-relying-on-hexdump-for-image-build-signature.patch} (100%) create mode 100644 patches/openwrt/0105-mt76-fix-build-with-kernel-3.18.patch diff --git a/patches/openwrt/0006-ath10k-firmware-add-Candela-Technologies-firmware-for-QCA988X.patch b/patches/openwrt/0006-ath10k-firmware-add-Candela-Technologies-firmware-for-QCA988X.patch deleted file mode 100644 index 5baf2712..00000000 --- a/patches/openwrt/0006-ath10k-firmware-add-Candela-Technologies-firmware-for-QCA988X.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Matthias Schiffer -Date: Tue, 9 Feb 2016 18:22:29 +0100 -Subject: ath10k-firmware: add Candela Technologies firmware for QCA988X - -diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile -index b03d644..7d4d449 100644 ---- a/package/firmware/ath10k-firmware/Makefile -+++ b/package/firmware/ath10k-firmware/Makefile -@@ -44,6 +44,26 @@ define Download/ath10k-firmware-qca988x - endef - $(eval $(call Download,ath10k-firmware-qca988x)) - -+ -+define Package/ath10k-firmware-qca988x-ct -+$(Package/ath10k-firmware-default) -+ TITLE:=ath10k firmware for QCA988x devices (Candela Technologies version) -+ CONFLICTS:=ath10k-firmware-qca988x -+endef -+ -+QCA988X_CT_FIRMWARE_FILE:=firmware-5-ct-full-community.bin -+ -+define Download/ath10k-firmware-qca988x-ct -+ # See http://www.candelatech.com/ath10k.php -+ #URL:=http://www.candelatech.com/downloads/ath10k-10-2/ -+ # Update to beta version (will switch back to official URL after v2 release) -+ URL:=https://home.universe-factory.net/neoraider/ -+ FILE:=$(QCA988X_CT_FIRMWARE_FILE) -+ MD5SUM:=9aa205cfd6b98e695ca8e9ae6d1bcb6b -+endef -+$(eval $(call Download,ath10k-firmware-qca988x-ct)) -+ -+ - define Package/ath10k-firmware-qca99x0 - $(Package/ath10k-firmware-default) - TITLE:=ath10k firmware for QCA99x0 devices -@@ -79,6 +99,16 @@ define Package/ath10k-firmware-qca988x/install - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin - endef - -+define Package/ath10k-firmware-qca988x-ct/install -+ $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0 -+ $(INSTALL_DATA) \ -+ $(PKG_BUILD_DIR)/QCA988X/board.bin \ -+ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/ -+ $(INSTALL_DATA) \ -+ $(DL_DIR)/$(QCA988X_CT_FIRMWARE_FILE) \ -+ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin -+endef -+ - define Package/ath10k-firmware-qca6174/install - $(INSTALL_DIR) $(1)/lib/firmware/ath10k - $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/ -@@ -98,5 +128,6 @@ define Package/ath10k-firmware-qca99x0/install - endef - - $(eval $(call BuildPackage,ath10k-firmware-qca988x)) -+$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct)) - $(eval $(call BuildPackage,ath10k-firmware-qca99x0)) - $(eval $(call BuildPackage,ath10k-firmware-qca6174)) -diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile -index 30da1cf..cd8d670 100644 ---- a/package/kernel/mac80211/Makefile -+++ b/package/kernel/mac80211/Makefile -@@ -247,7 +247,7 @@ define KernelPackage/ath10k - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11ac wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k -- DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x -+ DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko diff --git a/patches/openwrt/0006-mac80211-update-to-LEDE-0a0caa2656c8db73518a1783743ede772e3ac40f.patch b/patches/openwrt/0006-mac80211-update-to-LEDE-0a0caa2656c8db73518a1783743ede772e3ac40f.patch new file mode 100644 index 00000000..26bd0609 --- /dev/null +++ b/patches/openwrt/0006-mac80211-update-to-LEDE-0a0caa2656c8db73518a1783743ede772e3ac40f.patch @@ -0,0 +1,9585 @@ +From: Matthias Schiffer +Date: Tue, 7 Jun 2016 14:06:23 +0200 +Subject: mac80211: update to LEDE 0a0caa2656c8db73518a1783743ede772e3ac40f + +diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile +index b03d644..4f63cdd 100644 +--- a/package/firmware/ath10k-firmware/Makefile ++++ b/package/firmware/ath10k-firmware/Makefile +@@ -8,7 +8,7 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=ath10k-firmware +-PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186 ++PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c + PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION) + PKG_RELEASE:=1 + +@@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git + +-PKG_MAINTAINER:=Felix Fietkau ++PKG_MAINTAINER:=Felix Fietkau + + include $(INCLUDE_DIR)/package.mk + +@@ -28,14 +28,18 @@ define Package/ath10k-firmware-default + CATEGORY:=Kernel modules + SUBMENU:=$(WMENU) + URL:=$(PKG_SOURCE_URL) ++ DEPENDS:=kmod-ath10k + endef + + define Package/ath10k-firmware-qca988x + $(Package/ath10k-firmware-default) ++ DEFAULT:=PACKAGE_kmod-ath10k + TITLE:=ath10k firmware for QCA988x devices + endef + + QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1 ++QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.bin-lede ++QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.001 + + define Download/ath10k-firmware-qca988x + URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/ +@@ -44,11 +48,63 @@ define Download/ath10k-firmware-qca988x + endef + $(eval $(call Download,ath10k-firmware-qca988x)) + ++define Download/ath10k-firmware-qca988x-ct ++ URL:=https://www.candelatech.com/downloads/ ++ FILE:=$(QCA988X_FIRMWARE_FILE_CT) ++ MD5SUM:=5b651c0458bcf5c20701308b5e519976 ++endef ++$(eval $(call Download,ath10k-firmware-qca988x-ct)) ++ ++define Download/ath10k-firmware-qca99x0-ct ++ URL:=https://www.candelatech.com/downloads/ath10k-10-4/ ++ FILE:=$(QCA99X0_FIRMWARE_FILE_CT) ++ MD5SUM:=eb710949ff79142954aadae24616169c ++endef ++$(eval $(call Download,ath10k-firmware-qca99x0-ct)) ++ + define Package/ath10k-firmware-qca99x0 + $(Package/ath10k-firmware-default) + TITLE:=ath10k firmware for QCA99x0 devices + endef + ++define Package/ath10k-firmware-qca988x-ct ++$(Package/ath10k-firmware-default) ++ TITLE:=ath10k CT 10.1 firmware for QCA988x devices ++endef ++ ++define Package/ath10k-firmware-qca988x-ct/description ++Alternative ath10k firmware for QCA988X from Candela Technologies. ++Enables IBSS and other features. See: ++http://www.candelatech.com/ath10k-10.1.php ++This firmware will NOT be used unless the standard ath10k-firmware-qca988x ++is un-selected since the driver will try to load firmware-5.bin before ++firmware-2.bin ++endef ++ ++define Package/ath10k-firmware-qca99x0-ct/description ++Alternative ath10k firmware for QCA99x0 from Candela Technologies. ++Enables IBSS and other features. See: ++http://www.candelatech.com/ath10k-10.4.php ++This firmware conflicts with the standard 99x0 firmware, so select only ++one. ++endef ++ ++define Package/ath10k-firmware-qca99x0/description ++Standard ath10k firmware for QCA99x0 from QCA ++This firmware conflicts with the CT 99x0 firmware, so select only ++one. ++endef ++ ++define Package/ath10k-firmware-qca99x0-ct ++$(Package/ath10k-firmware-default) ++ TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices ++endef ++ ++define Package/ath10k-firmware-qca9984 ++$(Package/ath10k-firmware-default) ++ TITLE:=ath10k firmware for QCA9984 devices ++endef ++ + define Package/ath10k-firmware-qca6174 + $(Package/ath10k-firmware-default) + TITLE:=ath10k firmware for QCA6174 devices +@@ -58,8 +114,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe + QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV) + + define Download/qca99x0-board +- URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0 +- URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe ++ URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0 ++ URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV) + FILE:=$(QCA99X0_BOARD_FILE) + MD5SUM:=a2b3c653c2363a5641200051d6333d0a + endef +@@ -79,6 +135,16 @@ define Package/ath10k-firmware-qca988x/install + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin + endef + ++define Package/ath10k-firmware-qca988x-ct/install ++ $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0 ++ $(INSTALL_DATA) \ ++ $(PKG_BUILD_DIR)/QCA988X/board.bin \ ++ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/ ++ $(INSTALL_DATA) \ ++ $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \ ++ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin ++endef ++ + define Package/ath10k-firmware-qca6174/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k + $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/ +@@ -97,6 +163,33 @@ define Package/ath10k-firmware-qca99x0/install + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin + endef + ++define Package/ath10k-firmware-qca99x0-ct/install ++ $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 ++ $(INSTALL_DATA) \ ++ $(DL_DIR)/$(QCA99X0_BOARD_FILE) \ ++ $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin ++ $(INSTALL_DATA) \ ++ $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \ ++ $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin ++ $(INSTALL_DATA) \ ++ $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \ ++ $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin ++endef ++ ++define Package/ath10k-firmware-qca9984/install ++ $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0 ++ $(INSTALL_DATA) \ ++ $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \ ++ $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin ++ $(INSTALL_DATA) \ ++ $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \ ++ $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin ++endef ++ + $(eval $(call BuildPackage,ath10k-firmware-qca988x)) + $(eval $(call BuildPackage,ath10k-firmware-qca99x0)) + $(eval $(call BuildPackage,ath10k-firmware-qca6174)) ++$(eval $(call BuildPackage,ath10k-firmware-qca9984)) ++ ++$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct)) ++$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct)) +diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile +index 2fcd93b..7a2e977 100644 +--- a/package/firmware/linux-firmware/Makefile ++++ b/package/firmware/linux-firmware/Makefile +@@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) + PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +-PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git +-PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a ++PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git ++PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614 + +-PKG_MAINTAINER:=Felix Fietkau ++PKG_MAINTAINER:=Felix Fietkau + + SCAN_DEPS = *.mk + +diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk +index 0f8b1ce..4229ca0 100644 +--- a/package/firmware/linux-firmware/realtek.mk ++++ b/package/firmware/linux-firmware/realtek.mk +@@ -43,8 +43,15 @@ endef + $(eval $(call BuildPackage,rtl8192de-firmware)) + + Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware) +-define KernelPackage/rtl8192se/install ++define Package/rtl8192se-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi + endef + $(eval $(call BuildPackage,rtl8192se-firmware)) ++ ++Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware) ++define Package/rtl8192su-firmware/install ++ $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi ++ $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi ++endef ++$(eval $(call BuildPackage,rtl8192su-firmware)) +diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile +index 1820e7a..8fce374 100644 +--- a/package/kernel/acx-mac80211/Makefile ++++ b/package/kernel/acx-mac80211/Makefile +@@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk + include $(INCLUDE_DIR)/kernel.mk + + PKG_NAME:=acx-mac80211 +-PKG_REV:=v20130127 +-PKG_VERSION:=20130909 ++PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726 ++PKG_VERSION:=20140216 + PKG_RELEASE:=1 + + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +-PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211 ++PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211 + PKG_SOURCE_PROTO:=git + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + PKG_SOURCE_VERSION:=$(PKG_REV) +@@ -190,7 +190,7 @@ define Build/Compile + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + $(PKG_EXTRA_KCONFIG) \ +- EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \ ++ EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \ + LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \ + -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \ +diff --git a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch b/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch +deleted file mode 100644 +index fa4a6be..0000000 +--- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch ++++ /dev/null +@@ -1,129 +0,0 @@ +-From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001 +-From: Oliver Winker +-Date: Sun, 10 Mar 2013 21:04:23 +0100 +-Subject: [PATCH 1/3] pci, mem: Fix 3.8 build +- +-__devexit and __devinit not used anymore in 3.8 +- +-Signed-off-by: Reinhard Karcher +-Signed-off-by: Oliver Winker +---- +- mem.c | 13 ++++++++++++- +- pci.c | 26 +++++++++++++++++++++++++- +- 2 files changed, 37 insertions(+), 2 deletions(-) +- +---- a/mem.c +-+++ b/mem.c +-@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str +- * ================================================== +- */ +- +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- static int __devinit acxmem_probe(struct platform_device *pdev) +-+#else +-+static int acxmem_probe(struct platform_device *pdev) +-+#endif +- { +- acx_device_t *adev = NULL; +- const char *chip_name; +-@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct +- * pdev - ptr to PCI device structure containing info about pci +- * configuration +- */ +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- static int __devexit acxmem_remove(struct platform_device *pdev) +-+#else +-+static int acxmem_remove(struct platform_device *pdev) +-+#endif +- { +- struct ieee80211_hw *hw = (struct ieee80211_hw *) +- platform_get_drvdata(pdev); +-@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri +- .name = "acx-mem", +- }, +- .probe = acxmem_probe, +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- .remove = __devexit_p(acxmem_remove), +-- +-+#else +-+ .remove = acxmem_remove, +-+#endif +- #ifdef CONFIG_PM +- .suspend = acxmem_e_suspend, +- .resume = acxmem_e_resume +---- a/pci.c +-+++ b/pci.c +-@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str +- * id - ptr to the device id entry that matched this device +- */ +- #ifdef CONFIG_PCI +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- static int __devinit acxpci_probe(struct pci_dev *pdev, +-+#else +-+static int acxpci_probe(struct pci_dev *pdev, +-+#endif +- const struct pci_device_id *id) +- { +- unsigned long mem_region1 = 0; +-@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct +- * +- * pdev - ptr to PCI device structure containing info about pci configuration +- */ +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- static void __devexit acxpci_remove(struct pci_dev *pdev) +-+#else +-+static void acxpci_remove(struct pci_dev *pdev) +-+#endif +- { +- struct ieee80211_hw *hw +- = (struct ieee80211_hw *) pci_get_drvdata(pdev); +-@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver = +- .name = "acx_pci", +- .id_table = acxpci_id_tbl, +- .probe = acxpci_probe, +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- .remove = __devexit_p(acxpci_remove), +-+#else +-+ .remove = acxpci_remove, +-+#endif +- #ifdef CONFIG_PM +- .suspend = acxpci_e_suspend, +- .resume = acxpci_e_resume +-@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_ +- }; +- +- +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- static __devinit int vlynq_probe(struct vlynq_device *vdev, +-- struct vlynq_device_id *id) +-+#else +-+static int vlynq_probe(struct vlynq_device *vdev, +-+#endif +-+ struct vlynq_device_id *id) +- { +- int result = -EIO, i; +- u32 addr; +-@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct +- return result; +- } +- +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- static __devexit void vlynq_remove(struct vlynq_device *vdev) +-+#else +-+static void vlynq_remove(struct vlynq_device *vdev) +-+#endif +- { +- struct ieee80211_hw *hw = vlynq_get_drvdata(vdev); +- acx_device_t *adev = hw2adev(hw); +-@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv +- .name = "acx_vlynq", +- .id_table = acx_vlynq_id, +- .probe = vlynq_probe, +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) +- .remove = __devexit_p(vlynq_remove), +-+#else +-+ .remove = vlynq_remove, +-+#endif +- }; +- #endif /* CONFIG_VLYNQ */ +- +diff --git a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch b/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch +deleted file mode 100644 +index c737844..0000000 +--- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch ++++ /dev/null +@@ -1,31 +0,0 @@ +-From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001 +-From: Oliver Winker +-Date: Tue, 3 Sep 2013 20:36:36 +0200 +-Subject: [PATCH 3/3] Fix 3.10 build +- +-Signed-off-by: Reinhard Karcher +-Signed-off-by: Oliver Winker +---- +- main.c | 7 +++++++ +- 1 file changed, 7 insertions(+) +- +---- a/main.c +-+++ b/main.c +-@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h +- +- if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { +- logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL," +-+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0) +-+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value); +-+ +-+ acx_set_channel(adev, conf->chandef.chan->hw_value, +-+ conf->chandef.chan->center_freq); +-+#else +- "channel->hw_value=%i\n", conf->channel->hw_value); +- +- acx_set_channel(adev, conf->channel->hw_value, +- conf->channel->center_freq); +-+#endif +- +- changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL; +- } +diff --git a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch b/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch +deleted file mode 100644 +index 847b573..0000000 +--- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch ++++ /dev/null +@@ -1,22 +0,0 @@ +-From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001 +-From: Hauke Mehrtens +-Date: Wed, 5 Feb 2014 20:57:07 +0100 +-Subject: [PATCH] Fix 3.14 build +- +-Signed-off-by: Hauke Mehrtens +---- +- main.c | 2 ++ +- 1 file changed, 2 insertions(+) +- +---- a/main.c +-+++ b/main.c +-@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS; +- hw->queues = 1; +- hw->wiphy->max_scan_ssids = 1; +-+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0) +- hw->channel_change_time = 10000; +-+#endif +- +- /* OW TODO Check if RTS/CTS threshold can be included here */ +- +diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch +new file mode 100644 +index 0000000..94d6135 +--- /dev/null ++++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch +@@ -0,0 +1,83 @@ ++--- a/main.c +++++ b/main.c ++@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade ++ ++ int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw) ++ { ++- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS; +++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags); ++ hw->queues = 1; ++ hw->wiphy->max_scan_ssids = 1; ++ ++@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade ++ /* We base signal quality on winlevel approach of previous driver ++ * TODO OW 20100615 This should into a common init code ++ */ ++- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC; +++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags); ++ hw->max_signal = 100; ++ ++ if (IS_ACX100(adev)) { ++- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = +++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] = ++ &acx100_band_2GHz; ++ } else if (IS_ACX111(adev)) ++- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = +++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] = ++ &acx111_band_2GHz; ++ else { ++ log(L_ANY, "Error: Unknown device"); ++@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee ++ changed_flags, *total_flags); ++ ++ /* OWI TODO: Set also FIF_PROBE_REQ ? */ ++- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL ++- | FIF_CONTROL | FIF_OTHER_BSS); +++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL +++ | FIF_OTHER_BSS); ++ ++ logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags); ++ ++@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw, ++ } ++ ++ int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++- struct cfg80211_scan_request *req) +++ struct ieee80211_scan_request *hw_req) ++ { ++ acx_device_t *adev = hw2adev(hw); +++ struct cfg80211_scan_request *req = &hw_req->req; ++ struct sk_buff *skb; ++ size_t ssid_len = 0; ++ u8 *ssid = NULL; ++@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw * ++ goto out; ++ } ++ #else ++- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len, +++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len, ++ req->ie_len); ++ if (!skb) { ++ ret = -ENOMEM; ++--- a/main.h +++++ b/main.h ++@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw, ++ #endif ++ ++ int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++- struct cfg80211_scan_request *req); +++ struct ieee80211_scan_request *req); ++ ++ int acx_recover_hw(acx_device_t *adev); ++ ++--- a/cardsetting.c +++++ b/cardsetting.c ++@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev, ++ int res = 0; ++ ++ adev->rx_status.freq = freq; ++- adev->rx_status.band = IEEE80211_BAND_2GHZ; +++ adev->rx_status.band = NL80211_BAND_2GHZ; ++ ++ adev->channel = channel; ++ +diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile +index 30da1cf..bee0723 100644 +--- a/package/kernel/mac80211/Makefile ++++ b/package/kernel/mac80211/Makefile +@@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk + + PKG_NAME:=mac80211 + +-PKG_VERSION:=2016-01-10 ++PKG_VERSION:=2016-05-12 + PKG_RELEASE:=1 + PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources + PKG_BACKPORT_VERSION:= +-PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba ++PKG_MD5SUM:=2142cf38509896dca108624e7c193611 + + PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2 + PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) + PKG_BUILD_PARALLEL:=1 + +-PKG_MAINTAINER:=Felix Fietkau ++PKG_MAINTAINER:=Felix Fietkau + + PKG_DRIVERS = \ + adm8211 \ ++ airo \ + ath ath5k ath9k ath9k-common ath9k-htc ath10k \ + b43 b43legacy \ + carl9170 \ +@@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \ + CONFIG_PACKAGE_MAC80211_DEBUGFS \ + CONFIG_PACKAGE_MAC80211_MESH \ ++ CONFIG_PACKAGE_MAC80211_TRACING \ + CONFIG_PACKAGE_ATH_DEBUG \ + CONFIG_PACKAGE_ATH_DFS \ + CONFIG_PACKAGE_B43_DEBUG \ +@@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \ + CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \ + CONFIG_PACKAGE_B43_BUSES_BCMA \ + CONFIG_PACKAGE_B43_BUSES_SSB \ ++ CONFIG_PACKAGE_BRCM80211_DEBUG \ ++ CONFIG_PACKAGE_IWLWIFI_DEBUG \ ++ CONFIG_PACKAGE_IWLWIFI_DEBUGFS \ + CONFIG_PACKAGE_RTLWIFI_DEBUG \ ++ CONFIG_ATH9K_SUPPORT_PCOEM \ ++ CONFIG_ATH9K_TX99 \ + CONFIG_ATH_USER_REGD \ + + include $(INCLUDE_DIR)/package.mk +@@ -73,7 +80,7 @@ WMENU:=Wireless Drivers + define KernelPackage/mac80211/Default + SUBMENU:=$(WMENU) + URL:=https://wireless.wiki.kernel.org/ +- MAINTAINER:=Felix Fietkau ++ MAINTAINER:=Felix Fietkau + endef + + define KernelPackage/cfg80211 +@@ -92,7 +99,7 @@ endef + define KernelPackage/mac80211 + $(call KernelPackage/mac80211/Default) + TITLE:=Linux 802.11 Wireless Networking Stack +- DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4 ++ DEPENDS+= +kmod-cfg80211 +hostapd-common + KCONFIG:=\ + CONFIG_AVERAGE=y + FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko +@@ -138,10 +145,23 @@ define KernelPackage/adm8211 + AUTOLOAD:=$(call AutoProbe,adm8211) + endef + ++define KernelPackage/airo ++ $(call KernelPackage/mac80211/Default) ++ TITLE:=Cisco Aironet driver ++ DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86 ++ FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko ++ AUTOLOAD:=$(call AutoProbe,airo) ++endef ++ ++define KernelPackage/airo/description ++ Kernel support for Cisco Aironet cards ++endef ++ + define KernelPackage/ath/config + if PACKAGE_kmod-ath + config ATH_USER_REGD + bool "Force Atheros drivers to respect the user's regdomain settings" ++ default y + help + Atheros' idea of regulatory handling is that the EEPROM of the card defines + the regulatory limits and the user is only allowed to restrict the settings +@@ -226,6 +246,10 @@ define KernelPackage/ath9k/config + bool "Support chips used in PC OEM cards" + depends on PACKAGE_kmod-ath9k + ++ config ATH9K_TX99 ++ bool "Enable TX99 support" ++ depends on PACKAGE_kmod-ath9k ++ + endef + + define KernelPackage/ath9k-htc +@@ -247,7 +271,7 @@ define KernelPackage/ath10k + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11ac wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k +- DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x ++ DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko +@@ -673,6 +697,7 @@ define KernelPackage/brcmfmac/config + + config BRCMFMAC_SDIO + bool "Enable SDIO bus interface support" ++ default y if TARGET_brcm2708 + default n + help + Enable support for cards attached to an SDIO bus. +@@ -761,7 +786,7 @@ endef + + define KernelPackage/iwlwifi + $(call KernelPackage/mac80211/Default) +- DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware ++ DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18 + TITLE:=Intel AGN Wireless support + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \ +@@ -870,7 +895,7 @@ endef + define KernelPackage/lib80211 + $(call KernelPackage/mac80211/Default) + TITLE:=802.11 Networking stack +- DEPENDS:=+kmod-cfg80211 ++ DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash + FILES:= \ + $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \ + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \ +@@ -897,7 +922,7 @@ endef + define KernelPackage/libipw + $(call KernelPackage/mac80211/Default) + TITLE:=libipw for ipw2100 and ipw2200 +- DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN ++ DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko + AUTOLOAD:=$(call AutoProbe,libipw) + endef +@@ -978,7 +1003,7 @@ endef + define KernelPackage/libertas-spi + $(call KernelPackage/mac80211/Default) + SUBMENU:=Wireless Drivers +- DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware ++ DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware + KCONFIG := \ + CONFIG_SPI=y \ + CONFIG_SPI_MASTER=y +@@ -1453,6 +1478,7 @@ config-y:= \ + WLAN_VENDOR_ATH \ + WLAN_VENDOR_ATMEL \ + WLAN_VENDOR_BROADCOM \ ++ WLAN_VENDOR_CISCO \ + WLAN_VENDOR_INTEL \ + WLAN_VENDOR_INTERSIL \ + WLAN_VENDOR_MARVELL \ +@@ -1491,6 +1517,8 @@ endif + + config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP + ++config-$(call config_package,airo) += AIRO ++ + config-$(call config_package,ath) += ATH_CARDS ATH_COMMON + config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG + config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED +@@ -1501,6 +1529,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB + config-$(CONFIG_PCI) += ATH9K_PCI + config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD + config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM ++config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 + + config-$(call config_package,ath9k-htc) += ATH9K_HTC + config-$(call config_package,ath10k) += ATH10K ATH10K_PCI +@@ -1764,6 +1793,7 @@ endef + + + $(eval $(call KernelPackage,adm8211)) ++$(eval $(call KernelPackage,airo)) + $(eval $(call KernelPackage,ath)) + $(eval $(call KernelPackage,ath10k)) + $(eval $(call KernelPackage,ath5k)) +diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +index fb2f928..e3d612e 100644 +--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh ++++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +@@ -23,6 +23,7 @@ drv_mac80211_init_device_config() { + config_add_int rxantenna txantenna antenna_gain txpower distance + config_add_boolean noscan ht_coex + config_add_array ht_capab ++ config_add_array channels + config_add_boolean \ + rxldpc \ + short_gi_80 \ +@@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() { + json_select config + + [ "$auto_channel" -gt 0 ] && channel=acs_survey ++ [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels + + json_get_vars noscan ht_coex + json_get_values ht_capab_list ht_capab +@@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() { + vht_max_a_mpdu_len_exp:7 \ + vht_max_mpdu:11454 \ + rx_stbc:4 \ +- tx_stbc:4 \ + vht_link_adapt:3 \ + vht160:2 + +@@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() { + + cap_rx_stbc=$((($vht_cap >> 8) & 7)) + [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" +- ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" ++ vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" + + mac80211_add_capabilities vht_capab $vht_cap \ + RXLDPC:0x10::$rxldpc \ + SHORT-GI-80:0x20::$short_gi_80 \ + SHORT-GI-160:0x40::$short_gi_160 \ +- TX-STBC-2BY1:0x80::$tx_stbc \ ++ TX-STBC-2BY1:0x80::$tx_stbc_2by1 \ + SU-BEAMFORMER:0x800::$su_beamformer \ + SU-BEAMFORMEE:0x1000::$su_beamformee \ + MU-BEAMFORMER:0x80000::$mu_beamformer \ +@@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() { + HTC-VHT:0x400000::$htc_vht \ + RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \ + TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \ +- RX-STBC1:0x700:0x100:1 \ +- RX-STBC12:0x700:0x200:1 \ +- RX-STBC123:0x700:0x300:1 \ +- RX-STBC1234:0x700:0x400:1 \ ++ RX-STBC-1:0x700:0x100:1 \ ++ RX-STBC-12:0x700:0x200:1 \ ++ RX-STBC-123:0x700:0x300:1 \ ++ RX-STBC-1234:0x700:0x400:1 \ + + # supported Channel widths + vht160_hw=0 +@@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() { + hostapd_prepare_device_config "$hostapd_conf_file" nl80211 + cat >> "$hostapd_conf_file" </dev/null); do ++ case "$(readlink -f /sys/class/ieee80211/$phy/device)" in ++ *$path) return 0;; ++ esac + done + } + [ -n "$macaddr" ] && { +@@ -481,7 +482,7 @@ mac80211_prepare_vif() { + # All interfaces must have unique mac addresses + # which can either be explicitly set in the device + # section, or automatically generated +- ifconfig "$ifname" hw ether "$macaddr" ++ ip link set dev "$ifname" address "$macaddr" + fi + + json_select .. +@@ -496,7 +497,7 @@ mac80211_setup_supplicant() { + mac80211_setup_adhoc_htmode() { + case "$htmode" in + VHT20|HT20) ibss_htmode=HT20;; +- HT40*|VHT40|VHT80|VHT160) ++ HT40*|VHT40|VHT160) + case "$hwmode" in + a) + case "$(( ($channel / 4) % 2 ))" in +@@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() { + esac + [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+" + ;; ++ VHT80) ++ ibss_htmode="80MHZ" ++ ;; + NONE|NOHT) + ibss_htmode="NOHT" + ;; +@@ -580,7 +584,7 @@ mac80211_setup_vif() { + json_get_vars mode + json_get_var vif_txpower txpower + +- ifconfig "$ifname" up || { ++ ip link set dev "$ifname" up || { + wireless_setup_vif_failed IFUP_ERROR + json_select .. + return +@@ -643,7 +647,7 @@ mac80211_interface_cleanup() { + local phy="$1" + + for wdev in $(list_phy_interfaces "$phy"); do +- ifconfig "$wdev" down 2>/dev/null ++ ip link set dev "$wdev" down 2>/dev/null + iw dev "$wdev" del + done + } +diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh +index ea229d6..06f3b8b 100644 +--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh ++++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh +@@ -9,11 +9,10 @@ lookup_phy() { + local devpath + config_get devpath "$device" path + [ -n "$devpath" ] && { +- for _phy in /sys/devices/$devpath/ieee80211/phy*; do +- [ -e "$_phy" ] && { +- phy="${_phy##*/}" +- return +- } ++ for phy in $(ls /sys/class/ieee80211 2>/dev/null); do ++ case "$(readlink -f /sys/class/ieee80211/$phy/device)" in ++ *$devpath) return;; ++ esac + done + } + +@@ -102,6 +101,9 @@ detect_mac80211() { + fi + if [ -n "$path" ]; then + path="${path##/sys/devices/}" ++ case "$path" in ++ platform*/pci*) path="${path##platform/}";; ++ esac + dev_id=" option path '$path'" + else + dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)" +diff --git a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch +deleted file mode 100644 +index 9adfd8f..0000000 +--- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch ++++ /dev/null +@@ -1,21 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 28 Jan 2016 15:16:35 +0100 +-Subject: [PATCH] backports: add skb_free_frag() +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/backport-include/linux/skbuff.h +-+++ b/backport-include/linux/skbuff.h +-@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff * +- +- #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */ +- +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) +-+static inline void skb_free_frag(void *data) +-+{ +-+ put_page(virt_to_head_page(data)); +-+} +-+#endif +-+ +- #endif /* __BACKPORT_SKBUFF_H */ +diff --git a/package/kernel/mac80211/patches/004-header-backport-GENL_UNS_ADMIN_PERM.patch b/package/kernel/mac80211/patches/004-header-backport-GENL_UNS_ADMIN_PERM.patch +new file mode 100644 +index 0000000..38d655f +--- /dev/null ++++ b/package/kernel/mac80211/patches/004-header-backport-GENL_UNS_ADMIN_PERM.patch +@@ -0,0 +1,21 @@ ++From: Felix Fietkau ++Date: Sat, 14 May 2016 16:39:35 +0200 ++Subject: [PATCH] header: backport GENL_UNS_ADMIN_PERM ++ ++Signed-off-by: Felix Fietkau ++--- ++ create mode 100644 backport-include/uapi/linux/genetlink.h ++ ++--- /dev/null +++++ b/backport-include/uapi/linux/genetlink.h ++@@ -0,0 +1,10 @@ +++#ifndef __COMPAT_UAPI_LINUX_GENETLINK_H +++#define __COMPAT_UAPI_LINUX_GENETLINK_H +++ +++#include_next +++ +++#ifndef GENL_UNS_ADMIN_PERM +++#define GENL_UNS_ADMIN_PERM GENL_ADMIN_PERM +++#endif +++ +++#endif +diff --git a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch +deleted file mode 100644 +index 9b672a8..0000000 +--- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch ++++ /dev/null +@@ -1,20 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 28 Jan 2016 15:19:22 +0100 +-Subject: [PATCH] backports: add napi_alloc_frag +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/backport-include/linux/netdevice.h +-+++ b/backport-include/linux/netdevice.h +-@@ -232,6 +232,10 @@ static inline void backport_unregister_n +- #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many) +- #endif +- +-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) +-+#define napi_alloc_frag netdev_alloc_frag +-+#endif +-+ +- /* +- * Complicated way of saying: We only backport netdev_rss_key stuff on kernels +- * that either already have net_get_random_once() (>= 3.13) or where we've been +diff --git a/package/kernel/mac80211/patches/005-header-backport-nla_put_u64_64bit-and-nla_put_64bit.patch b/package/kernel/mac80211/patches/005-header-backport-nla_put_u64_64bit-and-nla_put_64bit.patch +new file mode 100644 +index 0000000..e20d87a +--- /dev/null ++++ b/package/kernel/mac80211/patches/005-header-backport-nla_put_u64_64bit-and-nla_put_64bit.patch +@@ -0,0 +1,158 @@ ++From: Felix Fietkau ++Date: Sat, 14 May 2016 16:40:16 +0200 ++Subject: [PATCH] header: backport nla_put_u64_64bit and nla_put_64bit ++ ++Signed-off-by: Felix Fietkau ++--- ++ ++--- a/backport-include/net/netlink.h +++++ b/backport-include/net/netlink.h ++@@ -189,4 +189,148 @@ static inline __le64 nla_get_le64(const ++ } ++ #endif /* < 4.4 */ ++ +++ +++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +++ +++/** +++ * nla_need_padding_for_64bit - test 64-bit alignment of the next attribute +++ * @skb: socket buffer the message is stored in +++ * +++ * Return true if padding is needed to align the next attribute (nla_data()) to +++ * a 64-bit aligned area. +++ */ +++static inline bool nla_need_padding_for_64bit(struct sk_buff *skb) +++{ +++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS +++ /* The nlattr header is 4 bytes in size, that's why we test +++ * if the skb->data _is_ aligned. A NOP attribute, plus +++ * nlattr header for next attribute, will make nla_data() +++ * 8-byte aligned. +++ */ +++ if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8)) +++ return true; +++#endif +++ return false; +++} +++ +++/** +++ * nla_align_64bit - 64-bit align the nla_data() of next attribute +++ * @skb: socket buffer the message is stored in +++ * @padattr: attribute type for the padding +++ * +++ * Conditionally emit a padding netlink attribute in order to make +++ * the next attribute we emit have a 64-bit aligned nla_data() area. +++ * This will only be done in architectures which do not have +++ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS defined. +++ * +++ * Returns zero on success or a negative error code. +++ */ +++static inline int nla_align_64bit(struct sk_buff *skb, int padattr) +++{ +++ if (nla_need_padding_for_64bit(skb) && +++ !nla_reserve(skb, padattr, 0)) +++ return -EMSGSIZE; +++ +++ return 0; +++} +++ +++/** +++ * __nla_reserve_64bit - reserve room for attribute on the skb and align it +++ * @skb: socket buffer to reserve room on +++ * @attrtype: attribute type +++ * @attrlen: length of attribute payload +++ * @padattr: attribute type for the padding +++ * +++ * Adds a netlink attribute header to a socket buffer and reserves +++ * room for the payload but does not copy it. It also ensure that this +++ * attribute will have a 64-bit aligned nla_data() area. +++ * +++ * The caller is responsible to ensure that the skb provides enough +++ * tailroom for the attribute header and payload. +++ */ +++static inline struct nlattr *__nla_reserve_64bit(struct sk_buff *skb, int attrtype, +++ int attrlen, int padattr) +++{ +++ if (nla_need_padding_for_64bit(skb)) +++ nla_align_64bit(skb, padattr); +++ +++ return __nla_reserve(skb, attrtype, attrlen); +++} +++ +++/** +++ * __nla_put_64bit - Add a netlink attribute to a socket buffer and align it +++ * @skb: socket buffer to add attribute to +++ * @attrtype: attribute type +++ * @attrlen: length of attribute payload +++ * @data: head of attribute payload +++ * @padattr: attribute type for the padding +++ * +++ * The caller is responsible to ensure that the skb provides enough +++ * tailroom for the attribute header and payload. +++ */ +++static inline void __nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen, +++ const void *data, int padattr) +++{ +++ struct nlattr *nla; +++ +++ nla = __nla_reserve_64bit(skb, attrtype, attrlen, padattr); +++ memcpy(nla_data(nla), data, attrlen); +++} +++ +++/** +++ * nla_total_size_64bit - total length of attribute including padding +++ * @payload: length of payload +++ */ +++static inline int nla_total_size_64bit(int payload) +++{ +++ return NLA_ALIGN(nla_attr_size(payload)) +++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS +++ + NLA_ALIGN(nla_attr_size(0)) +++#endif +++ ; +++} +++ +++/** +++ * nla_put_64bit - Add a netlink attribute to a socket buffer and align it +++ * @skb: socket buffer to add attribute to +++ * @attrtype: attribute type +++ * @attrlen: length of attribute payload +++ * @data: head of attribute payload +++ * @padattr: attribute type for the padding +++ * +++ * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store +++ * the attribute header and payload. +++ */ +++static inline int nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen, +++ const void *data, int padattr) +++{ +++ size_t len; +++ +++ if (nla_need_padding_for_64bit(skb)) +++ len = nla_total_size_64bit(attrlen); +++ else +++ len = nla_total_size(attrlen); +++ if (unlikely(skb_tailroom(skb) < len)) +++ return -EMSGSIZE; +++ +++ __nla_put_64bit(skb, attrtype, attrlen, data, padattr); +++ return 0; +++} +++ +++/** +++ * nla_put_u64_64bit - Add a u64 netlink attribute to a skb and align it +++ * @skb: socket buffer to add attribute to +++ * @attrtype: attribute type +++ * @value: numeric value +++ * @padattr: attribute type for the padding +++ */ +++static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype, +++ u64 value, int padattr) +++{ +++ return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr); +++} +++ +++ +++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) */ +++ ++ #endif /* __BACKPORT_NET_NETLINK_H */ +diff --git a/package/kernel/mac80211/patches/006-compat-bump-rhashtable-backport-version-due-to-API-c.patch b/package/kernel/mac80211/patches/006-compat-bump-rhashtable-backport-version-due-to-API-c.patch +new file mode 100644 +index 0000000..1fdad3c +--- /dev/null ++++ b/package/kernel/mac80211/patches/006-compat-bump-rhashtable-backport-version-due-to-API-c.patch +@@ -0,0 +1,18 @@ ++From: Felix Fietkau ++Date: Sat, 14 May 2016 16:44:57 +0200 ++Subject: [PATCH] compat: bump rhashtable backport version due to API changes ++ ++Signed-off-by: Felix Fietkau ++--- ++ ++--- a/compat/Kconfig +++++ b/compat/Kconfig ++@@ -139,7 +139,7 @@ config BPAUTO_BUILD_WANT_DEV_COREDUMP ++ config BPAUTO_RHASHTABLE ++ bool ++ # current API of rhashtable was introduced in version 4.1 ++- depends on KERNEL_4_1 +++ depends on KERNEL_4_7 ++ # not very nice - but better than always having it ++ default y if MAC80211 ++ #h-file linux/rhashtable.h +diff --git a/package/kernel/mac80211/patches/007-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/007-fix_duplicate_skcipher_backport.patch +new file mode 100644 +index 0000000..38b3179 +--- /dev/null ++++ b/package/kernel/mac80211/patches/007-fix_duplicate_skcipher_backport.patch +@@ -0,0 +1,11 @@ ++--- a/compat/Makefile +++++ b/compat/Makefile ++@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport- ++ ++ compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o ++ compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o ++-skcipher-objs += crypto-skcipher.o ++-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o ++ compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o ++ compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o ++ cordic-objs += lib-cordic.o +diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch +index fd1e1cf..e9a140c 100644 +--- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch ++++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch +@@ -1,6 +1,6 @@ + --- a/.local-symbols + +++ b/.local-symbols +-@@ -476,44 +476,6 @@ USB_IPHETH= ++@@ -481,45 +481,6 @@ USB_IPHETH= + USB_SIERRA_NET= + USB_VL600= + USB_NET_CH9200= +@@ -37,6 +37,7 @@ + -BCMA_DRIVER_PCI= + -BCMA_DRIVER_PCI_HOSTMODE= + -BCMA_DRIVER_MIPS= ++-BCMA_PFLASH= + -BCMA_SFLASH= + -BCMA_NFLASH= + -BCMA_DRIVER_GMAC_CMN= +@@ -56,7 +57,7 @@ + return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); + #else + return bus->chipco.dev; +-@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct ++@@ -4901,7 +4901,7 @@ static int b43_wireless_core_init(struct + } + if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) + hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ +diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch +deleted file mode 100644 +index 3765591..0000000 +--- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch ++++ /dev/null +@@ -1,20 +0,0 @@ +---- a/compat/compat-3.6.c +-+++ b/compat/compat-3.6.c +-@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_ +- return 0; +- } +- EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages); +-- +--/* whoopsie ! */ +--#ifndef CONFIG_COMMON_CLK +--int clk_enable(struct clk *clk) +--{ +-- return 0; +--} +--EXPORT_SYMBOL_GPL(clk_enable); +-- +--void clk_disable(struct clk *clk) +--{ +--} +--EXPORT_SYMBOL_GPL(clk_disable); +--#endif +diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch +index 02f46c7..b65b0bd 100644 +--- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch ++++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch +@@ -34,12 +34,9 @@ + #include "aes_ccm.h" + + -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, +-- u8 *data, size_t data_len, u8 *mic, +-- size_t mic_len) + +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0, + + u8 *a, u8 *b) +- { +-- struct scatterlist sg[3]; +++{ + + int i; + + + + crypto_cipher_encrypt_one(tfm, b, b_0); +@@ -54,55 +51,56 @@ + + for (i = 0; i < AES_BLOCK_SIZE; i++) + + aad[i] ^= b[i]; + + crypto_cipher_encrypt_one(tfm, a, aad); +- +-- char aead_req_data[sizeof(struct aead_request) + +-- crypto_aead_reqsize(tfm)] +-- __aligned(__alignof__(struct aead_request)); +-- struct aead_request *aead_req = (void *) aead_req_data; +++ + + /* Mask out bits from auth-only-b_0 */ + + b_0[0] &= 0x07; +- +-- memset(aead_req, 0, sizeof(aead_req_data)); +++ + + /* S_0 is used to encrypt T (= MIC) */ + + b_0[14] = 0; + + b_0[15] = 0; + + crypto_cipher_encrypt_one(tfm, s_0, b_0); + +} +- +-- sg_init_table(sg, 3); +-- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); +-- sg_set_buf(&sg[1], data, data_len); +-- sg_set_buf(&sg[2], mic, mic_len); +- +-- aead_request_set_tfm(aead_req, tfm); +-- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); +-- aead_request_set_ad(aead_req, sg[0].length); +++ +++ + +void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, +-+ u8 *data, size_t data_len, u8 *mic, +-+ size_t mic_len) +-+{ ++ u8 *data, size_t data_len, u8 *mic, ++ size_t mic_len) ++ { ++- struct scatterlist sg[3]; + + int i, j, last_len, num_blocks; + + u8 b[AES_BLOCK_SIZE]; + + u8 s_0[AES_BLOCK_SIZE]; + + u8 e[AES_BLOCK_SIZE]; + + u8 *pos, *cpos; +-+ ++ ++- char aead_req_data[sizeof(struct aead_request) + ++- crypto_aead_reqsize(tfm)] ++- __aligned(__alignof__(struct aead_request)); ++- struct aead_request *aead_req = (void *) aead_req_data; + + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); + + last_len = data_len % AES_BLOCK_SIZE; + + aes_ccm_prepare(tfm, b_0, aad, s_0, b, b); +-+ ++ ++- memset(aead_req, 0, sizeof(aead_req_data)); + + /* Process payload blocks */ + + pos = data; + + cpos = data; + + for (j = 1; j <= num_blocks; j++) { + + int blen = (j == num_blocks && last_len) ? + + last_len : AES_BLOCK_SIZE; +-+ ++ ++- sg_init_table(sg, 3); ++- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); ++- sg_set_buf(&sg[1], data, data_len); ++- sg_set_buf(&sg[2], mic, mic_len); + + /* Authentication followed by encryption */ + + for (i = 0; i < blen; i++) + + b[i] ^= pos[i]; + + crypto_cipher_encrypt_one(tfm, b, b); +-+ ++ ++- aead_request_set_tfm(aead_req, tfm); ++- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); ++- aead_request_set_ad(aead_req, sg[0].length); + + b_0[14] = (j >> 8) & 0xff; + + b_0[15] = j & 0xff; + + crypto_cipher_encrypt_one(tfm, e, b_0); +@@ -125,37 +123,30 @@ + - crypto_aead_reqsize(tfm)] + - __aligned(__alignof__(struct aead_request)); + - struct aead_request *aead_req = (void *) aead_req_data; +-- +-- if (data_len == 0) +-- return -EINVAL; +-- +-- memset(aead_req, 0, sizeof(aead_req_data)); +-- +-- sg_init_table(sg, 3); +-- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); +-- sg_set_buf(&sg[1], data, data_len); +-- sg_set_buf(&sg[2], mic, mic_len); +-- +-- aead_request_set_tfm(aead_req, tfm); +-- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0); +-- aead_request_set_ad(aead_req, sg[0].length); + + int i, j, last_len, num_blocks; + + u8 *pos, *cpos; + + u8 a[AES_BLOCK_SIZE]; + + u8 b[AES_BLOCK_SIZE]; + + u8 s_0[AES_BLOCK_SIZE]; +-+ ++ ++- if (data_len == 0) ++- return -EINVAL; + + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); + + last_len = data_len % AES_BLOCK_SIZE; + + aes_ccm_prepare(tfm, b_0, aad, s_0, a, b); +-+ ++ ++- memset(aead_req, 0, sizeof(aead_req_data)); + + /* Process payload blocks */ + + cpos = data; + + pos = data; + + for (j = 1; j <= num_blocks; j++) { + + int blen = (j == num_blocks && last_len) ? + + last_len : AES_BLOCK_SIZE; +-+ ++ ++- sg_init_table(sg, 3); ++- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad)); ++- sg_set_buf(&sg[1], data, data_len); ++- sg_set_buf(&sg[2], mic, mic_len); + + /* Decryption followed by authentication */ + + b_0[14] = (j >> 8) & 0xff; + + b_0[15] = j & 0xff; +@@ -166,7 +157,10 @@ + + } + + crypto_cipher_encrypt_one(tfm, a, a); + + } +-+ ++ ++- aead_request_set_tfm(aead_req, tfm); ++- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0); ++- aead_request_set_ad(aead_req, sg[0].length); + + for (i = 0; i < mic_len; i++) { + + if ((mic[i] ^ s_0[i]) != a[i]) + + return -1; +@@ -185,12 +179,12 @@ + { + - struct crypto_aead *tfm; + - int err; +-+ struct crypto_cipher *tfm; +- ++- + - tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC); + - if (IS_ERR(tfm)) + - return tfm; +-- +++ struct crypto_cipher *tfm; ++ + - err = crypto_aead_setkey(tfm, key, key_len); + - if (err) + - goto free_aead; +@@ -309,7 +303,7 @@ + #endif /* AES_GMAC_H */ + --- a/net/mac80211/key.h + +++ b/net/mac80211/key.h +-@@ -84,7 +84,7 @@ struct ieee80211_key { ++@@ -88,7 +88,7 @@ struct ieee80211_key { + * Management frames. + */ + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN]; +@@ -320,7 +314,7 @@ + struct { + --- a/net/mac80211/wpa.c + +++ b/net/mac80211/wpa.c +-@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee ++@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee + } + + +@@ -330,7 +324,7 @@ + { + __le16 mask_fc; + int a4_included, mgmt; +-@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s ++@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s + else + qos_tid = 0; + +@@ -347,7 +341,7 @@ + + /* Nonce: Nonce Flags | A2 | PN + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7) +-@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s ++@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s + b_0[1] = qos_tid | (mgmt << 4); + memcpy(&b_0[2], hdr->addr2, ETH_ALEN); + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN); +@@ -356,7 +350,7 @@ + + /* AAD (extra authenticate-only data) / masked 802.11 header + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */ +-@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8 ++@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8 + return 0; + + pos += IEEE80211_CCMP_HDR_LEN; +@@ -365,7 +359,7 @@ + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len, + skb_put(skb, mic_len), mic_len); + +-@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee ++@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee + u8 aad[2 * AES_BLOCK_SIZE]; + u8 b_0[AES_BLOCK_SIZE]; + /* hardware didn't decrypt/verify MIC */ +diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch +index d1d9fbd..3ca166f 100644 +--- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch ++++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch +@@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects + + --- a/net/mac80211/cfg.c + +++ b/net/mac80211/cfg.c +-@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph ++@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph + sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; + + __sta_info_flush(sdata, true); +diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch +index 2855a88..3029598 100644 +--- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch ++++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch +@@ -18,7 +18,7 @@ + static int ieee80211_ifa6_changed(struct notifier_block *nb, + unsigned long data, void *arg) + { +-@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802 ++@@ -1089,14 +1089,14 @@ int ieee80211_register_hw(struct ieee802 + + rtnl_unlock(); + +@@ -35,7 +35,7 @@ + local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; + result = register_inet6addr_notifier(&local->ifa6_notifier); + if (result) +-@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802 ++@@ -1105,13 +1105,13 @@ int ieee80211_register_hw(struct ieee802 + + return 0; + +@@ -52,7 +52,7 @@ + fail_ifa: + #endif + rtnl_lock(); +-@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee ++@@ -1139,10 +1139,10 @@ void ieee80211_unregister_hw(struct ieee + tasklet_kill(&local->tx_pending_tasklet); + tasklet_kill(&local->tasklet); + +diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch +index a99cbd2..29f05c4 100644 +--- a/package/kernel/mac80211/patches/210-ap_scan.patch ++++ b/package/kernel/mac80211/patches/210-ap_scan.patch +@@ -1,6 +1,6 @@ + --- a/net/mac80211/cfg.c + +++ b/net/mac80211/cfg.c +-@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy * ++@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy * + * the frames sent while scanning on other channel will be + * lost) + */ +diff --git a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch +index bddb15a..8f7e893 100644 +--- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch ++++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch +@@ -1,17 +1,18 @@ +-From: Felix Fietkau ++From: Felix Fietkau + Date: Sun, 7 Jun 2015 13:53:35 +0200 + Subject: [PATCH] ath9k: force rx_clear when disabling rx + + This makes stopping Rx more reliable and should reduce the frequency of +-Rx related DMA stop warnings ++Rx related DMA stop warnings. Don't use rx_clear in TX99 mode. + + Cc: stable@vger.kernel.org +-Signed-off-by: Felix Fietkau ++Signed-off-by: Felix Fietkau ++Signed-off-by: Helmut Schaa + --- + + --- a/drivers/net/wireless/ath/ath9k/mac.c + +++ b/drivers/net/wireless/ath/ath9k/mac.c +-@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath ++@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath + + ath9k_ani_reset(ah, is_scanning); + +@@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau + void ath9k_hw_abortpcurecv(struct ath_hw *ah) + { + - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS); +-+ REG_SET_BIT(ah, AR_DIAG_SW, +-+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR); +++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT; +++ +++ if (!config_enabled(CPTCFG_ATH9K_TX99)) +++ reg |= AR_DIAG_FORCE_RX_CLEAR; +++ REG_SET_BIT(ah, AR_DIAG_SW, reg); + + ath9k_hw_disable_mib_counters(ah); + } +diff --git a/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch +index a160dc4..358d028 100644 +--- a/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch ++++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch +@@ -1,4 +1,4 @@ +-From: Felix Fietkau ++From: Felix Fietkau + Date: Thu, 2 Jul 2015 15:20:56 +0200 + Subject: [PATCH] ath9k: limit retries for powersave response frames + +@@ -8,7 +8,7 @@ gone to sleep. To avoid wasting too much airtime on this, limit the + number of retries on such frames and ensure that no sample rate gets + used. + +-Signed-off-by: Felix Fietkau ++Signed-off-by: Felix Fietkau + --- + + --- a/drivers/net/wireless/ath/ath9k/xmit.c +diff --git a/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +new file mode 100644 +index 0000000..7caa9be +--- /dev/null ++++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +@@ -0,0 +1,37 @@ ++From: Felix Fietkau ++Date: Sat, 14 May 2016 14:51:02 +0200 ++Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP ++ domain" ++ ++This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. ++--- ++ ++--- a/drivers/net/wireless/ath/ath9k/hw.c +++++ b/drivers/net/wireless/ath/ath9k/hw.c ++@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h ++ { ++ struct ath_regulatory *reg = ath9k_hw_regulatory(ah); ++ struct ieee80211_channel *channel; ++- int chan_pwr, new_pwr; +++ int chan_pwr, new_pwr, max_gain; +++ int ant_gain, ant_reduction = 0; ++ ++ if (!chan) ++ return; ++@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h ++ channel = chan->chan; ++ chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); ++ new_pwr = min_t(int, chan_pwr, reg->power_limit); +++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2; +++ +++ ant_gain = get_antenna_gain(ah, chan); +++ if (ant_gain > max_gain) +++ ant_reduction = ant_gain - max_gain; ++ ++ ah->eep_ops->set_txpower(ah, chan, ++ ath9k_regd_get_ctl(reg, chan), ++- get_antenna_gain(ah, chan), new_pwr, test); +++ ant_reduction, new_pwr, test); ++ } ++ ++ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) +diff --git a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch +deleted file mode 100644 +index 22b987a..0000000 +--- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch ++++ /dev/null +@@ -1,95 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 14 Jan 2016 03:14:03 +0100 +-Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x +- +-Used in some newer TP-Link AR9533 devices. +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c +-+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c +-@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s +- else if (AR_SREV_9340(ah)) +- INIT_INI_ARRAY(&ah->iniModesTxGain, +- ar9340Modes_low_ob_db_tx_gain_table_1p0); +-+ else if (AR_SREV_9531_11(ah)) +-+ INIT_INI_ARRAY(&ah->iniModesTxGain, +-+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table); +- else if (AR_SREV_9485_11_OR_LATER(ah)) +- INIT_INI_ARRAY(&ah->iniModesTxGain, +- ar9485Modes_low_ob_db_tx_gain_1_1); +---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h +-+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h +-@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t +- {0x00016448, 0x6c927a70}, +- }; +- +-+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = { +-+ /* Addr allmodes */ +-+ {0x0000a2dc, 0xfff55592}, +-+ {0x0000a2e0, 0xfff99924}, +-+ {0x0000a2e4, 0xfffe1e00}, +-+ {0x0000a2e8, 0xffffe000}, +-+ {0x0000a410, 0x000050d6}, +-+ {0x0000a500, 0x00000069}, +-+ {0x0000a504, 0x0400006b}, +-+ {0x0000a508, 0x0800006d}, +-+ {0x0000a50c, 0x0c000269}, +-+ {0x0000a510, 0x1000026b}, +-+ {0x0000a514, 0x1400026d}, +-+ {0x0000a518, 0x18000669}, +-+ {0x0000a51c, 0x1c00066b}, +-+ {0x0000a520, 0x1d000a68}, +-+ {0x0000a524, 0x21000a6a}, +-+ {0x0000a528, 0x25000a6c}, +-+ {0x0000a52c, 0x29000a6e}, +-+ {0x0000a530, 0x2d0012a9}, +-+ {0x0000a534, 0x310012ab}, +-+ {0x0000a538, 0x350012ad}, +-+ {0x0000a53c, 0x39001b0a}, +-+ {0x0000a540, 0x3d001b0c}, +-+ {0x0000a544, 0x41001b0e}, +-+ {0x0000a548, 0x43001bae}, +-+ {0x0000a54c, 0x45001914}, +-+ {0x0000a550, 0x47001916}, +-+ {0x0000a554, 0x49001b96}, +-+ {0x0000a558, 0x49001b96}, +-+ {0x0000a55c, 0x49001b96}, +-+ {0x0000a560, 0x49001b96}, +-+ {0x0000a564, 0x49001b96}, +-+ {0x0000a568, 0x49001b96}, +-+ {0x0000a56c, 0x49001b96}, +-+ {0x0000a570, 0x49001b96}, +-+ {0x0000a574, 0x49001b96}, +-+ {0x0000a578, 0x49001b96}, +-+ {0x0000a57c, 0x49001b96}, +-+ {0x0000a600, 0x00000000}, +-+ {0x0000a604, 0x00000000}, +-+ {0x0000a608, 0x00000000}, +-+ {0x0000a60c, 0x00000000}, +-+ {0x0000a610, 0x00000000}, +-+ {0x0000a614, 0x00000000}, +-+ {0x0000a618, 0x00804201}, +-+ {0x0000a61c, 0x01408201}, +-+ {0x0000a620, 0x01408502}, +-+ {0x0000a624, 0x01408502}, +-+ {0x0000a628, 0x01408502}, +-+ {0x0000a62c, 0x01408502}, +-+ {0x0000a630, 0x01408502}, +-+ {0x0000a634, 0x01408502}, +-+ {0x0000a638, 0x01408502}, +-+ {0x0000a63c, 0x01408502}, +-+ {0x0000b2dc, 0xfff55592}, +-+ {0x0000b2e0, 0xfff99924}, +-+ {0x0000b2e4, 0xfffe1e00}, +-+ {0x0000b2e8, 0xffffe000}, +-+ {0x00016044, 0x044922db}, +-+ {0x00016048, 0x6c927a70}, +-+ {0x00016444, 0x044922db}, +-+ {0x00016448, 0x6c927a70}, +-+}; +-+ +- static const u32 qca953x_2p0_baseband_core[][2] = { +- /* Addr allmodes */ +- {0x00009800, 0xafe68e30}, +diff --git a/package/kernel/mac80211/patches/303-mac80211-mesh-flush-mesh-paths-unconditionally.patch b/package/kernel/mac80211/patches/303-mac80211-mesh-flush-mesh-paths-unconditionally.patch +new file mode 100644 +index 0000000..518d0a3 +--- /dev/null ++++ b/package/kernel/mac80211/patches/303-mac80211-mesh-flush-mesh-paths-unconditionally.patch +@@ -0,0 +1,146 @@ ++From: Bob Copeland ++Date: Sun, 15 May 2016 13:19:16 -0400 ++Subject: [PATCH] mac80211: mesh: flush mesh paths unconditionally ++ ++Currently, the mesh paths associated with a nexthop station are cleaned ++up in the following code path: ++ ++ __sta_info_destroy_part1 ++ synchronize_net() ++ __sta_info_destroy_part2 ++ -> cleanup_single_sta ++ -> mesh_sta_cleanup ++ -> mesh_plink_deactivate ++ -> mesh_path_flush_by_nexthop ++ ++However, there are a couple of problems here: ++ ++1) the paths aren't flushed at all if the MPM is running in userspace ++ (e.g. when using wpa_supplicant or authsae) ++ ++2) there is no synchronize_rcu between removing the path and readers ++ accessing the nexthop, which means the following race is possible: ++ ++CPU0 CPU1 ++~~~~ ~~~~ ++ sta_info_destroy_part1() ++ synchronize_net() ++rcu_read_lock() ++mesh_nexthop_resolve() ++ mpath = mesh_path_lookup() ++ [...] -> mesh_path_flush_by_nexthop() ++ sta = rcu_dereference( ++ mpath->next_hop) ++ kfree(sta) ++ access sta <-- CRASH ++ ++Fix both of these by unconditionally flushing paths before destroying ++the sta, and by adding a synchronize_net() after path flush to ensure ++no active readers can still dereference the sta. ++ ++Fixes this crash: ++ ++[ 348.529295] BUG: unable to handle kernel paging request at 00020040 ++[ 348.530014] IP: [] ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211] ++[ 348.530014] *pde = 00000000 ++[ 348.530014] Oops: 0000 [#1] PREEMPT ++[ 348.530014] Modules linked in: drbg ansi_cprng ctr ccm ppp_generic slhc ipt_MASQUERADE nf_nat_masquerade_ipv4 8021q ] ++[ 348.530014] CPU: 0 PID: 20597 Comm: wget Tainted: G O 4.6.0-rc5-wt=V1 #1 ++[ 348.530014] Hardware name: To Be Filled By O.E.M./To be filled by O.E.M., BIOS 080016 11/07/2014 ++[ 348.530014] task: f64fa280 ti: f4f9c000 task.ti: f4f9c000 ++[ 348.530014] EIP: 0060:[] EFLAGS: 00010246 CPU: 0 ++[ 348.530014] EIP is at ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211] ++[ 348.530014] EAX: f4ce63e0 EBX: 00000088 ECX: f3788416 EDX: 00020008 ++[ 348.530014] ESI: 00000000 EDI: 00000088 EBP: f6409a4c ESP: f6409a40 ++[ 348.530014] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068 ++[ 348.530014] CR0: 80050033 CR2: 00020040 CR3: 33190000 CR4: 00000690 ++[ 348.530014] Stack: ++[ 348.530014] 00000000 f4ce63e0 f5f9bd80 f6409a64 f9291d80 0000ce67 f5d51e00 f4ce63e0 ++[ 348.530014] f3788416 f6409a80 f9291dc1 f4ce8320 f4ce63e0 f5d51e00 f4ce63e0 f4ce8320 ++[ 348.530014] f6409a98 f9277f6f 00000000 00000000 0000007c 00000000 f6409b2c f9278dd1 ++[ 348.530014] Call Trace: ++[ 348.530014] [] mesh_nexthop_lookup+0xbb/0xc8 [mac80211] ++[ 348.530014] [] mesh_nexthop_resolve+0x34/0xd8 [mac80211] ++[ 348.530014] [] ieee80211_xmit+0x92/0xc1 [mac80211] ++[ 348.530014] [] __ieee80211_subif_start_xmit+0x807/0x83c [mac80211] ++[ 348.530014] [] ? sch_direct_xmit+0xd7/0x1b3 ++[ 348.530014] [] ? __local_bh_enable_ip+0x5d/0x7b ++[ 348.530014] [] ? nf_nat_ipv4_out+0x4c/0xd0 [nf_nat_ipv4] ++[ 348.530014] [] ? iptable_nat_ipv4_fn+0xf/0xf [iptable_nat] ++[ 348.530014] [] ? netif_skb_features+0x14d/0x30a ++[ 348.530014] [] ieee80211_subif_start_xmit+0xa/0xe [mac80211] ++[ 348.530014] [] dev_hard_start_xmit+0x1f8/0x267 ++[ 348.530014] [] ? validate_xmit_skb.isra.120.part.121+0x10/0x253 ++[ 348.530014] [] sch_direct_xmit+0x8b/0x1b3 ++[ 348.530014] [] __dev_queue_xmit+0x2c8/0x513 ++[ 348.530014] [] dev_queue_xmit+0xa/0xc ++[ 348.530014] [] batadv_send_skb_packet+0xd6/0xec [batman_adv] ++[ 348.530014] [] batadv_send_unicast_skb+0x15/0x4a [batman_adv] ++[ 348.530014] [] batadv_dat_send_data+0x27e/0x310 [batman_adv] ++[ 348.530014] [] ? batadv_tt_global_hash_find.isra.11+0x8/0xa [batman_adv] ++[ 348.530014] [] batadv_dat_snoop_outgoing_arp_request+0x208/0x23d [batman_adv] ++[ 348.530014] [] batadv_interface_tx+0x206/0x385 [batman_adv] ++[ 348.530014] [] dev_hard_start_xmit+0x1f8/0x267 ++[ 348.530014] [] ? validate_xmit_skb.isra.120.part.121+0x10/0x253 ++[ 348.530014] [] sch_direct_xmit+0x8b/0x1b3 ++[ 348.530014] [] __dev_queue_xmit+0x2c8/0x513 ++[ 348.530014] [] ? igb_xmit_frame+0x57/0x72 [igb] ++[ 348.530014] [] dev_queue_xmit+0xa/0xc ++[ 348.530014] [] br_dev_queue_push_xmit+0xeb/0xfb [bridge] ++[ 348.530014] [] br_forward_finish+0x29/0x74 [bridge] ++[ 348.530014] [] ? deliver_clone+0x3b/0x3b [bridge] ++[ 348.530014] [] __br_forward+0x89/0xe7 [bridge] ++[ 348.530014] [] ? br_dev_queue_push_xmit+0xfb/0xfb [bridge] ++[ 348.530014] [] deliver_clone+0x34/0x3b [bridge] ++[ 348.530014] [] ? br_flood+0x95/0x95 [bridge] ++[ 348.530014] [] br_flood+0x77/0x95 [bridge] ++[ 348.530014] [] br_flood_forward+0x13/0x1a [bridge] ++[ 348.530014] [] ? br_flood+0x95/0x95 [bridge] ++[ 348.530014] [] br_handle_frame_finish+0x392/0x3db [bridge] ++[ 348.530014] [] ? nf_iterate+0x2b/0x6b ++[ 348.530014] [] br_handle_frame+0x1e6/0x240 [bridge] ++[ 348.530014] [] ? br_handle_local_finish+0x6a/0x6a [bridge] ++[ 348.530014] [] __netif_receive_skb_core+0x43a/0x66b ++[ 348.530014] [] ? br_handle_frame_finish+0x3db/0x3db [bridge] ++[ 348.530014] [] ? resched_curr+0x19/0x37 ++[ 348.530014] [] ? check_preempt_wakeup+0xbf/0xfe ++[ 348.530014] [] ? ktime_get_with_offset+0x5c/0xfc ++[ 348.530014] [] __netif_receive_skb+0x47/0x55 ++[ 348.530014] [] netif_receive_skb_internal+0x40/0x5a ++[ 348.530014] [] napi_gro_receive+0x3a/0x94 ++[ 348.530014] [] igb_poll+0x6fd/0x9ad [igb] ++[ 348.530014] [] ? swake_up_locked+0x14/0x26 ++[ 348.530014] [] net_rx_action+0xde/0x250 ++[ 348.530014] [] __do_softirq+0x8a/0x163 ++[ 348.530014] [] ? __hrtimer_tasklet_trampoline+0x19/0x19 ++[ 348.530014] [] do_softirq_own_stack+0x26/0x2c ++[ 348.530014] ++[ 348.530014] [] irq_exit+0x31/0x6f ++[ 348.530014] [] do_IRQ+0x8d/0xa0 ++[ 348.530014] [] common_interrupt+0x2c/0x40 ++[ 348.530014] Code: e7 8c 00 66 81 ff 88 00 75 12 85 d2 75 0e b2 c3 b8 83 e9 29 f9 e8 a7 5f f9 c6 eb 74 66 81 e3 8c 005 ++[ 348.530014] EIP: [] ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211] SS:ESP 0068:f6409a40 ++[ 348.530014] CR2: 0000000000020040 ++[ 348.530014] ---[ end trace 48556ac26779732e ]--- ++[ 348.530014] Kernel panic - not syncing: Fatal exception in interrupt ++[ 348.530014] Kernel Offset: disabled ++ ++Cc: stable@vger.kernel.org ++Reported-by: Fred Veldini ++Tested-by: Fred Veldini ++Signed-off-by: Bob Copeland ++--- ++ ++--- a/net/mac80211/mesh.c +++++ b/net/mac80211/mesh.c ++@@ -161,6 +161,10 @@ void mesh_sta_cleanup(struct sta_info *s ++ del_timer_sync(&sta->mesh->plink_timer); ++ } ++ +++ /* make sure no readers can access nexthop sta from here on */ +++ mesh_path_flush_by_nexthop(sta); +++ synchronize_net(); +++ ++ if (changed) ++ ieee80211_mbss_info_change_notify(sdata, changed); ++ } +diff --git a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch +deleted file mode 100644 +index 7bb7435..0000000 +--- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch ++++ /dev/null +@@ -1,156 +0,0 @@ +-From: Eli Cooper +-Date: Thu, 14 Jan 2016 00:07:12 +0800 +-Subject: [PATCH] rt2x00: fix monitor mode regression +- +-Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00 +-has been made effectively useless because the hardware filter is configured to +-drop packets whose intended recipient is not the device, regardless of the +-presence of monitor mode interfaces. +- +-This patch fixes this regression by adding explicit monitor mode support, and +-configuring the hardware filter accordingly. +- +-Signed-off-by: Eli Cooper +---- +- +---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c +-@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru +- !(filter_flags & FIF_PLCPFAIL)); +- rt2x00_set_field32(®, RXCSR0_DROP_CONTROL, +- !(filter_flags & FIF_CONTROL)); +-- rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME, 1); +-+ rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME, +-+ !rt2x00dev->is_monitoring); +- rt2x00_set_field32(®, RXCSR0_DROP_TODS, +-+ !rt2x00dev->is_monitoring && +- !rt2x00dev->intf_ap_count); +- rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1); +- rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); +---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c +-@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru +- !(filter_flags & FIF_PLCPFAIL)); +- rt2x00_set_field32(®, RXCSR0_DROP_CONTROL, +- !(filter_flags & FIF_CONTROL)); +-- rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME, 1); +-+ rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME, +-+ !rt2x00dev->is_monitoring); +- rt2x00_set_field32(®, RXCSR0_DROP_TODS, +-+ !rt2x00dev->is_monitoring && +- !rt2x00dev->intf_ap_count); +- rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1); +- rt2x00_set_field32(®, RXCSR0_DROP_MCAST, +---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c +-@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru +- !(filter_flags & FIF_PLCPFAIL)); +- rt2x00_set_field16(®, TXRX_CSR2_DROP_CONTROL, +- !(filter_flags & FIF_CONTROL)); +-- rt2x00_set_field16(®, TXRX_CSR2_DROP_NOT_TO_ME, 1); +-+ rt2x00_set_field16(®, TXRX_CSR2_DROP_NOT_TO_ME, +-+ !rt2x00dev->is_monitoring); +- rt2x00_set_field16(®, TXRX_CSR2_DROP_TODS, +-+ !rt2x00dev->is_monitoring && +- !rt2x00dev->intf_ap_count); +- rt2x00_set_field16(®, TXRX_CSR2_DROP_VERSION_ERROR, 1); +- rt2x00_set_field16(®, TXRX_CSR2_DROP_MULTICAST, +---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_ +- !(filter_flags & FIF_FCSFAIL)); +- rt2x00_set_field32(®, RX_FILTER_CFG_DROP_PHY_ERROR, +- !(filter_flags & FIF_PLCPFAIL)); +-- rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_TO_ME, 1); +-+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_TO_ME, +-+ !rt2x00dev->is_monitoring); +- rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0); +- rt2x00_set_field32(®, RX_FILTER_CFG_DROP_VER_ERROR, 1); +- rt2x00_set_field32(®, RX_FILTER_CFG_DROP_MULTICAST, +---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -844,11 +844,13 @@ struct rt2x00_dev { +- * - Open sta interface count. +- * - Association count. +- * - Beaconing enabled count. +-+ * - Whether the device is monitoring. +- */ +- unsigned int intf_ap_count; +- unsigned int intf_sta_count; +- unsigned int intf_associated; +- unsigned int intf_beaconing; +-+ bool is_monitoring; +- +- /* +- * Interface combinations +---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c +-@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev +- (ieee80211_flags & IEEE80211_CONF_CHANGE_PS)) +- cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); +- +-+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) { +-+ if (conf->flags & IEEE80211_CONF_MONITOR) { +-+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n"); +-+ rt2x00dev->is_monitoring = true; +-+ } else { +-+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n"); +-+ rt2x00dev->is_monitoring = false; +-+ } +-+ } +-+ +- /* +- * Start configuration. +- */ +---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +-@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r +- rt2x00dev->intf_ap_count = 0; +- rt2x00dev->intf_sta_count = 0; +- rt2x00dev->intf_associated = 0; +-+ rt2x00dev->is_monitoring = false; +- +- /* Enable the radio */ +- retval = rt2x00lib_enable_radio(rt2x00dev); +---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +-@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i +- *total_flags |= FIF_PSPOLL; +- } +- +-- /* +-- * Check if there is any work left for us. +-- */ +-- if (rt2x00dev->packet_filter == *total_flags) +-- return; +- rt2x00dev->packet_filter = *total_flags; +- +- rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags); +---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c +-@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct +- !(filter_flags & FIF_PLCPFAIL)); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL, +- !(filter_flags & (FIF_CONTROL | FIF_PSPOLL))); +-- rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME, 1); +-+ rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME, +-+ !rt2x00dev->is_monitoring); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS, +-+ !rt2x00dev->is_monitoring && +- !rt2x00dev->intf_ap_count); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST, +---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c +-+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c +-@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct +- !(filter_flags & FIF_PLCPFAIL)); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL, +- !(filter_flags & (FIF_CONTROL | FIF_PSPOLL))); +-- rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME, 1); +-+ rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME, +-+ !rt2x00dev->is_monitoring); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS, +-+ !rt2x00dev->is_monitoring && +- !rt2x00dev->intf_ap_count); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1); +- rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST, +diff --git a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch +deleted file mode 100644 +index 049059a..0000000 +--- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch ++++ /dev/null +@@ -1,32 +0,0 @@ +-From: Miaoqing Pan +-Date: Fri, 15 Jan 2016 18:17:17 +0800 +-Subject: [PATCH] ath9k: avoid ANI restart if no trigger +- +-Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters") +- +-Call ath9k_ani_restart() only when the phy error rate reach the +-ANI immunity threshold. Sync the logic with internal code base. +- +-Signed-off-by: Miaoqing Pan +---- +- +---- a/drivers/net/wireless/ath/ath9k/ani.c +-+++ b/drivers/net/wireless/ath/ath9k/ani.c +-@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw +- ofdmPhyErrRate < ah->config.ofdm_trig_low) { +- ath9k_hw_ani_lower_immunity(ah); +- aniState->ofdmsTurn = !aniState->ofdmsTurn; +-+ ath9k_ani_restart(ah); +- } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) { +- ath9k_hw_ani_ofdm_err_trigger(ah); +- aniState->ofdmsTurn = false; +-+ ath9k_ani_restart(ah); +- } else if (cckPhyErrRate > ah->config.cck_trig_high) { +- ath9k_hw_ani_cck_err_trigger(ah); +- aniState->ofdmsTurn = true; +-+ ath9k_ani_restart(ah); +- } +-- ath9k_ani_restart(ah); +- } +- } +- EXPORT_SYMBOL(ath9k_hw_ani_monitor); +diff --git a/package/kernel/mac80211/patches/304-mac80211-fix-fast_tx-header-alignment.patch b/package/kernel/mac80211/patches/304-mac80211-fix-fast_tx-header-alignment.patch +new file mode 100644 +index 0000000..6316d81 +--- /dev/null ++++ b/package/kernel/mac80211/patches/304-mac80211-fix-fast_tx-header-alignment.patch +@@ -0,0 +1,25 @@ ++From: Felix Fietkau ++Date: Thu, 19 May 2016 17:32:13 +0200 ++Subject: [PATCH] mac80211: fix fast_tx header alignment ++ ++The header field is defined as u8[] but also accessed as struct ++ieee80211_hdr. Enforce an alignment of 2 to prevent unnecessary ++unaligned accesses, which can be very harmful for performance on many ++platforms. ++ ++Fixes: e495c24731a2 ("mac80211: extend fast-xmit for more ciphers") ++Cc: stable@vger.kernel.org ++Signed-off-by: Felix Fietkau ++--- ++ ++--- a/net/mac80211/sta_info.h +++++ b/net/mac80211/sta_info.h ++@@ -280,7 +280,7 @@ struct ieee80211_fast_tx { ++ u8 sa_offs, da_offs, pn_offs; ++ u8 band; ++ u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + ++- sizeof(rfc1042_header)]; +++ sizeof(rfc1042_header)] __aligned(2); ++ ++ struct rcu_head rcu_head; ++ }; +diff --git a/package/kernel/mac80211/patches/305-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch b/package/kernel/mac80211/patches/305-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch +new file mode 100644 +index 0000000..73accd8 +--- /dev/null ++++ b/package/kernel/mac80211/patches/305-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch +@@ -0,0 +1,21 @@ ++From: Ben Greear ++Date: Fri, 1 Apr 2016 14:12:08 -0700 ++Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning ++ htt-tx. ++ ++Otherwise, the txrx-compl-task may access some bad memory? ++ ++Signed-off-by: Ben Greear ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c ++@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht ++ { ++ int size; ++ +++ tasklet_kill(&htt->txrx_compl_task); +++ ++ idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); ++ idr_destroy(&htt->pending_tx); ++ +diff --git a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch +deleted file mode 100644 +index a1ac67c..0000000 +--- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch ++++ /dev/null +@@ -1,91 +0,0 @@ +-From: Miaoqing Pan +-Date: Fri, 15 Jan 2016 18:17:18 +0800 +-Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking +- +-commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel") +-removed per-channel handling, the code to check 'curchan' also +-should be removed as never used. +- +-Signed-off-by: Miaoqing Pan +---- +- +---- a/drivers/net/wireless/ath/ath9k/ani.c +-+++ b/drivers/net/wireless/ath/ath9k/ani.c +-@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str +- +- static void ath9k_ani_restart(struct ath_hw *ah) +- { +-- struct ar5416AniState *aniState; +-- +-- if (!ah->curchan) +-- return; +-+ struct ar5416AniState *aniState = &ah->ani; +- +-- aniState = &ah->ani; +- aniState->listenTime = 0; +- +- ENABLE_REGWRITE_BUFFER(ah); +-@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct +- +- static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) +- { +-- struct ar5416AniState *aniState; +-- +-- if (!ah->curchan) +-- return; +-- +-- aniState = &ah->ani; +-+ struct ar5416AniState *aniState = &ah->ani; +- +- if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL) +- ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false); +-@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct +- +- static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) +- { +-- struct ar5416AniState *aniState; +-- +-- if (!ah->curchan) +-- return; +-- +-- aniState = &ah->ani; +-+ struct ar5416AniState *aniState = &ah->ani; +- +- if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL) +- ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1, +-@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger +- */ +- static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) +- { +-- struct ar5416AniState *aniState; +-- +-- aniState = &ah->ani; +-+ struct ar5416AniState *aniState = &ah->ani; +- +- /* lower OFDM noise immunity */ +- if (aniState->ofdmNoiseImmunityLevel > 0 && +-@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah, +- struct ath_common *common = ath9k_hw_common(ah); +- int ofdm_nil, cck_nil; +- +-- if (!ah->curchan) +-+ if (!chan) +- return; +- +- BUG_ON(aniState == NULL); +-@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s +- +- void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan) +- { +-- struct ar5416AniState *aniState; +-+ struct ar5416AniState *aniState = &ah->ani; +- struct ath_common *common = ath9k_hw_common(ah); +- u32 ofdmPhyErrRate, cckPhyErrRate; +- +-- if (!ah->curchan) +-- return; +-- +-- aniState = &ah->ani; +- if (!ath9k_hw_ani_read_counters(ah)) +- return; +- +diff --git a/package/kernel/mac80211/patches/306-ath10k-Ensure-peer_map-references-are-cleaned-up.patch b/package/kernel/mac80211/patches/306-ath10k-Ensure-peer_map-references-are-cleaned-up.patch +new file mode 100644 +index 0000000..2979b4b +--- /dev/null ++++ b/package/kernel/mac80211/patches/306-ath10k-Ensure-peer_map-references-are-cleaned-up.patch +@@ -0,0 +1,60 @@ ++From: Ben Greear ++Date: Fri, 1 Apr 2016 14:12:09 -0700 ++Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up. ++ ++While debugging OS crashes due to firmware crashes, I enabled ++kasan, and it noticed that peer objects were being used-after-freed. ++ ++Looks like there are two places we could be leaving stale references ++in the peer-map, so clean that up. ++ ++Signed-off-by: Ben Greear ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/mac.c +++++ b/drivers/net/wireless/ath/ath10k/mac.c ++@@ -773,6 +773,7 @@ static void ath10k_peer_cleanup(struct a ++ { ++ struct ath10k_peer *peer, *tmp; ++ int peer_id; +++ int i; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++@@ -789,6 +790,17 @@ static void ath10k_peer_cleanup(struct a ++ ar->peer_map[peer_id] = NULL; ++ } ++ +++ /* Double check that peer is properly un-referenced from +++ * the peer_map +++ */ +++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { +++ if (ar->peer_map[i] == peer) { +++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n", +++ peer->addr, peer, i); +++ ar->peer_map[i] = NULL; +++ } +++ } +++ ++ list_del(&peer->list); ++ kfree(peer); ++ ar->num_peers--; ++@@ -799,6 +811,7 @@ static void ath10k_peer_cleanup(struct a ++ static void ath10k_peer_cleanup_all(struct ath10k *ar) ++ { ++ struct ath10k_peer *peer, *tmp; +++ int i; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++@@ -807,6 +820,10 @@ static void ath10k_peer_cleanup_all(stru ++ list_del(&peer->list); ++ kfree(peer); ++ } +++ +++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) +++ ar->peer_map[i] = NULL; +++ ++ spin_unlock_bh(&ar->data_lock); ++ ++ ar->num_peers = 0; +diff --git a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch +deleted file mode 100644 +index cf8194a..0000000 +--- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch ++++ /dev/null +@@ -1,31 +0,0 @@ +-From: Miaoqing Pan +-Date: Fri, 15 Jan 2016 18:17:19 +0800 +-Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561 +- +-BB panic(0x4000409) observed while AP enabling/disabling +-bursting. +- +-Signed-off-by: Miaoqing Pan +---- +- +---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +-+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c +-@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath +- * to be disabled. +- * +- * 0x04000409: Packet stuck on receive. +-- * Full chip reset is required for all chips except AR9340. +-+ * Full chip reset is required for all chips except +-+ * AR9340, AR9531 and AR9561. +- */ +- +- /* +-@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct +- case 0x04000b09: +- return true; +- case 0x04000409: +-- if (AR_SREV_9340(ah) || AR_SREV_9531(ah)) +-+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) +- return false; +- else +- return true; +diff --git a/package/kernel/mac80211/patches/307-ath10k-Clean-up-peer-when-sta-goes-away.patch b/package/kernel/mac80211/patches/307-ath10k-Clean-up-peer-when-sta-goes-away.patch +new file mode 100644 +index 0000000..f814ae7 +--- /dev/null ++++ b/package/kernel/mac80211/patches/307-ath10k-Clean-up-peer-when-sta-goes-away.patch +@@ -0,0 +1,32 @@ ++From: Ben Greear ++Date: Fri, 1 Apr 2016 14:12:11 -0700 ++Subject: [PATCH] ath10k: Clean up peer when sta goes away. ++ ++If WMI and/or firmware has issues removing the peer object, ++then we still need to clean up the peer object in the driver. ++ ++Signed-off-by: Ben Greear ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/mac.c +++++ b/drivers/net/wireless/ath/ath10k/mac.c ++@@ -5949,9 +5949,17 @@ static int ath10k_sta_state(struct ieee8 ++ continue; ++ ++ if (peer->sta == sta) { ++- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n", ++- sta->addr, arvif->vdev_id); +++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n", +++ sta->addr, peer, i, arvif->vdev_id); ++ peer->sta = NULL; +++ +++ /* Clean up the peer object as well since we +++ * must have failed to do this above. +++ */ +++ list_del(&peer->list); +++ ar->peer_map[i] = NULL; +++ kfree(peer); +++ ar->num_peers--; ++ } ++ } ++ spin_unlock_bh(&ar->data_lock); +diff --git a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch +deleted file mode 100644 +index 80b781c..0000000 +--- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch ++++ /dev/null +@@ -1,27 +0,0 @@ +-From: Miaoqing Pan +-Date: Fri, 15 Jan 2016 18:17:20 +0800 +-Subject: [PATCH] ath9k: fix inconsistent use of tab and space in +- indentation +- +-Minor changes for indenting. +- +-Signed-off-by: Miaoqing Pan +---- +- +---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +-+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +-@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact +- AR9300_PAPRD_SCALE_1); +- else { +- if (chan->channel >= 5700) +-- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20), +-- AR9300_PAPRD_SCALE_1); +-+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20), +-+ AR9300_PAPRD_SCALE_1); +- else if (chan->channel >= 5400) +- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40), +-- AR9300_PAPRD_SCALE_2); +-+ AR9300_PAPRD_SCALE_2); +- else +- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40), +- AR9300_PAPRD_SCALE_1); +diff --git a/package/kernel/mac80211/patches/308-ath10k-remove-duplicate-and-unused-rx-rate-flags.patch b/package/kernel/mac80211/patches/308-ath10k-remove-duplicate-and-unused-rx-rate-flags.patch +new file mode 100644 +index 0000000..7c5c5be +--- /dev/null ++++ b/package/kernel/mac80211/patches/308-ath10k-remove-duplicate-and-unused-rx-rate-flags.patch +@@ -0,0 +1,66 @@ ++From: Mohammed Shafi Shajakhan ++Date: Thu, 2 Jun 2016 19:54:41 +0530 ++Subject: [PATCH] ath10k: remove duplicate and unused rx rate flags ++ ++All these flags are not used and their use is completely ++covered by 'ath10k_hw_rate_ofdm', 'ath10k_hw_rate_cck', ++and RX_PPDU_START_RATE_FLAG ++ ++Signed-off-by: Mohammed Shafi Shajakhan ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/rx_desc.h +++++ b/drivers/net/wireless/ath/ath10k/rx_desc.h ++@@ -656,26 +656,6 @@ struct rx_msdu_end { ++ * Reserved: HW should fill with zero. FW should ignore. ++ */ ++ ++-#define RX_PPDU_START_SIG_RATE_SELECT_OFDM 0 ++-#define RX_PPDU_START_SIG_RATE_SELECT_CCK 1 ++- ++-#define RX_PPDU_START_SIG_RATE_OFDM_48 0 ++-#define RX_PPDU_START_SIG_RATE_OFDM_24 1 ++-#define RX_PPDU_START_SIG_RATE_OFDM_12 2 ++-#define RX_PPDU_START_SIG_RATE_OFDM_6 3 ++-#define RX_PPDU_START_SIG_RATE_OFDM_54 4 ++-#define RX_PPDU_START_SIG_RATE_OFDM_36 5 ++-#define RX_PPDU_START_SIG_RATE_OFDM_18 6 ++-#define RX_PPDU_START_SIG_RATE_OFDM_9 7 ++- ++-#define RX_PPDU_START_SIG_RATE_CCK_LP_11 0 ++-#define RX_PPDU_START_SIG_RATE_CCK_LP_5_5 1 ++-#define RX_PPDU_START_SIG_RATE_CCK_LP_2 2 ++-#define RX_PPDU_START_SIG_RATE_CCK_LP_1 3 ++-#define RX_PPDU_START_SIG_RATE_CCK_SP_11 4 ++-#define RX_PPDU_START_SIG_RATE_CCK_SP_5_5 5 ++-#define RX_PPDU_START_SIG_RATE_CCK_SP_2 6 ++- ++ #define HTT_RX_PPDU_START_PREAMBLE_LEGACY 0x04 ++ #define HTT_RX_PPDU_START_PREAMBLE_HT 0x08 ++ #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF 0x09 ++@@ -711,25 +691,6 @@ struct rx_msdu_end { ++ /* No idea what this flag means. It seems to be always set in rate. */ ++ #define RX_PPDU_START_RATE_FLAG BIT(3) ++ ++-enum rx_ppdu_start_rate { ++- RX_PPDU_START_RATE_OFDM_48M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_48M, ++- RX_PPDU_START_RATE_OFDM_24M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_24M, ++- RX_PPDU_START_RATE_OFDM_12M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_12M, ++- RX_PPDU_START_RATE_OFDM_6M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_6M, ++- RX_PPDU_START_RATE_OFDM_54M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_54M, ++- RX_PPDU_START_RATE_OFDM_36M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_36M, ++- RX_PPDU_START_RATE_OFDM_18M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_18M, ++- RX_PPDU_START_RATE_OFDM_9M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_9M, ++- ++- RX_PPDU_START_RATE_CCK_LP_11M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_11M, ++- RX_PPDU_START_RATE_CCK_LP_5_5M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_5_5M, ++- RX_PPDU_START_RATE_CCK_LP_2M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_2M, ++- RX_PPDU_START_RATE_CCK_LP_1M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_1M, ++- RX_PPDU_START_RATE_CCK_SP_11M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_11M, ++- RX_PPDU_START_RATE_CCK_SP_5_5M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_5_5M, ++- RX_PPDU_START_RATE_CCK_SP_2M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_2M, ++-}; ++- ++ struct rx_ppdu_start { ++ struct { ++ u8 pri20_mhz; +diff --git a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch +deleted file mode 100644 +index d408866..0000000 +--- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch ++++ /dev/null +@@ -1,65 +0,0 @@ +-From: Miaoqing Pan +-Date: Fri, 15 Jan 2016 18:17:21 +0800 +-Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580 +- +-One crash issue be found on ar9300: RTC_RC reg read leads crash, leading +-the data bus error, due to RTC_RC reg write not happen properly. +- +-Warm Reset trigger in continuous beacon stuck for one of the customer for +-other chip, noticed the MAC was stuck in RTC reset. After analysis noticed +-DMA did not complete when RTC was put in reset. +- +-So, before resetting the MAC need to make sure there are no pending DMA +-transactions because this reset does not reset all parts of the chip. +- +-The 12th and 11th bit of MAC _DMA_CFG register used to do that. +- 12 cfg_halt_ack 0x0 +- 0 DMA has not yet halted +- 1 DMA has halted +- 11 cfg_halt_req 0x0 +- 0 DMA logic operates normally +- 1 Request DMA logic to stop so software can reset the MAC +- +-The Bit [12] of this register indicates when the halt has taken effect or +-not. the DMA halt IS NOT recoverable; once software sets bit [11] to +-request a DMA halt, software must wait for bit [12] to be set and reset +-the MAC. +- +-So, the same thing we implemented for ar9580 chip. +- +-Signed-off-by: Miaoqing Pan +---- +- +---- a/drivers/net/wireless/ath/ath9k/hw.c +-+++ b/drivers/net/wireless/ath/ath9k/hw.c +-@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at +- if (ath9k_hw_mci_is_enabled(ah)) +- ar9003_mci_check_gpm_offset(ah); +- +-+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during +-+ * RTC_RC reg read +-+ */ +-+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) { +-+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); +-+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK, +-+ 20 * AH_WAIT_TIMEOUT); +-+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); +-+ } +-+ +- REG_WRITE(ah, AR_RTC_RC, rst_flags); +- +- REGWRITE_BUFFER_FLUSH(ah); +---- a/drivers/net/wireless/ath/ath9k/reg.h +-+++ b/drivers/net/wireless/ath/ath9k/reg.h +-@@ -34,8 +34,10 @@ +- #define AR_CFG_SWRG 0x00000010 +- #define AR_CFG_AP_ADHOC_INDICATION 0x00000020 +- #define AR_CFG_PHOK 0x00000100 +--#define AR_CFG_CLK_GATE_DIS 0x00000400 +- #define AR_CFG_EEBS 0x00000200 +-+#define AR_CFG_CLK_GATE_DIS 0x00000400 +-+#define AR_CFG_HALT_REQ 0x00000800 +-+#define AR_CFG_HALT_ACK 0x00001000 +- #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000 +- #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17 +- +diff --git a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch b/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch +deleted file mode 100644 +index d9511c8..0000000 +--- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch ++++ /dev/null +@@ -1,19 +0,0 @@ +-From: Felix Fietkau +-Date: Fri, 15 Jan 2016 15:59:45 +0100 +-Subject: [PATCH] brcmfmac: add missing include +- +-linux/module.h is required for defining module parameters +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +-@@ -17,6 +17,7 @@ +- #include +- #include +- #include +-+#include +- #include +- #include +- #include "core.h" +diff --git a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch b/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch +deleted file mode 100644 +index 711e019..0000000 +--- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch ++++ /dev/null +@@ -1,118 +0,0 @@ +-From: Hante Meuleman +-Date: Tue, 19 Jan 2016 12:39:24 +0100 +-Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash +- +-With commit 7d34b0560567 ("brcmfmac: Move all module parameters to +-one place") a bug was introduced causing a null pointer exception. +-This patch fixes the bug by initializing the sg table till after +-the settings have been initialized. +- +-Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place") +-Reported-by: Marc Zyngier +-Tested-by: Marc Zyngier +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Franky (Zhenhui) Lin +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +-@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_ +- return 0; +- } +- +--static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) +-+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) +- { +-+ struct sdio_func *func; +-+ struct mmc_host *host; +-+ uint max_blocks; +- uint nents; +- int err; +- +-+ func = sdiodev->func[2]; +-+ host = func->card->host; +-+ sdiodev->sg_support = host->max_segs > 1; +-+ max_blocks = min_t(uint, host->max_blk_count, 511u); +-+ sdiodev->max_request_size = min_t(uint, host->max_req_size, +-+ max_blocks * func->cur_blksize); +-+ sdiodev->max_segment_count = min_t(uint, host->max_segs, +-+ SG_MAX_SINGLE_ALLOC); +-+ sdiodev->max_segment_size = host->max_seg_size; +-+ +- if (!sdiodev->sg_support) +- return; +- +-@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc +- +- static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) +- { +-- struct sdio_func *func; +-- struct mmc_host *host; +-- uint max_blocks; +- int ret = 0; +- +- sdiodev->num_funcs = 2; +-@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm +- goto out; +- } +- +-- /* +-- * determine host related variables after brcmf_sdiod_probe() +-- * as func->cur_blksize is properly set and F2 init has been +-- * completed successfully. +-- */ +-- func = sdiodev->func[2]; +-- host = func->card->host; +-- sdiodev->sg_support = host->max_segs > 1; +-- max_blocks = min_t(uint, host->max_blk_count, 511u); +-- sdiodev->max_request_size = min_t(uint, host->max_req_size, +-- max_blocks * func->cur_blksize); +-- sdiodev->max_segment_count = min_t(uint, host->max_segs, +-- SG_MAX_SINGLE_ALLOC); +-- sdiodev->max_segment_size = host->max_seg_size; +-- +-- /* allocate scatter-gather table. sg support +-- * will be disabled upon allocation failure. +-- */ +-- brcmf_sdiod_sgtable_alloc(sdiodev); +-- +- ret = brcmf_sdiod_freezer_attach(sdiodev); +- if (ret) +- goto out; +-@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm +- ret = -ENODEV; +- goto out; +- } +-- brcmf_sdiod_host_fixup(host); +-+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host); +- out: +- if (ret) +- brcmf_sdiod_remove(sdiodev); +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +-@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru +- goto fail; +- } +- +-+ /* allocate scatter-gather table. sg support +-+ * will be disabled upon allocation failure. +-+ */ +-+ brcmf_sdiod_sgtable_alloc(bus->sdiodev); +-+ +- /* Query the F2 block size, set roundup accordingly */ +- bus->blocksize = bus->sdiodev->func[2]->cur_blksize; +- bus->roundup = min(max_roundup, bus->blocksize); +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +-@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_ +- +- /* Issue an abort to the specified function */ +- int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn); +-+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev); +- void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev, +- enum brcmf_sdiod_state state); +- #ifdef CONFIG_PM_SLEEP +diff --git a/package/kernel/mac80211/patches/309-ath10k-fix-CCK-h-w-rates-for-QCA99X0-and-newer-chips.patch b/package/kernel/mac80211/patches/309-ath10k-fix-CCK-h-w-rates-for-QCA99X0-and-newer-chips.patch +new file mode 100644 +index 0000000..50ebfce +--- /dev/null ++++ b/package/kernel/mac80211/patches/309-ath10k-fix-CCK-h-w-rates-for-QCA99X0-and-newer-chips.patch +@@ -0,0 +1,141 @@ ++From: Mohammed Shafi Shajakhan ++Date: Thu, 2 Jun 2016 19:54:42 +0530 ++Subject: [PATCH] ath10k: fix CCK h/w rates for QCA99X0 and newer chipsets ++ ++CCK hardware table mapping from QCA99X0 onwards got revised. ++The CCK hardware rate values are in a proper order wrt. to ++rate and preamble as below ++ ++ATH10K_HW_RATE_REV2_CCK_LP_1M = 1, ++ATH10K_HW_RATE_REV2_CCK_LP_2M = 2, ++ATH10K_HW_RATE_REV2_CCK_LP_5_5M = 3, ++ATH10K_HW_RATE_REV2_CCK_LP_11M = 4, ++ATH10K_HW_RATE_REV2_CCK_SP_2M = 5, ++ATH10K_HW_RATE_REV2_CCK_SP_5_5M = 6, ++ATH10K_HW_RATE_REV2_CCK_SP_11M = 7, ++ ++This results in reporting of rx frames (with CCK rates) ++totally wrong for QCA99X0, QCA4019. Fix this by having ++separate CCK rate table for these chipsets with rev2 suffix ++and registering the correct rate mapping to mac80211 based on ++the new hw_param (introduced) 'cck_rate_map_rev2' which shall ++be true for any newchipsets from QCA99X0 onwards ++ ++Signed-off-by: Mohammed Shafi Shajakhan ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/core.c +++++ b/drivers/net/wireless/ath/ath10k/core.c ++@@ -148,6 +148,8 @@ static const struct ath10k_hw_params ath ++ .uart_pin = 7, ++ .otp_exe_param = 0x00000700, ++ .continuous_frag_desc = true, +++ .cck_rate_map_rev2 = true, +++ .cck_rate_map_rev2 = true, ++ .channel_counters_freq_hz = 150000, ++ .max_probe_resp_desc_thres = 24, ++ .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE, ++@@ -205,6 +207,7 @@ static const struct ath10k_hw_params ath ++ .has_shifted_cc_wraparound = true, ++ .otp_exe_param = 0x0010000, ++ .continuous_frag_desc = true, +++ .cck_rate_map_rev2 = true, ++ .channel_counters_freq_hz = 125000, ++ .max_probe_resp_desc_thres = 24, ++ .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE, ++--- a/drivers/net/wireless/ath/ath10k/core.h +++++ b/drivers/net/wireless/ath/ath10k/core.h ++@@ -716,6 +716,12 @@ struct ath10k { ++ */ ++ bool continuous_frag_desc; ++ +++ /* CCK hardware rate table mapping for the newer chipsets +++ * like QCA99X0, QCA4019 got revised. The CCK h/w rate values +++ * are in a proper order with respect to the rate/preamble +++ */ +++ bool cck_rate_map_rev2; +++ ++ u32 channel_counters_freq_hz; ++ ++ /* Mgmt tx descriptors threshold for limiting probe response ++--- a/drivers/net/wireless/ath/ath10k/hw.h +++++ b/drivers/net/wireless/ath/ath10k/hw.h ++@@ -315,6 +315,16 @@ enum ath10k_hw_rate_cck { ++ ATH10K_HW_RATE_CCK_SP_2M, ++ }; ++ +++enum ath10k_hw_rate_rev2_cck { +++ ATH10K_HW_RATE_REV2_CCK_LP_1M = 1, +++ ATH10K_HW_RATE_REV2_CCK_LP_2M, +++ ATH10K_HW_RATE_REV2_CCK_LP_5_5M, +++ ATH10K_HW_RATE_REV2_CCK_LP_11M, +++ ATH10K_HW_RATE_REV2_CCK_SP_2M, +++ ATH10K_HW_RATE_REV2_CCK_SP_5_5M, +++ ATH10K_HW_RATE_REV2_CCK_SP_11M, +++}; +++ ++ enum ath10k_hw_4addr_pad { ++ ATH10K_HW_4ADDR_PAD_AFTER, ++ ATH10K_HW_4ADDR_PAD_BEFORE, ++--- a/drivers/net/wireless/ath/ath10k/mac.c +++++ b/drivers/net/wireless/ath/ath10k/mac.c ++@@ -62,6 +62,32 @@ static struct ieee80211_rate ath10k_rate ++ { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M }, ++ }; ++ +++static struct ieee80211_rate ath10k_rates_rev2[] = { +++ { .bitrate = 10, +++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_1M }, +++ { .bitrate = 20, +++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_2M, +++ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_2M, +++ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, +++ { .bitrate = 55, +++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_5_5M, +++ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_5_5M, +++ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, +++ { .bitrate = 110, +++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_11M, +++ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_11M, +++ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, +++ +++ { .bitrate = 60, .hw_value = ATH10K_HW_RATE_OFDM_6M }, +++ { .bitrate = 90, .hw_value = ATH10K_HW_RATE_OFDM_9M }, +++ { .bitrate = 120, .hw_value = ATH10K_HW_RATE_OFDM_12M }, +++ { .bitrate = 180, .hw_value = ATH10K_HW_RATE_OFDM_18M }, +++ { .bitrate = 240, .hw_value = ATH10K_HW_RATE_OFDM_24M }, +++ { .bitrate = 360, .hw_value = ATH10K_HW_RATE_OFDM_36M }, +++ { .bitrate = 480, .hw_value = ATH10K_HW_RATE_OFDM_48M }, +++ { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M }, +++}; +++ ++ #define ATH10K_MAC_FIRST_OFDM_RATE_IDX 4 ++ ++ #define ath10k_a_rates (ath10k_rates + ATH10K_MAC_FIRST_OFDM_RATE_IDX) ++@@ -70,6 +96,9 @@ static struct ieee80211_rate ath10k_rate ++ #define ath10k_g_rates (ath10k_rates + 0) ++ #define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates)) ++ +++#define ath10k_g_rates_rev2 (ath10k_rates_rev2 + 0) +++#define ath10k_g_rates_rev2_size (ARRAY_SIZE(ath10k_rates_rev2)) +++ ++ static bool ath10k_mac_bitrate_is_cck(int bitrate) ++ { ++ switch (bitrate) { ++@@ -7720,8 +7749,14 @@ int ath10k_mac_register(struct ath10k *a ++ band = &ar->mac.sbands[NL80211_BAND_2GHZ]; ++ band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels); ++ band->channels = channels; ++- band->n_bitrates = ath10k_g_rates_size; ++- band->bitrates = ath10k_g_rates; +++ +++ if (ar->hw_params.cck_rate_map_rev2) { +++ band->n_bitrates = ath10k_g_rates_rev2_size; +++ band->bitrates = ath10k_g_rates_rev2; +++ } else { +++ band->n_bitrates = ath10k_g_rates_size; +++ band->bitrates = ath10k_g_rates; +++ } ++ ++ ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; ++ } +diff --git a/package/kernel/mac80211/patches/310-ath10k-improve-tx-scheduling.patch b/package/kernel/mac80211/patches/310-ath10k-improve-tx-scheduling.patch +new file mode 100644 +index 0000000..81ac2db +--- /dev/null ++++ b/package/kernel/mac80211/patches/310-ath10k-improve-tx-scheduling.patch +@@ -0,0 +1,67 @@ ++From: Michal Kazior ++Date: Mon, 23 May 2016 23:12:45 +0300 ++Subject: [PATCH] ath10k: improve tx scheduling ++ ++Recent changes revolving around implementing ++wake_tx_queue support introduced a significant ++performance regressions on some (slower, uni-proc) ++systems. ++ ++Signed-off-by: Michal Kazior ++Signed-off-by: Kalle Valo ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -2291,7 +2291,6 @@ bool ath10k_htt_t2h_msg_handler(struct a ++ ath10k_htt_tx_mgmt_dec_pending(htt); ++ spin_unlock_bh(&htt->tx_lock); ++ } ++- ath10k_mac_tx_push_pending(ar); ++ break; ++ } ++ case HTT_T2H_MSG_TYPE_TX_COMPL_IND: ++@@ -2442,8 +2441,6 @@ static void ath10k_htt_txrx_compl_task(u ++ dev_kfree_skb_any(skb); ++ } ++ ++- ath10k_mac_tx_push_pending(ar); ++- ++ num_mpdus = atomic_read(&htt->num_mpdus_ready); ++ ++ while (num_mpdus) { ++--- a/drivers/net/wireless/ath/ath10k/mac.c +++++ b/drivers/net/wireless/ath/ath10k/mac.c ++@@ -3827,6 +3827,9 @@ void ath10k_mac_tx_push_pending(struct a ++ int ret; ++ int max; ++ +++ if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) +++ return; +++ ++ spin_lock_bh(&ar->txqs_lock); ++ rcu_read_lock(); ++ ++@@ -4097,9 +4100,7 @@ static void ath10k_mac_op_wake_tx_queue( ++ list_add_tail(&artxq->list, &ar->txqs); ++ spin_unlock_bh(&ar->txqs_lock); ++ ++- if (ath10k_mac_tx_can_push(hw, txq)) ++- tasklet_schedule(&ar->htt.txrx_compl_task); ++- +++ ath10k_mac_tx_push_pending(ar); ++ ath10k_htt_tx_txq_update(hw, txq); ++ } ++ ++--- a/drivers/net/wireless/ath/ath10k/txrx.c +++++ b/drivers/net/wireless/ath/ath10k/txrx.c ++@@ -117,6 +117,9 @@ int ath10k_txrx_tx_unref(struct ath10k_h ++ ++ ieee80211_tx_status(htt->ar->hw, msdu); ++ /* we do not own the msdu anymore */ +++ +++ ath10k_mac_tx_push_pending(ar); +++ ++ return 0; ++ } ++ +diff --git a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch +deleted file mode 100644 +index 287d6e1..0000000 +--- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch ++++ /dev/null +@@ -1,38 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 21 Jan 2016 16:28:44 +0100 +-Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices +- +-Many AR913x based devices (maybe others too) do not have a valid EEPROM +-magic in their calibration data partition. +- +-Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping") +-Signed-off-by: Felix Fietkau +---- +- +---- a/drivers/net/wireless/ath/ath9k/eeprom.c +-+++ b/drivers/net/wireless/ath/ath9k/eeprom.c +-@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_ +- return -EIO; +- } +- +-- if (magic == AR5416_EEPROM_MAGIC) { +-- *swap_needed = false; +-- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) { +-+ *swap_needed = false; +-+ if (swab16(magic) == AR5416_EEPROM_MAGIC) { +- if (ah->ah_flags & AH_NO_EEP_SWAP) { +- ath_info(common, +- "Ignoring endianness difference in EEPROM magic bytes.\n"); +-- +-- *swap_needed = false; +- } else { +- *swap_needed = true; +- } +-- } else { +-+ } else if (magic != AR5416_EEPROM_MAGIC) { +-+ if (ath9k_hw_use_flash(ah)) +-+ return 0; +-+ +- ath_err(common, +- "Invalid EEPROM Magic (0x%04x).\n", magic); +- return -EINVAL; +diff --git a/package/kernel/mac80211/patches/311-ath10k-fix-deadlock-while-processing-rx_in_ord_ind.patch b/package/kernel/mac80211/patches/311-ath10k-fix-deadlock-while-processing-rx_in_ord_ind.patch +new file mode 100644 +index 0000000..3664d70 +--- /dev/null ++++ b/package/kernel/mac80211/patches/311-ath10k-fix-deadlock-while-processing-rx_in_ord_ind.patch +@@ -0,0 +1,59 @@ ++From: Rajkumar Manoharan ++Date: Thu, 9 Jun 2016 11:33:55 +0530 ++Subject: [PATCH] ath10k: fix deadlock while processing rx_in_ord_ind ++ ++commit 5c86d97bcc1d ("ath10k: combine txrx and replenish task") ++introduced deadlock while processing rx in order indication message ++for qca6174 based devices. While merging replenish and txrx tasklets, ++replenish task should be called out of htt rx ring locking since it ++is also try to acquire the same lock. ++ ++Unfortunately this issue is not exposed by other solutions (qca988x, ++qca99x0 & qca4019), as rx_in_ord_ind message is specific to qca6174 ++based devices. This patch fixes ++ ++============================================= ++[ INFO: possible recursive locking detected ] ++4.7.0-rc2-wt-ath+ #1353 Tainted: G E ++--------------------------------------------- ++swapper/3/0 is trying to acquire lock: ++ (&(&htt->rx_ring.lock)->rlock){+.-...}, at: [] ++ath10k_htt_rx_msdu_buff_replenish+0x29/0x90 [ath10k_core] ++ ++but task is already holding lock: ++ (&(&htt->rx_ring.lock)->rlock){+.-...}, at: [] ++ath10k_htt_txrx_compl_task+0x21b/0x250 [ath10k_core] ++ ++other info that might help us debug this: ++ Possible unsafe locking scenario: ++ ++ CPU0 ++ ---- ++ lock(&(&htt->rx_ring.lock)->rlock); ++ lock(&(&htt->rx_ring.lock)->rlock); ++ ++ *** DEADLOCK *** ++ ++ May be due to missing lock nesting notation ++ ++1 lock held by swapper/3/0: ++ #0: (&(&htt->rx_ring.lock)->rlock){+.-...}, at: [] ++ath10k_htt_txrx_compl_task+0x21b/0x250 [ath10k_core] ++ ++Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=119151 ++Fixes: 5c86d97bcc1d ("ath10k: combine txrx and replenish task") ++Reported-by: Mike Lothian ++Signed-off-by: Rajkumar Manoharan ++Signed-off-by: Kalle Valo ++--- ++ ++--- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c ++@@ -1904,7 +1904,6 @@ static void ath10k_htt_rx_in_ord_ind(str ++ return; ++ } ++ } ++- ath10k_htt_rx_msdu_buff_replenish(htt); ++ } ++ ++ static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar, +diff --git a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch +deleted file mode 100644 +index 070efa9..0000000 +--- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch ++++ /dev/null +@@ -1,55 +0,0 @@ +-From: Felix Fietkau +-Date: Fri, 22 Jan 2016 01:05:56 +0100 +-Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1 +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/drivers/net/wireless/ath/ath9k/init.c +-+++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb +- +- #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */ +- +--static const struct ieee80211_iface_limit if_dfs_limits[] = { +-- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) | +--#ifdef CPTCFG_MAC80211_MESH +-- BIT(NL80211_IFTYPE_MESH_POINT) | +--#endif +-- BIT(NL80211_IFTYPE_ADHOC) }, +--}; +-- +- static const struct ieee80211_iface_combination if_comb[] = { +- { +- .limits = if_limits, +-@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb +- .max_interfaces = 2048, +- .num_different_channels = 1, +- .beacon_int_infra_match = true, +-+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED +-+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | +-+ BIT(NL80211_CHAN_WIDTH_20) | +-+ BIT(NL80211_CHAN_WIDTH_40), +-+#endif +- }, +- { +- .limits = wds_limits, +-@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb +- .num_different_channels = 1, +- .beacon_int_infra_match = true, +- }, +--#ifdef CPTCFG_ATH9K_DFS_CERTIFIED +-- { +-- .limits = if_dfs_limits, +-- .n_limits = ARRAY_SIZE(if_dfs_limits), +-- .max_interfaces = 1, +-- .num_different_channels = 1, +-- .beacon_int_infra_match = true, +-- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | +-- BIT(NL80211_CHAN_WIDTH_20) | +-- BIT(NL80211_CHAN_WIDTH_40), +-- } +--#endif +- }; +- +- #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT +diff --git a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch +deleted file mode 100644 +index 61cafc7..0000000 +--- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch ++++ /dev/null +@@ -1,27 +0,0 @@ +-From: Michal Kazior +-Date: Thu, 21 Jan 2016 14:23:07 +0100 +-Subject: [PATCH] mac80211: fix txq queue related crashes +- +-The driver can access the queue simultanously +-while mac80211 tears down the interface. Without +-spinlock protection this could lead to corrupting +-sk_buff_head and subsequently to an invalid +-pointer dereference. +- +-Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation") +-Signed-off-by: Michal Kazior +---- +- +---- a/net/mac80211/iface.c +-+++ b/net/mac80211/iface.c +-@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee +- if (sdata->vif.txq) { +- struct txq_info *txqi = to_txq_info(sdata->vif.txq); +- +-+ spin_lock_bh(&txqi->queue.lock); +- ieee80211_purge_tx_queue(&local->hw, &txqi->queue); +-+ spin_unlock_bh(&txqi->queue.lock); +-+ +- atomic_set(&sdata->txqs_len[txqi->txq.ac], 0); +- } +- +diff --git a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch +deleted file mode 100644 +index 844d43b..0000000 +--- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch ++++ /dev/null +@@ -1,57 +0,0 @@ +-From: Michal Kazior +-Date: Mon, 25 Jan 2016 14:43:24 +0100 +-Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding +- +-The ieee80211_queue_stopped() expects hw queue +-number but it was given raw WMM AC number instead. +- +-This could cause frame drops and problems with +-traffic in some cases - most notably if driver +-doesn't map AC numbers to queue numbers 1:1 and +-uses ieee80211_stop_queues() and +-ieee80211_wake_queue() only without ever calling +-ieee80211_wake_queues(). +- +-On ath10k it was possible to hit this problem in +-the following case: +- +- 1. wlan0 uses queue 0 +- (ath10k maps queues per vif) +- 2. offchannel uses queue 15 +- 3. queues 1-14 are unused +- 4. ieee80211_stop_queues() +- 5. ieee80211_wake_queue(q=0) +- 6. ieee80211_wake_queue(q=15) +- (other queues are not woken up because both +- driver and mac80211 know other queues are +- unused) +- 7. ieee80211_rx_h_mesh_fwding() +- 8. ieee80211_select_queue_80211() returns 2 +- 9. ieee80211_queue_stopped(q=2) returns true +- 10. frame is dropped (oops!) +- +-Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping") +-Signed-off-by: Michal Kazior +---- +- +---- a/net/mac80211/rx.c +-+++ b/net/mac80211/rx.c +-@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 +- struct ieee80211_local *local = rx->local; +- struct ieee80211_sub_if_data *sdata = rx->sdata; +- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; +-- u16 q, hdrlen; +-+ u16 ac, q, hdrlen; +- +- hdr = (struct ieee80211_hdr *) skb->data; +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +-@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 +- ether_addr_equal(sdata->vif.addr, hdr->addr3)) +- return RX_CONTINUE; +- +-- q = ieee80211_select_queue_80211(sdata, skb, hdr); +-+ ac = ieee80211_select_queue_80211(sdata, skb, hdr); +-+ q = sdata->vif.hw_queue[ac]; +- if (ieee80211_queue_stopped(&local->hw, q)) { +- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); +- return RX_DROP_MONITOR; +diff --git a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch +deleted file mode 100644 +index 5b3efbd..0000000 +--- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch ++++ /dev/null +@@ -1,103 +0,0 @@ +-From: Sachin Kulkarni +-Date: Tue, 12 Jan 2016 14:30:19 +0530 +-Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF +- types. +- +-During a sw scan ieee80211_iface_work ignores work items for all vifs. +-However after the scan complete work is requeued only for STA, ADHOC +-and MESH iftypes. +- +-This occasionally results in event processing getting delayed/not +-processed for iftype AP when it coexists with a STA. This can result +-in data halt and eventually disconnection on the AP interface. +- +-Signed-off-by: Sachin Kulkarni +-Cc: linux-wireless@vger.kernel.org +-Cc: johannes@sipsolutions.net +---- +- +---- a/net/mac80211/ibss.c +-+++ b/net/mac80211/ibss.c +-@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete +- if (sdata->vif.type != NL80211_IFTYPE_ADHOC) +- continue; +- sdata->u.ibss.last_scan_completed = jiffies; +-- ieee80211_queue_work(&local->hw, &sdata->work); +- } +- mutex_unlock(&local->iflist_mtx); +- } +---- a/net/mac80211/mesh.c +-+++ b/net/mac80211/mesh.c +-@@ -1369,17 +1369,6 @@ out: +- sdata_unlock(sdata); +- } +- +--void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) +--{ +-- struct ieee80211_sub_if_data *sdata; +-- +-- rcu_read_lock(); +-- list_for_each_entry_rcu(sdata, &local->interfaces, list) +-- if (ieee80211_vif_is_mesh(&sdata->vif) && +-- ieee80211_sdata_running(sdata)) +-- ieee80211_queue_work(&local->hw, &sdata->work); +-- rcu_read_unlock(); +--} +- +- void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) +- { +---- a/net/mac80211/mesh.h +-+++ b/net/mac80211/mesh.h +-@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp +- return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP; +- } +- +--void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local); +-- +- void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata); +- void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata); +- void ieee80211s_stop(void); +- #else +--static inline void +--ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {} +- static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) +- { return false; } +- static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata) +---- a/net/mac80211/mlme.c +-+++ b/net/mac80211/mlme.c +-@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer( +- if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) +- ieee80211_queue_work(&sdata->local->hw, +- &sdata->u.mgd.monitor_work); +-- /* and do all the other regular work too */ +-- ieee80211_queue_work(&sdata->local->hw, &sdata->work); +- } +- } +- +---- a/net/mac80211/scan.c +-+++ b/net/mac80211/scan.c +-@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s +- bool was_scanning = local->scanning; +- struct cfg80211_scan_request *scan_req; +- struct ieee80211_sub_if_data *scan_sdata; +-+ struct ieee80211_sub_if_data *sdata; +- +- lockdep_assert_held(&local->mtx); +- +-@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s +- +- ieee80211_mlme_notify_scan_completed(local); +- ieee80211_ibss_notify_scan_completed(local); +-- ieee80211_mesh_notify_scan_completed(local); +-+ +-+ /* Requeue all the work that might have been ignored while +-+ * the scan was in progress +-+ */ +-+ list_for_each_entry_rcu(sdata, &local->interfaces, list) { +-+ if (ieee80211_sdata_running(sdata)) +-+ ieee80211_queue_work(&sdata->local->hw, &sdata->work); +-+ } +-+ +- if (was_scanning) +- ieee80211_start_next_roc(local); +- } +diff --git a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch +deleted file mode 100644 +index 52fecb9..0000000 +--- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch ++++ /dev/null +@@ -1,57 +0,0 @@ +-From: Sara Sharon +-Date: Mon, 25 Jan 2016 15:46:35 +0200 +-Subject: [PATCH] mac80211: fix ibss scan parameters +- +-When joining IBSS a full scan should be initiated in order to search +-for existing cell, unless the fixed_channel parameter was set. +-A default channel to create the IBSS on if no cell was found is +-provided as well. +-However - a scan is initiated only on the default channel provided +-regardless of whether ifibss->fixed_channel is set or not, with the +-obvious result of the cell not joining existing IBSS cell that is +-on another channel. +- +-Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request") +-Signed-off-by: Sara Sharon +-Signed-off-by: Emmanuel Grumbach +---- +- +---- a/net/mac80211/ibss.c +-+++ b/net/mac80211/ibss.c +-@@ -7,6 +7,7 @@ +- * Copyright 2007, Michael Wu +- * Copyright 2009, Johannes Berg +- * Copyright 2013-2014 Intel Mobile Communications GmbH +-+ * Copyright(c) 2016 Intel Deutschland GmbH +- * +- * 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 +-@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru +- +- sdata_info(sdata, "Trigger new scan to find an IBSS to join\n"); +- +-- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy, +-- &ifibss->chandef, +-- channels, +-- ARRAY_SIZE(channels)); +- scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef); +-- ieee80211_request_ibss_scan(sdata, ifibss->ssid, +-- ifibss->ssid_len, channels, num, +-- scan_width); +-+ +-+ if (ifibss->fixed_channel) { +-+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy, +-+ &ifibss->chandef, +-+ channels, +-+ ARRAY_SIZE(channels)); +-+ ieee80211_request_ibss_scan(sdata, ifibss->ssid, +-+ ifibss->ssid_len, channels, +-+ num, scan_width); +-+ } else { +-+ ieee80211_request_ibss_scan(sdata, ifibss->ssid, +-+ ifibss->ssid_len, NULL, +-+ 0, scan_width); +-+ } +- } else { +- int interval = IEEE80211_SCAN_INTERVAL; +- +diff --git a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch +deleted file mode 100644 +index e78df36..0000000 +--- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch ++++ /dev/null +@@ -1,50 +0,0 @@ +-From: Chris Bainbridge +-Date: Wed, 27 Jan 2016 15:46:18 +0000 +-Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values +- +-Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes: +- +-[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29 +-[ 7.976608] load of value 2 is not a valid value for type '_Bool' +-[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265 +-[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015 +-[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone +-[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007 +-[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500 +-[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032 +-[ 7.976629] Call Trace: +-[ 7.976633] [] dump_stack+0x45/0x5f +-[ 7.976637] [] ubsan_epilogue+0xd/0x40 +-[ 7.976642] [] __ubsan_handle_load_invalid_value+0x67/0x70 +-[ 7.976646] [] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730 +-[ 7.976650] [] ieee80211_prepare_and_rx_handle+0xd04/0x1c00 +-[ 7.976654] [] ? usb_hcd_map_urb_for_dma+0x65e/0x960 +-[ 7.976659] [] __ieee80211_rx_handle_packet+0x1f3/0x750 +-[ 7.976663] [] ieee80211_rx_napi+0x447/0x990 +-[ 7.976667] [] rt2x00lib_rxdone+0x305/0xbd0 +-[ 7.976670] [] ? dequeue_task_fair+0x64f/0x1de0 +-[ 7.976674] [] ? sched_clock_cpu+0xe6/0x150 +-[ 7.976678] [] rt2x00usb_work_rxdone+0x7c/0x140 +-[ 7.976682] [] process_one_work+0x226/0x860 +-[ 7.976686] [] worker_thread+0x5c/0x680 +-[ 7.976690] [] ? process_one_work+0x860/0x860 +-[ 7.976693] [] kthread+0xf6/0x150 +-[ 7.976697] [] ? kthread_worker_fn+0x310/0x310 +-[ 7.976700] [] ret_from_fork+0x3f/0x70 +-[ 7.976703] [] ? kthread_worker_fn+0x310/0x310 +- +-Link: https://lkml.org/lkml/2016/1/26/230 +-Signed-off-by: Chris Bainbridge +---- +- +---- a/net/mac80211/agg-rx.c +-+++ b/net/mac80211/agg-rx.c +-@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str +- } +- +- /* prepare A-MPDU MLME for Rx aggregation */ +-- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL); +-+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL); +- if (!tid_agg_rx) +- goto end; +- +diff --git a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch +deleted file mode 100644 +index 5bf53b9..0000000 +--- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch ++++ /dev/null +@@ -1,45 +0,0 @@ +-From: Konstantin Khlebnikov +-Date: Fri, 29 Jan 2016 11:35:12 +0300 +-Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in +- minstrel_ht_set_best_prob_rate +- +-Patch fixes this splat +- +-BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0 +-[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0 +- +-Signed-off-by: Konstantin Khlebnikov +-Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com +---- +- +---- a/net/mac80211/rc80211_minstrel_ht.c +-+++ b/net/mac80211/rc80211_minstrel_ht.c +-@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi +- (max_tp_group != MINSTREL_CCK_GROUP)) +- return; +- +-+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; +-+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; +-+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma; +-+ +- if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) { +- cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, +- mrs->prob_ewma); +- if (cur_tp_avg > tmp_tp_avg) +- mi->max_prob_rate = index; +- +-- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; +-- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; +-- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma; +- max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group, +- max_gpr_idx, +- max_gpr_prob); +-@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi +- } else { +- if (mrs->prob_ewma > tmp_prob) +- mi->max_prob_rate = index; +-- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma) +-+ if (mrs->prob_ewma > max_gpr_prob) +- mg->max_group_prob_rate = index; +- } +- } +diff --git a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch +deleted file mode 100644 +index 655dc4b..0000000 +--- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch ++++ /dev/null +@@ -1,35 +0,0 @@ +-From: Felix Fietkau +-Date: Tue, 2 Feb 2016 14:39:08 +0100 +-Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to +- ieee80211_amsdu_to_8023s +- +-Prepararation for zero-copy A-MSDU support with page fragment SKBs +- +-Signed-off-by: Felix Fietkau +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/rx.c +-+++ b/net/mac80211/rx.c +-@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx +- skb->dev = dev; +- __skb_queue_head_init(&frame_list); +- +-- if (skb_linearize(skb)) +-- return RX_DROP_UNUSABLE; +-- +- ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, +- rx->sdata->vif.type, +- rx->local->hw.extra_tx_headroom, true); +---- a/net/wireless/util.c +-+++ b/net/wireless/util.c +-@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_ +- int remaining, err; +- u8 dst[ETH_ALEN], src[ETH_ALEN]; +- +-+ if (skb_linearize(skb)) +-+ goto out; +-+ +- if (has_80211_header) { +- err = ieee80211_data_to_8023(skb, addr, iftype); +- if (err) +diff --git a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch +deleted file mode 100644 +index b646ab3..0000000 +--- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch ++++ /dev/null +@@ -1,186 +0,0 @@ +-From: Felix Fietkau +-Date: Tue, 2 Feb 2016 14:39:09 +0100 +-Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate +- output buffer +- +-Use skb_copy_bits in preparation for allowing fragmented skbs +- +-Signed-off-by: Felix Fietkau +-Signed-off-by: Johannes Berg +---- +- +---- a/net/wireless/util.c +-+++ b/net/wireless/util.c +-@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s +- } +- EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); +- +--unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) +-+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags) +- { +-- int ae = meshhdr->flags & MESH_FLAGS_AE; +-+ int ae = flags & MESH_FLAGS_AE; +- /* 802.11-2012, 8.2.4.7.3 */ +- switch (ae) { +- default: +-@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s +- return 18; +- } +- } +-+ +-+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) +-+{ +-+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags); +-+} +- EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); +- +--int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, +-- enum nl80211_iftype iftype) +-+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr, +-+ const u8 *addr, enum nl80211_iftype iftype) +- { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; +-- u16 hdrlen, ethertype; +-- u8 *payload; +-- u8 dst[ETH_ALEN]; +-- u8 src[ETH_ALEN] __aligned(2); +-+ struct { +-+ u8 hdr[ETH_ALEN] __aligned(2); +-+ __be16 proto; +-+ } payload; +-+ struct ethhdr tmp; +-+ u16 hdrlen; +-+ u8 mesh_flags = 0; +- +- if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) +- return -1; +- +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +-+ if (skb->len < hdrlen + 8) +-+ return -1; +- +- /* convert IEEE 802.11 header + possible LLC headers into Ethernet +- * header +-@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf +- * 1 0 BSSID SA DA n/a +- * 1 1 RA TA DA SA +- */ +-- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN); +-- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN); +-+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN); +-+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN); +-+ +-+ if (iftype == NL80211_IFTYPE_MESH_POINT) +-+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1); +- +- switch (hdr->frame_control & +- cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { +-@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf +- iftype != NL80211_IFTYPE_STATION)) +- return -1; +- if (iftype == NL80211_IFTYPE_MESH_POINT) { +-- struct ieee80211s_hdr *meshdr = +-- (struct ieee80211s_hdr *) (skb->data + hdrlen); +-- /* make sure meshdr->flags is on the linear part */ +-- if (!pskb_may_pull(skb, hdrlen + 1)) +-- return -1; +-- if (meshdr->flags & MESH_FLAGS_AE_A4) +-+ if (mesh_flags & MESH_FLAGS_AE_A4) +- return -1; +-- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { +-+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) { +- skb_copy_bits(skb, hdrlen + +- offsetof(struct ieee80211s_hdr, eaddr1), +-- dst, ETH_ALEN); +-- skb_copy_bits(skb, hdrlen + +-- offsetof(struct ieee80211s_hdr, eaddr2), +-- src, ETH_ALEN); +-+ tmp.h_dest, 2 * ETH_ALEN); +- } +-- hdrlen += ieee80211_get_mesh_hdrlen(meshdr); +-+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); +- } +- break; +- case cpu_to_le16(IEEE80211_FCTL_FROMDS): +- if ((iftype != NL80211_IFTYPE_STATION && +- iftype != NL80211_IFTYPE_P2P_CLIENT && +- iftype != NL80211_IFTYPE_MESH_POINT) || +-- (is_multicast_ether_addr(dst) && +-- ether_addr_equal(src, addr))) +-+ (is_multicast_ether_addr(tmp.h_dest) && +-+ ether_addr_equal(tmp.h_source, addr))) +- return -1; +- if (iftype == NL80211_IFTYPE_MESH_POINT) { +-- struct ieee80211s_hdr *meshdr = +-- (struct ieee80211s_hdr *) (skb->data + hdrlen); +-- /* make sure meshdr->flags is on the linear part */ +-- if (!pskb_may_pull(skb, hdrlen + 1)) +-- return -1; +-- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) +-+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) +- return -1; +-- if (meshdr->flags & MESH_FLAGS_AE_A4) +-+ if (mesh_flags & MESH_FLAGS_AE_A4) +- skb_copy_bits(skb, hdrlen + +- offsetof(struct ieee80211s_hdr, eaddr1), +-- src, ETH_ALEN); +-- hdrlen += ieee80211_get_mesh_hdrlen(meshdr); +-+ tmp.h_source, ETH_ALEN); +-+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); +- } +- break; +- case cpu_to_le16(0): +-@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf +- break; +- } +- +-- if (!pskb_may_pull(skb, hdrlen + 8)) +-- return -1; +-- +-- payload = skb->data + hdrlen; +-- ethertype = (payload[6] << 8) | payload[7]; +-+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)); +-+ tmp.h_proto = payload.proto; +- +-- if (likely((ether_addr_equal(payload, rfc1042_header) && +-- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || +-- ether_addr_equal(payload, bridge_tunnel_header))) { +-+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) && +-+ tmp.h_proto != htons(ETH_P_AARP) && +-+ tmp.h_proto != htons(ETH_P_IPX)) || +-+ ether_addr_equal(payload.hdr, bridge_tunnel_header))) +- /* remove RFC1042 or Bridge-Tunnel encapsulation and +- * replace EtherType */ +-- skb_pull(skb, hdrlen + 6); +-- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); +-- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); +-- } else { +-- struct ethhdr *ehdr; +-- __be16 len; +-+ hdrlen += ETH_ALEN + 2; +-+ else +-+ tmp.h_proto = htons(skb->len); +- +-- skb_pull(skb, hdrlen); +-- len = htons(skb->len); +-+ pskb_pull(skb, hdrlen); +-+ +-+ if (!ehdr) +- ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr)); +-- memcpy(ehdr->h_dest, dst, ETH_ALEN); +-- memcpy(ehdr->h_source, src, ETH_ALEN); +-- ehdr->h_proto = len; +-- } +-+ memcpy(ehdr, &tmp, sizeof(tmp)); +-+ +- return 0; +- } +-+ +-+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, +-+ enum nl80211_iftype iftype) +-+{ +-+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype); +-+} +- EXPORT_SYMBOL(ieee80211_data_to_8023); +- +- int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, +diff --git a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch +deleted file mode 100644 +index 2eeed22..0000000 +--- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch ++++ /dev/null +@@ -1,159 +0,0 @@ +-From: Felix Fietkau +-Date: Tue, 2 Feb 2016 14:39:10 +0100 +-Subject: [PATCH] cfg80211: add support for non-linear skbs in +- ieee80211_amsdu_to_8023s +- +-Signed-off-by: Felix Fietkau +-Signed-off-by: Johannes Berg +---- +- +---- a/net/wireless/util.c +-+++ b/net/wireless/util.c +-@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b +- } +- EXPORT_SYMBOL(ieee80211_data_from_8023); +- +-+static struct sk_buff * +-+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen, +-+ int offset, int len) +-+{ +-+ struct sk_buff *frame; +-+ +-+ if (skb->len - offset < len) +-+ return NULL; +-+ +-+ /* +-+ * Allocate and reserve two bytes more for payload +-+ * alignment since sizeof(struct ethhdr) is 14. +-+ */ +-+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len); +-+ +-+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); +-+ skb_copy_bits(skb, offset, skb_put(frame, len), len); +-+ +-+ return frame; +-+} +- +- void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, +- const u8 *addr, enum nl80211_iftype iftype, +- const unsigned int extra_headroom, +- bool has_80211_header) +- { +-+ unsigned int hlen = ALIGN(extra_headroom, 4); +- struct sk_buff *frame = NULL; +- u16 ethertype; +- u8 *payload; +-- const struct ethhdr *eth; +-- int remaining, err; +-- u8 dst[ETH_ALEN], src[ETH_ALEN]; +-- +-- if (skb_linearize(skb)) +-- goto out; +-+ int offset = 0, remaining, err; +-+ struct ethhdr eth; +-+ bool reuse_skb = true; +-+ bool last = false; +- +- if (has_80211_header) { +-- err = ieee80211_data_to_8023(skb, addr, iftype); +-+ err = __ieee80211_data_to_8023(skb, ð, addr, iftype); +- if (err) +- goto out; +-- +-- /* skip the wrapping header */ +-- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr)); +-- if (!eth) +-- goto out; +-- } else { +-- eth = (struct ethhdr *) skb->data; +- } +- +-- while (skb != frame) { +-+ while (!last) { +-+ unsigned int subframe_len; +-+ int len; +- u8 padding; +-- __be16 len = eth->h_proto; +-- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len); +-- +-- remaining = skb->len; +-- memcpy(dst, eth->h_dest, ETH_ALEN); +-- memcpy(src, eth->h_source, ETH_ALEN); +- +-+ skb_copy_bits(skb, offset, ð, sizeof(eth)); +-+ len = ntohs(eth.h_proto); +-+ subframe_len = sizeof(struct ethhdr) + len; +- padding = (4 - subframe_len) & 0x3; +-+ +- /* the last MSDU has no padding */ +-+ remaining = skb->len - offset; +- if (subframe_len > remaining) +- goto purge; +- +-- skb_pull(skb, sizeof(struct ethhdr)); +-+ offset += sizeof(struct ethhdr); +- /* reuse skb for the last subframe */ +-- if (remaining <= subframe_len + padding) +-+ last = remaining <= subframe_len + padding; +-+ if (!skb_is_nonlinear(skb) && last) { +-+ skb_pull(skb, offset); +- frame = skb; +-- else { +-- unsigned int hlen = ALIGN(extra_headroom, 4); +-- /* +-- * Allocate and reserve two bytes more for payload +-- * alignment since sizeof(struct ethhdr) is 14. +-- */ +-- frame = dev_alloc_skb(hlen + subframe_len + 2); +-+ reuse_skb = true; +-+ } else { +-+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len); +- if (!frame) +- goto purge; +- +-- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); +-- memcpy(skb_put(frame, ntohs(len)), skb->data, +-- ntohs(len)); +-- +-- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) + +-- padding); +-- if (!eth) { +-- dev_kfree_skb(frame); +-- goto purge; +-- } +-+ offset += len + padding; +- } +- +- skb_reset_network_header(frame); +-@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_ +- +- payload = frame->data; +- ethertype = (payload[6] << 8) | payload[7]; +-- +- if (likely((ether_addr_equal(payload, rfc1042_header) && +- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || +- ether_addr_equal(payload, bridge_tunnel_header))) { +-- /* remove RFC1042 or Bridge-Tunnel +-- * encapsulation and replace EtherType */ +-- skb_pull(frame, 6); +-- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); +-- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); +-- } else { +-- memcpy(skb_push(frame, sizeof(__be16)), &len, +-- sizeof(__be16)); +-- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); +-- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); +-+ eth.h_proto = htons(ethertype); +-+ skb_pull(frame, ETH_ALEN + 2); +- } +-+ +-+ memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth)); +- __skb_queue_tail(list, frame); +- } +- +-+ if (!reuse_skb) +-+ dev_kfree_skb(skb); +-+ +- return; +- +- purge: +diff --git a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch +deleted file mode 100644 +index c4155a1..0000000 +--- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch ++++ /dev/null +@@ -1,155 +0,0 @@ +-From: Sven Eckelmann +-Date: Tue, 26 Jan 2016 17:11:13 +0100 +-Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames +- +-Drivers/devices without their own rate control algorithm can get the +-information what rates they should use from either the radiotap header of +-injected frames or from the rate control algorithm. But the parsing of the +-legacy rate information from the radiotap header was removed in commit +-e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API"). +- +-The removal of this feature heavily reduced the usefulness of frame +-injection when wanting to simulate specific transmission behavior. Having +-rate parsing together with MCS rates and retry support allows a fine +-grained selection of the tx behavior of injected frames for these kind of +-tests. +- +-Signed-off-by: Sven Eckelmann +-Cc: Simon Wunderlich +-Signed-off-by: Johannes Berg +---- +- +---- a/include/net/mac80211.h +-+++ b/include/net/mac80211.h +-@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags { +- * protocol frame (e.g. EAP) +- * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll +- * frame (PS-Poll or uAPSD). +-+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information +- * +- * These flags are used in tx_info->control.flags. +- */ +- enum mac80211_tx_control_flags { +- IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), +- IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), +-+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2), +- }; +- +- /* +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 +- +- info->control.short_preamble = txrc.short_preamble; +- +-+ /* don't ask rate control when rate already injected via radiotap */ +-+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT) +-+ return TX_CONTINUE; +-+ +- if (tx->sta) +- assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC); +- +-@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub +- ieee80211_tx(sdata, sta, skb, false); +- } +- +--static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb) +-+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local, +-+ struct sk_buff *skb) +- { +- struct ieee80211_radiotap_iterator iterator; +- struct ieee80211_radiotap_header *rthdr = +- (struct ieee80211_radiotap_header *) skb->data; +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); +-+ struct ieee80211_supported_band *sband = +-+ local->hw.wiphy->bands[info->band]; +- int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len, +- NULL); +- u16 txflags; +-+ u16 rate = 0; +-+ bool rate_found = false; +-+ u8 rate_retries = 0; +-+ u16 rate_flags = 0; +-+ u8 mcs_known, mcs_flags; +-+ int i; +- +- info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | +- IEEE80211_TX_CTL_DONTFRAG; +-@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap( +- info->flags |= IEEE80211_TX_CTL_NO_ACK; +- break; +- +-+ case IEEE80211_RADIOTAP_RATE: +-+ rate = *iterator.this_arg; +-+ rate_flags = 0; +-+ rate_found = true; +-+ break; +-+ +-+ case IEEE80211_RADIOTAP_DATA_RETRIES: +-+ rate_retries = *iterator.this_arg; +-+ break; +-+ +-+ case IEEE80211_RADIOTAP_MCS: +-+ mcs_known = iterator.this_arg[0]; +-+ mcs_flags = iterator.this_arg[1]; +-+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS)) +-+ break; +-+ +-+ rate_found = true; +-+ rate = iterator.this_arg[2]; +-+ rate_flags = IEEE80211_TX_RC_MCS; +-+ +-+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI && +-+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI) +-+ rate_flags |= IEEE80211_TX_RC_SHORT_GI; +-+ +-+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW && +-+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40) +-+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; +-+ break; +-+ +- /* +- * Please update the file +- * Documentation/networking/mac80211-injection.txt +-@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap( +- if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */ +- return false; +- +-+ if (rate_found) { +-+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT; +-+ +-+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { +-+ info->control.rates[i].idx = -1; +-+ info->control.rates[i].flags = 0; +-+ info->control.rates[i].count = 0; +-+ } +-+ +-+ if (rate_flags & IEEE80211_TX_RC_MCS) { +-+ info->control.rates[0].idx = rate; +-+ } else { +-+ for (i = 0; i < sband->n_bitrates; i++) { +-+ if (rate * 5 != sband->bitrates[i].bitrate) +-+ continue; +-+ +-+ info->control.rates[0].idx = i; +-+ break; +-+ } +-+ } +-+ +-+ info->control.rates[0].flags = rate_flags; +-+ info->control.rates[0].count = min_t(u8, rate_retries + 1, +-+ local->hw.max_rate_tries); +-+ } +-+ +- /* +- * remove the radiotap header +- * iterator->_max_length was sanity-checked against +-@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit +- IEEE80211_TX_CTL_INJECTED; +- +- /* process and remove the injection radiotap header */ +-- if (!ieee80211_parse_tx_radiotap(skb)) +-+ if (!ieee80211_parse_tx_radiotap(local, skb)) +- goto fail; +- +- rcu_read_lock(); +diff --git a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch +deleted file mode 100644 +index e7bfb9c..0000000 +--- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch ++++ /dev/null +@@ -1,317 +0,0 @@ +-From: Felix Fietkau +-Date: Fri, 5 Feb 2016 01:38:51 +0100 +-Subject: [PATCH] mac80211: add A-MSDU tx support +- +-Requires software tx queueing support. frag_list support (for zero-copy) +-is optional. +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/include/net/mac80211.h +-+++ b/include/net/mac80211.h +-@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags { +- * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll +- * frame (PS-Poll or uAPSD). +- * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information +-+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame +- * +- * These flags are used in tx_info->control.flags. +- */ +-@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags { +- IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), +- IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), +- IEEE80211_TX_CTRL_RATE_INJECT = BIT(2), +-+ IEEE80211_TX_CTRL_AMSDU = BIT(3), +- }; +- +- /* +-@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates { +- * size is min(max_amsdu_len, 7935) bytes. +- * Both additional HT limits must be enforced by the low level driver. +- * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2). +-+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control. +- * @txq: per-TID data TX queues (if driver uses the TXQ abstraction) +- */ +- struct ieee80211_sta { +-@@ -1748,6 +1751,7 @@ struct ieee80211_sta { +- bool mfp; +- u8 max_amsdu_subframes; +- u16 max_amsdu_len; +-+ u16 max_rc_amsdu_len; +- +- struct ieee80211_txq *txq[IEEE80211_NUM_TIDS]; +- +-@@ -1961,6 +1965,15 @@ struct ieee80211_txq { +- * order and does not need to manage its own reorder buffer or BA session +- * timeout. +- * +-+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated +-+ * A-MSDU frames. Requires software tx queueing and fast-xmit support. +-+ * When not using minstrel/minstrel_ht rate control, the driver should +-+ * limit the maximum A-MSDU size based on the current tx rate by setting +-+ * max_rc_amsdu_len in struct ieee80211_sta. +-+ * +-+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list +-+ * skbs, needed for zero-copy software A-MSDU. +-+ * +- * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays +- */ +- enum ieee80211_hw_flags { +-@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags { +- IEEE80211_HW_BEACON_TX_STATUS, +- IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, +- IEEE80211_HW_SUPPORTS_REORDERING_BUFFER, +-+ IEEE80211_HW_TX_AMSDU, +-+ IEEE80211_HW_TX_FRAG_LIST, +- +- /* keep last, obviously */ +- NUM_IEEE80211_HW_FLAGS +-@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags { +- * size is smaller (an example is LinkSys WRT120N with FW v1.0.07 +- * build 002 Jun 18 2012). +- * +-+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum +-+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list. +-+ * +- * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX +- * (if %IEEE80211_HW_QUEUE_CONTROL is set) +- * +-@@ -2124,6 +2142,7 @@ struct ieee80211_hw { +- u8 max_rate_tries; +- u8 max_rx_aggregation_subframes; +- u8 max_tx_aggregation_subframes; +-+ u8 max_tx_fragments; +- u8 offchannel_tx_hw_queue; +- u8 radiotap_mcs_details; +- u16 radiotap_vht_details; +---- a/net/mac80211/agg-tx.c +-+++ b/net/mac80211/agg-tx.c +-@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct +- size_t len) +- { +- struct tid_ampdu_tx *tid_tx; +-+ struct ieee80211_txq *txq; +- u16 capab, tid; +- u8 buf_size; +- bool amsdu; +-@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct +- buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6; +- buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes); +- +-+ txq = sta->sta.txq[tid]; +-+ if (!amsdu && txq) +-+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags); +-+ +- mutex_lock(&sta->ampdu_mlme.mtx); +- +- tid_tx = rcu_dereference_protected_tid_tx(sta, tid); +---- a/net/mac80211/debugfs.c +-+++ b/net/mac80211/debugfs.c +-@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE +- FLAG(BEACON_TX_STATUS), +- FLAG(NEEDS_UNIQUE_STA_ADDR), +- FLAG(SUPPORTS_REORDERING_BUFFER), +-+ FLAG(TX_AMSDU), +-+ FLAG(TX_FRAG_LIST), +- +- /* keep last for the build bug below */ +- (void *)0x1 +---- a/net/mac80211/ieee80211_i.h +-+++ b/net/mac80211/ieee80211_i.h +-@@ -799,6 +799,7 @@ struct mac80211_qos_map { +- enum txq_info_flags { +- IEEE80211_TXQ_STOP, +- IEEE80211_TXQ_AMPDU, +-+ IEEE80211_TXQ_NO_AMSDU, +- }; +- +- struct txq_info { +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str +- out: +- spin_unlock_bh(&txqi->queue.lock); +- +-+ if (skb && skb_has_frag_list(skb) && +-+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) +-+ skb_linearize(skb); +-+ +- return skb; +- } +- EXPORT_SYMBOL(ieee80211_tx_dequeue); +-@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st +- kfree_rcu(fast_tx, rcu_head); +- } +- +-+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local, +-+ struct sk_buff *skb, int headroom, +-+ int *subframe_len) +-+{ +-+ int amsdu_len = *subframe_len + sizeof(struct ethhdr); +-+ int padding = (4 - amsdu_len) & 3; +-+ +-+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) { +-+ I802_DEBUG_INC(local->tx_expand_skb_head); +-+ +-+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) { +-+ wiphy_debug(local->hw.wiphy, +-+ "failed to reallocate TX buffer\n"); +-+ return false; +-+ } +-+ } +-+ +-+ if (padding) { +-+ *subframe_len += padding; +-+ memset(skb_put(skb, padding), 0, padding); +-+ } +-+ +-+ return true; +-+} +-+ +-+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, +-+ struct ieee80211_fast_tx *fast_tx, +-+ struct sk_buff *skb) +-+{ +-+ struct ieee80211_local *local = sdata->local; +-+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); +-+ struct ieee80211_hdr *hdr; +-+ struct ethhdr amsdu_hdr; +-+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header); +-+ int subframe_len = skb->len - hdr_len; +-+ void *data; +-+ u8 *qc; +-+ +-+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) +-+ return false; +-+ +-+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU) +-+ return true; +-+ +-+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr), +-+ &subframe_len)) +-+ return false; +-+ +-+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len); +-+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN); +-+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN); +-+ +-+ data = skb_push(skb, sizeof(amsdu_hdr)); +-+ memmove(data, data + sizeof(amsdu_hdr), hdr_len); +-+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr)); +-+ +-+ hdr = data; +-+ qc = ieee80211_get_qos_ctl(hdr); +-+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT; +-+ +-+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU; +-+ +-+ return true; +-+} +-+ +-+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, +-+ struct sta_info *sta, +-+ struct ieee80211_fast_tx *fast_tx, +-+ struct sk_buff *skb) +-+{ +-+ struct ieee80211_local *local = sdata->local; +-+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; +-+ struct ieee80211_txq *txq = sta->sta.txq[tid]; +-+ struct txq_info *txqi; +-+ struct sk_buff **frag_tail, *head; +-+ int subframe_len = skb->len - ETH_ALEN; +-+ u8 max_subframes = sta->sta.max_amsdu_subframes; +-+ int max_frags = local->hw.max_tx_fragments; +-+ int max_amsdu_len = sta->sta.max_amsdu_len; +-+ __be16 len; +-+ void *data; +-+ bool ret = false; +-+ int n = 1, nfrags; +-+ +-+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) +-+ return false; +-+ +-+ if (!txq) +-+ return false; +-+ +-+ txqi = to_txq_info(txq); +-+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags)) +-+ return false; +-+ +-+ if (sta->sta.max_rc_amsdu_len) +-+ max_amsdu_len = min_t(int, max_amsdu_len, +-+ sta->sta.max_rc_amsdu_len); +-+ +-+ spin_lock_bh(&txqi->queue.lock); +-+ +-+ head = skb_peek_tail(&txqi->queue); +-+ if (!head) +-+ goto out; +-+ +-+ if (skb->len + head->len > max_amsdu_len) +-+ goto out; +-+ +-+ /* +-+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation +-+ * sessions are started/stopped without txq flush, use the limit here +-+ * to avoid having to de-aggregate later. +-+ */ +-+ if (skb->len + head->len > 4095 && +-+ !sta->sta.vht_cap.vht_supported) +-+ goto out; +-+ +-+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) +-+ goto out; +-+ +-+ nfrags = 1 + skb_shinfo(skb)->nr_frags; +-+ nfrags += 1 + skb_shinfo(head)->nr_frags; +-+ frag_tail = &skb_shinfo(head)->frag_list; +-+ while (*frag_tail) { +-+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags; +-+ frag_tail = &(*frag_tail)->next; +-+ n++; +-+ } +-+ +-+ if (max_subframes && n > max_subframes) +-+ goto out; +-+ +-+ if (max_frags && nfrags > max_frags) +-+ goto out; +-+ +-+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2, +-+ &subframe_len)) +-+ return false; +-+ +-+ ret = true; +-+ data = skb_push(skb, ETH_ALEN + 2); +-+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN); +-+ +-+ data += 2 * ETH_ALEN; +-+ len = cpu_to_be16(subframe_len); +-+ memcpy(data, &len, 2); +-+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header)); +-+ +-+ head->len += skb->len; +-+ head->data_len += skb->len; +-+ *frag_tail = skb; +-+ +-+out: +-+ spin_unlock_bh(&txqi->queue.lock); +-+ +-+ return ret; +-+} +-+ +- static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, +- struct net_device *dev, struct sta_info *sta, +- struct ieee80211_fast_tx *fast_tx, +-@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i +- +- ieee80211_tx_stats(dev, skb->len + extra_head); +- +-+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && +-+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) +-+ return true; +-+ +- /* will not be crypto-handled beyond what we do here, so use false +- * as the may-encrypt argument for the resize to not account for +- * more room than we already have in 'extra_head' +diff --git a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch +deleted file mode 100644 +index 9277b2c..0000000 +--- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch ++++ /dev/null +@@ -1,64 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Wed, 20 Jan 2016 16:46:04 +0100 +-Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-First of all it changes the way we calculate primary channel offset. If +-we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means +-center frequency is 5210 MHz) it makes sense to calculate primary offset +-as -30 MHz. +-Then it fixes values we compare primary_offset with. We were comparing +-offset in MHz against -2 or 2 which was resulting in picking a wrong +-primary channel. +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +-@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br +- brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", +- ch->chan->center_freq, ch->center_freq1, ch->width); +- ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); +-- primary_offset = ch->center_freq1 - ch->chan->center_freq; +-+ primary_offset = ch->chan->center_freq - ch->center_freq1; +- switch (ch->width) { +- case NL80211_CHAN_WIDTH_20: +- case NL80211_CHAN_WIDTH_20_NOHT: +-@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br +- break; +- case NL80211_CHAN_WIDTH_40: +- ch_inf.bw = BRCMU_CHAN_BW_40; +-- if (primary_offset < 0) +-+ if (primary_offset > 0) +- ch_inf.sb = BRCMU_CHAN_SB_U; +- else +- ch_inf.sb = BRCMU_CHAN_SB_L; +- break; +- case NL80211_CHAN_WIDTH_80: +- ch_inf.bw = BRCMU_CHAN_BW_80; +-- if (primary_offset < 0) { +-- if (primary_offset < -CH_10MHZ_APART) +-- ch_inf.sb = BRCMU_CHAN_SB_UU; +-- else +-- ch_inf.sb = BRCMU_CHAN_SB_UL; +-- } else { +-- if (primary_offset > CH_10MHZ_APART) +-- ch_inf.sb = BRCMU_CHAN_SB_LL; +-- else +-- ch_inf.sb = BRCMU_CHAN_SB_LU; +-- } +-+ if (primary_offset == -30) +-+ ch_inf.sb = BRCMU_CHAN_SB_LL; +-+ else if (primary_offset == -10) +-+ ch_inf.sb = BRCMU_CHAN_SB_LU; +-+ else if (primary_offset == 10) +-+ ch_inf.sb = BRCMU_CHAN_SB_UL; +-+ else +-+ ch_inf.sb = BRCMU_CHAN_SB_UU; +- break; +- case NL80211_CHAN_WIDTH_80P80: +- case NL80211_CHAN_WIDTH_160: +diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch +deleted file mode 100644 +index d7018da..0000000 +--- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch ++++ /dev/null +@@ -1,51 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Tue, 26 Jan 2016 17:57:01 +0100 +-Subject: [PATCH] brcmfmac: analyze descriptors of current component only +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-So far we were looking for address descriptors without a check for +-crossing current component border. In case of dealing with unsupported +-descriptor or descriptor missing at all the code would incorrectly get +-data from another component. +- +-Consider this binary-described component from BCM4366 EROM: +-4bf83b01 TAG==CI CID==0x83b +-20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1 +-18400035 TAG==ADDR SZ_SZD TYPE_SLAVE +-00050000 +-18107085 TAG==ADDR SZ_4K TYPE_SWRAP +- +-Driver was assigning invalid base address to this core: +-brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000 +-which came from totally different component defined in EROM: +-43b36701 TAG==CI CID==0x367 +-00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0 +-18109005 TAG==ADDR SZ_4K TYPE_SLAVE +- +-This change will also allow us to support components without wrapper +-address in the future. +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st +- *eromaddr -= 4; +- return -EFAULT; +- } +-- } while (desc != DMP_DESC_ADDRESS); +-+ } while (desc != DMP_DESC_ADDRESS && +-+ desc != DMP_DESC_COMPONENT); +-+ +-+ /* stop if we crossed current component border */ +-+ if (desc == DMP_DESC_COMPONENT) { +-+ *eromaddr -= 4; +-+ return 0; +-+ } +- +- /* skip upper 32-bit address descriptor */ +- if (val & DMP_DESC_ADDRSIZE_GT32) +diff --git a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch +deleted file mode 100644 +index 045ab49..0000000 +--- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch ++++ /dev/null +@@ -1,28 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Tue, 26 Jan 2016 17:57:02 +0100 +-Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-Separated PMU core can be found in new devices and should be used for +-accessing PMU registers (which were routed through ChipCommon so far). +-This core is one of exceptions that doesn't have or need wrapper address +-to be still safely accessible. +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm +- rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S; +- +- /* need core with ports */ +-- if (nmw + nsw == 0) +-+ if (nmw + nsw == 0 && +-+ id != BCMA_CORE_PMU) +- continue; +- +- /* try to obtain register address info */ +diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch +deleted file mode 100644 +index 7b7ba4f..0000000 +--- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch ++++ /dev/null +@@ -1,43 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Tue, 26 Jan 2016 17:57:03 +0100 +-Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-This is an extra bitfield with info about some present hardware. +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf +- /* get chipcommon capabilites */ +- pub->cc_caps = chip->ops->read32(chip->ctx, +- CORE_CC_REG(base, capabilities)); +-+ pub->cc_caps_ext = chip->ops->read32(chip->ctx, +-+ CORE_CC_REG(base, +-+ capabilities_ext)); +- +- /* get pmu caps & rev */ +- if (pub->cc_caps & CC_CAP_PMU) { +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +-@@ -27,6 +27,7 @@ +- * @chip: chip identifier. +- * @chiprev: chip revision. +- * @cc_caps: chipcommon core capabilities. +-+ * @cc_caps_ext: chipcommon core extended capabilities. +- * @pmucaps: PMU capabilities. +- * @pmurev: PMU revision. +- * @rambase: RAM base address (only applicable for ARM CR4 chips). +-@@ -38,6 +39,7 @@ struct brcmf_chip { +- u32 chip; +- u32 chiprev; +- u32 cc_caps; +-+ u32 cc_caps_ext; +- u32 pmucaps; +- u32 pmurev; +- u32 rambase; +diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch +deleted file mode 100644 +index 2af6fd9..0000000 +--- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch ++++ /dev/null +@@ -1,148 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Tue, 26 Jan 2016 17:57:04 +0100 +-Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if +- available +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-On recent Broadcom chipsets PMU is present as separated core and it +-can't be accessed using ChipCommon anymore as it fails with e.g.: +-[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f +- +-Add a new helper function that will return a proper core that should be +-used for accessing PMU registers. +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +-@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf +- { +- struct brcmf_chip *pub; +- struct brcmf_core_priv *cc; +-+ struct brcmf_core *pmu; +- u32 base; +- u32 val; +- int ret = 0; +-@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf +- capabilities_ext)); +- +- /* get pmu caps & rev */ +-+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */ +- if (pub->cc_caps & CC_CAP_PMU) { +- val = chip->ops->read32(chip->ctx, +-- CORE_CC_REG(base, pmucapabilities)); +-+ CORE_CC_REG(pmu->base, pmucapabilities)); +- pub->pmurev = val & PCAP_REV_MASK; +- pub->pmucaps = val; +- } +-@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco +- return &cc->pub; +- } +- +-+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub) +-+{ +-+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub); +-+ struct brcmf_core *pmu; +-+ +-+ /* See if there is separated PMU core available */ +-+ if (cc->rev >= 35 && +-+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { +-+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU); +-+ if (pmu) +-+ return pmu; +-+ } +-+ +-+ /* Fallback to ChipCommon core for older hardware */ +-+ return cc; +-+} +-+ +- bool brcmf_chip_iscoreup(struct brcmf_core *pub) +- { +- struct brcmf_core_priv *core; +-@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_ +- { +- u32 base, addr, reg, pmu_cc3_mask = ~0; +- struct brcmf_chip_priv *chip; +-+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub); +- +- brcmf_dbg(TRACE, "Enter\n"); +- +-@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_ +- case BRCM_CC_4335_CHIP_ID: +- case BRCM_CC_4339_CHIP_ID: +- /* read PMU chipcontrol register 3 */ +-- addr = CORE_CC_REG(base, chipcontrol_addr); +-+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr); +- chip->ops->write32(chip->ctx, addr, 3); +-- addr = CORE_CC_REG(base, chipcontrol_data); +-+ addr = CORE_CC_REG(pmu->base, chipcontrol_data); +- reg = chip->ops->read32(chip->ctx, addr); +- return (reg & pmu_cc3_mask) != 0; +- case BRCM_CC_43430_CHIP_ID: +-@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_ +- reg = chip->ops->read32(chip->ctx, addr); +- return reg != 0; +- default: +-- addr = CORE_CC_REG(base, pmucapabilities_ext); +-+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext); +- reg = chip->ops->read32(chip->ctx, addr); +- if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0) +- return false; +- +-- addr = CORE_CC_REG(base, retention_ctl); +-+ addr = CORE_CC_REG(pmu->base, retention_ctl); +- reg = chip->ops->read32(chip->ctx, addr); +- return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK | +- PMU_RCTL_LOGIC_DISABLE_MASK)) == 0; +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +-@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi +- void brcmf_chip_detach(struct brcmf_chip *chip); +- struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid); +- struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip); +-+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub); +- bool brcmf_chip_iscoreup(struct brcmf_core *core); +- void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset); +- void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset, +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +-@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm +- const struct sdiod_drive_str *str_tab = NULL; +- u32 str_mask; +- u32 str_shift; +-- u32 base; +- u32 i; +- u32 drivestrength_sel = 0; +- u32 cc_data_temp; +-@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm +- } +- +- if (str_tab != NULL) { +-+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci); +-+ +- for (i = 0; str_tab[i].strength != 0; i++) { +- if (drivestrength >= str_tab[i].strength) { +- drivestrength_sel = str_tab[i].sel; +- break; +- } +- } +-- base = brcmf_chip_get_chipcommon(ci)->base; +-- addr = CORE_CC_REG(base, chipcontrol_addr); +-+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr); +- brcmf_sdiod_regwl(sdiodev, addr, 1, NULL); +- cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL); +- cc_data_temp &= ~str_mask; +-@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi +- goto fail; +- +- /* set PMUControl so a backplane reset does PMU state reload */ +-- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base, +-- pmucontrol); +-+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol); +- reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err); +- if (err) +- goto fail; +diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch +deleted file mode 100644 +index 35887fc..0000000 +--- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch ++++ /dev/null +@@ -1,38 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Tue, 26 Jan 2016 17:57:05 +0100 +-Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366 +- chipset +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID. +-Unfortunately this ID was already used by Broadcom for cards with +-BCM43142, a totally different chipset requiring SoftMAC driver. To avoid +-a conflict between brcmfmac and bcma use more specific ID entry with +-subvendor and subdevice specified. +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci +- +- #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\ +- PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 } +-+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \ +-+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\ +-+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 } +- +- static struct pci_device_id brcmf_pcie_devid_table[] = { +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID), +-@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID), +-+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID), +diff --git a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch +deleted file mode 100644 +index 6ce60f1..0000000 +--- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch ++++ /dev/null +@@ -1,32 +0,0 @@ +-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +-Date: Sun, 31 Jan 2016 12:14:34 +0100 +-Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-Platform NVRAM (stored on a flash partition) has entries separated by a +-NULL (\0) char. Our parsing code switches from VALUE state to IDLE +-whenever it meets a NULL (\0). When that happens our IDLE handler should +-simply consume it and analyze whatever is placed ahead. +- +-This fixes harmless warnings spamming debugging output: +-[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character +-[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character +-[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character +- +-Signed-off-by: Rafał Miłecki +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +-@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr +- c = nvp->data[nvp->pos]; +- if (c == '\n') +- return COMMENT; +-- if (is_whitespace(c)) +-+ if (is_whitespace(c) || c == '\0') +- goto proceed; +- if (c == '#') +- return COMMENT; +diff --git a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch +deleted file mode 100644 +index 012dea1..0000000 +--- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch ++++ /dev/null +@@ -1,41 +0,0 @@ +-From: Sjoerd Simons +-Date: Mon, 25 Jan 2016 11:47:29 +0100 +-Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit +- +-On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems +-the card responds very quickly most of the time, unfortunately during +-initialisation it sometimes seems to take just a bit over 2 seconds to +-respond. +- +-This results intialization failing with message like: +- brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52 +- brcmf_bus_start: failed: -52 +- brcmf_sdio_firmware_callback: dongle is not responding +- +-Increasing the timeout to allow for a bit more headroom allows the +-card to initialize reliably. +- +-A quick search online after diagnosing/fixing this showed that Google +-has a similar patch in their ChromeOS tree, so this doesn't seem +-specific to the board I'm using. +- +-Signed-off-by: Sjoerd Simons +-Reviewed-by: Julian Calaby +-Acked-by: Arend van Spriel +-Reviewed-by: Douglas Anderson +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +-@@ -45,8 +45,8 @@ +- #include "chip.h" +- #include "firmware.h" +- +--#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000) +--#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000) +-+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) +-+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) +- +- #ifdef DEBUG +- +diff --git a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch +deleted file mode 100644 +index 71f7a40..0000000 +--- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch ++++ /dev/null +@@ -1,87 +0,0 @@ +-From: Miaoqing Pan +-Date: Fri, 5 Feb 2016 09:45:50 +0800 +-Subject: [PATCH] ath9k: make NF load complete quickly and reliably +- +-Make NF load complete quickly and reliably. NF load execution +-is delayed by HW to end of frame if frame Rx or Tx is ongoing. +-Increasing timeout to max frame duration. If NF cal is ongoing +-before NF load, stop it before load, and restart it afterwards. +- +-Signed-off-by: Miaoqing Pan +---- +- +---- a/drivers/net/wireless/ath/ath9k/calib.c +-+++ b/drivers/net/wireless/ath/ath9k/calib.c +-@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s +- u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; +- struct ath_common *common = ath9k_hw_common(ah); +- s16 default_nf = ath9k_hw_get_default_nf(ah, chan); +-+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL); +- +- if (ah->caldata) +- h = ah->caldata->nfCalHist; +-@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s +- } +- +- /* +-+ * stop NF cal if ongoing to ensure NF load completes immediately +-+ * (or after end rx/tx frame if ongoing) +-+ */ +-+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) { +-+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); +-+ REG_RMW_BUFFER_FLUSH(ah); +-+ ENABLE_REG_RMW_BUFFER(ah); +-+ } +-+ +-+ /* +- * Load software filtered NF value into baseband internal minCCApwr +- * variable. +- */ +-@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s +- +- /* +- * Wait for load to complete, should be fast, a few 10s of us. +-- * The max delay was changed from an original 250us to 10000us +-- * since 250us often results in NF load timeout and causes deaf +-- * condition during stress testing 12/12/2009 +-+ * The max delay was changed from an original 250us to 22.2 msec. +-+ * This would increase timeout to the longest possible frame +-+ * (11n max length 22.1 msec) +- */ +-- for (j = 0; j < 10000; j++) { +-+ for (j = 0; j < 22200; j++) { +- if ((REG_READ(ah, AR_PHY_AGC_CONTROL) & +-- AR_PHY_AGC_CONTROL_NF) == 0) +-+ AR_PHY_AGC_CONTROL_NF) == 0) +- break; +- udelay(10); +- } +- +- /* +-+ * Restart NF so it can continue. +-+ */ +-+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) { +-+ ENABLE_REG_RMW_BUFFER(ah); +-+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF) +-+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, +-+ AR_PHY_AGC_CONTROL_ENABLE_NF); +-+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF) +-+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, +-+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF); +-+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); +-+ REG_RMW_BUFFER_FLUSH(ah); +-+ } +-+ +-+ /* +- * We timed out waiting for the noisefloor to load, probably due to an +- * in-progress rx. Simply return here and allow the load plenty of time +- * to complete before the next calibration interval. We need to avoid +-@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s +- * here, the baseband nf cal will just be capped by our present +- * noisefloor until the next calibration timer. +- */ +-- if (j == 10000) { +-+ if (j == 22200) { +- ath_dbg(common, ANY, +- "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n", +- REG_READ(ah, AR_PHY_AGC_CONTROL)); +diff --git a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch +deleted file mode 100644 +index f7f9df9..0000000 +--- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch ++++ /dev/null +@@ -1,54 +0,0 @@ +-From: Henning Rogge +-Date: Wed, 3 Feb 2016 13:58:36 +0100 +-Subject: [PATCH] mac80211: Remove MPP table entries with MPath +- +-Make the mesh_path_del() function remove all mpp table entries +-that are proxied by the removed mesh path. +- +-Acked-by: Bob Copeland +-Signed-off-by: Henning Rogge +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/mesh_pathtbl.c +-+++ b/net/mac80211/mesh_pathtbl.c +-@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s +- rcu_read_unlock(); +- } +- +-+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata, +-+ const u8 *proxy) +-+{ +-+ struct mesh_table *tbl; +-+ struct mesh_path *mpp; +-+ struct mpath_node *node; +-+ int i; +-+ +-+ rcu_read_lock(); +-+ read_lock_bh(&pathtbl_resize_lock); +-+ tbl = resize_dereference_mpp_paths(); +-+ for_each_mesh_entry(tbl, node, i) { +-+ mpp = node->mpath; +-+ if (ether_addr_equal(mpp->mpp, proxy)) { +-+ spin_lock(&tbl->hashwlock[i]); +-+ __mesh_path_del(tbl, node); +-+ spin_unlock(&tbl->hashwlock[i]); +-+ } +-+ } +-+ read_unlock_bh(&pathtbl_resize_lock); +-+ rcu_read_unlock(); +-+} +-+ +- static void table_flush_by_iface(struct mesh_table *tbl, +- struct ieee80211_sub_if_data *sdata) +- { +-@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i +- int hash_idx; +- int err = 0; +- +-+ /* flush relevant mpp entries first */ +-+ mpp_flush_by_proxy(sdata, addr); +-+ +- read_lock_bh(&pathtbl_resize_lock); +- tbl = resize_dereference_mesh_paths(); +- hash_idx = mesh_table_hash(addr, sdata, tbl); +diff --git a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch +deleted file mode 100644 +index 740993c..0000000 +--- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch ++++ /dev/null +@@ -1,104 +0,0 @@ +-From: Henning Rogge +-Date: Wed, 3 Feb 2016 13:58:37 +0100 +-Subject: [PATCH] mac80211: let unused MPP table entries timeout +- +-Remember the last time when a mpp table entry is used for +-rx or tx and remove them after MESH_PATH_EXPIRE time. +- +-Acked-by: Bob Copeland +-Signed-off-by: Henning Rogge +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/mesh_pathtbl.c +-+++ b/net/mac80211/mesh_pathtbl.c +-@@ -942,6 +942,46 @@ enddel: +- } +- +- /** +-+ * mpp_path_del - delete a mesh proxy path from the table +-+ * +-+ * @addr: addr address (ETH_ALEN length) +-+ * @sdata: local subif +-+ * +-+ * Returns: 0 if successful +-+ */ +-+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr) +-+{ +-+ struct mesh_table *tbl; +-+ struct mesh_path *mpath; +-+ struct mpath_node *node; +-+ struct hlist_head *bucket; +-+ int hash_idx; +-+ int err = 0; +-+ +-+ read_lock_bh(&pathtbl_resize_lock); +-+ tbl = resize_dereference_mpp_paths(); +-+ hash_idx = mesh_table_hash(addr, sdata, tbl); +-+ bucket = &tbl->hash_buckets[hash_idx]; +-+ +-+ spin_lock(&tbl->hashwlock[hash_idx]); +-+ hlist_for_each_entry(node, bucket, list) { +-+ mpath = node->mpath; +-+ if (mpath->sdata == sdata && +-+ ether_addr_equal(addr, mpath->dst)) { +-+ __mesh_path_del(tbl, node); +-+ goto enddel; +-+ } +-+ } +-+ +-+ err = -ENXIO; +-+enddel: +-+ mesh_paths_generation++; +-+ spin_unlock(&tbl->hashwlock[hash_idx]); +-+ read_unlock_bh(&pathtbl_resize_lock); +-+ return err; +-+} +-+ +-+/** +- * mesh_path_tx_pending - sends pending frames in a mesh path queue +- * +- * @mpath: mesh path to activate +-@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s +- time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) +- mesh_path_del(mpath->sdata, mpath->dst); +- } +-+ +-+ tbl = rcu_dereference(mpp_paths); +-+ for_each_mesh_entry(tbl, node, i) { +-+ if (node->mpath->sdata != sdata) +-+ continue; +-+ mpath = node->mpath; +-+ if ((!(mpath->flags & MESH_PATH_FIXED)) && +-+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) +-+ mpp_path_del(mpath->sdata, mpath->dst); +-+ } +-+ +- rcu_read_unlock(); +- } +- +---- a/net/mac80211/rx.c +-+++ b/net/mac80211/rx.c +-@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 +- spin_lock_bh(&mppath->state_lock); +- if (!ether_addr_equal(mppath->mpp, mpp_addr)) +- memcpy(mppath->mpp, mpp_addr, ETH_ALEN); +-+ mppath->exp_time = jiffies; +- spin_unlock_bh(&mppath->state_lock); +- } +- rcu_read_unlock(); +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h +- mpp_lookup = true; +- } +- +-- if (mpp_lookup) +-+ if (mpp_lookup) { +- mppath = mpp_path_lookup(sdata, skb->data); +-+ if (mppath) +-+ mppath->exp_time = jiffies; +-+ } +- +- if (mppath && mpath) +- mesh_path_del(mpath->sdata, mpath->dst); +diff --git a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch +deleted file mode 100644 +index 0c36b1d..0000000 +--- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch ++++ /dev/null +@@ -1,143 +0,0 @@ +-From: Henning Rogge +-Date: Wed, 3 Feb 2016 13:58:38 +0100 +-Subject: [PATCH] mac80211: Unify mesh and mpp path removal function +- +-mpp_path_del() and mesh_path_del() are mostly the same function. +-Move common code into a new static function. +- +-Acked-by: Bob Copeland +-Signed-off-by: Henning Rogge +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/mesh_pathtbl.c +-+++ b/net/mac80211/mesh_pathtbl.c +-@@ -55,16 +55,21 @@ int mpp_paths_generation; +- static DEFINE_RWLOCK(pathtbl_resize_lock); +- +- +-+static inline struct mesh_table *resize_dereference_paths( +-+ struct mesh_table __rcu *table) +-+{ +-+ return rcu_dereference_protected(table, +-+ lockdep_is_held(&pathtbl_resize_lock)); +-+} +-+ +- static inline struct mesh_table *resize_dereference_mesh_paths(void) +- { +-- return rcu_dereference_protected(mesh_paths, +-- lockdep_is_held(&pathtbl_resize_lock)); +-+ return resize_dereference_paths(mesh_paths); +- } +- +- static inline struct mesh_table *resize_dereference_mpp_paths(void) +- { +-- return rcu_dereference_protected(mpp_paths, +-- lockdep_is_held(&pathtbl_resize_lock)); +-+ return resize_dereference_paths(mpp_paths); +- } +- +- /* +-@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee +- } +- +- /** +-- * mesh_path_del - delete a mesh path from the table +-+ * table_path_del - delete a path from the mesh or mpp table +- * +-- * @addr: dst address (ETH_ALEN length) +-+ * @tbl: mesh or mpp path table +- * @sdata: local subif +-+ * @addr: dst address (ETH_ALEN length) +- * +- * Returns: 0 if successful +- */ +--int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr) +-+static int table_path_del(struct mesh_table __rcu *rcu_tbl, +-+ struct ieee80211_sub_if_data *sdata, +-+ const u8 *addr) +- { +- struct mesh_table *tbl; +- struct mesh_path *mpath; +-@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i +- int hash_idx; +- int err = 0; +- +-- /* flush relevant mpp entries first */ +-- mpp_flush_by_proxy(sdata, addr); +-- +-- read_lock_bh(&pathtbl_resize_lock); +-- tbl = resize_dereference_mesh_paths(); +-+ tbl = resize_dereference_paths(rcu_tbl); +- hash_idx = mesh_table_hash(addr, sdata, tbl); +- bucket = &tbl->hash_buckets[hash_idx]; +- +-@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i +- +- err = -ENXIO; +- enddel: +-- mesh_paths_generation++; +- spin_unlock(&tbl->hashwlock[hash_idx]); +-+ return err; +-+} +-+ +-+/** +-+ * mesh_path_del - delete a mesh path from the table +-+ * +-+ * @addr: dst address (ETH_ALEN length) +-+ * @sdata: local subif +-+ * +-+ * Returns: 0 if successful +-+ */ +-+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr) +-+{ +-+ int err = 0; +-+ +-+ /* flush relevant mpp entries first */ +-+ mpp_flush_by_proxy(sdata, addr); +-+ +-+ read_lock_bh(&pathtbl_resize_lock); +-+ err = table_path_del(mesh_paths, sdata, addr); +-+ mesh_paths_generation++; +- read_unlock_bh(&pathtbl_resize_lock); +-+ +- return err; +- } +- +-@@ -951,33 +976,13 @@ enddel: +- */ +- static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr) +- { +-- struct mesh_table *tbl; +-- struct mesh_path *mpath; +-- struct mpath_node *node; +-- struct hlist_head *bucket; +-- int hash_idx; +- int err = 0; +- +- read_lock_bh(&pathtbl_resize_lock); +-- tbl = resize_dereference_mpp_paths(); +-- hash_idx = mesh_table_hash(addr, sdata, tbl); +-- bucket = &tbl->hash_buckets[hash_idx]; +-- +-- spin_lock(&tbl->hashwlock[hash_idx]); +-- hlist_for_each_entry(node, bucket, list) { +-- mpath = node->mpath; +-- if (mpath->sdata == sdata && +-- ether_addr_equal(addr, mpath->dst)) { +-- __mesh_path_del(tbl, node); +-- goto enddel; +-- } +-- } +-- +-- err = -ENXIO; +--enddel: +-- mesh_paths_generation++; +-- spin_unlock(&tbl->hashwlock[hash_idx]); +-+ err = table_path_del(mpp_paths, sdata, addr); +-+ mpp_paths_generation++; +- read_unlock_bh(&pathtbl_resize_lock); +-+ +- return err; +- } +- +diff --git a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch +deleted file mode 100644 +index 4dc6d66..0000000 +--- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch ++++ /dev/null +@@ -1,51 +0,0 @@ +-From: Sven Eckelmann +-Date: Tue, 2 Feb 2016 08:12:26 +0100 +-Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to +- Kbps +- +-The change from cur_tp to the function +-minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the +-current throughput. For example in minstrel_ht the correct +-conversion between them would be: +- +- mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..). +- +-This factor 10 must also be included in the calculation of +-minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to +-return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing +-algorithms like B.A.T.M.A.N. V will make incorrect decision based on these +-values. Its kernel based implementation expects expected_throughput always +-to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps]. +- +-The same requirement has iw or olsrdv2's nl80211 based statistics module +-which retrieve the same data via NL80211_STA_INFO_TX_BITRATE. +- +-Cc: stable@vger.kernel.org +-Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function") +-Signed-off-by: Sven Eckelmann +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/rc80211_minstrel.c +-+++ b/net/mac80211/rc80211_minstrel.c +-@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through +- * computing cur_tp +- */ +- tmp_mrs = &mi->r[idx].stats; +-- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma); +-+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10; +- tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024; +- +- return tmp_cur_tp; +---- a/net/mac80211/rc80211_minstrel_ht.c +-+++ b/net/mac80211/rc80211_minstrel_ht.c +-@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro +- prob = mi->groups[i].rates[j].prob_ewma; +- +- /* convert tp_avg from pkt per second in kbps */ +-- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024; +-+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10; +-+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024; +- +- return tp_avg; +- } +diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch +deleted file mode 100644 +index 1fd016f..0000000 +--- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch ++++ /dev/null +@@ -1,307 +0,0 @@ +-From: Hante Meuleman +-Date: Sun, 7 Feb 2016 18:08:24 +0100 +-Subject: [PATCH] brcmfmac: Increase nr of supported flowrings. +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-New generation devices have firmware which has more than 256 flowrings. +-E.g. following debugging message comes from 14e4:4365 BCM4366: +-[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264 +- +-At various code places (related to flowrings) we were using u8 which +-could lead to storing wrong number or infinite loops when indexing with +-this type. This issue was quite easy to spot in brcmf_flowring_detach +-where it led to infinite loop e.g. on failed initialization. +- +-This patch switches code to proper types and increases the maximum +-number of supported flowrings to 512. +- +-Originally this change was sent in September 2015, but back it was +-causing a regression on BCM43602 resulting in: +-Unable to handle kernel NULL pointer dereference at virtual address ... +- +-The reason for this regression was missing update (s/u8/u16) of struct +-brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix +-bug in flowring management."). Starting with that it's safe to apply +-this original patch as it doesn't cause a regression anymore. +- +-This patch fixes an infinite loop on BCM4366 which is supported since +-4.4 so it makes sense to apply it to stable 4.4+. +- +-Cc: # 4.4+ +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Franky (Zhenhui) Lin +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Rafał Miłecki +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +-@@ -32,7 +32,7 @@ +- #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256) +- #define BRCMF_FLOWRING_INVALID_IFIDX 0xff +- +--#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16) +-+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16) +- #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16) +- +- static const u8 brcmf_flowring_prio2fifo[] = { +-@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f +- u8 prio, u8 ifidx) +- { +- struct brcmf_flowring_hash *hash; +-- u8 hash_idx; +-+ u16 hash_idx; +- u32 i; +- bool found; +- bool sta; +-@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f +- } +- hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) : +- BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx); +-+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1); +- found = false; +- hash = flow->hash; +- for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) { +-@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f +- break; +- } +- hash_idx++; +-+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1); +- } +- if (found) +- return hash[hash_idx].flowid; +-@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f +- { +- struct brcmf_flowring_ring *ring; +- struct brcmf_flowring_hash *hash; +-- u8 hash_idx; +-+ u16 hash_idx; +- u32 i; +- bool found; +- u8 fifo; +-@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f +- } +- hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) : +- BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx); +-+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1); +- found = false; +- hash = flow->hash; +- for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) { +-@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f +- break; +- } +- hash_idx++; +-+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1); +- } +- if (found) { +- for (i = 0; i < flow->nrofrings; i++) { +-@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f +- } +- +- +--u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid) +-+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid) +- { +- struct brcmf_flowring_ring *ring; +- +-@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr +- } +- +- +--static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid, +-+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid, +- bool blocked) +- { +- struct brcmf_flowring_ring *ring; +-@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct +- } +- +- +--void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid) +-+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid) +- { +- struct brcmf_flowring_ring *ring; +-- u8 hash_idx; +-+ u16 hash_idx; +- struct sk_buff *skb; +- +- ring = flow->rings[flowid]; +-@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_ +- } +- +- +--u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid, +-+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid, +- struct sk_buff *skb) +- { +- struct brcmf_flowring_ring *ring; +-@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_ +- } +- +- +--struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid) +-+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid) +- { +- struct brcmf_flowring_ring *ring; +- struct sk_buff *skb; +-@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s +- } +- +- +--void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid, +-+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid, +- struct sk_buff *skb) +- { +- struct brcmf_flowring_ring *ring; +-@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm +- } +- +- +--u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid) +-+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid) +- { +- struct brcmf_flowring_ring *ring; +- +-@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo +- } +- +- +--void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid) +-+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid) +- { +- struct brcmf_flowring_ring *ring; +- +-@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl +- } +- +- +--u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid) +-+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid) +- { +- struct brcmf_flowring_ring *ring; +-- u8 hash_idx; +-+ u16 hash_idx; +- +- ring = flow->rings[flowid]; +- hash_idx = ring->hash_id; +-@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_ +- struct brcmf_pub *drvr = bus_if->drvr; +- struct brcmf_flowring_tdls_entry *search; +- struct brcmf_flowring_tdls_entry *remove; +-- u8 flowid; +-+ u16 flowid; +- +- for (flowid = 0; flowid < flow->nrofrings; flowid++) { +- if (flow->rings[flowid]) +-@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode( +- struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev); +- struct brcmf_pub *drvr = bus_if->drvr; +- u32 i; +-- u8 flowid; +-+ u16 flowid; +- +- if (flow->addr_mode[ifidx] != addr_mode) { +- for (i = 0; i < ARRAY_SIZE(flow->hash); i++) { +-@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b +- struct brcmf_flowring_tdls_entry *prev; +- struct brcmf_flowring_tdls_entry *search; +- u32 i; +-- u8 flowid; +-+ u16 flowid; +- bool sta; +- +- sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT); +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h +-@@ -16,7 +16,7 @@ +- #define BRCMFMAC_FLOWRING_H +- +- +--#define BRCMF_FLOWRING_HASHSIZE 256 +-+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */ +- #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF +- +- +-@@ -24,7 +24,7 @@ struct brcmf_flowring_hash { +- u8 mac[ETH_ALEN]; +- u8 fifo; +- u8 ifidx; +-- u8 flowid; +-+ u16 flowid; +- }; +- +- enum ring_status { +-@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f +- u8 prio, u8 ifidx); +- u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN], +- u8 prio, u8 ifidx); +--void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid); +--void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid); +--u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid); +--u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid, +-+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid); +-+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid); +-+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid); +-+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid, +- struct sk_buff *skb); +--struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid); +--void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid, +-+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid); +-+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid, +- struct sk_buff *skb); +--u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid); +--u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid); +-+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid); +-+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid); +- struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings); +- void brcmf_flowring_detach(struct brcmf_flowring *flow); +- void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx, +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +-@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create( +- } +- +- +--static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid) +-+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid) +- { +- struct brcmf_flowring *flow = msgbuf->flow; +- struct brcmf_commonring *commonring; +-@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct +- } +- +- +--void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid) +-+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid) +- { +- struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd; +- struct msgbuf_tx_flowring_delete_req *delete; +-@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc +- u32 count; +- +- if_msgbuf = drvr->bus_if->msgbuf; +-+ +-+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) { +-+ brcmf_err("driver not configured for this many flowrings %d\n", +-+ if_msgbuf->nrof_flowrings); +-+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1; +-+ } +-+ +- msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL); +- if (!msgbuf) +- goto fail; +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h +-@@ -33,7 +33,7 @@ +- +- +- int brcmf_proto_msgbuf_rx_trigger(struct device *dev); +--void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); +-+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid); +- int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); +- void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); +- #else +diff --git a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch +deleted file mode 100644 +index e414f23..0000000 +--- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch ++++ /dev/null +@@ -1,22 +0,0 @@ +-From: Felix Fietkau +-Date: Mon, 8 Feb 2016 14:24:36 +0100 +-Subject: [PATCH] cfg80211: fix faulty variable initialization in +- ieee80211_amsdu_to_8023s +- +-reuse_skb is set to true if the code decides to use the last segment. +-Fixes a memory leak +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/wireless/util.c +-+++ b/net/wireless/util.c +-@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_ +- u8 *payload; +- int offset = 0, remaining, err; +- struct ethhdr eth; +-- bool reuse_skb = true; +-+ bool reuse_skb = false; +- bool last = false; +- +- if (has_80211_header) { +diff --git a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch b/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch +deleted file mode 100644 +index 6e2d0cf..0000000 +--- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch ++++ /dev/null +@@ -1,132 +0,0 @@ +-From: Felix Fietkau +-Date: Mon, 8 Feb 2016 14:33:19 +0100 +-Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx +- +-This massively reduces data copying and thus improves rx performance +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/wireless/util.c +-+++ b/net/wireless/util.c +-@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b +- } +- EXPORT_SYMBOL(ieee80211_data_from_8023); +- +-+static void +-+__frame_add_frag(struct sk_buff *skb, struct page *page, +-+ void *ptr, int len, int size) +-+{ +-+ struct skb_shared_info *sh = skb_shinfo(skb); +-+ int page_offset; +-+ +-+ atomic_inc(&page->_count); +-+ page_offset = ptr - page_address(page); +-+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size); +-+} +-+ +-+static void +-+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame, +-+ int offset, int len) +-+{ +-+ struct skb_shared_info *sh = skb_shinfo(skb); +-+ const skb_frag_t *frag = &sh->frags[-1]; +-+ struct page *frag_page; +-+ void *frag_ptr; +-+ int frag_len, frag_size; +-+ int head_size = skb->len - skb->data_len; +-+ int cur_len; +-+ +-+ frag_page = virt_to_head_page(skb->head); +-+ frag_ptr = skb->data; +-+ frag_size = head_size; +-+ +-+ while (offset >= frag_size) { +-+ offset -= frag_size; +-+ frag++; +-+ frag_page = skb_frag_page(frag); +-+ frag_ptr = skb_frag_address(frag); +-+ frag_size = skb_frag_size(frag); +-+ } +-+ +-+ frag_ptr += offset; +-+ frag_len = frag_size - offset; +-+ +-+ cur_len = min(len, frag_len); +-+ +-+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size); +-+ len -= cur_len; +-+ +-+ while (len > 0) { +-+ frag++; +-+ frag_len = skb_frag_size(frag); +-+ cur_len = min(len, frag_len); +-+ __frame_add_frag(frame, skb_frag_page(frag), +-+ skb_frag_address(frag), cur_len, frag_len); +-+ len -= cur_len; +-+ } +-+} +-+ +- static struct sk_buff * +- __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen, +-- int offset, int len) +-+ int offset, int len, bool reuse_frag) +- { +- struct sk_buff *frame; +-+ int cur_len = len; +- +- if (skb->len - offset < len) +- return NULL; +- +- /* +-+ * When reusing framents, copy some data to the head to simplify +-+ * ethernet header handling and speed up protocol header processing +-+ * in the stack later. +-+ */ +-+ if (reuse_frag) +-+ cur_len = min_t(int, len, 32); +-+ +-+ /* +- * Allocate and reserve two bytes more for payload +- * alignment since sizeof(struct ethhdr) is 14. +- */ +-- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len); +-+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len); +- +- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); +-- skb_copy_bits(skb, offset, skb_put(frame, len), len); +-+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len); +-+ +-+ len -= cur_len; +-+ if (!len) +-+ return frame; +-+ +-+ offset += cur_len; +-+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len); +- +- return frame; +- } +-@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_ +- u8 *payload; +- int offset = 0, remaining, err; +- struct ethhdr eth; +-+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb); +- bool reuse_skb = false; +- bool last = false; +- +-@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_ +- offset += sizeof(struct ethhdr); +- /* reuse skb for the last subframe */ +- last = remaining <= subframe_len + padding; +-- if (!skb_is_nonlinear(skb) && last) { +-+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) { +- skb_pull(skb, offset); +- frame = skb; +- reuse_skb = true; +- } else { +-- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len); +-+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len, +-+ reuse_frag); +- if (!frame) +- goto purge; +- +diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch b/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch +deleted file mode 100644 +index f8f4f09..0000000 +--- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch ++++ /dev/null +@@ -1,36 +0,0 @@ +-From: Lorenzo Bianconi +-Date: Wed, 10 Feb 2016 16:08:17 +0100 +-Subject: [PATCH] mac80211: fix wiphy supported_band access +- +-Fix wiphy supported_band access in tx radiotap parsing. In particular, +-info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not +-assigned yet. This cause a kernel crash on 5GHz only devices. +-Move ieee80211_parse_tx_radiotap() after info->band assignment +- +-Signed-off-by: Lorenzo Bianconi +---- +- +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit +- info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS | +- IEEE80211_TX_CTL_INJECTED; +- +-- /* process and remove the injection radiotap header */ +-- if (!ieee80211_parse_tx_radiotap(local, skb)) +-- goto fail; +-- +- rcu_read_lock(); +- +- /* +-@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit +- goto fail_rcu; +- +- info->band = chandef->chan->band; +-+ /* process and remove the injection radiotap header */ +-+ if (!ieee80211_parse_tx_radiotap(local, skb)) +-+ goto fail_rcu; +-+ +- ieee80211_xmit(sdata, NULL, skb); +- rcu_read_unlock(); +- +diff --git a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch +deleted file mode 100644 +index acaacf7..0000000 +--- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch ++++ /dev/null +@@ -1,61 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 18 Feb 2016 19:30:05 +0100 +-Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected +- max_prob_rate +- +-Prevents excessive A-MSDU aggregation at low data rates or bad +-conditions. +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/mac80211/rc80211_minstrel_ht.c +-+++ b/net/mac80211/rc80211_minstrel_ht.c +-@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri +- ratetbl->rate[offset].flags = flags; +- } +- +-+static int +-+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi) +-+{ +-+ int group = mi->max_prob_rate / MCS_GROUP_RATES; +-+ const struct mcs_group *g = &minstrel_mcs_groups[group]; +-+ int rate = mi->max_prob_rate % MCS_GROUP_RATES; +-+ +-+ /* Disable A-MSDU if max_prob_rate is bad */ +-+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) +-+ return 1; +-+ +-+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */ +-+ if (g->duration[rate] > MCS_DURATION(1, 0, 52)) +-+ return 500; +-+ +-+ /* +-+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual +-+ * data packet size +-+ */ +-+ if (g->duration[rate] > MCS_DURATION(1, 0, 104)) +-+ return 1500; +-+ +-+ /* +-+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice +-+ * the usual data packet size +-+ */ +-+ if (g->duration[rate] > MCS_DURATION(1, 0, 260)) +-+ return 3000; +-+ +-+ /* unlimited */ +-+ return 0; +-+} +-+ +- static void +- minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) +- { +-@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel +- minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate); +- } +- +-+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi); +- rates->rate[i].idx = -1; +- rate_control_set_rates(mp->hw, mi->sta, rates); +- } +diff --git a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch +deleted file mode 100644 +index 32a2ad6..0000000 +--- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch ++++ /dev/null +@@ -1,31 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 18 Feb 2016 19:45:33 +0100 +-Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to +- 0 +- +-The value 5000 was put here with the addition of the timeout field to +-ieee80211_start_tx_ba_session. It was originally added in mac80211 to +-save resources for drivers like iwlwifi, which only supports a limited +-number of concurrent aggregation sessions. +- +-Since iwlwifi does not use minstrel_ht and other drivers don't need +-this, 0 is a better default - especially since there have been +-recent reports of aggregation setup related issues reproduced with +-ath9k. This should improve stability without causing any adverse +-effects. +- +-Cc: stable@vger.kernel.org +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/mac80211/rc80211_minstrel_ht.c +-+++ b/net/mac80211/rc80211_minstrel_ht.c +-@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta +- if (likely(sta->ampdu_mlme.tid_tx[tid])) +- return; +- +-- ieee80211_start_tx_ba_session(pubsta, tid, 5000); +-+ ieee80211_start_tx_ba_session(pubsta, tid, 0); +- } +- +- static void +diff --git a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch b/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch +deleted file mode 100644 +index 229351b..0000000 +--- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch ++++ /dev/null +@@ -1,26 +0,0 @@ +-From: Felix Fietkau +-Date: Wed, 24 Feb 2016 12:03:13 +0100 +-Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling +-MIME-Version: 1.0 +-Content-Type: text/plain; charset=UTF-8 +-Content-Transfer-Encoding: 8bit +- +-RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's +-a dual-stream rate and the sta is in dynamic SMPS mode. +- +-Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS") +-Reported-by: Matías Richart +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/mac80211/rc80211_minstrel_ht.c +-+++ b/net/mac80211/rc80211_minstrel_ht.c +-@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri +- * - if station is in dynamic SMPS (and streams > 1) +- * - for fallback rates, to increase chances of getting through +- */ +-- if (offset > 0 && +-+ if (offset > 0 || +- (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC && +- group->streams > 1)) { +- ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts; +diff --git a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch b/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch +deleted file mode 100644 +index 56cd94a..0000000 +--- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch ++++ /dev/null +@@ -1,35 +0,0 @@ +-From: Jouni Malinen +-Date: Tue, 1 Mar 2016 00:29:00 +0200 +-Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode +- +-Public Action frames use special rules for how the BSSID field (Address +-3) is set. A wildcard BSSID is used in cases where the transmitter and +-recipient are not members of the same BSS. As such, we need to accept +-Public Action frames with wildcard BSSID. +- +-Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when +-operating as AP") added a rule that drops Action frames to TDLS-peers +-based on an Action frame having different DA (Address 1) and BSSID +-(Address 3) values. This is not correct since it misses the possibility +-of BSSID being a wildcard BSSID in which case the Address 1 would not +-necessarily match. +- +-Fix this by allowing mac80211 to accept wildcard BSSID in an Action +-frame when in AP mode. +- +-Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP") +-Cc: stable@vger.kernel.org +-Signed-off-by: Jouni Malinen +-Signed-off-by: Johannes Berg +---- +- +---- a/net/mac80211/rx.c +-+++ b/net/mac80211/rx.c +-@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc +- return false; +- /* ignore action frames to TDLS-peers */ +- if (ieee80211_is_action(hdr->frame_control) && +-+ !is_broadcast_ether_addr(bssid) && +- !ether_addr_equal(bssid, hdr->addr1)) +- return false; +- } +diff --git a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch b/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch +deleted file mode 100644 +index 15d6cd0..0000000 +--- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch ++++ /dev/null +@@ -1,21 +0,0 @@ +-From: Lorenzo Bianconi +-Date: Fri, 19 Feb 2016 11:43:04 +0100 +-Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes +- +-Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to +-define alignment and size of VHT info in tx radiotap +- +-Signed-off-by: Lorenzo Bianconi +-Signed-off-by: Johannes Berg +---- +- +---- a/net/wireless/radiotap.c +-+++ b/net/wireless/radiotap.c +-@@ -43,6 +43,7 @@ static const struct radiotap_align_size +- [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, }, +- [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, }, +- [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, }, +-+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, }, +- /* +- * add more here as they are defined in radiotap.h +- */ +diff --git a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch b/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch +deleted file mode 100644 +index de1b386..0000000 +--- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch ++++ /dev/null +@@ -1,36 +0,0 @@ +-From: Sven Eckelmann +-Date: Wed, 24 Feb 2016 16:25:49 +0100 +-Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap +- header +- +-The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2 +-bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if +-the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be +-confused with IEEE80211_RADIOTAP_MCS_BW_20U. +- +-Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames") +-Signed-off-by: Sven Eckelmann +---- +- +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap( +- bool rate_found = false; +- u8 rate_retries = 0; +- u16 rate_flags = 0; +-- u8 mcs_known, mcs_flags; +-+ u8 mcs_known, mcs_flags, mcs_bw; +- int i; +- +- info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | +-@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap( +- mcs_flags & IEEE80211_RADIOTAP_MCS_SGI) +- rate_flags |= IEEE80211_TX_RC_SHORT_GI; +- +-+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK; +- if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW && +-- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40) +-+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40) +- rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; +- break; +- +diff --git a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch b/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch +deleted file mode 100644 +index ac1f251..0000000 +--- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch ++++ /dev/null +@@ -1,65 +0,0 @@ +-From: Lorenzo Bianconi +-Date: Tue, 23 Feb 2016 15:43:35 +0100 +-Subject: [PATCH] mac80211: parse VHT info in injected frames +- +-Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap(). +-That capability has been tested using a d-link dir-860l rev b1 running +-OpenWrt trunk and mt76 driver +- +-Signed-off-by: Lorenzo Bianconi +---- +- +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap( +- u8 rate_retries = 0; +- u16 rate_flags = 0; +- u8 mcs_known, mcs_flags, mcs_bw; +-+ u16 vht_known; +-+ u8 vht_mcs = 0, vht_nss = 0; +- int i; +- +- info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | +-@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap( +- rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; +- break; +- +-+ case IEEE80211_RADIOTAP_VHT: +-+ vht_known = get_unaligned_le16(iterator.this_arg); +-+ rate_found = true; +-+ +-+ rate_flags = IEEE80211_TX_RC_VHT_MCS; +-+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) && +-+ (iterator.this_arg[2] & +-+ IEEE80211_RADIOTAP_VHT_FLAG_SGI)) +-+ rate_flags |= IEEE80211_TX_RC_SHORT_GI; +-+ if (vht_known & +-+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) { +-+ if (iterator.this_arg[3] == 1) +-+ rate_flags |= +-+ IEEE80211_TX_RC_40_MHZ_WIDTH; +-+ else if (iterator.this_arg[3] == 4) +-+ rate_flags |= +-+ IEEE80211_TX_RC_80_MHZ_WIDTH; +-+ else if (iterator.this_arg[3] == 11) +-+ rate_flags |= +-+ IEEE80211_TX_RC_160_MHZ_WIDTH; +-+ } +-+ +-+ vht_mcs = iterator.this_arg[4] >> 4; +-+ vht_nss = iterator.this_arg[4] & 0xF; +-+ break; +-+ +- /* +- * Please update the file +- * Documentation/networking/mac80211-injection.txt +-@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap( +- +- if (rate_flags & IEEE80211_TX_RC_MCS) { +- info->control.rates[0].idx = rate; +-+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) { +-+ ieee80211_rate_set_vht(info->control.rates, vht_mcs, +-+ vht_nss); +- } else { +- for (i = 0; i < sband->n_bitrates; i++) { +- if (rate * 5 != sband->bitrates[i].bitrate) +diff --git a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch b/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch +deleted file mode 100644 +index d7452c2..0000000 +--- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch ++++ /dev/null +@@ -1,23 +0,0 @@ +-From: Felix Fietkau +-Date: Wed, 2 Mar 2016 15:51:40 +0100 +-Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to +- the driver +- +-Fall back to rate control if the requested bitrate was not found. +- +-Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames") +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/mac80211/tx.c +-+++ b/net/mac80211/tx.c +-@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap( +- } +- } +- +-+ if (info->control.rates[0].idx < 0) +-+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT; +-+ +- info->control.rates[0].flags = rate_flags; +- info->control.rates[0].count = min_t(u8, rate_retries + 1, +- local->hw.max_rate_tries); +diff --git a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch b/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch +deleted file mode 100644 +index 55ff817..0000000 +--- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch ++++ /dev/null +@@ -1,77 +0,0 @@ +-From: Felix Fietkau +-Date: Thu, 3 Mar 2016 23:20:06 +0100 +-Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic +- +-There were a few issues that were slowing down the process of finding +-the optimal rate, especially on devices with multi-rate retry +-limitations: +- +-When max_tp_rate[0] was slower than max_tp_rate[1], the code did not +-sample max_tp_rate[1], which would often allow it to switch places with +-max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the +-rate is otherwise good). +- +-Also, sample attempts of rates between max_tp_rate[0] and [1] were being +-ignored in this case, because the code only checked if the rate was +-slower than [1]. +- +-Fix this by checking against the fastest / second fastest max_tp_rate +-instead of assuming a specific order between the two. +- +-In my tests this patch significantly reduces the time until minstrel_ht +-finds the optimal rate right after assoc +- +-Signed-off-by: Felix Fietkau +---- +- +---- a/net/mac80211/rc80211_minstrel_ht.c +-+++ b/net/mac80211/rc80211_minstrel_ht.c +-@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel +- struct minstrel_rate_stats *mrs; +- struct minstrel_mcs_group_data *mg; +- unsigned int sample_dur, sample_group, cur_max_tp_streams; +-+ int tp_rate1, tp_rate2; +- int sample_idx = 0; +- +- if (mi->sample_wait > 0) { +-@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel +- mrs = &mg->rates[sample_idx]; +- sample_idx += sample_group * MCS_GROUP_RATES; +- +-+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */ +-+ if (minstrel_get_duration(mi->max_tp_rate[0]) > +-+ minstrel_get_duration(mi->max_tp_rate[1])) { +-+ tp_rate1 = mi->max_tp_rate[1]; +-+ tp_rate2 = mi->max_tp_rate[0]; +-+ } else { +-+ tp_rate1 = mi->max_tp_rate[0]; +-+ tp_rate2 = mi->max_tp_rate[1]; +-+ } +-+ +- /* +- * Sampling might add some overhead (RTS, no aggregation) +-- * to the frame. Hence, don't use sampling for the currently +-- * used rates. +-+ * to the frame. Hence, don't use sampling for the highest currently +-+ * used highest throughput or probability rate. +- */ +-- if (sample_idx == mi->max_tp_rate[0] || +-- sample_idx == mi->max_tp_rate[1] || +-- sample_idx == mi->max_prob_rate) +-+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate) +- return -1; +- +- /* +-@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel +- * if the link is working perfectly. +- */ +- +-- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] / +-+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 / +- MCS_GROUP_RATES].streams; +- sample_dur = minstrel_get_duration(sample_idx); +-- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) && +-+ if (sample_dur >= minstrel_get_duration(tp_rate2) && +- (cur_max_tp_streams - 1 < +- minstrel_mcs_groups[sample_group].streams || +- sample_dur >= minstrel_get_duration(mi->max_prob_rate))) { +diff --git a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch b/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch +deleted file mode 100644 +index 3de0f64..0000000 +--- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch ++++ /dev/null +@@ -1,73 +0,0 @@ +-From: Hante Meuleman +-Date: Wed, 17 Feb 2016 11:26:57 +0100 +-Subject: [PATCH] brcmfmac: use device memsize config from fw if defined +- +-Newer type pcie devices have memory which get shared between fw and +-hw. The division of this memory is done firmware compile time. As a +-result the ramsize as used by driver needs to be adjusted for this. +-This is done by reading the memory size from the firmware. +- +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Franky (Zhenhui) Lin +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc +- #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4 +- #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3 +- +-+/* Magic number at a magic location to find RAM size */ +-+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */ +-+#define BRCMF_RAMSIZE_OFFSET 0x6c +-+ +- +- struct brcmf_pcie_console { +- u32 base_addr; +-@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_ +- }; +- +- +-+static void +-+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data, +-+ u32 data_len) +-+{ +-+ __le32 *field; +-+ u32 newsize; +-+ +-+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8) +-+ return; +-+ +-+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET]; +-+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC) +-+ return; +-+ field++; +-+ newsize = le32_to_cpup(field); +-+ +-+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n", +-+ newsize); +-+ devinfo->ci->ramsize = newsize; +-+} +-+ +-+ +- static int +- brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo, +- u32 sharedram_addr) +-@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi +- +- brcmf_pcie_attach(devinfo); +- +-+ /* Some of the firmwares have the size of the memory of the device +-+ * defined inside the firmware. This is because part of the memory in +-+ * the device is shared and the devision is determined by FW. Parse +-+ * the firmware and adjust the chip memory size now. +-+ */ +-+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size); +-+ +- ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len); +- if (ret) +- goto fail; +diff --git a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch b/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch +deleted file mode 100644 +index ca03ffe..0000000 +--- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch ++++ /dev/null +@@ -1,58 +0,0 @@ +-From: Hante Meuleman +-Date: Wed, 17 Feb 2016 11:26:58 +0100 +-Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem +- +-The PCIE bar1 window size is specified by chip. Currently the +-ioremap of bar1 was using a define which always matched the size +-of bar1, but newer chips can have a different bar1 sizes. With +-this patch the ioremap will be called with the by chip provided +-window size. +- +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Franky (Zhenhui) Lin +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc +- +- #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */ +- +--#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024) +- #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024) +- +- /* backplane addres space accessed by BAR0 */ +-@@ -252,7 +251,6 @@ struct brcmf_pciedev_info { +- char nvram_name[BRCMF_FW_NAME_LEN]; +- void __iomem *regs; +- void __iomem *tcm; +-- u32 tcm_size; +- u32 ram_base; +- u32 ram_size; +- struct brcmf_chip *ci; +-@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc +- } +- +- devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE); +-- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE); +-- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE; +-+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size); +- +- if (!devinfo->regs || !devinfo->tcm) { +- brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs, +-@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc +- } +- brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n", +- devinfo->regs, (unsigned long long)bar0_addr); +-- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n", +-- devinfo->tcm, (unsigned long long)bar1_addr); +-+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n", +-+ devinfo->tcm, (unsigned long long)bar1_addr, +-+ (unsigned int)bar1_size); +- +- return 0; +- } +diff --git a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch b/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch +deleted file mode 100644 +index e4a8f30..0000000 +--- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch ++++ /dev/null +@@ -1,34 +0,0 @@ +-From: Hante Meuleman +-Date: Wed, 17 Feb 2016 11:26:59 +0100 +-Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip +- +-A newer version of the 4366 PCIE chip has been released. Add +-support for this version of the chip. +- +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +-@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p +- BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt"); +- BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt"); +- BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt"); +-+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt"); +- BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt"); +- +- static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { +-@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B), +-- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B), +-+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), +-+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), +- }; +- +diff --git a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch b/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch +deleted file mode 100644 +index c529ff2..0000000 +--- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch ++++ /dev/null +@@ -1,30 +0,0 @@ +-From: Hante Meuleman +-Date: Wed, 17 Feb 2016 11:27:01 +0100 +-Subject: [PATCH] brcmfmac: increase timeout for tx eapol +- +-When keys get set and updated this has to happen after eapol got +-transmitted (without key or old key) before the key can be updated. +-To make sure the order of sending eapol and configuring key is done +-correctly a timeout for tx of eapol is applied. This timeout is set +-to 50 msec, which is not always enough. Especially in AP mode and +-key updates the timeout may need to be much longer because client(s) +-can be in powersave. Increase the timeout from 50 to 950 msec. +- +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +-@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation"); +- MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); +- MODULE_LICENSE("Dual BSD/GPL"); +- +--#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50) +-+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950) +- +- /* AMPDU rx reordering definitions */ +- #define BRCMF_RXREORDER_FLOWID_OFFSET 0 +diff --git a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch b/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch +deleted file mode 100644 +index f293401..0000000 +--- a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch ++++ /dev/null +@@ -1,114 +0,0 @@ +-From: Hante Meuleman +-Date: Mon, 11 Apr 2016 11:35:23 +0200 +-Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if +- missing +- +-Some nvram files/stores come without the boardrev information, +-but firmware requires this to be set. When not found in nvram then +-add a default boardrev string to the nvram data. +- +-Reported-by: Rafal Milecki +-Reviewed-by: Arend Van Spriel +-Reviewed-by: Franky (Zhenhui) Lin +-Reviewed-by: Pieter-Paul Giesberts +-Signed-off-by: Hante Meuleman +-Signed-off-by: Arend van Spriel +-Signed-off-by: Kalle Valo +---- +- +---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +-@@ -29,6 +29,7 @@ +- #define BRCMF_FW_MAX_NVRAM_SIZE 64000 +- #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */ +- #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */ +-+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff" +- +- enum nvram_parser_state { +- IDLE, +-@@ -51,6 +52,7 @@ enum nvram_parser_state { +- * @entry: start position of key,value entry. +- * @multi_dev_v1: detect pcie multi device v1 (compressed). +- * @multi_dev_v2: detect pcie multi device v2. +-+ * @boardrev_found: nvram contains boardrev information. +- */ +- struct nvram_parser { +- enum nvram_parser_state state; +-@@ -63,6 +65,7 @@ struct nvram_parser { +- u32 entry; +- bool multi_dev_v1; +- bool multi_dev_v2; +-+ bool boardrev_found; +- }; +- +- /** +-@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr +- nvp->multi_dev_v1 = true; +- if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0) +- nvp->multi_dev_v2 = true; +-+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0) +-+ nvp->boardrev_found = true; +- } else if (!is_nvram_char(c) || c == ' ') { +- brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n", +- nvp->line, nvp->column); +-@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru +- while (i < nvp->nvram_len) { +- if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) { +- i += 2; +-+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0) +-+ nvp->boardrev_found = true; +- while (nvp->nvram[i] != 0) { +- nvram[j] = nvp->nvram[i]; +- i++; +-@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru +- while (i < nvp->nvram_len - len) { +- if (strncmp(&nvp->nvram[i], prefix, len) == 0) { +- i += len; +-+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0) +-+ nvp->boardrev_found = true; +- while (nvp->nvram[i] != 0) { +- nvram[j] = nvp->nvram[i]; +- i++; +-@@ -356,6 +365,18 @@ fail: +- nvp->nvram_len = 0; +- } +- +-+static void brcmf_fw_add_defaults(struct nvram_parser *nvp) +-+{ +-+ if (nvp->boardrev_found) +-+ return; +-+ +-+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV, +-+ strlen(BRCMF_FW_DEFAULT_BOARDREV)); +-+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV); +-+ nvp->nvram[nvp->nvram_len] = '\0'; +-+ nvp->nvram_len++; +-+} +-+ +- /* brcmf_nvram_strip :Takes a buffer of "=\n" lines read from a fil +- * and ending in a NUL. Removes carriage returns, empty lines, comment lines, +- * and converts newlines to NULs. Shortens buffer as needed and pads with NULs. +-@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const +- if (nvp.state == END) +- break; +- } +-- if (nvp.multi_dev_v1) +-+ if (nvp.multi_dev_v1) { +-+ nvp.boardrev_found = false; +- brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr); +-- else if (nvp.multi_dev_v2) +-+ } else if (nvp.multi_dev_v2) { +-+ nvp.boardrev_found = false; +- brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr); +-+ } +- +- if (nvp.nvram_len == 0) { +- kfree(nvp.nvram); +- return NULL; +- } +- +-+ brcmf_fw_add_defaults(&nvp); +-+ +- pad = nvp.nvram_len; +- *new_length = roundup(nvp.nvram_len + 1, 4); +- while (pad != *new_length) { +diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch +index 7351353..4634283 100644 +--- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch ++++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch +@@ -8,7 +8,7 @@ + + return; + +#endif + + +- for (band = 0; band < IEEE80211_NUM_BANDS; band++) { ++ for (band = 0; band < NUM_NL80211_BANDS; band++) { + if (!wiphy->bands[band]) + continue; + @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip +@@ -19,7 +19,7 @@ + + return; + +#endif + + +- sband = wiphy->bands[IEEE80211_BAND_2GHZ]; ++ sband = wiphy->bands[NL80211_BAND_2GHZ]; + if (!sband) + return; + @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st +@@ -30,7 +30,7 @@ + + return; + +#endif + + +- if (!wiphy->bands[IEEE80211_BAND_5GHZ]) ++ if (!wiphy->bands[NL80211_BAND_5GHZ]) + return; + + @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator +@@ -59,7 +59,7 @@ + ---help--- + --- a/.local-symbols + +++ b/.local-symbols +-@@ -125,6 +125,7 @@ ADM8211= ++@@ -127,6 +127,7 @@ ADM8211= + ATH_COMMON= + WLAN_VENDOR_ATH= + ATH_DEBUG= +diff --git a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch +index 1a62484..819e64f 100644 +--- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch ++++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/init.c + +++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi ++@@ -728,6 +728,7 @@ static const struct ieee80211_iface_limi + BIT(NL80211_IFTYPE_AP) }, + { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | + BIT(NL80211_IFTYPE_P2P_GO) }, +diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch +index a7f9d9f..4b6da97 100644 +--- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch ++++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc ++@@ -1319,6 +1319,53 @@ void ath9k_deinit_debug(struct ath_softc + ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); + } + +@@ -54,7 +54,7 @@ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +-@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1338,6 +1385,8 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_tx99_init_debug(sc); + ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); + +diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch +index 5892c3e..1825d77 100644 +--- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch ++++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/init.c + +++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void) ++@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void) + { + int error; + +diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch +index 5ecf528..a105d40 100644 +--- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch ++++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1348,6 +1348,52 @@ static const struct file_operations fops ++@@ -1366,6 +1366,52 @@ static const struct file_operations fops + .owner = THIS_MODULE + }; + +@@ -53,7 +53,7 @@ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +-@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1387,6 +1433,8 @@ int ath9k_init_debug(struct ath_hw *ah) + + debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, + &fops_eeprom); +@@ -90,7 +90,7 @@ + ichan->channel = chan->center_freq; + ichan->chan = chan; + @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st +- if (chan->band == IEEE80211_BAND_5GHZ) ++ if (chan->band == NL80211_BAND_5GHZ) + flags |= CHANNEL_5GHZ; + + - switch (chandef->width) { +diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch +index c84d1bc..167eeff 100644 +--- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch ++++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch +@@ -20,7 +20,7 @@ + #define AR9160_DEVID_PCI 0x0027 + --- a/drivers/net/wireless/ath/ath9k/pci.c + +++ b/drivers/net/wireless/ath/ath9k/pci.c +-@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc ++@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc + .driver_data = ATH9K_PCI_BT_ANT_DIV }, + #endif + +diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch +index e151a12..28f5dcc 100644 +--- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch ++++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch +@@ -1,6 +1,6 @@ + --- a/include/net/cfg80211.h + +++ b/include/net/cfg80211.h +-@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map { ++@@ -2406,6 +2406,7 @@ struct cfg80211_qos_map { + * (as advertised by the nl80211 feature flag.) + * @get_tx_power: store the current TX power into the dbm variable; + * return 0 if successful +@@ -8,7 +8,7 @@ + * + * @set_wds_peer: set the WDS peer for a WDS interface + * +-@@ -2624,6 +2625,7 @@ struct cfg80211_ops { ++@@ -2667,6 +2668,7 @@ struct cfg80211_ops { + enum nl80211_tx_power_setting type, int mbm); + int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, + int *dbm); +@@ -18,7 +18,7 @@ + const u8 *addr); + --- a/include/net/mac80211.h + +++ b/include/net/mac80211.h +-@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode { ++@@ -1305,6 +1305,7 @@ enum ieee80211_smps_mode { + * + * @power_level: requested transmit power (in dBm), backward compatibility + * value only that is set to the minimum of all interfaces +@@ -26,7 +26,7 @@ + * + * @chandef: the channel definition to tune to + * @radar_enabled: whether radar detection is enabled +-@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode { ++@@ -1325,6 +1326,7 @@ enum ieee80211_smps_mode { + struct ieee80211_conf { + u32 flags; + int power_level, dynamic_ps_timeout; +@@ -36,9 +36,9 @@ + u8 ps_dtim_period; + --- a/include/uapi/linux/nl80211.h + +++ b/include/uapi/linux/nl80211.h +-@@ -1790,6 +1790,9 @@ enum nl80211_commands { +- * between scans. The scan plans are executed sequentially. +- * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. ++@@ -1819,6 +1819,9 @@ enum nl80211_commands { ++ * ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment + * + + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + + * transmit power to stay within regulatory limits. u32, dBi. +@@ -46,9 +46,9 @@ + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +-@@ -2164,6 +2167,8 @@ enum nl80211_attrs { +- NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, +- NL80211_ATTR_SCHED_SCAN_PLANS, ++@@ -2201,6 +2204,8 @@ enum nl80211_attrs { ++ ++ NL80211_ATTR_PAD, + + + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + + +@@ -57,7 +57,7 @@ + __NL80211_ATTR_AFTER_LAST, + --- a/net/mac80211/cfg.c + +++ b/net/mac80211/cfg.c +-@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct ++@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct + return 0; + } + +@@ -77,7 +77,7 @@ + static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, + const u8 *addr) + { +-@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi ++@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi + .set_wiphy_params = ieee80211_set_wiphy_params, + .set_tx_power = ieee80211_set_tx_power, + .get_tx_power = ieee80211_get_tx_power, +@@ -87,7 +87,7 @@ + CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) + --- a/net/mac80211/ieee80211_i.h + +++ b/net/mac80211/ieee80211_i.h +-@@ -1318,6 +1318,7 @@ struct ieee80211_local { ++@@ -1322,6 +1322,7 @@ struct ieee80211_local { + int dynamic_ps_forced_timeout; + + int user_power_level; /* in dBm, for all interfaces */ +@@ -119,7 +119,7 @@ + if (local->hw.conf.power_level != power) { + changed |= IEEE80211_CONF_CHANGE_POWER; + local->hw.conf.power_level = power; +-@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ ++@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + IEEE80211_RADIOTAP_MCS_HAVE_BW; + local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | + IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; +@@ -129,15 +129,15 @@ + local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; + --- a/net/wireless/nl80211.c + +++ b/net/wireless/nl80211.c +-@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p +- [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 }, +- [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 }, +- [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG }, ++@@ -406,6 +406,7 @@ static const struct nla_policy nl80211_p ++ [NL80211_ATTR_PBSS] = { .type = NLA_FLAG }, ++ [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED }, ++ [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 }, + + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, + }; + + /* policy for the key attributes */ +-@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b ++@@ -2251,6 +2252,20 @@ static int nl80211_set_wiphy(struct sk_b + if (result) + return result; + } +diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +index 5a5e464..6001266 100644 +--- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch ++++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +@@ -1,16 +1,16 @@ + --- a/drivers/net/wireless/ath/ath9k/ath9k.h + +++ b/drivers/net/wireless/ath/ath9k/ath9k.h +-@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru ++@@ -813,6 +813,9 @@ static inline int ath9k_dump_btcoex(stru ++ #ifdef CPTCFG_MAC80211_LEDS + void ath_init_leds(struct ath_softc *sc); + void ath_deinit_leds(struct ath_softc *sc); +- void ath_fill_led_pin(struct ath_softc *sc); + +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name, +-+ const char *trigger, bool active_low); +++ const char *trigger, bool active_low); + + + #else + static inline void ath_init_leds(struct ath_softc *sc) + { +-@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc ++@@ -949,6 +952,13 @@ void ath_ant_comb_scan(struct ath_softc + + #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ + +@@ -24,7 +24,7 @@ + struct ath_softc { + struct ieee80211_hw *hw; + struct device *dev; +-@@ -1005,9 +1015,8 @@ struct ath_softc { ++@@ -1001,9 +1011,8 @@ struct ath_softc { + spinlock_t chan_lock; + + #ifdef CPTCFG_MAC80211_LEDS +@@ -38,24 +38,33 @@ + #ifdef CPTCFG_ATH9K_DEBUGFS + --- a/drivers/net/wireless/ath/ath9k/gpio.c + +++ b/drivers/net/wireless/ath/ath9k/gpio.c +-@@ -24,45 +24,102 @@ +- static void ath_led_brightness(struct led_classdev *led_cdev, +- enum led_brightness brightness) ++@@ -22,7 +22,7 @@ ++ ++ #ifdef CPTCFG_MAC80211_LEDS ++ ++-void ath_fill_led_pin(struct ath_softc *sc) +++static void ath_fill_led_pin(struct ath_softc *sc) + { +-- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); +-- u32 val = (brightness == LED_OFF); ++ struct ath_hw *ah = sc->sc_ah; ++ ++@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc * ++ else ++ ah->led_pin = ATH_LED_PIN_DEF; ++ } +++} +++ +++static void ath_led_brightness(struct led_classdev *led_cdev, +++ enum led_brightness brightness) +++{ + + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev); + + struct ath_softc *sc = led->sc; +- +-- if (sc->sc_ah->config.led_active_high) +-- val = !val; +++ + + ath9k_ps_wakeup(sc); + + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio, + + (brightness != LED_OFF) ^ led->gpio->active_low); + + ath9k_ps_restore(sc); + +} +- +-- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); +++ + +static int ath_add_led(struct ath_softc *sc, struct ath_led *led) + +{ + + const struct gpio_led *gpio = led->gpio; +@@ -71,30 +80,40 @@ + + + + led->sc = sc; + + list_add(&led->list, &sc->leds); +-+ +-+ /* Configure gpio for output */ +-+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio, +-+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); +-+ ++ ++ /* Configure gpio for output */ ++- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led", +++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); ++ ++- /* LED off, active low */ ++- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1); + + /* LED off */ + + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); + + + + return 0; +-+} +-+ ++ } ++ ++-static void ath_led_brightness(struct led_classdev *led_cdev, ++- enum led_brightness brightness) + +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name, + + const char *trigger, bool active_low) +-+{ ++ { ++- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); ++- u32 val = (brightness == LED_OFF); + + struct ath_led *led; + + struct gpio_led *gpio; + + char *_name; + + int ret; +-+ ++ ++- if (sc->sc_ah->config.led_active_high) ++- val = !val; + + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1, + + GFP_KERNEL); + + if (!led) + + return -ENOMEM; +-+ ++ ++- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); + + led->gpio = gpio = (struct gpio_led *) (led + 1); + + _name = (char *) (led->gpio + 1); + + +@@ -115,15 +134,18 @@ + { + - if (!sc->led_registered) + - return; +-+ struct ath_led *led; +- ++- + - ath_led_brightness(&sc->led_cdev, LED_OFF); + - led_classdev_unregister(&sc->led_cdev); +++ struct ath_led *led; ++ ++- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); + + while (!list_empty(&sc->leds)) { + + led = list_first_entry(&sc->leds, struct ath_led, list); + + list_del(&led->list); + + ath_led_brightness(&led->cdev, LED_OFF); + + led_classdev_unregister(&led->cdev); +++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio); + + kfree(led); + + } + } +@@ -139,6 +161,8 @@ + if (AR_SREV_9100(sc->sc_ah)) + return; + ++ ath_fill_led_pin(sc); ++ + - if (!ath9k_led_blink) + - sc->led_cdev.default_trigger = + - ieee80211_get_radio_led_name(sc->hw); +@@ -159,13 +183,14 @@ + + trigger = ieee80211_get_radio_led_name(sc->hw); + + - sc->led_registered = true; +-+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high); +++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, +++ !sc->sc_ah->config.led_active_high); + } ++ #endif + +- void ath_fill_led_pin(struct ath_softc *sc) + --- a/drivers/net/wireless/ath/ath9k/init.c + +++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct ++@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct + + #ifdef CPTCFG_MAC80211_LEDS + /* must be initialized before ieee80211_register_hw */ +@@ -176,7 +201,7 @@ + #endif + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1393,6 +1393,61 @@ static const struct file_operations fops ++@@ -1411,6 +1411,61 @@ static const struct file_operations fops + .llseek = default_llseek, + }; + +@@ -238,7 +263,7 @@ + + int ath9k_init_debug(struct ath_hw *ah) + { +-@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1435,6 +1490,10 @@ int ath9k_init_debug(struct ath_hw *ah) + &fops_eeprom); + debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, + sc, &fops_chanbw); +diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch +index 7c10ea6..f656697 100644 +--- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch ++++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch +@@ -1,6 +1,6 @@ + --- a/include/linux/ath9k_platform.h + +++ b/include/linux/ath9k_platform.h +-@@ -41,6 +41,9 @@ struct ath9k_platform_data { ++@@ -45,6 +45,9 @@ struct ath9k_platform_data { + int (*external_reset)(void); + + bool use_eeprom; +@@ -20,7 +20,7 @@ + + /********************************/ + /* LED functions */ +-@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc ++@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc + return ret; + } + +@@ -45,7 +45,7 @@ + void ath_deinit_leds(struct ath_softc *sc) + { + struct ath_led *led; +-@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s ++@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s + + void ath_init_leds(struct ath_softc *sc) + { +@@ -56,10 +56,10 @@ + + INIT_LIST_HEAD(&sc->leds); + +-@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc) +- trigger = ieee80211_get_radio_led_name(sc->hw); ++@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc) + +- ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high); ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, ++ !sc->sc_ah->config.led_active_high); + + + + if (!pdata) + + return; +@@ -67,5 +67,5 @@ + + for (i = 0; i < pdata->num_leds; i++) + + ath_create_platform_led(sc, &pdata->leds[i]); + } ++ #endif + +- void ath_fill_led_pin(struct ath_softc *sc) +diff --git a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch +index 6d62a2b..986f155 100644 +--- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch ++++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch +@@ -1,6 +1,6 @@ + --- a/include/linux/ath9k_platform.h + +++ b/include/linux/ath9k_platform.h +-@@ -36,6 +36,7 @@ struct ath9k_platform_data { ++@@ -40,6 +40,7 @@ struct ath9k_platform_data { + bool tx_gain_buffalo; + bool disable_2ghz; + bool disable_5ghz; +@@ -10,7 +10,7 @@ + int (*external_reset)(void); + --- a/drivers/net/wireless/ath/ath9k/init.c + +++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s ++@@ -581,6 +581,7 @@ static int ath9k_init_softc(u16 devid, s + ah->external_reset = pdata->external_reset; + ah->disable_2ghz = pdata->disable_2ghz; + ah->disable_5ghz = pdata->disable_5ghz; +diff --git a/package/kernel/mac80211/patches/533-mac80211_correct_4addr_skbsize.patch b/package/kernel/mac80211/patches/533-mac80211_correct_4addr_skbsize.patch +new file mode 100644 +index 0000000..afd8cca +--- /dev/null ++++ b/package/kernel/mac80211/patches/533-mac80211_correct_4addr_skbsize.patch +@@ -0,0 +1,11 @@ ++--- a/net/wireless/util.c +++++ b/net/wireless/util.c ++@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru ++ * replace EtherType */ ++ hdrlen += ETH_ALEN + 2; ++ else ++- tmp.h_proto = htons(skb->len); +++ tmp.h_proto = htons(skb->len - hdrlen); ++ ++ pskb_pull(skb, hdrlen); ++ +diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch +index e83c6bf..f4bb0f2 100644 +--- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch ++++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/debug.c + +++ b/drivers/net/wireless/ath/ath9k/debug.c +-@@ -1449,6 +1449,50 @@ static const struct file_operations fops ++@@ -1467,6 +1467,50 @@ static const struct file_operations fops + #endif + + +@@ -51,7 +51,7 @@ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +-@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah) ++@@ -1494,6 +1538,8 @@ int ath9k_init_debug(struct ath_hw *ah) + debugfs_create_file("gpio_led", S_IWUSR, + sc->debug.debugfs_phy, sc, &fops_gpio_led); + #endif +@@ -62,7 +62,7 @@ + debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, + --- a/drivers/net/wireless/ath/ath9k/hw.h + +++ b/drivers/net/wireless/ath/ath9k/hw.h +-@@ -519,6 +519,12 @@ enum { ++@@ -520,6 +520,12 @@ enum { + ATH9K_RESET_COLD, + }; + +@@ -75,7 +75,7 @@ + struct ath9k_hw_version { + u32 magic; + u16 devid; +-@@ -804,6 +810,8 @@ struct ath_hw { ++@@ -805,6 +811,8 @@ struct ath_hw { + u32 rfkill_polarity; + u32 ah_flags; + +@@ -84,7 +84,7 @@ + bool reset_power_on; + bool htc_reset_init; + +-@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a ++@@ -1067,6 +1075,7 @@ void ath9k_hw_check_nav(struct ath_hw *a + bool ath9k_hw_check_alive(struct ath_hw *ah); + + bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); +@@ -94,7 +94,7 @@ + struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, + --- a/drivers/net/wireless/ath/ath9k/hw.c + +++ b/drivers/net/wireless/ath/ath9k/hw.c +-@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times ++@@ -1821,6 +1821,20 @@ u32 ath9k_hw_get_tsf_offset(struct times + } + EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); + +@@ -115,7 +115,7 @@ + int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, + struct ath9k_hw_cal_data *caldata, bool fastcc) + { +-@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ++@@ -2029,6 +2043,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st + ar9003_hw_disable_phy_restart(ah); + + ath9k_hw_apply_gpio_override(ah); +diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch +index d7bb5a1..7da7165 100644 +--- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch ++++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/hw.h + +++ b/drivers/net/wireless/ath/ath9k/hw.h +-@@ -720,6 +720,7 @@ struct ath_spec_scan { ++@@ -721,6 +721,7 @@ struct ath_spec_scan { + * @config_pci_powersave: + * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC + * +@@ -8,7 +8,7 @@ + * @spectral_scan_config: set parameters for spectral scan and enable/disable it + * @spectral_scan_trigger: trigger a spectral scan run + * @spectral_scan_wait: wait for a spectral scan run to finish +-@@ -742,6 +743,7 @@ struct ath_hw_ops { ++@@ -743,6 +744,7 @@ struct ath_hw_ops { + struct ath_hw_antcomb_conf *antconf); + void (*antdiv_comb_conf_set)(struct ath_hw *ah, + struct ath_hw_antcomb_conf *antconf); +@@ -18,7 +18,7 @@ + void (*spectral_scan_trigger)(struct ath_hw *ah); + --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c + +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c +-@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct ++@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct + } + } + +@@ -45,7 +45,7 @@ + void ar9003_hw_attach_phy_ops(struct ath_hw *ah) + { + struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); +-@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath ++@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath + priv_ops->set_radar_params = ar9003_hw_set_radar_params; + priv_ops->fast_chan_change = ar9003_hw_fast_chan_change; + +@@ -55,9 +55,9 @@ + ops->spectral_scan_config = ar9003_hw_spectral_scan_config; + --- a/drivers/net/wireless/ath/ath9k/init.c + +++ b/drivers/net/wireless/ath/ath9k/init.c +-@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st ++@@ -717,7 +717,8 @@ static void ath9k_init_txpower_limits(st + if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) +- ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ); ++ ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); + + - ah->curchan = curchan; + + if (curchan) +@@ -65,7 +65,7 @@ + } + + static const struct ieee80211_iface_limit if_limits[] = { +-@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at ++@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at + SET_IEEE80211_PERM_ADDR(hw, common->macaddr); + } + +@@ -84,7 +84,7 @@ + int ath9k_init_device(u16 devid, struct ath_softc *sc, + const struct ath_bus_ops *bus_ops) + { +-@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct ++@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct + ARRAY_SIZE(ath9k_tpt_blink)); + #endif + +@@ -110,7 +110,7 @@ + static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) + --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c + +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c +-@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct ++@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct + } + } + +@@ -141,7 +141,7 @@ + static const u32 ar5416_cca_regs[6] = { + AR_PHY_CCA, + AR_PHY_CH1_CCA, +-@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ ++@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ + if (ret) + return ret; + +diff --git a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch +index 8768c5d..9462fca 100644 +--- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch ++++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch +@@ -40,7 +40,7 @@ + return true; + } + +-@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath ++@@ -1799,8 +1818,14 @@ static int ath9k_hw_do_fastcc(struct ath + if (AR_SREV_9271(ah)) + ar9002_hw_load_ani_reg(ah, chan); + +@@ -55,7 +55,7 @@ + return -EINVAL; + } + +-@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ++@@ -2054,6 +2079,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st + ath9k_hw_set_radar_params(ah); + } + +diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch +index 3d24ccd..b639f97 100644 +--- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch ++++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c + +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c +-@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st ++@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st + * on == 0 means more noise imm + */ + u32 on = param ? 1 : 0; +@@ -58,7 +58,7 @@ + REG_SET_BIT(ah, AR_PHY_SFCORR_LOW, + --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c + +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c +-@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] = ++@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] = + /* level: 0 1 2 3 4 5 6 7 8 */ + { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */ + +@@ -79,7 +79,7 @@ + static const u8 ofdm2pwr[] = { + ALL_TARGET_LEGACY_6_24, + ALL_TARGET_LEGACY_6_24, +-@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct ++@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct + struct ath_common *common = ath9k_hw_common(ah); + struct ath9k_channel *chan = ah->curchan; + struct ar5416AniState *aniState = &ah->ani; +@@ -91,7 +91,7 @@ + s32 value, value2; + + switch (cmd & ah->ani_function) { +-@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct ++@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct + */ + u32 on = param ? 1 : 0; + +diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch +new file mode 100644 +index 0000000..ced72c6 +--- /dev/null ++++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch +@@ -0,0 +1,39 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 20:45:57 +0100 ++Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name ++ ++Enable platform-supplied WLAN LED name for ath9k device. It replaces generic ++'ath9k-phy*' label with string set during platform initialization. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++ drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++--- ++ include/linux/ath9k_platform.h | 1 + ++ 2 files changed, 8 insertions(+), 3 deletions(-) ++ ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc) ++ ++ ath_fill_led_pin(sc); ++ ++- snprintf(led_name, sizeof(led_name), "ath9k-%s", ++- wiphy_name(sc->hw->wiphy)); +++ if (pdata && pdata->led_name) +++ strncpy(led_name, pdata->led_name, sizeof(led_name)); +++ else +++ snprintf(led_name, sizeof(led_name), "ath9k-%s", +++ wiphy_name(sc->hw->wiphy)); ++ ++ if (ath9k_led_blink) ++ trigger = sc->led_default_trigger; ++--- a/include/linux/ath9k_platform.h +++++ b/include/linux/ath9k_platform.h ++@@ -49,6 +49,7 @@ struct ath9k_platform_data { ++ ++ int num_leds; ++ const struct gpio_led *leds; +++ const char *led_name; ++ }; ++ ++ #endif /* _LINUX_ATH9K_PLATFORM_H */ +diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch +new file mode 100644 +index 0000000..5d84cf0 +--- /dev/null ++++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch +@@ -0,0 +1,29 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 20:48:49 +0100 ++Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs ++ ++Support default state for platform LEDs connected to ath9k device. ++Now LEDs are correctly set on or off at ath9k module initialization. ++Very useful if power LED is connected to wireless chip. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++ gpio.c | 7 +++++-- ++ 1 file changed, 5 insertions(+), 2 deletions(-) ++ ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); ++ ++- /* LED off */ ++- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); +++ /* Set default LED state */ +++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON) +++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low); +++ else +++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); ++ ++ return 0; ++ } +diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch +new file mode 100644 +index 0000000..1c89e42 +--- /dev/null ++++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch +@@ -0,0 +1,237 @@ ++From: Michal Cieslakiewicz ++Date: Sun, 31 Jan 2016 21:01:31 +0100 ++Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO ++ ++Enable access to GPIO chip and its pins for Atheros AR92xx ++wireless devices. For now AR9285 and AR9287 are supported. ++ ++Signed-off-by: Michal Cieslakiewicz ++Signed-off-by: Felix Fietkau ++--- ++--- a/drivers/net/wireless/ath/ath9k/ath9k.h +++++ b/drivers/net/wireless/ath/ath9k/ath9k.h ++@@ -24,6 +24,7 @@ ++ #include ++ #include ++ #include +++#include ++ ++ #include "common.h" ++ #include "debug.h" ++@@ -959,6 +960,14 @@ struct ath_led { ++ struct led_classdev cdev; ++ }; ++ +++#ifdef CONFIG_GPIOLIB +++struct ath9k_gpio_chip { +++ struct ath_softc *sc; +++ char label[32]; +++ struct gpio_chip gchip; +++}; +++#endif +++ ++ struct ath_softc { ++ struct ieee80211_hw *hw; ++ struct device *dev; ++@@ -1013,6 +1022,9 @@ struct ath_softc { ++ #ifdef CPTCFG_MAC80211_LEDS ++ const char *led_default_trigger; ++ struct list_head leds; +++#ifdef CONFIG_GPIOLIB +++ struct ath9k_gpio_chip *gpiochip; +++#endif ++ #endif ++ ++ #ifdef CPTCFG_ATH9K_DEBUGFS ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -16,13 +16,138 @@ ++ ++ #include "ath9k.h" ++ #include +++#include +++ +++#ifdef CPTCFG_MAC80211_LEDS +++ +++#ifdef CONFIG_GPIOLIB +++ +++/***************/ +++/* GPIO Chip */ +++/***************/ +++ +++/* gpio_chip handler : set GPIO to input */ +++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio"); +++ +++ return 0; +++} +++ +++/* gpio_chip handler : set GPIO to output */ +++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, +++ int value) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio", +++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); +++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +++ +++ return 0; +++} +++ +++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ +++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ struct ath_hw *ah = gc->sc->sc_ah; +++ +++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); +++} +++ +++/* gpio_chip handler : get GPIO pin value */ +++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); +++} +++ +++/* gpio_chip handler : set GPIO pin to value */ +++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, +++ int value) +++{ +++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, +++ gchip); +++ +++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +++} +++ +++/* register GPIO chip */ +++static void ath9k_register_gpio_chip(struct ath_softc *sc) +++{ +++ struct ath9k_gpio_chip *gc; +++ u16 ng; +++ +++ /* for now only AR9285 and AR9287 are recognized */ +++ if (AR_SREV_9287(sc->sc_ah)) +++ ng = AR9287_NUM_GPIO; +++ else if (AR_SREV_9285(sc->sc_ah)) +++ ng = AR9285_NUM_GPIO; +++ else +++ return; +++ +++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); +++ if (!gc) +++ return; +++ +++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", +++ wiphy_name(sc->hw->wiphy)); +++ gc->gchip.label = gc->label; +++ gc->gchip.base = -1; /* determine base automatically */ +++ gc->gchip.ngpio = ng; +++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; +++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; +++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir; +++ gc->gchip.get = ath9k_gpio_pin_get; +++ gc->gchip.set = ath9k_gpio_pin_set; +++ gc->gchip.owner = THIS_MODULE; +++ +++ if (gpiochip_add(&gc->gchip)) { +++ kfree(gc); +++ return; +++ } +++ +++ sc->gpiochip = gc; +++ gc->sc = sc; +++} +++ +++/* remove GPIO chip */ +++static void ath9k_unregister_gpio_chip(struct ath_softc *sc) +++{ +++ struct ath9k_gpio_chip *gc = sc->gpiochip; +++ +++ if (!gc) +++ return; +++ +++ gpiochip_remove(&gc->gchip); +++ kfree(gc); +++ sc->gpiochip = NULL; +++} +++ +++#else /* CONFIG_GPIOLIB */ +++ +++static inline void ath9k_register_gpio_chip(struct ath_softc *sc) +++{ +++} +++ +++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc) +++{ +++} +++ +++#endif /* CONFIG_GPIOLIB */ ++ ++ /********************************/ ++ /* LED functions */ ++ /********************************/ ++ ++-#ifdef CPTCFG_MAC80211_LEDS ++- ++ static void ath_fill_led_pin(struct ath_softc *sc) ++ { ++ struct ath_hw *ah = sc->sc_ah; ++@@ -80,6 +205,12 @@ static int ath_add_led(struct ath_softc ++ else ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); ++ +++#ifdef CONFIG_GPIOLIB +++ /* If there is GPIO chip configured, reserve LED pin */ +++ if (sc->gpiochip) +++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); +++#endif +++ ++ return 0; ++ } ++ ++@@ -136,12 +267,18 @@ void ath_deinit_leds(struct ath_softc *s ++ ++ while (!list_empty(&sc->leds)) { ++ led = list_first_entry(&sc->leds, struct ath_led, list); +++#ifdef CONFIG_GPIOLIB +++ /* If there is GPIO chip configured, free LED pin */ +++ if (sc->gpiochip) +++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); +++#endif ++ list_del(&led->list); ++ ath_led_brightness(&led->cdev, LED_OFF); ++ led_classdev_unregister(&led->cdev); ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio); ++ kfree(led); ++ } +++ ath9k_unregister_gpio_chip(sc); ++ } ++ ++ void ath_init_leds(struct ath_softc *sc) ++@@ -158,6 +295,8 @@ void ath_init_leds(struct ath_softc *sc) ++ ++ ath_fill_led_pin(sc); ++ +++ ath9k_register_gpio_chip(sc); +++ ++ if (pdata && pdata->led_name) ++ strncpy(led_name, pdata->led_name, sizeof(led_name)); ++ else ++@@ -178,6 +317,7 @@ void ath_init_leds(struct ath_softc *sc) ++ for (i = 0; i < pdata->num_leds; i++) ++ ath_create_platform_led(sc, &pdata->leds[i]); ++ } +++ ++ #endif ++ ++ /*******************/ +diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch +new file mode 100644 +index 0000000..c7973bb +--- /dev/null ++++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch +@@ -0,0 +1,149 @@ ++From: Michal Cieslakiewicz ++Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons ++ ++Enable platform-defined GPIO button support for ath9k device. ++Key poller is activated for attached platform buttons. ++Requires ath9k GPIO chip access. ++ ++Signed-off-by: Michal Cieslakiewicz ++Signed-off-by: Felix Fietkau ++--- ++--- a/drivers/net/wireless/ath/ath9k/ath9k.h +++++ b/drivers/net/wireless/ath/ath9k/ath9k.h ++@@ -1024,6 +1024,7 @@ struct ath_softc { ++ struct list_head leds; ++ #ifdef CONFIG_GPIOLIB ++ struct ath9k_gpio_chip *gpiochip; +++ struct platform_device *btnpdev; /* gpio-keys-polled */ ++ #endif ++ #endif ++ ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -17,6 +17,8 @@ ++ #include "ath9k.h" ++ #include ++ #include +++#include +++#include ++ ++ #ifdef CPTCFG_MAC80211_LEDS ++ ++@@ -132,6 +134,64 @@ static void ath9k_unregister_gpio_chip(s ++ sc->gpiochip = NULL; ++ } ++ +++/******************/ +++/* GPIO Buttons */ +++/******************/ +++ +++/* add GPIO buttons */ +++static void ath9k_init_buttons(struct ath_softc *sc) +++{ +++ struct ath9k_platform_data *pdata = sc->dev->platform_data; +++ struct platform_device *pdev; +++ struct gpio_keys_platform_data gkpdata; +++ struct gpio_keys_button *bt; +++ int i; +++ +++ if (!sc->gpiochip) +++ return; +++ +++ if (!pdata || !pdata->btns || !pdata->num_btns) +++ return; +++ +++ bt = devm_kmemdup(sc->dev, pdata->btns, +++ pdata->num_btns * sizeof(struct gpio_keys_button), +++ GFP_KERNEL); +++ if (!bt) +++ return; +++ +++ for (i = 0; i < pdata->num_btns; i++) { +++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio, +++ "ath9k-gpio"); +++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; +++ } +++ +++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); +++ gkpdata.buttons = bt; +++ gkpdata.nbuttons = pdata->num_btns; +++ gkpdata.poll_interval = pdata->btn_poll_interval; +++ +++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", +++ PLATFORM_DEVID_AUTO, &gkpdata, +++ sizeof(gkpdata)); +++ if (!IS_ERR_OR_NULL(pdev)) +++ sc->btnpdev = pdev; +++ else { +++ sc->btnpdev = NULL; +++ devm_kfree(sc->dev, bt); +++ } +++} +++ +++/* remove GPIO buttons */ +++static void ath9k_deinit_buttons(struct ath_softc *sc) +++{ +++ if (!sc->gpiochip || !sc->btnpdev) +++ return; +++ +++ platform_device_unregister(sc->btnpdev); +++ +++ sc->btnpdev = NULL; +++} +++ ++ #else /* CONFIG_GPIOLIB */ ++ ++ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) ++@@ -142,6 +202,14 @@ static inline void ath9k_unregister_gpio ++ { ++ } ++ +++static inline void ath9k_init_buttons(struct ath_softc *sc) +++{ +++} +++ +++static inline void ath9k_deinit_buttons(struct ath_softc *sc) +++{ +++} +++ ++ #endif /* CONFIG_GPIOLIB */ ++ ++ /********************************/ ++@@ -265,6 +333,7 @@ void ath_deinit_leds(struct ath_softc *s ++ { ++ struct ath_led *led; ++ +++ ath9k_deinit_buttons(sc); ++ while (!list_empty(&sc->leds)) { ++ led = list_first_entry(&sc->leds, struct ath_led, list); ++ #ifdef CONFIG_GPIOLIB ++@@ -296,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc) ++ ath_fill_led_pin(sc); ++ ++ ath9k_register_gpio_chip(sc); +++ ath9k_init_buttons(sc); ++ ++ if (pdata && pdata->led_name) ++ strncpy(led_name, pdata->led_name, sizeof(led_name)); ++@@ -311,7 +381,7 @@ void ath_init_leds(struct ath_softc *sc) ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, ++ !sc->sc_ah->config.led_active_high); ++ ++- if (!pdata) +++ if (!pdata || !pdata->leds || !pdata->num_leds) ++ return; ++ ++ for (i = 0; i < pdata->num_leds; i++) ++--- a/include/linux/ath9k_platform.h +++++ b/include/linux/ath9k_platform.h ++@@ -50,6 +50,10 @@ struct ath9k_platform_data { ++ int num_leds; ++ const struct gpio_led *leds; ++ const char *led_name; +++ +++ unsigned num_btns; +++ const struct gpio_keys_button *btns; +++ unsigned btn_poll_interval; ++ }; ++ ++ #endif /* _LINUX_ATH9K_PLATFORM_H */ +diff --git a/package/kernel/mac80211/patches/550-ath9k_add_ar9280_gpio_chip.patch b/package/kernel/mac80211/patches/550-ath9k_add_ar9280_gpio_chip.patch +new file mode 100644 +index 0000000..22e2c66 +--- /dev/null ++++ b/package/kernel/mac80211/patches/550-ath9k_add_ar9280_gpio_chip.patch +@@ -0,0 +1,27 @@ ++From: Michal Cieslakiewicz ++Date: Thu, 21 Apr 2016 23:00:54 +0200 ++Subject: [PATCH] mac80211: ath9k: add GPIO support for AR9280 chip ++ ++Enable access to GPIO on Atheros wireless chip AR9280. ++Support for 9280 is added to existing 9285/9287 subsystem ++because these 3 chips differ only in number of GPIO pins. ++ ++Signed-off-by: Michal Cieslakiewicz ++--- ++--- a/drivers/net/wireless/ath/ath9k/gpio.c +++++ b/drivers/net/wireless/ath/ath9k/gpio.c ++@@ -88,11 +88,13 @@ static void ath9k_register_gpio_chip(str ++ struct ath9k_gpio_chip *gc; ++ u16 ng; ++ ++- /* for now only AR9285 and AR9287 are recognized */ +++ /* supported chips are AR9280, AR9285 and AR9287 */ ++ if (AR_SREV_9287(sc->sc_ah)) ++ ng = AR9287_NUM_GPIO; ++ else if (AR_SREV_9285(sc->sc_ah)) ++ ng = AR9285_NUM_GPIO; +++ else if (AR_SREV_9280(sc->sc_ah)) +++ ng = AR9280_NUM_GPIO; ++ else ++ return; ++ +diff --git a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch +index 8245909..db70a33 100644 +--- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch ++++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch +@@ -24,7 +24,7 @@ Changes since v1: + + --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00 ++@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00 + + int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev) + { +@@ -32,7 +32,7 @@ Changes since v1: + int retval; + u32 reg; + +-@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r + if (retval) + return retval; + +diff --git a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch +index 7abfcd1..a3b62bc 100644 +--- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch ++++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch +@@ -239,7 +239,7 @@ Changes since v1: --- + msleep(1); + + /* +-@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r + int retval; + u32 reg; + +@@ -248,7 +248,7 @@ Changes since v1: --- + retval = rt2800_probe_rt(rt2x00dev); + if (retval) + return retval; +-@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211 ++@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211 + return; + + offset = MAC_IVEIV_ENTRY(key->hw_key_idx); +diff --git a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch +index 02b2acf..f41a160 100644 +--- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch ++++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch +@@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos + rt2800_clear_beacon_register(rt2x00dev, i); + + if (rt2x00_is_usb(rt2x00dev)) { +-@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r + if (rt2x00_rt(rt2x00dev, RT3593)) + __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags); + +diff --git a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch +index e909272..5099c64 100644 +--- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch ++++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch +@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos + + --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r + if (rt2x00_rt(rt2x00dev, RT3593)) + __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags); + +diff --git a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch +index 7fe38e0..a2e7015 100644 +--- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch ++++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch +@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos + + --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00 ++@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00 + case RT3390: + case RT3572: + case RT3593: +diff --git a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch +index 253a0c0..89bd0ac 100644 +--- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch ++++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch +@@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos + static const struct rf_channel rf_vals_5592_xtal20[] = { + /* Channel, N, K, mod, R */ + {1, 482, 4, 10, 3}, +-@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r ++@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r + spec->channels = rf_vals_3x; + break; + +diff --git a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch +index f15c22b..b7efc9f 100644 +--- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch ++++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch +@@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos + case RF5360: + case RF5362: + case RF5370: +-@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r ++@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r + case RF3053: + case RF3070: + case RF3290: +diff --git a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch +index 6ce224a..220e35f 100644 +--- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch ++++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch +@@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos + + --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r + if (rt2x00_rt(rt2x00dev, RT3593)) + __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags); + +diff --git a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch +index 25753af..2ffa5a4 100644 +--- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch ++++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch +@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos + + --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +-@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r + if (retval) + return retval; + +diff --git a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch +index 7a183a4..daa5dc6 100644 +--- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch ++++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch +@@ -22,10 +22,10 @@ + +#endif /* _RT2X00_PLATFORM_H */ + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -38,6 +38,7 @@ +- #include ++@@ -39,6 +39,7 @@ + #include + #include ++ #include + +#include + + #include +diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch +index bc056cd..8ae5da3 100644 +--- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch ++++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch +@@ -1,6 +1,6 @@ + --- a/.local-symbols + +++ b/.local-symbols +-@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE= ++@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE= + RT2X00_LIB_CRYPTO= + RT2X00_LIB_LEDS= + RT2X00_LIB_DEBUGFS= +@@ -105,7 +105,7 @@ + .drv_init_registers = rt2800mmio_init_registers, + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -697,6 +697,7 @@ enum rt2x00_capability_flags { ++@@ -699,6 +699,7 @@ enum rt2x00_capability_flags { + REQUIRE_HT_TX_DESC, + REQUIRE_PS_AUTOWAKE, + REQUIRE_DELAYED_RFKILL, +@@ -127,7 +127,7 @@ + DECLARE_KFIFO_PTR(txstatus_fifo, u32); + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +-@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de ++@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de + INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); + INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); + +@@ -138,7 +138,7 @@ + /* + * Let the driver probe the device to detect the capabilities. + */ +-@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ ++@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ + * Free the driver data. + */ + kfree(rt2x00dev->drv_data); +diff --git a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch +index d923e05..a2e1faf 100644 +--- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch ++++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch +@@ -37,7 +37,7 @@ + num_rates += 4; + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -405,6 +405,7 @@ struct hw_mode_spec { ++@@ -406,6 +406,7 @@ struct hw_mode_spec { + unsigned int supported_bands; + #define SUPPORT_BAND_2GHZ 0x00000001 + #define SUPPORT_BAND_5GHZ 0x00000002 +diff --git a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch +index a645ba1..6704ff8 100644 +--- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch ++++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch +@@ -31,7 +31,7 @@ + { + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram ++@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram + */ + u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, + struct ieee80211_vif *vif); +diff --git a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch +index c69d330..9f10fe3 100644 +--- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch ++++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch +@@ -200,7 +200,7 @@ + * EEPROM frequency + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -717,6 +717,8 @@ enum rt2x00_capability_flags { ++@@ -719,6 +719,8 @@ enum rt2x00_capability_flags { + CAPABILITY_DOUBLE_ANTENNA, + CAPABILITY_BT_COEXIST, + CAPABILITY_VCO_RECALIBRATION, +diff --git a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch +index b44fe90..860fdc0 100644 +--- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch ++++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch +@@ -28,7 +28,7 @@ + static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) + { + struct hw_mode_spec *spec = &rt2x00dev->spec; +-@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r ++@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r + case RF5390: + case RF5392: + spec->num_channels = 14; +@@ -40,7 +40,7 @@ + break; + + case RF3052: +-@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00 ++@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00 + return 0; + } + +@@ -60,7 +60,7 @@ + int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev) + { + struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; +-@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r ++@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r + rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); + + /* +@@ -78,7 +78,7 @@ + retval = rt2800_probe_hw_mode(rt2x00dev); + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to ++@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to + * @channels: Device/chipset specific channel values (See &struct rf_channel). + * @channels_info: Additional information for channels (See &struct channel_info). + * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap). +@@ -86,7 +86,7 @@ + */ + struct hw_mode_spec { + unsigned int supported_bands; +-@@ -416,6 +417,7 @@ struct hw_mode_spec { ++@@ -417,6 +418,7 @@ struct hw_mode_spec { + const struct channel_info *channels_info; + + struct ieee80211_sta_ht_cap ht; +diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch +index 8e3bd2a..e7b2a8c 100644 +--- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch ++++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch +@@ -8,7 +8,7 @@ + + #include "rt2x00.h" + #include "rt2800lib.h" +-@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00 ++@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00 + + int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev) + { +diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch +index faa5879..44bd8a1 100644 +--- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch ++++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch +@@ -240,7 +240,7 @@ + case RF5360: + case RF5362: + case RF5370: +-@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r ++@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r + case RF3290: + case RF3320: + case RF3322: +@@ -248,7 +248,7 @@ + case RF5360: + case RF5362: + case RF5370: +-@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r ++@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r + case RF3070: + case RF3290: + case RF3853: +@@ -256,7 +256,7 @@ + case RF5360: + case RF5362: + case RF5370: +-@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00 ++@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00 + case RT3572: + case RT3593: + case RT3883: +@@ -266,7 +266,7 @@ + case RT5592: + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +-@@ -169,6 +169,7 @@ struct rt2x00_chip { ++@@ -170,6 +170,7 @@ struct rt2x00_chip { + #define RT3572 0x3572 + #define RT3593 0x3593 + #define RT3883 0x3883 /* WSOC */ +diff --git a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch +index 55452b9..dba6033 100644 +--- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch ++++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c + +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +-@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb ++@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb + */ + if_limit = &rt2x00dev->if_limits_ap; + if_limit->max = rt2x00dev->ops->max_ap_intf; +diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch +index fd885cc..02f3053 100644 +--- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch ++++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/marvell/libertas/cfg.c + +++ b/drivers/net/wireless/marvell/libertas/cfg.c +-@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc ++@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc + goto err_wiphy_new; + } + +diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch +index b67a95f..ad30608 100644 +--- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch ++++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/marvell/libertas/cfg.c + +++ b/drivers/net/wireless/marvell/libertas/cfg.c +-@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private ++@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private + wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); + wdev->wiphy->reg_notifier = lbs_reg_notifier; + +diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch +deleted file mode 100644 +index 74cd448..0000000 +--- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch ++++ /dev/null +@@ -1,17 +0,0 @@ +---- a/drivers/net/wireless/broadcom/b43/main.c +-+++ b/drivers/net/wireless/broadcom/b43/main.c +-@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str +- case B43_BUS_BCMA: +- bcma_cc = &dev->dev->bdev->bus->drv_cc; +- +-- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0); +-- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4); +-- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4); +-- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4); +-+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0); +-+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4); +-+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4); +-+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4); +- break; +- #endif +- #ifdef CPTCFG_B43_SSB +diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch +index 06c731f..b60ef76 100644 +--- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch ++++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch +@@ -42,7 +42,7 @@ + + if (wl->radio_enabled != phy->radio_on) { + if (wl->radio_enabled) { +-@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee ++@@ -5207,6 +5204,47 @@ static int b43_op_get_survey(struct ieee + return 0; + } + +@@ -90,7 +90,7 @@ + static const struct ieee80211_ops b43_hw_ops = { + .tx = b43_op_tx, + .conf_tx = b43_op_conf_tx, +-@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw ++@@ -5228,6 +5266,8 @@ static const struct ieee80211_ops b43_hw + .sw_scan_complete = b43_op_sw_scan_complete_notifier, + .get_survey = b43_op_get_survey, + .rfkill_poll = b43_rfkill_poll, +@@ -99,7 +99,7 @@ + }; + + /* Hard-reset the chip. Do not call this directly. +-@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4 ++@@ -5536,6 +5576,8 @@ static int b43_one_core_attach(struct b4 + if (!wldev) + goto out; + +@@ -108,7 +108,7 @@ + wldev->use_pio = b43_modparam_pio; + wldev->dev = dev; + wldev->wl = wl; +-@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init( ++@@ -5626,6 +5668,9 @@ static struct b43_wl *b43_wireless_init( + + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; + +diff --git a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch b/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch +new file mode 100644 +index 0000000..46227c4 +--- /dev/null ++++ b/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch +@@ -0,0 +1,26 @@ ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Subject: [PATCH] brcmfmac: add missing eth_type_trans call ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++There are 2 protocols supported by brcmfmac and msgbuf one was missing a ++proper skb setup before passing it to the netif. This was triggering ++"NULL pointer dereference". ++ ++Fixes: 9c349892ccc9 ("brcmfmac: revise handling events in receive path") ++Signed-off-by: Rafał Miłecki ++--- ++ ++--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++@@ -1157,6 +1157,9 @@ brcmf_msgbuf_process_rx_complete(struct ++ brcmu_pkt_buf_free_skb(skb); ++ return; ++ } +++ +++ skb->protocol = eth_type_trans(skb, ifp->ndev); +++ ++ brcmf_netif_rx(ifp, skb); ++ } ++ +diff --git a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch +index 00181f6..8cf9ea2 100644 +--- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch ++++ b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch +@@ -13,8 +13,8 @@ Signed-off-by: Rafał Miłecki + + --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c + +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +-@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v +- #endif ++@@ -1232,6 +1232,7 @@ int __init brcmf_core_init(void) ++ { + if (!schedule_work(&brcmf_driver_work)) + return -EBUSY; + + flush_work(&brcmf_driver_work); +diff --git a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +index 4295b4b..4f22a4e 100644 +--- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch ++++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +@@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki + + --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c + +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +-@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802 ++@@ -650,9 +650,37 @@ static struct wireless_dev *brcmf_cfg802 + u32 *flags, + struct vif_params *params) + { +@@ -42,7 +42,7 @@ Signed-off-by: Rafał Miłecki + + dev = dev_get_by_name(&init_net, name); + + if (dev) { + + dev_put(dev); +-+ return ERR_PTR(-EEXIST); +++ return ERR_PTR(-ENFILE); + + } + + + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); +diff --git a/package/kernel/mac80211/patches/863-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/863-brcmfmac-Disable-power-management.patch +new file mode 100644 +index 0000000..f971bb7 +--- /dev/null ++++ b/package/kernel/mac80211/patches/863-brcmfmac-Disable-power-management.patch +@@ -0,0 +1,27 @@ ++From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001 ++From: Phil Elwell ++Date: Wed, 9 Mar 2016 17:25:59 +0000 ++Subject: [PATCH] brcmfmac: Disable power management ++ ++Disable wireless power saving in the brcmfmac WLAN driver. This is a ++temporary measure until the connectivity loss resulting from power ++saving is resolved. ++ ++Signed-off-by: Phil Elwell ++--- ++ drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++ ++ 1 file changed, 2 insertions(+) ++ ++--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++@@ -2711,6 +2711,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip ++ * preference in cfg struct to apply this to ++ * FW later while initializing the dongle ++ */ +++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709) +++ pr_info("power management disabled\n"); +++ enabled = false; +++#endif ++ cfg->pwr_save = enabled; ++ if (!check_vif_up(ifp->vif)) { ++ +diff --git a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch +index f2e21ea..be210f2 100644 +--- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch ++++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch +@@ -1184,7 +1184,7 @@ + break; + default: + rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n", +-@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r ++@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r + case RF5372: + case RF5390: + case RF5392: +@@ -1192,7 +1192,7 @@ + spec->num_channels = 14; + if (spec->clk_is_20mhz) + spec->channels = rf_vals_xtal20mhz_3x; +-@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r ++@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r + case RF5372: + case RF5390: + case RF5392: +diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch +index 8c6d720..9322b45 100644 +--- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch ++++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch +@@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann + + --- a/drivers/net/wireless/ath/ath10k/core.c + +++ b/drivers/net/wireless/ath/ath10k/core.c +-@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k * ++@@ -2012,6 +2012,16 @@ int ath10k_core_register(struct ath10k * + ar->chip_id = chip_id; + queue_work(ar->workqueue, &ar->register_work); + +diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch +index 281b447..1bfded0 100644 +--- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch ++++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch +@@ -1,6 +1,6 @@ + --- a/drivers/net/wireless/ath/ath10k/mac.c + +++ b/drivers/net/wireless/ath/ath10k/mac.c +-@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru ++@@ -7717,6 +7717,21 @@ struct ath10k_vif *ath10k_get_arvif(stru + return arvif_iter.arvif; + } + +@@ -22,7 +22,7 @@ + int ath10k_mac_register(struct ath10k *ar) + { + static const u32 cipher_suites[] = { +-@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a ++@@ -7941,6 +7956,12 @@ int ath10k_mac_register(struct ath10k *a + ar->hw->wiphy->cipher_suites = cipher_suites; + ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); + +diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch +new file mode 100644 +index 0000000..7f51dd2 +--- /dev/null ++++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch +@@ -0,0 +1,42 @@ ++--- a/drivers/net/wireless/ath/ath10k/core.c +++++ b/drivers/net/wireless/ath/ath10k/core.c ++@@ -1168,9 +1168,6 @@ static int ath10k_core_fetch_firmware_fi ++ { ++ int ret; ++ ++- /* calibration file is optional, don't check for any errors */ ++- ath10k_fetch_cal_file(ar); ++- ++ ar->fw_api = 5; ++ ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); ++ ++@@ -1873,6 +1870,9 @@ static int ath10k_core_probe_fw(struct a ++ goto err_power_down; ++ } ++ +++ /* calibration file is optional, don't check for any errors */ +++ int calret = ath10k_fetch_cal_file(ar); +++ ++ ret = ath10k_core_fetch_firmware_files(ar); ++ if (ret) { ++ ath10k_err(ar, "could not fetch firmware files (%d)\n", ret); ++@@ -1895,11 +1895,14 @@ static int ath10k_core_probe_fw(struct a ++ "could not load pre cal data: %d\n", ret); ++ } ++ ++- ret = ath10k_core_get_board_id_from_otp(ar); ++- if (ret && ret != -EOPNOTSUPP) { ++- ath10k_err(ar, "failed to get board id from otp: %d\n", ++- ret); ++- goto err_free_firmware_files; +++ /* otp and board file not needed if calibration data is present */ +++ if (calret) { +++ ret = ath10k_core_get_board_id_from_otp(ar); +++ if (ret && ret != -EOPNOTSUPP) { +++ ath10k_err(ar, "failed to get board id from otp: %d\n", +++ ret); +++ goto err_free_firmware_files; +++ } ++ } ++ ++ ret = ath10k_core_fetch_board_file(ar); +diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile +index e49dd48..0f832e4 100644 +--- a/package/kernel/mt76/Makefile ++++ b/package/kernel/mt76/Makefile +@@ -1,7 +1,7 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=mt76 +-PKG_VERSION:=2016-03-03 ++PKG_VERSION:=2016-06-17 + PKG_RELEASE=1 + + PKG_LICENSE:=GPLv2 +@@ -10,23 +10,26 @@ PKG_LICENSE_FILES:= + PKG_SOURCE_URL:=https://github.com/openwrt/mt76 + PKG_SOURCE_PROTO:=git + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +-PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251 ++PKG_SOURCE_VERSION:=f06ed811cda67ab2ed9932c3e87ba03229e75f4e + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz + +-PKG_MAINTAINER:=Felix Fietkau ++PKG_MAINTAINER:=Felix Fietkau + PKG_BUILD_PARALLEL:=1 + ++STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h ++ + include $(INCLUDE_DIR)/kernel.mk + include $(INCLUDE_DIR)/package.mk + + define KernelPackage/mt76 + SUBMENU:=Wireless Drivers +- TITLE:=MediaTek MT76x2 wireless driver +- DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT ++ TITLE:=MediaTek MT76x2/MT7603 wireless driver ++ DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18 + FILES:=\ + $(PKG_BUILD_DIR)/mt76.ko \ +- $(PKG_BUILD_DIR)/mt76x2e.ko +- AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e) ++ $(PKG_BUILD_DIR)/mt76x2e.ko \ ++ $(PKG_BUILD_DIR)/mt7603e.ko ++ AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e) + endef + + NOSTDINC_FLAGS = \ +@@ -54,6 +57,12 @@ endef + define KernelPackage/mt76/install + $(INSTALL_DIR) $(1)/lib/firmware + cp \ ++ $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \ ++ $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \ ++ $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \ ++ ) \ ++ $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \ ++ $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \ + $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \ + $(PKG_BUILD_DIR)/firmware/mt7662.bin \ + $(1)/lib/firmware +diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile +index 091928d..6a59a02 100644 +--- a/package/kernel/mwlwifi/Makefile ++++ b/package/kernel/mwlwifi/Makefile +@@ -8,7 +8,7 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=mwlwifi +-PKG_VERSION:=10.3.0.16-20160105 ++PKG_VERSION:=10.3.0.17-20160520-1 + PKG_RELEASE=1 + + PKG_LICENSE:=ISC +@@ -17,7 +17,7 @@ PKG_LICENSE_FILES:= + PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi + PKG_SOURCE_PROTO:=git + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +-PKG_SOURCE_VERSION:=99d3879cc72f2a25d44fb4bee96fd84eca028b04 ++PKG_SOURCE_VERSION:=7d49296d12b44025278a52c5a26fb1b4236f320f + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz + + PKG_MAINTAINER:=Imre Kaloz +diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch +index d2e149e..086edeb 100644 +--- a/package/kernel/mwlwifi/patches/100-drop_old_api.patch ++++ b/package/kernel/mwlwifi/patches/100-drop_old_api.patch +@@ -1,6 +1,6 @@ + --- a/main.c + +++ b/main.c +-@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p ++@@ -423,11 +423,7 @@ static void mwl_set_ht_caps(struct mwl_p + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; + +@@ -12,7 +12,7 @@ + band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; + band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4; + +-@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv * ++@@ -563,29 +559,16 @@ static int mwl_wl_init(struct mwl_priv * + hw->queues = SYSADPT_TX_WMM_QUEUES; + + /* Set rssi values to dBm */ +@@ -41,10 +41,10 @@ + -#endif + + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; +- ++ hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; + --- a/dev.h + +++ b/dev.h +-@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge ++@@ -506,10 +506,6 @@ static inline struct mwl_sta *mwl_dev_ge + return (struct mwl_sta *)&sta->drv_priv; + } + +@@ -57,7 +57,7 @@ + + --- a/mac80211.c + +++ b/mac80211.c +-@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc ++@@ -598,19 +598,11 @@ static int mwl_mac80211_get_survey(struc + return 0; + } + +diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch +index ed3e06a..920cb8c 100644 +--- a/package/kernel/mwlwifi/patches/110-api_sync.patch ++++ b/package/kernel/mwlwifi/patches/110-api_sync.patch +@@ -1,6 +1,30 @@ + --- a/mac80211.c + +++ b/mac80211.c +-@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc ++@@ -260,12 +260,12 @@ static int mwl_mac80211_config(struct ie ++ if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { ++ int rate = 0; ++ ++- if (conf->chandef.chan->band == IEEE80211_BAND_2GHZ) { +++ if (conf->chandef.chan->band == NL80211_BAND_2GHZ) { ++ mwl_fwcmd_set_apmode(hw, AP_MODE_2_4GHZ_11AC_MIXED); ++ mwl_fwcmd_set_linkadapt_cs_mode(hw, ++ LINK_CS_STATE_CONSERV); ++ rate = mwl_rates_24[0].hw_value; ++- } else if (conf->chandef.chan->band == IEEE80211_BAND_5GHZ) { +++ } else if (conf->chandef.chan->band == NL80211_BAND_5GHZ) { ++ mwl_fwcmd_set_apmode(hw, AP_MODE_11AC); ++ mwl_fwcmd_set_linkadapt_cs_mode(hw, ++ LINK_CS_STATE_AUTO); ++@@ -333,7 +333,7 @@ static void mwl_mac80211_bss_info_change ++ if (idx) ++ idx--; ++ ++- if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) +++ if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) ++ rate = mwl_rates_24[idx].hw_value; ++ else ++ rate = mwl_rates_50[idx].hw_value; ++@@ -600,10 +600,13 @@ static int mwl_mac80211_get_survey(struc + + static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, +@@ -17,3 +41,227 @@ + int rc = 0; + struct mwl_priv *priv = hw->priv; + struct mwl_ampdu_stream *stream; ++--- a/fwcmd.c +++++ b/fwcmd.c ++@@ -730,9 +730,9 @@ static int mwl_fwcmd_set_country_code(st ++ bool enable = false; ++ ++ if (b_inf->ie_country_ptr) { ++- if (bss_conf->chandef.chan->band == IEEE80211_BAND_2GHZ) +++ if (bss_conf->chandef.chan->band == NL80211_BAND_2GHZ) ++ a_band = false; ++- else if (bss_conf->chandef.chan->band == IEEE80211_BAND_5GHZ) +++ else if (bss_conf->chandef.chan->band == NL80211_BAND_5GHZ) ++ a_band = true; ++ else ++ return -EINVAL; ++@@ -1075,9 +1075,9 @@ int mwl_fwcmd_max_tx_power(struct ieee80 ++ break; ++ } ++ ++- if (channel->band == IEEE80211_BAND_2GHZ) +++ if (channel->band == NL80211_BAND_2GHZ) ++ band = FREQ_BAND_2DOT4GHZ; ++- else if (channel->band == IEEE80211_BAND_5GHZ) +++ else if (channel->band == NL80211_BAND_5GHZ) ++ band = FREQ_BAND_5GHZ; ++ ++ switch (conf->chandef.width) { ++@@ -1161,9 +1161,9 @@ int mwl_fwcmd_tx_power(struct ieee80211_ ++ break; ++ } ++ ++- if (channel->band == IEEE80211_BAND_2GHZ) +++ if (channel->band == NL80211_BAND_2GHZ) ++ band = FREQ_BAND_2DOT4GHZ; ++- else if (channel->band == IEEE80211_BAND_5GHZ) +++ else if (channel->band == NL80211_BAND_5GHZ) ++ band = FREQ_BAND_5GHZ; ++ ++ switch (conf->chandef.width) { ++@@ -1354,9 +1354,9 @@ int mwl_fwcmd_set_rf_channel(struct ieee ++ pcmd->action = cpu_to_le16(WL_SET); ++ pcmd->curr_chnl = channel->hw_value; ++ ++- if (channel->band == IEEE80211_BAND_2GHZ) { +++ if (channel->band == NL80211_BAND_2GHZ) { ++ freq_band = FREQ_BAND_2DOT4GHZ; ++- } else if (channel->band == IEEE80211_BAND_5GHZ) { +++ } else if (channel->band == NL80211_BAND_5GHZ) { ++ freq_band = FREQ_BAND_5GHZ; ++ } else { ++ mutex_unlock(&priv->fwcmd_mutex); ++@@ -1923,10 +1923,10 @@ int mwl_fwcmd_set_new_stn_add(struct iee ++ } ++ ether_addr_copy(pcmd->mac_addr, sta->addr); ++ ++- if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) ++- rates = sta->supp_rates[IEEE80211_BAND_2GHZ]; +++ if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) +++ rates = sta->supp_rates[NL80211_BAND_2GHZ]; ++ else ++- rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5; +++ rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5; ++ pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates); ++ ++ if (sta->ht_cap.ht_supported) { ++@@ -2097,9 +2097,9 @@ int mwl_fwcmd_set_switch_channel(struct ++ if (priv->csa_active) ++ return 0; ++ ++- if (channel->band == IEEE80211_BAND_2GHZ) +++ if (channel->band == NL80211_BAND_2GHZ) ++ freq_band = FREQ_BAND_2DOT4GHZ; ++- else if (channel->band == IEEE80211_BAND_5GHZ) +++ else if (channel->band == NL80211_BAND_5GHZ) ++ freq_band = FREQ_BAND_5GHZ; ++ else ++ return -EINVAL; ++--- a/main.c +++++ b/main.c ++@@ -63,20 +63,20 @@ static struct mwl_chip_info mwl_chip_tbl ++ }; ++ ++ static const struct ieee80211_channel mwl_channels_24[] = { ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, }, ++- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, }, +++ { .band = NL80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, }, ++ }; ++ ++ static const struct ieee80211_rate mwl_rates_24[] = { ++@@ -96,30 +96,30 @@ static const struct ieee80211_rate mwl_r ++ }; ++ ++ static const struct ieee80211_channel mwl_channels_50[] = { ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5260, .hw_value = 52, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5280, .hw_value = 56, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5300, .hw_value = 60, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5320, .hw_value = 64, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5500, .hw_value = 100, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5520, .hw_value = 104, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5540, .hw_value = 108, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5560, .hw_value = 112, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5580, .hw_value = 116, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5600, .hw_value = 120, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5620, .hw_value = 124, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5640, .hw_value = 128, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5660, .hw_value = 132, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5680, .hw_value = 136, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5700, .hw_value = 140, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5720, .hw_value = 144, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, }, ++- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5260, .hw_value = 52, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5280, .hw_value = 56, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5300, .hw_value = 60, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5320, .hw_value = 64, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5500, .hw_value = 100, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5520, .hw_value = 104, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5540, .hw_value = 108, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5560, .hw_value = 112, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5580, .hw_value = 116, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5600, .hw_value = 120, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5620, .hw_value = 124, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5640, .hw_value = 128, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5660, .hw_value = 132, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5680, .hw_value = 136, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5700, .hw_value = 140, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5720, .hw_value = 144, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, }, +++ { .band = NL80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, }, ++ }; ++ ++ static const struct ieee80211_rate mwl_rates_50[] = { ++@@ -478,7 +478,7 @@ static void mwl_set_caps(struct mwl_priv ++ BUILD_BUG_ON(sizeof(priv->rates_24) != sizeof(mwl_rates_24)); ++ memcpy(priv->rates_24, mwl_rates_24, sizeof(mwl_rates_24)); ++ ++- priv->band_24.band = IEEE80211_BAND_2GHZ; +++ priv->band_24.band = NL80211_BAND_2GHZ; ++ priv->band_24.channels = priv->channels_24; ++ priv->band_24.n_channels = ARRAY_SIZE(mwl_channels_24); ++ priv->band_24.bitrates = priv->rates_24; ++@@ -487,7 +487,7 @@ static void mwl_set_caps(struct mwl_priv ++ mwl_set_ht_caps(priv, &priv->band_24); ++ mwl_set_vht_caps(priv, &priv->band_24); ++ ++- hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band_24; +++ hw->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band_24; ++ } ++ ++ /* set up band information for 5G */ ++@@ -500,7 +500,7 @@ static void mwl_set_caps(struct mwl_priv ++ BUILD_BUG_ON(sizeof(priv->rates_50) != sizeof(mwl_rates_50)); ++ memcpy(priv->rates_50, mwl_rates_50, sizeof(mwl_rates_50)); ++ ++- priv->band_50.band = IEEE80211_BAND_5GHZ; +++ priv->band_50.band = NL80211_BAND_5GHZ; ++ priv->band_50.channels = priv->channels_50; ++ priv->band_50.n_channels = ARRAY_SIZE(mwl_channels_50); ++ priv->band_50.bitrates = priv->rates_50; ++@@ -509,7 +509,7 @@ static void mwl_set_caps(struct mwl_priv ++ mwl_set_ht_caps(priv, &priv->band_50); ++ mwl_set_vht_caps(priv, &priv->band_50); ++ ++- hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->band_50; +++ hw->wiphy->bands[NL80211_BAND_5GHZ] = &priv->band_50; ++ } ++ } ++ ++--- a/rx.c +++++ b/rx.c ++@@ -243,7 +243,7 @@ static inline void mwl_rx_prepare_status ++ status->rate_idx = rt; ++ ++ if (pdesc->channel > BAND_24_CHANNEL_NUM) { ++- status->band = IEEE80211_BAND_5GHZ; +++ status->band = NL80211_BAND_5GHZ; ++ if ((!(status->flag & RX_FLAG_HT)) && ++ (!(status->flag & RX_FLAG_VHT))) { ++ status->rate_idx -= 5; ++@@ -251,7 +251,7 @@ static inline void mwl_rx_prepare_status ++ status->rate_idx = BAND_50_RATE_NUM - 1; ++ } ++ } else { ++- status->band = IEEE80211_BAND_2GHZ; +++ status->band = NL80211_BAND_2GHZ; ++ if ((!(status->flag & RX_FLAG_HT)) && ++ (!(status->flag & RX_FLAG_VHT))) { ++ if (status->rate_idx >= BAND_24_RATE_NUM) +diff --git a/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch b/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch +new file mode 100644 +index 0000000..43523ed +--- /dev/null ++++ b/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch +@@ -0,0 +1,73 @@ ++--- a/fwcmd.c +++++ b/fwcmd.c ++@@ -132,7 +132,7 @@ static int mwl_fwcmd_wait_complete(struc ++ int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[2])); ++ else ++ int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[0])); ++- mdelay(1); +++ usleep_range(1000, 2000); ++ } while ((int_code != cmd) && (--curr_iteration)); ++ ++ if (curr_iteration == 0) { ++@@ -142,7 +142,7 @@ static int mwl_fwcmd_wait_complete(struc ++ return -EIO; ++ } ++ ++- mdelay(3); +++ usleep_range(3000, 5000); ++ ++ return 0; ++ } ++--- a/fwdl.c +++++ b/fwdl.c ++@@ -74,7 +74,7 @@ int mwl_fwdl_download_firmware(struct ie ++ /* FW before jumping to boot rom, it will enable PCIe transaction retry, ++ * wait for boot code to stop it. ++ */ ++- mdelay(FW_CHECK_MSECS); +++ usleep_range(FW_CHECK_MSECS * 1000, FW_CHECK_MSECS * 2000); ++ ++ writel(MACREG_A2HRIC_BIT_MASK, ++ priv->iobase1 + MACREG_REG_A2H_INTERRUPT_CLEAR_SEL); ++@@ -95,7 +95,7 @@ int mwl_fwdl_download_firmware(struct ie ++ ++ /* make sure SCRATCH2 C40 is clear, in case we are too quick */ ++ while (readl(priv->iobase1 + 0xc40) == 0) ++- ; +++ cond_resched(); ++ ++ while (size_fw_downloaded < fw->size) { ++ len = readl(priv->iobase1 + 0xc40); ++@@ -125,6 +125,7 @@ int mwl_fwdl_download_firmware(struct ie ++ int_code = readl(priv->iobase1 + 0xc1c); ++ if (int_code != 0) ++ break; +++ cond_resched(); ++ curr_iteration--; ++ } while (curr_iteration); ++ ++@@ -133,6 +134,7 @@ int mwl_fwdl_download_firmware(struct ie ++ if ((int_code & MACREG_H2ARIC_BIT_DOOR_BELL) != ++ MACREG_H2ARIC_BIT_DOOR_BELL) ++ break; +++ cond_resched(); ++ curr_iteration--; ++ } while (curr_iteration); ++ ++@@ -167,12 +169,14 @@ int mwl_fwdl_download_firmware(struct ie ++ do { ++ curr_iteration--; ++ if (priv->mfg_mode && priv->chip_type == MWL8897) { ++- mdelay(FW_CHECK_MSECS); +++ usleep_range(FW_CHECK_MSECS * 1000, +++ FW_CHECK_MSECS * 2000); ++ int_code = readl(priv->iobase1 + 0xc44); ++ } else { ++ writel(HOSTCMD_SOFTAP_MODE, ++ priv->iobase1 + MACREG_REG_GEN_PTR); ++- mdelay(FW_CHECK_MSECS); +++ usleep_range(FW_CHECK_MSECS * 1000, +++ FW_CHECK_MSECS * 2000); ++ int_code = readl(priv->iobase1 + MACREG_REG_INT_CODE); ++ } ++ if (!(curr_iteration % 0xff) && (int_code != 0)) +diff --git a/package/kernel/mwlwifi/patches/210-fix_logspam.patch b/package/kernel/mwlwifi/patches/210-fix_logspam.patch +new file mode 100644 +index 0000000..99b247f +--- /dev/null ++++ b/package/kernel/mwlwifi/patches/210-fix_logspam.patch +@@ -0,0 +1,22 @@ ++--- a/fwcmd.c +++++ b/fwcmd.c ++@@ -2393,8 +2393,6 @@ int mwl_fwcmd_check_ba(struct ieee80211_ ++ ++ if (pcmd->cmd_hdr.result != 0) { ++ mutex_unlock(&priv->fwcmd_mutex); ++- wiphy_err(hw->wiphy, "check ba result error %d\n", ++- le16_to_cpu(pcmd->cmd_hdr.result)); ++ return -EINVAL; ++ } ++ ++--- a/mac80211.c +++++ b/mac80211.c ++@@ -644,8 +644,6 @@ static int mwl_mac80211_ampdu_action(str ++ spin_lock_bh(&priv->stream_lock); ++ if (rc) { ++ mwl_fwcmd_remove_stream(hw, stream); ++- wiphy_err(hw->wiphy, ++- "ampdu start error code: %d\n", rc); ++ rc = -EPERM; ++ break; ++ } +diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile +index ad82081..d17cbca 100644 +--- a/package/network/utils/iw/Makefile ++++ b/package/network/utils/iw/Makefile +@@ -12,10 +12,10 @@ PKG_VERSION:=4.3 + PKG_RELEASE:=1 + + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +-PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw ++PKG_SOURCE_URL:=@KERNEL/software/network/iw + PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5 + +-PKG_MAINTAINER:=Felix Fietkau ++PKG_MAINTAINER:=Felix Fietkau + PKG_LICENSE:=GPL-2.0 + + include $(INCLUDE_DIR)/package.mk +diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch +index 7de2258..e5ea8f7 100644 +--- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch ++++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch +@@ -8,7 +8,17 @@ + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +-@@ -328,7 +329,15 @@ ++@@ -321,14 +322,24 @@ ++ * @NL80211_CMD_GET_SCAN: get scan results ++ * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters ++ * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the ++- * probe requests at CCK rate or not. +++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to +++ * specify a BSSID to scan for; if not included, the wildcard BSSID will +++ * be used. ++ * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to ++ * NL80211_CMD_GET_SCAN and on the "scan" multicast group) ++ * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, + * partial scan results may be available + * + * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain +@@ -25,7 +35,82 @@ + * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) + * are passed, they are used in the probe requests. For + * broadcast, a broadcast SSID must be passed (ie. an empty +-@@ -1761,6 +1770,22 @@ enum nl80211_commands { ++@@ -418,7 +429,11 @@ ++ * @NL80211_CMD_ASSOCIATE: association request and notification; like ++ * NL80211_CMD_AUTHENTICATE but for Association and Reassociation ++ * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, ++- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). +++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The +++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the +++ * request is for the initial association to an ESS (that attribute not +++ * included) or for reassociation within the ESS (that attribute is +++ * included). ++ * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like ++ * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to ++ * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication ++@@ -468,6 +483,9 @@ ++ * set of BSSID,frequency parameters is used (i.e., either the enforcing ++ * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict ++ * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT). +++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within +++ * the ESS in case the device is already associated and an association with +++ * a different BSS is desired. ++ * Background scan period can optionally be ++ * specified in %NL80211_ATTR_BG_SCAN_PERIOD, ++ * if not specified default background scan configuration ++@@ -811,6 +829,10 @@ ++ * as an event to indicate changes for devices with wiphy-specific regdom ++ * management. ++ * +++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is +++ * not running. The driver indicates the status of the scan through +++ * cfg80211_scan_done(). +++ * ++ * @NL80211_CMD_MAX: highest used command number ++ * @__NL80211_CMD_AFTER_LAST: internal use ++ */ ++@@ -997,6 +1019,8 @@ enum nl80211_commands { ++ ++ NL80211_CMD_WIPHY_REG_CHANGE, ++ +++ NL80211_CMD_ABORT_SCAN, +++ ++ /* add new commands above here */ ++ ++ /* used to define NL80211_CMD_MAX below */ ++@@ -1270,8 +1294,11 @@ enum nl80211_commands { ++ * @NL80211_ATTR_RESP_IE: (Re)association response information elements as ++ * sent by peer, for ROAM and successful CONNECT events. ++ * ++- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE ++- * commands to specify using a reassociate frame +++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT +++ * commands to specify a request to reassociate within an ESS, i.e., to use +++ * Reassociate Request frame (with the value of this attribute in the +++ * Current AP address field) instead of Association Request frame which is +++ * used for the initial association to an ESS. ++ * ++ * @NL80211_ATTR_KEY: key information in a nested attribute with ++ * %NL80211_KEY_* sub-attributes ++@@ -1712,6 +1739,8 @@ enum nl80211_commands { ++ * underlying device supports these minimal RRM features: ++ * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES, ++ * %NL80211_FEATURE_QUIET, +++ * Or, if global RRM is supported, see: +++ * %NL80211_EXT_FEATURE_RRM ++ * If this flag is used, driver must add the Power Capabilities IE to the ++ * association request. In addition, it must also set the RRM capability ++ * flag in the association request's Capability Info field. ++@@ -1755,12 +1784,44 @@ enum nl80211_commands { ++ * over all channels. ++ * ++ * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a ++- * scheduled scan (or a WoWLAN net-detect scan) is started, u32 ++- * in seconds. +++ * scheduled scan is started. Or the delay before a WoWLAN +++ * net-detect scan is started, counting from the moment the +++ * system is suspended. This value is a u32, in seconds. ++ + * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device + * is operating in an indoor environment. + * +@@ -41,6 +126,21 @@ + + * thus it must not specify the number of iterations, only the interval + + * between scans. The scan plans are executed sequentially. + + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. +++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate +++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request +++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start +++ * a PCP instead of AP. Relevant for DMG networks only. +++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the +++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains +++ * attributes according &enum nl80211_bss_select_attr to indicate what +++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT +++ * it contains the behaviour-specific attribute containing the parameters for +++ * BSS selection to be done by driver and/or firmware. +++ * +++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported +++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status +++ * +++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment + + * + + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + + * transmit power to stay within regulatory limits. u32, dBi. +@@ -48,7 +148,7 @@ + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +-@@ -2130,6 +2155,13 @@ enum nl80211_attrs { ++@@ -2130,6 +2191,21 @@ enum nl80211_attrs { + + NL80211_ATTR_REG_INDOOR, + +@@ -57,30 +157,147 @@ + + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, + + NL80211_ATTR_SCHED_SCAN_PLANS, + + +++ NL80211_ATTR_PBSS, +++ +++ NL80211_ATTR_BSS_SELECT, +++ +++ NL80211_ATTR_STA_SUPPORT_P2P_PS, +++ +++ NL80211_ATTR_PAD, +++ + + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + + + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +-@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width { ++@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags { ++ NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 ++ }; ++ +++/** +++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS +++ * +++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism +++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism +++ * @NUM_NL80211_P2P_PS_STATUS: number of values +++ */ +++enum nl80211_sta_p2p_ps_status { +++ NL80211_P2P_PS_UNSUPPORTED = 0, +++ NL80211_P2P_PS_SUPPORTED, +++ +++ NUM_NL80211_P2P_PS_STATUS, +++}; +++ ++ #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER ++ ++ /** ++@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param { ++ * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames; ++ * each one of those is again nested with &enum nl80211_tid_stats ++ * attributes carrying the actual values. +++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames +++ * received from the station (u64, usec) +++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment ++ * @__NL80211_STA_INFO_AFTER_LAST: internal ++ * @NL80211_STA_INFO_MAX: highest possible station info attribute ++ */ ++@@ -2466,6 +2559,8 @@ enum nl80211_sta_info { ++ NL80211_STA_INFO_BEACON_RX, ++ NL80211_STA_INFO_BEACON_SIGNAL_AVG, ++ NL80211_STA_INFO_TID_STATS, +++ NL80211_STA_INFO_RX_DURATION, +++ NL80211_STA_INFO_PAD, ++ ++ /* keep last */ ++ __NL80211_STA_INFO_AFTER_LAST, ++@@ -2482,6 +2577,7 @@ enum nl80211_sta_info { ++ * transmitted MSDUs (not counting the first attempt; u64) ++ * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted ++ * MSDUs (u64) +++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment ++ * @NUM_NL80211_TID_STATS: number of attributes here ++ * @NL80211_TID_STATS_MAX: highest numbered attribute here ++ */ ++@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats { ++ NL80211_TID_STATS_TX_MSDU, ++ NL80211_TID_STATS_TX_MSDU_RETRIES, ++ NL80211_TID_STATS_TX_MSDU_FAILED, +++ NL80211_TID_STATS_PAD, ++ ++ /* keep last */ ++ NUM_NL80211_TID_STATS, ++@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type { ++ * transmitting data (on channel or globally) ++ * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan ++ * (on this channel or globally) +++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment ++ * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number ++ * currently defined ++ * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use ++@@ -2942,6 +3040,7 @@ enum nl80211_survey_info { ++ NL80211_SURVEY_INFO_TIME_RX, ++ NL80211_SURVEY_INFO_TIME_TX, ++ NL80211_SURVEY_INFO_TIME_SCAN, +++ NL80211_SURVEY_INFO_PAD, ++ ++ /* keep last */ ++ __NL80211_SURVEY_INFO_AFTER_LAST, ++@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width { + * (not present if no beacon frame has been received yet) + * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and + * @NL80211_BSS_TSF is known to be from a probe response (flag attribute) + + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry + + * was last updated by a received frame. The value is expected to be + + * accurate to about 10ms. (u64, nanoseconds) +++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment + * @__NL80211_BSS_AFTER_LAST: internal + * @NL80211_BSS_MAX: highest BSS attribute + */ +-@@ -3383,6 +3418,7 @@ enum nl80211_bss { ++@@ -3383,6 +3486,8 @@ enum nl80211_bss { + NL80211_BSS_CHAN_WIDTH, + NL80211_BSS_BEACON_TSF, + NL80211_BSS_PRESP_DATA, + + NL80211_BSS_LAST_SEEN_BOOTTIME, +++ NL80211_BSS_PAD, + + /* keep last */ + __NL80211_BSS_AFTER_LAST, +-@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability { ++@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi { ++ * @NL80211_BAND_2GHZ: 2.4 GHz ISM band ++ * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) ++ * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) +++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace +++ * since newer kernel versions may support more bands ++ */ ++ enum nl80211_band { ++ NL80211_BAND_2GHZ, ++ NL80211_BAND_5GHZ, ++ NL80211_BAND_60GHZ, +++ +++ NUM_NL80211_BANDS, ++ }; ++ ++ /** ++@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags { ++ /** ++ * enum nl80211_ext_feature_index - bit index of extended features. ++ * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. +++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can +++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with +++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set +++ * the ASSOC_REQ_USE_RRM flag in the association request even if +++ * NL80211_FEATURE_QUIET is not advertized. ++ * ++ * @NUM_NL80211_EXT_FEATURES: number of extended features. ++ * @MAX_NL80211_EXT_FEATURES: highest extended feature index. ++ */ ++ enum nl80211_ext_feature_index { ++ NL80211_EXT_FEATURE_VHT_IBSS, +++ NL80211_EXT_FEATURE_RRM, ++ ++ /* add new features before the definition below */ ++ NUM_NL80211_EXT_FEATURES, ++@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability { + NL80211_TDLS_PEER_WMM = 1<<2, + }; + +@@ -108,4 +325,48 @@ + + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1 + +}; + + +++/** +++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters. +++ * +++ * @band: band of BSS that must match for RSSI value adjustment. +++ * @delta: value used to adjust the RSSI value of matching BSS. +++ */ +++struct nl80211_bss_select_rssi_adjust { +++ __u8 band; +++ __s8 delta; +++} __attribute__((packed)); +++ +++/** +++ * enum nl80211_bss_select_attr - attributes for bss selection. +++ * +++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved. +++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection +++ * is requested. +++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS +++ * selection should be done such that the specified band is preferred. +++ * When there are multiple BSS-es in the preferred band, the driver +++ * shall use RSSI-based BSS selection as a second step. The value of +++ * this attribute is according to &enum nl80211_band (u32). +++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for +++ * BSS-es in the specified band is to be adjusted before doing +++ * RSSI-based BSS selection. The attribute value is a packed structure +++ * value as specified by &struct nl80211_bss_select_rssi_adjust. +++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number. +++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use. +++ * +++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT +++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour +++ * which the driver shall use. +++ */ +++enum nl80211_bss_select_attr { +++ __NL80211_BSS_SELECT_ATTR_INVALID, +++ NL80211_BSS_SELECT_ATTR_RSSI, +++ NL80211_BSS_SELECT_ATTR_BAND_PREF, +++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST, +++ +++ /* keep last */ +++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST, +++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1 +++}; +++ + #endif /* __LINUX_NL80211_H */ +diff --git a/package/network/utils/iw/patches/300-display_interface_TX_power.patch b/package/network/utils/iw/patches/300-display_interface_TX_power.patch +index 574c490..2cdf360 100644 +--- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch ++++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch +@@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg + interface.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +-diff --git a/interface.c b/interface.c +-index 73ccecd..4f0821d 100644 + --- a/interface.c + +++ b/interface.c +-@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg) ++@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl + printf("\n"); + } + +diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch +index 709fbb2..0627bcc 100644 +--- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch ++++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch +@@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg + ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 41 insertions(+), 8 deletions(-) + +-diff --git a/ibss.c b/ibss.c +-index 7a0b707..a99a262 100644 + --- a/ibss.c + +++ b/ibss.c + @@ -16,6 +16,39 @@ +@@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644 + static int join_ibss(struct nl80211_state *state, + struct nl_msg *msg, + int argc, char **argv, +-@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state, ++@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat + int bintval; + int i; + unsigned long freq; +@@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644 + { .name = "HT20", + .width = NL80211_CHAN_WIDTH_20, + .freq1_diff = 0, +-@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state, ++@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat + .width = NL80211_CHAN_WIDTH_10, + .freq1_diff = 0, + .chantype = -1 }, +@@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644 + }; + + if (argc < 2) +-@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state, ++@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat + NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH, + chanmode_selected->width); + NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, +diff --git a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch +index fc44427..f96d5ea 100644 +--- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch ++++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch +@@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg + ibss.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +-diff --git a/ibss.c b/ibss.c +-index a99a262..23bda70 100644 + --- a/ibss.c + +++ b/ibss.c +-@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state, ++@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat + .width = NL80211_CHAN_WIDTH_20_NOHT, + .freq1_diff = 0, + .chantype = NL80211_CHAN_NO_HT }, +diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch +index fe8dc21..956b050 100644 +--- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch ++++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch +@@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann + util.c | 26 ++++++++++++++++++++++++++ + 4 files changed, 43 insertions(+), 41 deletions(-) + +-diff --git a/ibss.c b/ibss.c +-index 23bda70..ac06fc5 100644 + --- a/ibss.c + +++ b/ibss.c + @@ -16,39 +16,6 @@ +@@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644 + static int join_ibss(struct nl80211_state *state, + struct nl_msg *msg, + int argc, char **argv, +-diff --git a/iw.h b/iw.h +-index cef9da8..8e1a37a 100644 + --- a/iw.h + +++ b/iw.h + @@ -59,6 +59,13 @@ struct cmd { +@@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644 + #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0])) + #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y)) + +-@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown, ++@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie + void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen); + void iw_hexdump(const char *prefix, const __u8 *data, size_t len); + +@@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644 + #define SCHED_SCAN_OPTIONS "interval [delay ] " \ + "[freqs +] [matches [ssid ]+]] [active [ssid ]+|passive] [randomise[=/]]" + int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv); +-diff --git a/mesh.c b/mesh.c +-index 0090530..930d58f 100644 + --- a/mesh.c + +++ b/mesh.c +-@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state, ++@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat + int bintval, dtim_period, i, n_rates = 0; + char *end, *value = NULL, *sptr = NULL; + unsigned long freq = 0; +@@ -105,7 +99,7 @@ index 0090530..930d58f 100644 + { .name = "HT20", + .width = NL80211_CHAN_WIDTH_20, + .freq1_diff = 0, +-@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state, ++@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat + .width = NL80211_CHAN_WIDTH_20_NOHT, + .freq1_diff = 0, + .chantype = NL80211_CHAN_NO_HT }, +@@ -116,7 +110,7 @@ index 0090530..930d58f 100644 + }; + + if (argc < 1) +-@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state, ++@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat + NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH, + chanmode_selected->width); + NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, +@@ -125,7 +119,7 @@ index 0090530..930d58f 100644 + if (chanmode_selected->chantype != -1) + NLA_PUT_U32(msg, + NL80211_ATTR_WIPHY_CHANNEL_TYPE, +-@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state, ++@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat + nla_put_failure: + return -ENOBUFS; + } +@@ -134,11 +128,9 @@ index 0090530..930d58f 100644 + " [basic-rates ]], [mcast-rate ]" + " [beacon-interval