Re: [PATCH] dropbear: make rsa-sha2-256 pubkeys usable again

2020-07-17 Thread Petr Štetiar
Matt Johnston  [2020-07-17 19:54:51]:

Hi,

> Are you using a rsa key on disk, or using a SSH agent? I wonder if the agent
> doesn't support rsa-sha2-256 signatures or something?

I'm using Yubikeys as my key storage, so it's gpg-agent (GnuPG) 2.2.4 with
libgcrypt 1.8.1 running on Ubuntu 18.04. Disabling the agent and using the key
from disk makes it working again. It was working fine with 2019.78.

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ipq40xx: add open-drain support to pinctrl-msm

2020-07-17 Thread Brian Norris
On Fri, Jul 17, 2020 at 1:59 AM Petr Štetiar  wrote:
> Or is there any other valid reason I'm missing right now?

I put my main reason in the original email:
"Submitting this separately, partly because the device-support patches
are a bit bigger and likely will take a little work."

Particularly, the device in question uses some new disk layout and
kernel packaging that's not yet supported in OpenWRT, and there are
likely some questions to be resolved there. I figured the more obvious
stuff (like this) could go separately.

But I can just keep this in the device-support series, since that
appears to be your preference. Stay tuned.

Regards,
Brian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[no subject]

2020-07-17 Thread Florian Eckert via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
> Until now it has not been possible to remove countries from the regdb.
> The packages has been extended, so that it is now possible to add or
> omit individual countries in the regdb during package compile time.
>
> You can now add countries to a blacklist or whitelist to customize the
> regdb. In the blacklist or whitelist the countries must be entered in a
> comma separated list. So abbreviation for the countries are entered in
> IS03166 ALPHA-2 notation.

As there is a discussion about inclusive language terms, isn't it
appropriate that I rename the names to Blocklist or Allowlist?
This is also being discussed in the kernel LKML.

--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Rosen Penev
On Fri, Jul 17, 2020 at 3:49 AM Bjørn Mork  wrote:
>
> Rosen Penev  writes:
> >> On Jul 17, 2020, at 3:06 AM, Felix Fietkau  wrote:
>
> >>> +--- a/ui_common.h
> >>>  b/ui_common.h
> >>> +@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
> >>> +
> >>> + extern options_t options;
> >>> +
> >>> +-sorted_list_type screen_list;
> >>> +-host_pair_line totals;
> >>> +-int peaksent, peakrecv, peaktotal;
> >>> ++static sorted_list_type screen_list;
> >>> ++static host_pair_line totals;
> >>> ++static int peaksent, peakrecv, peaktotal;
> >>> + extern history_type history_totals;
> >>> +-hash_type* screen_hash;
> >>> +-hash_type* service_hash;
> >>> ++static hash_type* screen_hash;
> >>> ++static hash_type* service_hash;
> >>
> >> Declaring these variables as static in a header file seems wrong to me.
> >> Shouldn't this be declared as a global variable in one of the .c files
> >> and extern here?
> >
> > Sure. static creates a smaller patch though.
>
> How does that help if the result is buggy?  I assume these variables are
> declared in a header because their values are actually shared.
Correct. -fno-common (the default in GCC10) mandates that variable
names be unique. No two variables can share the same name.

Interestingly enough, clang has a warning for this
(-Wmissing-variable-declarations).
>
>
> Bjørn
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Rosen Penev
On Fri, Jul 17, 2020 at 3:21 AM Jo-Philipp Wich  wrote:
>
> Hi,
>
> I've sent a fix using extern declarations upstream, lets see what happens.
Where? I don't see a merge request on the git link referenced in the Makefile.
>
> ~ Jo
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] toolchain: binutils: Use version 2.34 by default

2020-07-17 Thread Rosen Penev
On Fri, Jul 17, 2020 at 2:53 PM Hauke Mehrtens  wrote:
>
> Switch to binutils version 2.34 for all CPUs by default. The ARC CPUs
> do not need any sepcial binutils version any more.
>
> Tested on lantiq, ipq40xx
>
> Signed-off-by: Hauke Mehrtens 
Acked-by: Rosen Penev 

I've been using this since it was made available on mvebu and ath79.
No issues to report.
> ---
>  toolchain/binutils/Config.in  | 3 +--
>  toolchain/binutils/Config.version | 4 +---
>  2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in
> index 4ae0b5757235..e9b2d3042293 100644
> --- a/toolchain/binutils/Config.in
> +++ b/toolchain/binutils/Config.in
> @@ -2,8 +2,7 @@
>
>  choice
> prompt "Binutils Version" if TOOLCHAINOPTS
> -   default BINUTILS_USE_VERSION_2_31_1 if !arc
> -   default BINUTILS_USE_VERSION_2_32 if arc
> +   default BINUTILS_USE_VERSION_2_34
> help
>   Select the version of binutils you wish to use.
>
> diff --git a/toolchain/binutils/Config.version 
> b/toolchain/binutils/Config.version
> index 7c3519680d10..e7924f89c378 100644
> --- a/toolchain/binutils/Config.version
> +++ b/toolchain/binutils/Config.version
> @@ -2,15 +2,13 @@ config BINUTILS_VERSION_2_29_1
> bool
>
>  config BINUTILS_VERSION_2_31_1
> -   default y if (!TOOLCHAINOPTS && !arc)
> bool
>
>  config BINUTILS_VERSION_2_32
> -   default y if (!TOOLCHAINOPTS && arc)
> bool
>
>  config BINUTILS_VERSION_2_34
> -   default y if (!TOOLCHAINOPTS && arc)
> +   default y if !TOOLCHAINOPTS
> bool
>
>  config BINUTILS_VERSION
> --
> 2.20.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] lantiq: Fix warning in SPI driver

2020-07-17 Thread Hauke Mehrtens
This fixes a warning in the SPI driver at bootup. This warning is seen
in kernel 5.4 on lantiq deives.

Signed-off-by: Hauke Mehrtens 
---
 ...c-Fix-warning-by-using-WQ_MEM_RECLAI.patch | 35 +++
 1 file changed, 35 insertions(+)
 create mode 100644 
target/linux/lantiq/patches-5.4/0800-spi-lantiq-ssc-Fix-warning-by-using-WQ_MEM_RECLAI.patch

diff --git 
a/target/linux/lantiq/patches-5.4/0800-spi-lantiq-ssc-Fix-warning-by-using-WQ_MEM_RECLAI.patch
 
b/target/linux/lantiq/patches-5.4/0800-spi-lantiq-ssc-Fix-warning-by-using-WQ_MEM_RECLAI.patch
new file mode 100644
index ..b2e1ff89077f
--- /dev/null
+++ 
b/target/linux/lantiq/patches-5.4/0800-spi-lantiq-ssc-Fix-warning-by-using-WQ_MEM_RECLAI.patch
@@ -0,0 +1,35 @@
+From 907137d9ef048e7d0282c28e47b32aa4084ad395 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens 
+Date: Mon, 6 Jul 2020 00:05:12 +0200
+Subject: [PATCH v2] spi: lantiq-ssc: Fix warning by using WQ_MEM_RECLAIM
+
+The lantiq-ssc driver uses internally an own workqueue to wait till the
+data is not only written out of the FIFO but really written to the wire.
+This workqueue is flushed while the SPI subsystem is working in some
+other system workqueue.
+
+The system workqueue is marked as WQ_MEM_RECLAIM, but the workqueue in
+the lantiq-ssc driver does not use WQ_MEM_RECLAIM for now. Add this flag
+too to prevent this warning.
+
+This fixes the following warning:
+[2.975956] WARNING: CPU: 1 PID: 17 at kernel/workqueue.c:2614 
check_flush_dependency+0x168/0x184
+[2.984752] workqueue: WQ_MEM_RECLAIM kblockd:blk_mq_run_work_fn is 
flushing !WQ_MEM_RECLAIM 1e100800.spi:0x0
+
+Fixes: 891b7c5fbf61 ("mtd_blkdevs: convert to blk-mq")
+Signed-off-by: Hauke Mehrtens 
+---
+ drivers/spi/spi-lantiq-ssc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/spi/spi-lantiq-ssc.c
 b/drivers/spi/spi-lantiq-ssc.c
+@@ -907,7 +907,7 @@ static int lantiq_ssc_probe(struct platf
+   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) |
+SPI_BPW_MASK(16) | SPI_BPW_MASK(32);
+ 
+-  spi->wq = alloc_ordered_workqueue(dev_name(dev), 0);
++  spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM);
+   if (!spi->wq) {
+   err = -ENOMEM;
+   goto err_clk_put;
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] build: Remove dependency of user space stack cookies from kernel

2020-07-17 Thread Hauke Mehrtens
Currently the user space stack cookies work well also when the kernel
stack cookies are not activated. This is handled completely in user
space and does not need kernel support.

This dependency was probably needed some years ago when the libc did not
support stack cookies.

Signed-off-by: Hauke Mehrtens 
---
 config/Config-build.in | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config/Config-build.in b/config/Config-build.in
index ac1e05d2ff49..199277167bf7 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -256,10 +256,8 @@ menu "Global build settings"
bool "None"
config PKG_CC_STACKPROTECTOR_REGULAR
bool "Regular"
-   depends on KERNEL_CC_STACKPROTECTOR_REGULAR
config PKG_CC_STACKPROTECTOR_STRONG
bool "Strong"
-   depends on KERNEL_CC_STACKPROTECTOR_STRONG
endchoice
 
choice
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] toolchain: binutils: Use version 2.34 by default

2020-07-17 Thread Hauke Mehrtens
Switch to binutils version 2.34 for all CPUs by default. The ARC CPUs
do not need any sepcial binutils version any more.

Tested on lantiq, ipq40xx

Signed-off-by: Hauke Mehrtens 
---
 toolchain/binutils/Config.in  | 3 +--
 toolchain/binutils/Config.version | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in
index 4ae0b5757235..e9b2d3042293 100644
--- a/toolchain/binutils/Config.in
+++ b/toolchain/binutils/Config.in
@@ -2,8 +2,7 @@
 
 choice
prompt "Binutils Version" if TOOLCHAINOPTS
-   default BINUTILS_USE_VERSION_2_31_1 if !arc
-   default BINUTILS_USE_VERSION_2_32 if arc
+   default BINUTILS_USE_VERSION_2_34
help
  Select the version of binutils you wish to use.
 
diff --git a/toolchain/binutils/Config.version 
b/toolchain/binutils/Config.version
index 7c3519680d10..e7924f89c378 100644
--- a/toolchain/binutils/Config.version
+++ b/toolchain/binutils/Config.version
@@ -2,15 +2,13 @@ config BINUTILS_VERSION_2_29_1
bool
 
 config BINUTILS_VERSION_2_31_1
-   default y if (!TOOLCHAINOPTS && !arc)
bool
 
 config BINUTILS_VERSION_2_32
-   default y if (!TOOLCHAINOPTS && arc)
bool
 
 config BINUTILS_VERSION_2_34
-   default y if (!TOOLCHAINOPTS && arc)
+   default y if !TOOLCHAINOPTS
bool
 
 config BINUTILS_VERSION
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] mediatek: add U-Boot build for UniElec U7623

2020-07-17 Thread David Woodhouse
Patches submitted upstream at
https://patchwork.ozlabs.org/project/uboot/list/?series=189178

Tested on Banana Pi R2 and U7623-06.

Signed-off-by: David Woodhouse 
---
 package/boot/uboot-mediatek/Makefile  |   9 +-
 ...ix-mmc_get_boot_dev-for-platforms-wi.patch |  51 +++
 ...-Add-support-for-UniElec-U7623-board.patch | 310 ++
 .../patches/010-update-u7623-defconfig.patch  |  17 +
 4 files changed, 386 insertions(+), 1 deletion(-)
 create mode 100644 
package/boot/uboot-mediatek/patches/008-board-mediatek-fix-mmc_get_boot_dev-for-platforms-wi.patch
 create mode 100644 
package/boot/uboot-mediatek/patches/009-board-mediatek-Add-support-for-UniElec-U7623-board.patch
 create mode 100644 
package/boot/uboot-mediatek/patches/010-update-u7623-defconfig.patch

diff --git a/package/boot/uboot-mediatek/Makefile 
b/package/boot/uboot-mediatek/Makefile
index f6745f6cad..0908831ad9 100644
--- a/package/boot/uboot-mediatek/Makefile
+++ b/package/boot/uboot-mediatek/Makefile
@@ -34,7 +34,14 @@ define U-Boot/mt7623n_bpir2
   UBOOT_CONFIG:=mt7623n_bpir2
 endef
 
-UBOOT_TARGETS := mt7629 mt7622 mt7623n_bpir2
+define U-Boot/mt7623a_unielec_u7623
+  NAME:=UniElec U7623 (mt7623)
+  BUILD_SUBTARGET:=mt7623
+  UBOOT_IMAGE:=u-boot-mtk.bin
+  UBOOT_CONFIG:=mt7623a_unielec_u7623_02
+endef
+
+UBOOT_TARGETS := mt7629 mt7622 mt7623n_bpir2 mt7623a_unielec_u7623
 
 UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE)
 
diff --git 
a/package/boot/uboot-mediatek/patches/008-board-mediatek-fix-mmc_get_boot_dev-for-platforms-wi.patch
 
b/package/boot/uboot-mediatek/patches/008-board-mediatek-fix-mmc_get_boot_dev-for-platforms-wi.patch
new file mode 100644
index 00..e32114a880
--- /dev/null
+++ 
b/package/boot/uboot-mediatek/patches/008-board-mediatek-fix-mmc_get_boot_dev-for-platforms-wi.patch
@@ -0,0 +1,51 @@
+From b0d1b85fb25a28a9532eaa9dda064b40a0e25f25 Mon Sep 17 00:00:00 2001
+From: David Woodhouse 
+Date: Sun, 12 Jul 2020 23:19:09 +0100
+Subject: [PATCH 1/3] board: mediatek: fix mmc_get_boot_dev() for platforms
+ without external SD
+
+On the UniElec U7623 board there is no external SD slot and the preloader
+doesn't fill in the magic field at 0x81d0 to indicate that it was
+booted from eMMC.
+
+Signed-off-by: David Woodhouse 
+---
+ board/mediatek/mt7623/mt7623_rfb.c | 7 +++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/board/mediatek/mt7623/mt7623_rfb.c 
b/board/mediatek/mt7623/mt7623_rfb.c
+index 4ec2764976..984e75ccaf 100644
+--- a/board/mediatek/mt7623/mt7623_rfb.c
 b/board/mediatek/mt7623/mt7623_rfb.c
+@@ -4,6 +4,7 @@
+  */
+ 
+ #include 
++#include 
+ 
+ DECLARE_GLOBAL_DATA_PTR;
+ 
+@@ -15,10 +16,15 @@ int board_init(void)
+   return 0;
+ }
+ 
++#ifdef CONFIG_MMC
+ int mmc_get_boot_dev(void)
+ {
+   int g_mmc_devid = -1;
+   char *uflag = (char *)0x81D0;
++
++  if (!find_mmc_device(1))
++  return 0;
++
+   if (strncmp(uflag,"eMMC",4)==0) {
+   g_mmc_devid = 0;
+   printf("Boot From Emmc(id:%d)\n\n", g_mmc_devid);
+@@ -33,3 +39,4 @@ int mmc_get_env_dev(void)
+ {
+   return mmc_get_boot_dev();
+ }
++#endif
+-- 
+2.26.2
+
diff --git 
a/package/boot/uboot-mediatek/patches/009-board-mediatek-Add-support-for-UniElec-U7623-board.patch
 
b/package/boot/uboot-mediatek/patches/009-board-mediatek-Add-support-for-UniElec-U7623-board.patch
new file mode 100644
index 00..32bef358f4
--- /dev/null
+++ 
b/package/boot/uboot-mediatek/patches/009-board-mediatek-Add-support-for-UniElec-U7623-board.patch
@@ -0,0 +1,310 @@
+From d13abe5b2c5b85228bdd34584fcbd642f1883668 Mon Sep 17 00:00:00 2001
+From: David Woodhouse 
+Date: Sun, 12 Jul 2020 23:23:05 +0100
+Subject: [PATCH 3/3] board: mediatek: Add support for UniElec U7623 board
+
+This is an MT7623A-based board, very similar to the Banana Pi R2.
+
+http://www.unielecinc.com/q/news/cn/p/product/detail.html?qd_guid=OjXwKCaRlN
+
+Signed-off-by: David Woodhouse 
+---
+ arch/arm/dts/Makefile |   1 +
+ .../arm/dts/mt7623a-unielec-u7623-02-emmc.dts | 211 ++
+ configs/mt7623a_unielec_u7623_02_defconfig|  54 +
+ 3 files changed, 266 insertions(+)
+ create mode 100644 arch/arm/dts/mt7623a-unielec-u7623-02-emmc.dts
+ create mode 100644 configs/mt7623a_unielec_u7623_02_defconfig
+
+diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
+index 89fa448818..a140b1c8d4 100644
+--- a/arch/arm/dts/Makefile
 b/arch/arm/dts/Makefile
+@@ -938,6 +938,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += 
k3-j721e-common-proc-board.dtb \
+ 
+ dtb-$(CONFIG_ARCH_MEDIATEK) += \
+   mt7622-rfb.dtb \
++  mt7623a-unielec-u7623-02-emmc.dtb \
+   mt7623n-bananapi-bpi-r2.dtb \
+   mt7629-rfb.dtb \
+   mt8512-bm1-emmc.dtb \
+diff --git a/arch/arm/dts/mt7623a-unielec-u7623-02-emmc.dts 
b/arch/arm/dts/mt7623a-unielec-u7623-02-emmc.dts
+new file mode 100644
+index 00..fdeec75b05
+--- /dev/null
 b/arch/arm/dts/mt7623a-unielec-u7623-02-emmc.dts
+@@ -0,0 +1,211 @@

[PATCH v2] dropbear: allow disabling the RSA public key algorithm

2020-07-17 Thread Rui Salvaterra
This allows the user to disable the RSA algorithm in Dropbear, if not required.
(RSA is still enabled by default, of course, due to its ubiquity.)

Size comparison of the dropbear executable (cortex-a9+neon):

RSA + Ed25519:  182804 bytes
RSA only:   170496 bytes
Ed25519 only:   166356 bytes

Signed-off-by: Rui Salvaterra 
---
 package/network/services/dropbear/Config.in|  7 +++
 package/network/services/dropbear/Makefile |  9 ++---
 ...0-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch | 14 +-
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/package/network/services/dropbear/Config.in 
b/package/network/services/dropbear/Config.in
index 3de4189e08..0ac84ee206 100644
--- a/package/network/services/dropbear/Config.in
+++ b/package/network/services/dropbear/Config.in
@@ -1,6 +1,13 @@
 menu "Configuration"
depends on PACKAGE_dropbear
 
+config DROPBEAR_RSA
+   bool "RSA support"
+   default y
+   help
+   The ubiquitous RSA public key algorithm.
+   Keep enabled, unless you're 100 % sure you don't need it!
+
 config DROPBEAR_CURVE25519
bool "Curve25519 support"
default y
diff --git a/package/network/services/dropbear/Makefile 
b/package/network/services/dropbear/Makefile
index 0a9b5c0a99..742dc403ad 100644
--- a/package/network/services/dropbear/Makefile
+++ b/package/network/services/dropbear/Makefile
@@ -28,7 +28,7 @@ PKG_FIXUP:=autoreconf
 
 PKG_CONFIG_DEPENDS:= \
CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
-   CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
+   CONFIG_DROPBEAR_RSA CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
CONFIG_DROPBEAR_DBCLIENT
@@ -64,9 +64,9 @@ define Package/dropbear/description
 endef
 
 define Package/dropbear/conffiles
+$(if $(CONFIG_DROPBEAR_RSA),/etc/dropbear/dropbear_rsa_host_key)
 $(if $(CONFIG_DROPBEAR_ED25519),/etc/dropbear/dropbear_ed25519_host_key)
 $(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key)
-/etc/dropbear/dropbear_rsa_host_key
 /etc/config/dropbear
 endef
 
@@ -104,6 +104,9 @@ define Build/Configure
echo '#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
$(PKG_BUILD_DIR)/localoptions.h
 
+   echo '#define DROPBEAR_RSA $(if $(CONFIG_DROPBEAR_RSA),1,0)' >> \
+   $(PKG_BUILD_DIR)/localoptions.h
+
echo '#define DROPBEAR_CURVE25519 $(if 
$(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
$(PKG_BUILD_DIR)/localoptions.h
 
@@ -169,7 +172,7 @@ define Package/dropbear/install
$(INSTALL_DATA) ./files/dropbear.failsafe 
$(1)/lib/preinit/99_10_failsafe_dropbear
$(if $(CONFIG_DROPBEAR_ED25519),touch 
$(1)/etc/dropbear/dropbear_ed25519_host_key)
$(if $(CONFIG_DROPBEAR_ECC),touch 
$(1)/etc/dropbear/dropbear_ecdsa_host_key)
-   touch $(1)/etc/dropbear/dropbear_rsa_host_key
+   $(if $(CONFIG_DROPBEAR_RSA),touch 
$(1)/etc/dropbear/dropbear_rsa_host_key
 endef
 
 define Package/dropbearconvert/install
diff --git 
a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
 
b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
index afa0ebb310..b2846ea87b 100644
--- 
a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
+++ 
b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
@@ -19,22 +19,26 @@ Signed-off-by: Petr Štetiar 
  signkey.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)
 
-diff --git a/signkey.c b/signkey.c
-index 92fe6a242cd0..d16ab174d83a 100644
 --- a/signkey.c
 +++ b/signkey.c
-@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *key, enum 
signature_type expect_sigtype,
+@@ -657,9 +657,19 @@ int buf_verify(buffer * buf, sign_key *k
sigtype = signature_type_from_name(type_name, type_name_len);
m_free(type_name);
  
--  if (expect_sigtype != sigtype) {
--  dropbear_exit("Non-matching signing type");
++#if DROPBEAR_RSA
 +  if (sigtype == DROPBEAR_SIGNATURE_NONE) {
 +  dropbear_exit("No signature type");
 +  }
 +
 +  if ((expect_sigtype != DROPBEAR_SIGNATURE_RSA_SHA256) && 
(expect_sigtype != sigtype)) {
++  dropbear_exit("Non-matching signing type");
++  }
++#else
+   if (expect_sigtype != sigtype) {
+-  dropbear_exit("Non-matching signing type");
 +  dropbear_exit("Non-matching signing type");
}
++#endif
  
keytype = signkey_type_from_signature(sigtype);
+ #if DROPBEAR_DSS
-- 
2.27.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] gemini: Add swap partition to DNS-313

2020-07-17 Thread Linus Walleij
Sometimes when using the DNS-313 memory usage can peak and
with a simple swap partition we can avoid running into the
roof and invoking the OOM killer. Set this partition to
128MB (twice the size of the memory of the DNS-313).

Signed-off-by: Linus Walleij 
---
 .../linux/gemini/image/dns313_gen_hdd_img.sh  | 20 ---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/target/linux/gemini/image/dns313_gen_hdd_img.sh 
b/target/linux/gemini/image/dns313_gen_hdd_img.sh
index 813852232f69..d302ca634871 100755
--- a/target/linux/gemini/image/dns313_gen_hdd_img.sh
+++ b/target/linux/gemini/image/dns313_gen_hdd_img.sh
@@ -15,14 +15,20 @@ ROOTFSSIZE="$5"
 head=4
 sect=63
 
-# Create two empty partitions followed by the boot partition with
-# the ./boot/zImage and then the rootfs partition.
-set $(ptgen -o $OUTPUT -h $head -s $sect -t 83 -n -p 0 -p 0 -p ${BOOTFSSIZE}M 
-p ${ROOTFSSIZE}M)
+# Create one empty partitions followed by the swap partition, then the
+# boot partition with the ./boot/zImage and then the rootfs partition.
+# The swap partition with type 82 is 128 MB since the DNS-313 has 64 MB of
+# memory so we assign twice of that as swap.
+# The boot partition must always be the third partition.
+# The user should use the first (blank) partition for user data storage,
+# this will typically be named /dev/sda1
+set $(ptgen -o $OUTPUT -h $head -s $sect -n -t 83 -p 0 -t 82 -p 128M -t 83 -p 
${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M)
 
-BOOTOFFSET="$(($1 / 512))"
-BOOTSIZE="$(($2 / 512))"
-ROOTFSOFFSET="$(($3 / 512))"
-ROOTFSSIZE="$(($4 / 512))"
+# Swapoffset and swapsize will be $1 and $2
+BOOTOFFSET="$(($3 / 512))"
+BOOTSIZE="$(($4 / 512))"
+ROOTFSOFFSET="$(($5 / 512))"
+ROOTFSSIZE="$(($6 / 512))"
 
 dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
 dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
-- 
2.26.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] dropbear: allow disabling the RSA public key algorithm

2020-07-17 Thread Rui Salvaterra
This allows the user to disable the RSA algorithm in Dropbear, if not required.
(RSA is still enabled by default, of course, due to its ubiquity.)

Size comparison of the dropbear executable (cortex-a9+neon)…

RSA + Ed25519:  182804 bytes
Ed25519 only:   166356 bytes

… which amounts to over 16 kiB of savings.

Signed-off-by: Rui Salvaterra 
---
 package/network/services/dropbear/Config.in|  7 +++
 package/network/services/dropbear/Makefile |  7 +--
 ...0-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch | 14 +-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/package/network/services/dropbear/Config.in 
b/package/network/services/dropbear/Config.in
index 3de4189e08..0ac84ee206 100644
--- a/package/network/services/dropbear/Config.in
+++ b/package/network/services/dropbear/Config.in
@@ -1,6 +1,13 @@
 menu "Configuration"
depends on PACKAGE_dropbear
 
+config DROPBEAR_RSA
+   bool "RSA support"
+   default y
+   help
+   The ubiquitous RSA public key algorithm.
+   Keep enabled, unless you're 100 % sure you don't need it!
+
 config DROPBEAR_CURVE25519
bool "Curve25519 support"
default y
diff --git a/package/network/services/dropbear/Makefile 
b/package/network/services/dropbear/Makefile
index 0a9b5c0a99..d216eaf299 100644
--- a/package/network/services/dropbear/Makefile
+++ b/package/network/services/dropbear/Makefile
@@ -28,7 +28,7 @@ PKG_FIXUP:=autoreconf
 
 PKG_CONFIG_DEPENDS:= \
CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
-   CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
+   CONFIG_DROPBEAR_RSA CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
CONFIG_DROPBEAR_DBCLIENT
@@ -64,9 +64,9 @@ define Package/dropbear/description
 endef
 
 define Package/dropbear/conffiles
+$(if $(CONFIG_DROPBEAR_RSA),/etc/dropbear/dropbear_rsa_host_key)
 $(if $(CONFIG_DROPBEAR_ED25519),/etc/dropbear/dropbear_ed25519_host_key)
 $(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key)
-/etc/dropbear/dropbear_rsa_host_key
 /etc/config/dropbear
 endef
 
@@ -104,6 +104,9 @@ define Build/Configure
echo '#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
$(PKG_BUILD_DIR)/localoptions.h
 
+   echo '#define DROPBEAR_RSA $(if $(CONFIG_DROPBEAR_RSA),1,0)' >> \
+   $(PKG_BUILD_DIR)/localoptions.h
+
echo '#define DROPBEAR_CURVE25519 $(if 
$(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
$(PKG_BUILD_DIR)/localoptions.h
 
diff --git 
a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
 
b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
index afa0ebb310..b2846ea87b 100644
--- 
a/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
+++ 
b/package/network/services/dropbear/patches/910-signkey-fix-use-of-rsa-sha2-256-pubkeys.patch
@@ -19,22 +19,26 @@ Signed-off-by: Petr Štetiar 
  signkey.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)
 
-diff --git a/signkey.c b/signkey.c
-index 92fe6a242cd0..d16ab174d83a 100644
 --- a/signkey.c
 +++ b/signkey.c
-@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *key, enum 
signature_type expect_sigtype,
+@@ -657,9 +657,19 @@ int buf_verify(buffer * buf, sign_key *k
sigtype = signature_type_from_name(type_name, type_name_len);
m_free(type_name);
  
--  if (expect_sigtype != sigtype) {
--  dropbear_exit("Non-matching signing type");
++#if DROPBEAR_RSA
 +  if (sigtype == DROPBEAR_SIGNATURE_NONE) {
 +  dropbear_exit("No signature type");
 +  }
 +
 +  if ((expect_sigtype != DROPBEAR_SIGNATURE_RSA_SHA256) && 
(expect_sigtype != sigtype)) {
++  dropbear_exit("Non-matching signing type");
++  }
++#else
+   if (expect_sigtype != sigtype) {
+-  dropbear_exit("Non-matching signing type");
 +  dropbear_exit("Non-matching signing type");
}
++#endif
  
keytype = signkey_type_from_signature(sigtype);
+ #if DROPBEAR_DSS
-- 
2.27.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


RE: [RFC PATCH 6/7] ath79: support for TP-Link EAP225-Outdoor v1

2020-07-17 Thread mail
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Sander Vanheule
> Sent: Freitag, 17. Juli 2020 13:38
> To: openwrt-devel@lists.openwrt.org
> Cc: Sander Vanheule ; m...@bibbl.com;
> julien.dus...@free.fr; j...@phrozen.org; ra...@milecki.pl; yn...@true.cz;
> m...@david-bauer.net
> Subject: [RFC PATCH 6/7] ath79: support for TP-Link EAP225-Outdoor v1
> 
> TP-Link EAP225-Outdoor v1 is an AC1200 (802.11ac Wave-2) pole or wall
> mount access point.
> 
> Device specifications:
> * SoC: QCA9563 @ 775MHz
> * Memory: 128MiB DDR2
> * Flash: 16MiB SPI-NOR
> * Wireless 2.4GHz (SoC): b/g/n 2x2
> * Wireless 5GHz (QCA9886): a/n/ac 2x2 MU-MIMO
> * Ethernet (AR8033): 1× 1GbE, PoE
> 
> Flashing instructions:
> * ssh into target device with recent (>= v1.6.0) firmware
> * run `cliclientd stopcs` on target device
> * upload factory image via web interface
> 
> MAC addresses:
> MAC address (as on device label) is stored in device info partition at an 
> offset
> of 8 bytes. ath9k device has same address as ethernet, ath10k uses address
> incremented by 1.
> From stock ifconfig:
> 
> ath0  Link encap:Ethernet  HWaddr D8:...:2E
> ath10 Link encap:Ethernet  HWaddr D8:...:2F
> br0   Link encap:Ethernet  HWaddr D8:...:2E
> eth0  Link encap:Ethernet  HWaddr D8:...:2E
> 
> Tested by forum user PolynomialDivision on firmware v1.7.0.
> 
> Signed-off-by: Sander Vanheule 
> ---
>  .../ath79/dts/qca9563_tplink_eap225od-v1.dts  | 21 ++
> .../generic/base-files/etc/board.d/02_network |  1 +
> .../etc/hotplug.d/firmware/11-ath10k-caldata  |  6 
>  target/linux/ath79/image/generic-tp-link.mk   | 10 +++
>  tools/firmware-utils/src/tplink-safeloader.c  | 29 +++
>  5 files changed, 67 insertions(+)
>  create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap225od-
> v1.dts
> 
> diff --git a/target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts
> b/target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts
> new file mode 100644
> index 00..dcfdb7e524
> --- /dev/null
> +++ b/target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts
> @@ -0,0 +1,21 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/;
> +
> +#include 

in DTSI.

> +
> +#include "qca9563_tplink_eap2x5_1port.dtsi"
> +
> +/ {
> + compatible = "tplink,eap225od-v1", "qca,qca9563";

No abbreviations, please. Replace by tplink,eap225-outdoor-v1 (everywhere).

> + model = "TP-Link EAP225-Outdoor v1";
> +};
> +
> +_status_green {
> + status = "okay";
> + gpios = < 7 GPIO_ACTIVE_LOW>;
> +};
> +
> +_status_amber {
> + status = "okay";
> + gpios = < 9 GPIO_ACTIVE_LOW>;
> +};
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> index d19f885e27..9bcee6da0e 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -38,6 +38,7 @@ ath79_setup_interfaces()
>   pisen,wmb001n|\
>   pisen,wmm003n|\
>   siemens,ws-ap3610|\
> + tplink,eap225od-v1|\
>   tplink,eap245-v1|\
>   tplink,cpe210-v2|\
>   tplink,cpe210-v3|\
> diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-
> ath10k-caldata b/target/linux/ath79/generic/base-
> files/etc/hotplug.d/firmware/11-ath10k-caldata
> index d722f2dcaf..b964c302d5 100644
> --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-
> ath10k-caldata
> +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-at
> +++ h10k-caldata
> @@ -194,6 +194,12 @@ case "$FIRMWARE" in
>   ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
>   /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
>   ;;
> + tplink,eap225od-v1)
> + caldata_extract "art" 0x5000 0x2f20
> + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary
> info 0x8) +1)
> + ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
> + /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
> + ;;
>   tplink,eap245-v3)
>   caldata_extract "art" 0x5000 0x2f20
>   ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary
> info 0x8) +1) diff --git a/target/linux/ath79/image/generic-tp-link.mk
> b/target/linux/ath79/image/generic-tp-link.mk
> index a4a14ed889..9ac24908fe 100644
> --- a/target/linux/ath79/image/generic-tp-link.mk
> +++ b/target/linux/ath79/image/generic-tp-link.mk
> @@ -372,6 +372,16 @@ define Device/tplink_eap2x5_1port
>IMAGE/factory.bin := append-rootfs | tplink-safeloader factory | pad-extra
> 128  endef
> 
> +define Device/tplink_eap225od-v1
> +  $(Device/tplink_eap2x5_1port)
> +  DEVICE_MODEL := EAP225-Outdoor
> +  DEVICE_VARIANT := v1
> +  TPLINK_BOARD_ID := EAP225OD-V1
> +  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct 

RE: [RFC PATCH 5/7] ath79: support for TP-Link EAP245 v1

2020-07-17 Thread mail
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Sander Vanheule
> Sent: Freitag, 17. Juli 2020 13:38
> To: openwrt-devel@lists.openwrt.org
> Cc: Sander Vanheule ; m...@bibbl.com;
> julien.dus...@free.fr; j...@phrozen.org; ra...@milecki.pl; yn...@true.cz;
> m...@david-bauer.net
> Subject: [RFC PATCH 5/7] ath79: support for TP-Link EAP245 v1
> 
> TP-Link EAP245 v1 is an AC1750 (802.11ac Wave-1) ceiling mount access point.
> 
> Device specifications:
> * SoC: QCA9563 @ 775MHz
> * RAM: 128MiB DDR2
> * Flash: 16MiB SPI-NOR
> * Wireless 2.4GHz (SoC): b/g/n, 3x3
> * Wireless 5Ghz (QCA9880): a/n/ac, 3x3
> * Ethernet (AR8033): 1× 1GbE, 803.2at PoE
> 
> Flashing instructions:
> * Extract /usr/bin/uclited from the device via ssh and apply the binary
>   patch listed below. The patch is required to prevent `uclited -u` in
>   the last step from crashing.
> * Exploit the user management page in the web interface to start telnetd
>   by changing the username to `;/usr/sbin/telnetd -l/bin/sh&`.
> * Immediately change the malformed username back to something valid
>   (e.g. 'admin') to make ssh work again.
> * Use the root shell via telnet to make /tmp world writeable (chmod 777)
> * Copy the patched uclited programme back to the device at /tmp/uclited
>   (via ssh)
> * Upload the factory image to /tmp/upgrade.bin (via ssh)
> * Run `chmod +x /tmp/uclited && /tmp/uclited -u` to flash OpenWrt.
> 
> --- xxd uclited
> +++ xxd uclited-patched
> @@ -53796,7 +53796,7 @@
>  000d2240: 8c44  0320 f809   8fbc 0010  .D... ..
>  000d2250: 8fa6 0a4c 02c0 2821 8f82 87b8    ...L..(!
> -000d2260: 8c44  0c13 45e0 27a7 0018 8fbc 0010  .DE.'...
> +000d2260: 8c44  2402    8fbc 0010  .D..$...
>  000d2270: 1040 001d  1821 8f99 8374 3c04 0058  .@.!...t<..X
>  000d2280: 3c05 0056 2484 a898 24a5 9a30 0320 f809  <..V$...$..0. ..
> 
> Debricking:
> * Serial port can be soldered on PCB J3 (1: TXD, 2: RXD, 3: GND, 4: VCC)
> * Bridge unpopulated resistors R225 (TXD) and R237 (RXD).
>   Do NOT bridge R230.
> * Use 3.3V, 115200 baud, 8n1
> * Interrupt bootloader with by holding CTRL+B during boot
> * tftp initramfs to flash via Luci web-interface
> 
> Tested on the EAP245v1 running the latest firmware (v1.4.0). The binary
> patch might not apply to uclited from other firmware versions.
> 
> Signed-off-by: Sander Vanheule 
> ---
>  .../ath79/dts/qca9563_tplink_eap245-v1.dts| 26 +
>  .../generic/base-files/etc/board.d/02_network |  1 +
> .../etc/hotplug.d/firmware/11-ath10k-caldata  |  3 +-
>  target/linux/ath79/image/generic-tp-link.mk   |  9 ++
>  tools/firmware-utils/src/tplink-safeloader.c  | 28 +++
>  5 files changed, 66 insertions(+), 1 deletion(-)  create mode 100644
> target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
> 
> diff --git a/target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
> b/target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
> new file mode 100644
> index 00..8a11d2e469
> --- /dev/null
> +++ b/target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
> @@ -0,0 +1,26 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/;
> +
> +#include 

This line is already in the DTSI.

> +
> +#include "qca9563_tplink_eap2x5_1port.dtsi"
> +
> +/ {
> + compatible = "tplink,eap245-v1", "qca,qca9563";
> + model = "TP-Link EAP245 v1";
> +};
> +
> +_status_green {
> + status = "okay";
> + gpios = < 7 GPIO_ACTIVE_HIGH>;
> +};
> +
> +_status_amber {
> + status = "okay";
> + gpios = < 9 GPIO_ACTIVE_HIGH>;
> +};
> +
> +_status_red {
> + status = "okay";
> + gpios = < 1 GPIO_ACTIVE_HIGH>;
> +};

Use the whole LED block in the root node here, see my comment on the DTSI ...

> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> index 7524806d72..d19f885e27 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -38,6 +38,7 @@ ath79_setup_interfaces()
>   pisen,wmb001n|\
>   pisen,wmm003n|\
>   siemens,ws-ap3610|\
> + tplink,eap245-v1|\
>   tplink,cpe210-v2|\
>   tplink,cpe210-v3|\
>   tplink,cpe510-v2|\
> diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-
> ath10k-caldata b/target/linux/ath79/generic/base-
> files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 2926796d65..d722f2dcaf 100644
> --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-
> ath10k-caldata
> +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-at
> +++ h10k-caldata
> @@ -63,7 +63,8 @@ case "$FIRMWARE" in
>   caldata_extract "art" 0x5000 0x844
>   ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-
> boot-env 

RE: [RFC PATCH 4/7] ath79: prepare for 1-port TP-Link EAP2x5 devices

2020-07-17 Thread mail
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Sander Vanheule
> Sent: Freitag, 17. Juli 2020 13:38
> To: openwrt-devel@lists.openwrt.org
> Cc: Sander Vanheule ; m...@bibbl.com;
> julien.dus...@free.fr; j...@phrozen.org; ra...@milecki.pl; yn...@true.cz;
> m...@david-bauer.net
> Subject: [RFC PATCH 4/7] ath79: prepare for 1-port TP-Link EAP2x5 devices
> 
> TP-Link has developed a number of access points based on the AP152
> reference board. In the EAP-series of 802.11ac access points, this includes
> the following devices with one ethernet port:
> * EAP225 v1/v2
> * EAP225 v3
> * EAP225-Outdoor v1
> * EAP245 v1
> 
> Since the only differences between these devices are the ath10k wireless
> radios and LEDs, a common base is provided for the overlapping support
> requirements.
> 
> Hardware commonalities:
> * SoC: QCA9563-AL3A MIPS 74kc v5.0 @ 775MHz
> * RAM: 128MiB DDR2 @ 650MHz
> * Flash: 16MiB SPI NOR
> * Wi-Fi 2.4GHz: provided by SoC
> * Wi-Fi 5Ghz: ath10k chip on PCIe
> * Ethernet: AR8033-AL1A, one 1GbE port (802.3at PoE)
> 
> This patch was originally developed by Julien Dusser for the EAP245 v1, and
> was adapted by Sander Vanheule to support more devices.
> 
> Signed-off-by: Julien Dusser 
> Signed-off-by: Sander Vanheule 
> ---
>  .../dts/qca9563_tplink_eap2x5_1port.dtsi  | 174 ++
>  target/linux/ath79/image/generic-tp-link.mk   |  10 +
>  2 files changed, 184 insertions(+)
>  create mode 100644
> target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
> 
> diff --git a/target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
> b/target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
> new file mode 100644
> index 00..1b55bb855c
> --- /dev/null
> +++ b/target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
> @@ -0,0 +1,174 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/;

dts-v1 should only be defined once, please remove it in the DTSI and keep it in 
the DTS (so we ensure we have it once and always at beginning of the DTS).

> +
> +#include 
> +#include 
> +
> +#include "qca956x.dtsi"
> +
> +/ {
> + aliases {
> + label-device-mac = 

label-mac-device?

> + led-boot = _status_green;
> + led-failsafe = _status_amber;
> + led-running = _status_green;
> + led-upgrade = _status_amber;
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> +
> + led_status_green: status_green {
> + status = "disabled";
> + label = "tp-link:green:status";
> + default-state = "on";
> + };
> +
> + led_status_amber: status_amber {
> + status = "disabled";
> + label = "tp-link:amber:status";
> + };
> +
> + led_status_red: status_red {
> + status = "disabled";
> + label = "tp-link:red:status";
> + };
> + };

Since what you add in the DTS files is not much less than what you have here, 
I'd prefer to just put the entire led node into the DTS file.
It will be much easier to read and you won't need that status lines at all.

> +
> + keys {
> + compatible = "gpio-keys";
> +
> + reset {
> + label = "Reset button";
> + linux,code = ;
> + gpios = < 2 GPIO_ACTIVE_LOW>;
> + debounce-interval = <60>;
> + };
> + };
> +};
> +
> + {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +};

This block can be dropped, gpio is not disabled in qca956x.dtsi

> +
> + {
> + status = "okay";
> + num-cs = <1>;
> +
> + flash@0 {
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + spi-max-frequency = <2500>;

Can this go faster?

Best

Adrian

> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition@0 {
> + label = "u-boot";
> + reg = <0x00 0x02>;
> + read-only;
> + };
> +
> + partition@2 {
> + label = "partition-table";
> + reg = <0x02 0x01>;
> + read-only;
> + };
> +
> + info: partition@3 {
> + label = "info";
> + reg = <0x03 0x01>;
> + read-only;
> + };
> +
> + partition@4 {
> + compatible = "openwrt,elf";
> +  

[no subject]

2020-07-17 Thread Владислав Карпов via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
АУДИОКНИГИ "МОДЕЛЬ ДЛЯ СБОРКИ"
Самая полная и качественная коллекция !

Программа "Модель для сборки" появилась вскоре после открытия радио <Станция> - 
в конце 1995 года. <Станция> была в то время свежей волной в радио, выдав в 
эфир танцевальную клубную музыку всех стилей и направлений - от хауса до 
хардкора. Данная передача представляет собой сложную смесь, состоящую из 
музыки, которую играет DJ Incognito, и чтения различных фантастических (а 
иногда и не очень) произведений отечественных и зарубежных авторов, чем 
занимается Влад Копп. В принципе, идея этой передачи не первична по своей сути. 
Многие знают, что подобного рода радиопередачи в течение длительного времени 
выходили на частоте радиостанции "Маяк". Однако они были неинтересны, 
во-первых, абсолютно другой направленностью читаемых произведений, а во-вторых 
- и это главное - почти полным отсутствием какого бы то ни было музыкального 
сопровождения. В "Модели для сборки" же музыка в большой степени определяет то, 
например, как слушатель воспримет произведение, играемое под эту музыку, 
понравится оно ему, или нет, а значит - определяет и всю радиопередачу. Музыка 
несет большую эмоциональную нагрузку, к тому же авторы передачи стараются так 
сочетать музыку и текст, чтобы музыка являлась отражением каждого конкретного 
объема текста, несла ту же смысловую нагрузку. Что касается самой музыки, то 
она очень разнообразна. Она включает в себя такие музыкальные направления, как 
Ambient, Psychedelic Trance, Dub, Trip-Hop, Electronic и так далее... Наша 
коллекция послужит прекрасным подарком, не лишайте себя и своих близких 
удовольствия!

! Полный список аудиокниг находится в прикрепленном к письму файле !

Коллекция состоит из всех передач с первой до последней. Общий обьём коллекции 
= 57 гигабайт. Записи в формате MP3 с битрейтом 128-224 kbps (преобладает 
высокий битрейт). Общее количество авторов = 473. Общее количество рассказов 
~1200. Все рассказы поименованы. Записана на внешний USB накопитель (флешка). 
Проблем с воспроизведением не возникнет, можно слушать на компьютере, планшете, 
смартфоне, телевизоре и т.д. Запись на внешний USB накопитель имеет ряд 
преимуществ в сравнении с обычными DVD дисками, USB накопитель гораздо легче, 
занимает меньше места, обладает высокой надёжностью сохранности записей, а это 
значит, что наша коллекция будет радовать Вас много лет. Мы гарантируем 
отличное качество всех записей. На самом носителе создана продуманная 
структура, все записи разнесены по каталогам, имеются плейлисты, прописаны 
теги, а также полный список вошедших записей, поэтому проблем с поиском и 
навигацией не возникнет.

Стоимость коллекции на внешнем USB накопителе — 6500 (Шесть Тысяч Пятьсот) 
Рублей.
Продаются только вместе. Доставка включена в стоимость.

Доставка и оплата коллекции осуществляется только по России — почтой, 
наложенным платежом, никакой предоплаты не требуется, оплата только в момент 
получения на почте, доставка включена в стоимость. Сроки доставки зависят от 
расстояния и степени загрузки почты, но как правило это 7-14 суток с момента 
отправки. Напоминаем, что у нас нет курьерской доставки — только почтой, в том 
числе и по Москве.

Для оформления заказа просьба не забывать указывать:
 --- Ваш почтовый индекс (пишите правильный индекс — это ускорит доставку);
 --- Ваш город и точный адрес (название улицы, номер дома и номер квартиры);
 --- Ф.И.О. получателя и ОБЯЗАТЕЛЬНО номер контактного телефона (лучше сотовый);
Заказы\вопросы направляйте по адресу: mdsb...@cwhflash.ru

Мы очень ответственно относимся к качеству нашего товара, поэтому перед 
отправкой всё дополнительно проверяется, как следствие отправка бракованной 
продукции сведена к нулю. Товар упаковывается в специальный ударостойкий 
материал, что в значительной степени уменьшает риск повреждения при 
транспортировке. Если вдруг с полученным товаром возникнут проблемы, то все 
наши покупатели всегда могут рассчитывать на квалифицированную техническую 
поддержку. Мы никогда не отказываемся от гарантийных обязательств, в случае 
проблемы Вы можете рассчитывать на замену, почтовые расходы мы берём на себя.

По вашему желанию, данная коллекция может быть записана на DVD диски. Для 
записи используются надёжные DVD диски со специальным покрытием, которое 
повышает устойчивость диска к механическим повреждениям, таким как трещины и 
царапины, а это значит, что наша коллекция будет радовать Вас много лет. 
Коллекция упакована в пластиковые боксы (slim-dvd), имеет красивые и 
продуманные обложки, с обратной стороны которых указан список вошедших на 
каждый диск записей и другая полезная информация, поэтому проблем с поиском и 
навигацией не возникнет. Если хотите приобрести коллекцию, записанную 

Re: [PATCH] dropbear: make rsa-sha2-256 pubkeys usable again

2020-07-17 Thread Matt Johnston
Hi Petr,

I still can't reproduce this with OpenSSH_7.6p1 Ubuntu-4ubuntu0.3.

Are you using a rsa key on disk, or using a SSH agent? I wonder if the agent 
doesn't support rsa-sha2-256 signatures or something?
Dropbear is meant to be handling the difference between the key names and 
signature names - it's possible there are bugs, but I can't reproduce it yet.

Thanks,
Matt

> On Fri 17/7/2020, at 4:38 pm, Petr Štetiar  wrote:
> 
> Matt Johnston  [2020-07-16 21:24:43]:
> 
> Hi,
> 
>> I can't reproduce a problem authenticating to a Dropbear 2020.80 server with
>> rsa keys. I've tried with either dbclient 2019.78 (using ssh-rsa sha1
>> signatures) or dbclient 2020.80 (rsa-sha2-256 signatures). Could you give me
>> some steps to reproduce it?
> 
> just use any other SSH client which is implemented according to rfc8332, like
> OpenSSH as those would likely send the public keys with 'ssh-rsa' string:
> 
>   Since RSA keys are not dependent on the choice of hash function, the
>   new public key algorithms reuse the "ssh-rsa" public key format as
>   defined in [RFC4253]:
> 
>   string"ssh-rsa"
>   mpint e
>   mpint n
> 
>   All aspects of the "ssh-rsa" format are kept, including the encoded
>   string "ssh-rsa".  This allows existing RSA keys to be used with the
>   new public key algorithms, without requiring re-encoding or affecting
>   already trusted key fingerprints.
> 
> In other words, OpenSSH client sends the key with `ssh-rsa` string, but
> Dropbear checks for `rsa-sha2-256` and thus refusing the client.
> 
> Server:
> 
> $ dropbear -V
> Dropbear v2020.80
> 
> $ dropbear -F -s -v
> TRACE  (2907) 2.994471: buf_put_sign type 101 rsa-sha2-256
> TRACE  (2907) 3.008211: enter send_msg_ext_info
> TRACE  (2907) 3.008608: algolist add 20 
> 'rsa-sha2-256,ssh-rsa���@E�W7��'�_��U��q}�+*L#�
>   
>  +R�g���d$p��vqp���
>   
> ��,@��n):�TfIÂj��_'
> ...
> 
> TRACE  (2907) 3.999860: checkpubkey: opened authorized_keys OK
> TRACE  (2907) 4.001785: checkpubkey_line: line pos = 8 len = 724
> TRACE  (2907) 4.003487: checkpubkey: base64_decode success
> TRACE  (2907) 4.004858: leave checkpubkey: ret=0
> TRACE  (2907) 4.006211: enter buf_get_rsa_pub_key
> TRACE  (2907) 4.007392: leave buf_get_rsa_pub_key: success
> TRACE  (2907) 4.008283: enter buf_verify
> [2907] Jul 17 08:30:56 Exit before auth from <192.168.200.1:49142>: (user 
> 'root', 0 fails): Non-matching signing type
> 
>   ^--- here it fails in buf_verify as expected
>sigtype=DROPBEAR_SIGNATURE_RSA_SHA256, but actual sigtype is 
> DROPBEAR_SIGNATURE_RSA_SHA1
> 
> TRACE  (2907) 4.010526: enter session_cleanup
> 
> Client:
> 
> $ ssh -v root@192.168.200.77
> OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
> ...
> debug1: kex: host key algorithm: rsa-sha2-256
> ...
> debug1: kex_input_ext_info: server-sig-algs=
> debug1: SSH2_MSG_SERVICE_ACCEPT received
> debug1: Authentications that can continue: publickey
> debug1: Next authentication method: publickey
> debug1: Offering public key: RSA 
> SHA256:ZLONs7adjPBljemwKAX5dXDiKPDVh4fsStkqi2eJsiI cardno:000610530066
> debug1: Server accepts key: pkalg rsa-sha2-256 blen 535
> Connection closed by 192.168.200.77 port 22
> 
> -- ynezz


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 1/7] ath79: add lots of missing regs for QCA956x

2020-07-17 Thread Sander Vanheule
This patch adds many registers and values for QCA956x GMAC interface.

QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG, QCA956X_PLL_ETH_XMII_CONTROL_REG
and QCA956X_ETH_CFG_RGMII_EN names are fixed to match original names.

Values are taken from U-Boot 1.1.4 of CAF.

Signed-off-by: Julien Dusser 
Signed-off-by: Sander Vanheule 
---
 .../920-qca956x-add-more-registers.patch  | 186 ++
 .../920-qca956x-add-more-registers.patch  | 186 ++
 2 files changed, 372 insertions(+)
 create mode 100644 
target/linux/ath79/patches-4.19/920-qca956x-add-more-registers.patch
 create mode 100644 
target/linux/ath79/patches-5.4/920-qca956x-add-more-registers.patch

diff --git 
a/target/linux/ath79/patches-4.19/920-qca956x-add-more-registers.patch 
b/target/linux/ath79/patches-4.19/920-qca956x-add-more-registers.patch
new file mode 100644
index 00..961bfe05ba
--- /dev/null
+++ b/target/linux/ath79/patches-4.19/920-qca956x-add-more-registers.patch
@@ -0,0 +1,186 @@
+MIPS: ath79: add lots of missing registers for QCA956x SoCs
+
+This patch adds many registers and values for QCA956x GMAC interface.
+
+QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG, QCA956X_PLL_ETH_XMII_CONTROL_REG
+and QCA956X_ETH_CFG_RGMII_EN names are fixed to match original names.
+
+Values are taken from U-Boot 1.1.4 of CAF.
+
+Signed-off-by: Julien Dusser 
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -438,8 +438,18 @@
+ #define QCA956X_PLL_DDR_CONFIG_REG0x08
+ #define QCA956X_PLL_DDR_CONFIG1_REG   0x0c
+ #define QCA956X_PLL_CLK_CTRL_REG  0x10
+-#define QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG  0x28
+-#define QCA956X_PLL_ETH_XMII_CONTROL_REG  0x30
++#define QCA956X_PLL_PCIE_PLL_CONFIG_REG   0x14
++#define QCA956X_PLL_PCIE_PLL_DITHER_DIV_MAX_REG   0x18
++#define QCA956X_PLL_PCIE_PLL_DITHER_DIV_MIN_REG   0x1c
++#define QCA956X_PLL_SWITCH_CLOCK_SPARE_REG0x28
++#define QCA956X_PLL_CURRENT_PCIE_PLL_DITHER_REG   0x2c
++#define QCA956X_PLL_ETH_XMII_REG  0x30
++#define QCA956X_PLL_BB_PLL_CONFIG_REG 0x34
++#define QCA956X_PLL_DDR_PLL_DITHER1_REG   0x38
++#define QCA956X_PLL_DDR_PLL_DITHER2_REG   0x3c
++#define QCA956X_PLL_CPU_PLL_DITHER1_REG   0x40
++#define QCA956X_PLL_CPU_PLL_DITHER2_REG   0x44
++#define QCA956X_PLL_ETH_SGMII_REG 0x48
+ #define QCA956X_PLL_ETH_SGMII_SERDES_REG  0x4c
+ 
+ #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT   12
+@@ -1333,24 +1343,39 @@
+  * QCA956X GMAC Interface
+  */
+ 
+-#define QCA956X_GMAC_REG_ETH_CFG  0x00
+-#define QCA956X_GMAC_REG_SGMII_RESET  0x14
+-#define QCA956X_GMAC_REG_SGMII_SERDES 0x18
+-#define QCA956X_GMAC_REG_MR_AN_CONTROL0x1c
+-#define QCA956X_GMAC_REG_SGMII_CONFIG 0x34
+-#define QCA956X_GMAC_REG_SGMII_DEBUG  0x58
+-
+-#define QCA956X_ETH_CFG_RGMII_EN  BIT(0)
++#define QCA956X_GMAC_REG_ETH_CFG  0x00
++#define QCA956X_GMAC_REG_SGMII_RESET  0x14
++#define QCA956X_GMAC_REG_SGMII_SERDES 0x18
++#define QCA956X_GMAC_REG_MR_AN_CONTROL0x1c
++#define QCA956X_GMAC_REG_SGMII_CONFIG 0x34
++#define QCA956X_GMAC_REG_SGMII_MAC_RX_CONFIG  0x38
++#define QCA956X_GMAC_REG_ETH_SGMII0x48
++#define QCA956X_GMAC_REG_SGMII_DEBUG  0x58
++#define QCA956X_GMAC_REG_SGMII_INTERRUPT  0x5c
++#define QCA956X_GMAC_REG_SGMII_INTERRUPT_MASK 0x60
++
++#define QCA956X_ETH_CFG_RGMII_GE0 BIT(0)
++#define QCA956X_ETH_CFG_MII_GE0   BIT(1)
++#define QCA956X_ETH_CFG_GMII_GE0  BIT(2)
++#define QCA956X_ETH_CFG_MII_GE0_MASTERBIT(3)
++#define QCA956X_ETH_CFG_MII_GE0_SLAVE BIT(4)
++#define QCA956X_ETH_CFG_GE0_ERR   BIT(5)
+ #define QCA956X_ETH_CFG_GE0_SGMII BIT(6)
+ #define QCA956X_ETH_CFG_SW_ONLY_MODE  BIT(7)
+ #define QCA956X_ETH_CFG_SW_PHY_SWAP   BIT(8)
+ #define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP  BIT(9)
+ #define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10)
++#define QCA956X_ETH_CFG_MII_CNTL_SPEEDBIT(11)
++#define QCA956X_ETH_CFG_RMII_GE0_MASTER   BIT(12)
+ #define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST  BIT(13)
+ #define QCA956X_ETH_CFG_RXD_DELAY_MASK0x3
+ #define QCA956X_ETH_CFG_RXD_DELAY_SHIFT   14
+ #define QCA956X_ETH_CFG_RDV_DELAY_MASK0x3
+ #define QCA956X_ETH_CFG_RDV_DELAY_SHIFT   16
++#define QCA956X_ETH_CFG_TXD_DELAY_MASK0x3
++#define QCA956X_ETH_CFG_TXD_DELAY_SHIFT   18
++#define QCA956X_ETH_CFG_TXE_DELAY_MASK0x3
++#define QCA956X_ETH_CFG_TXE_DELAY_SHIFT   20
+ 
+ #define QCA956X_SGMII_RESET_RX_CLK_N_RESET0x0
+ 

[RFC PATCH 4/7] ath79: prepare for 1-port TP-Link EAP2x5 devices

2020-07-17 Thread Sander Vanheule
TP-Link has developed a number of access points based on the AP152
reference board. In the EAP-series of 802.11ac access points, this
includes the following devices with one ethernet port:
* EAP225 v1/v2
* EAP225 v3
* EAP225-Outdoor v1
* EAP245 v1

Since the only differences between these devices are the ath10k wireless
radios and LEDs, a common base is provided for the overlapping support
requirements.

Hardware commonalities:
* SoC: QCA9563-AL3A MIPS 74kc v5.0 @ 775MHz
* RAM: 128MiB DDR2 @ 650MHz
* Flash: 16MiB SPI NOR
* Wi-Fi 2.4GHz: provided by SoC
* Wi-Fi 5Ghz: ath10k chip on PCIe
* Ethernet: AR8033-AL1A, one 1GbE port (802.3at PoE)

This patch was originally developed by Julien Dusser for the EAP245 v1,
and was adapted by Sander Vanheule to support more devices.

Signed-off-by: Julien Dusser 
Signed-off-by: Sander Vanheule 
---
 .../dts/qca9563_tplink_eap2x5_1port.dtsi  | 174 ++
 target/linux/ath79/image/generic-tp-link.mk   |  10 +
 2 files changed, 184 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi

diff --git a/target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi 
b/target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
new file mode 100644
index 00..1b55bb855c
--- /dev/null
+++ b/target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
@@ -0,0 +1,174 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+#include 
+
+#include "qca956x.dtsi"
+
+/ {
+   aliases {
+   label-device-mac = 
+   led-boot = _status_green;
+   led-failsafe = _status_amber;
+   led-running = _status_green;
+   led-upgrade = _status_amber;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_status_green: status_green {
+   status = "disabled";
+   label = "tp-link:green:status";
+   default-state = "on";
+   };
+
+   led_status_amber: status_amber {
+   status = "disabled";
+   label = "tp-link:amber:status";
+   };
+
+   led_status_red: status_red {
+   status = "disabled";
+   label = "tp-link:red:status";
+   };
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   reset {
+   label = "Reset button";
+   linux,code = ;
+   gpios = < 2 GPIO_ACTIVE_LOW>;
+   debounce-interval = <60>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+   num-cs = <1>;
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <2500>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x00 0x02>;
+   read-only;
+   };
+
+   partition@2 {
+   label = "partition-table";
+   reg = <0x02 0x01>;
+   read-only;
+   };
+
+   info: partition@3 {
+   label = "info";
+   reg = <0x03 0x01>;
+   read-only;
+   };
+
+   partition@4 {
+   compatible = "openwrt,elf";
+   label = "firmware";
+   reg = <0x04 0xec>;
+   };
+
+   partition@f0 {
+   label = "config";
+   reg = <0xf0 0x03>;
+   read-only;
+   };
+
+   partition@f3 {
+   label = "mutil-log";
+   reg = <0xf3 0x08>;
+   read-only;
+   };
+
+   partition@fb {
+   label = "oops";
+   reg = <0xfb 0x04>;
+   read-only;
+   };
+
+   art: partition@ff {
+   label = "art";
+   reg = <0xff 0x01>;
+   read-only;
+   };
+   };
+   };
+};
+
+ {
+   

[RFC PATCH 0/7] ath79: support for TP-Link EAP2x5 devices

2020-07-17 Thread Sander Vanheule
This patch series seeks to add support for the following devices:
 * TP-Link EAP245 v1
 * TP-Link EAP225 v3
 * TP-Link EAP225-Outdoor v1
Currently not included:
 * TP-Link EAP225 v1/v2

Note that the patches cannot be applied straight to master, but require
(at least) the first four patches (elf splitter and tplink safeloader)
of my pull request for the EAP245v3. (CC ynezz, rmilecki)
For these patches, see https://github.com/openwrt/openwrt/pull/3130 and
https://patchwork.ozlabs.org/project/openwrt/patch/c429526040b8753011fc905af8d32747c8da6d1b.1594471105.git.san...@svanheule.net/

The three first patches of this series are (derived from) work done by
Julien Dusser and were submitted earlier in the following pull requests
(reviewed by blogic, blocktrron, CodeFetch)
 * ar71xx: add support for TP-Link EAP245 v1
   https://github.com/openwrt/openwrt/pull/599
 * ath79: extra gmac configurations from DT on qca956x
   https://github.com/openwrt/openwrt/pull/2441

I have included Julien's patches verbatim for now (hence the RFC), but
can to strip them down to include only what's required for the last
four patches.

Questions:
 * I'm guessing you would like patches #1 and #2 to be submitted
   upstream to linux-mips?
 * The EAP245 v1 factory partition layout is different from, though
   compatible with, the layout provide in patch #4. The only difference
   this would make, is a slightly smaller firmware partition and perhaps
   the odd confused user downloading seeking to extract the original
   user-config partition. Using only one layout does simplify the DTs,
   which is why I went with the current approach.
 * I can probably provide working support for the EAP225 v1/v2, given
   the minimal differences between the devices. However, I do not have
   this device to test an image, nor has anyone offered to test on the
   forums. This device would have a similar flashing procedure as the
   EAP245 v1. Would you nevertheless want me to provide a patch?

Julien Dusser (3):
  ath79: add lots of missing regs for QCA956x
  ath79: export more QCA956x GMAC settings to DT
  ath79: add QCA956x SERDES init workaround

Sander Vanheule (4):
  ath79: prepare for 1-port TP-Link EAP2x5 devices
  ath79: support for TP-Link EAP245 v1
  ath79: support for TP-Link EAP225-Outdoor v1
  ath79: support for TP-Link EAP225 v3

 .../ath79/dts/qca9563_tplink_eap225-v3.dts|  21 ++
 .../ath79/dts/qca9563_tplink_eap225od-v1.dts  |  21 ++
 .../ath79/dts/qca9563_tplink_eap245-v1.dts|  26 +++
 .../dts/qca9563_tplink_eap2x5_1port.dtsi  | 174 
 .../net/ethernet/atheros/ag71xx/ag71xx_gmac.c |  14 ++
 .../net/ethernet/atheros/ag71xx/ag71xx_main.c |  78 
 .../generic/base-files/etc/board.d/02_network |   3 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |  10 +-
 target/linux/ath79/image/generic-tp-link.mk   |  38 
 .../920-qca956x-add-more-registers.patch  | 186 ++
 .../920-qca956x-add-more-registers.patch  | 186 ++
 tools/firmware-utils/src/tplink-safeloader.c  |  85 
 12 files changed, 841 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap225-v3.dts
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap2x5_1port.dtsi
 create mode 100644 
target/linux/ath79/patches-4.19/920-qca956x-add-more-registers.patch
 create mode 100644 
target/linux/ath79/patches-5.4/920-qca956x-add-more-registers.patch

-- 
2.26.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 6/7] ath79: support for TP-Link EAP225-Outdoor v1

2020-07-17 Thread Sander Vanheule
TP-Link EAP225-Outdoor v1 is an AC1200 (802.11ac Wave-2) pole or wall
mount access point.

Device specifications:
* SoC: QCA9563 @ 775MHz
* Memory: 128MiB DDR2
* Flash: 16MiB SPI-NOR
* Wireless 2.4GHz (SoC): b/g/n 2x2
* Wireless 5GHz (QCA9886): a/n/ac 2x2 MU-MIMO
* Ethernet (AR8033): 1× 1GbE, PoE

Flashing instructions:
* ssh into target device with recent (>= v1.6.0) firmware
* run `cliclientd stopcs` on target device
* upload factory image via web interface

MAC addresses:
MAC address (as on device label) is stored in device info partition at
an offset of 8 bytes. ath9k device has same address as ethernet, ath10k
uses address incremented by 1.
From stock ifconfig:

ath0  Link encap:Ethernet  HWaddr D8:...:2E
ath10 Link encap:Ethernet  HWaddr D8:...:2F
br0   Link encap:Ethernet  HWaddr D8:...:2E
eth0  Link encap:Ethernet  HWaddr D8:...:2E

Tested by forum user PolynomialDivision on firmware v1.7.0.

Signed-off-by: Sander Vanheule 
---
 .../ath79/dts/qca9563_tplink_eap225od-v1.dts  | 21 ++
 .../generic/base-files/etc/board.d/02_network |  1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |  6 
 target/linux/ath79/image/generic-tp-link.mk   | 10 +++
 tools/firmware-utils/src/tplink-safeloader.c  | 29 +++
 5 files changed, 67 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts

diff --git a/target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts 
b/target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts
new file mode 100644
index 00..dcfdb7e524
--- /dev/null
+++ b/target/linux/ath79/dts/qca9563_tplink_eap225od-v1.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+
+#include "qca9563_tplink_eap2x5_1port.dtsi"
+
+/ {
+   compatible = "tplink,eap225od-v1", "qca,qca9563";
+   model = "TP-Link EAP225-Outdoor v1";
+};
+
+_status_green {
+   status = "okay";
+   gpios = < 7 GPIO_ACTIVE_LOW>;
+};
+
+_status_amber {
+   status = "okay";
+   gpios = < 9 GPIO_ACTIVE_LOW>;
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network 
b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index d19f885e27..9bcee6da0e 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -38,6 +38,7 @@ ath79_setup_interfaces()
pisen,wmb001n|\
pisen,wmm003n|\
siemens,ws-ap3610|\
+   tplink,eap225od-v1|\
tplink,eap245-v1|\
tplink,cpe210-v2|\
tplink,cpe210-v3|\
diff --git 
a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
 
b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index d722f2dcaf..b964c302d5 100644
--- 
a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ 
b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -194,6 +194,12 @@ case "$FIRMWARE" in
ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
+   tplink,eap225od-v1)
+   caldata_extract "art" 0x5000 0x2f20
+   ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 
+1)
+   ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
+   /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
+   ;;
tplink,eap245-v3)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 
+1)
diff --git a/target/linux/ath79/image/generic-tp-link.mk 
b/target/linux/ath79/image/generic-tp-link.mk
index a4a14ed889..9ac24908fe 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -372,6 +372,16 @@ define Device/tplink_eap2x5_1port
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory | pad-extra 
128
 endef
 
+define Device/tplink_eap225od-v1
+  $(Device/tplink_eap2x5_1port)
+  DEVICE_MODEL := EAP225-Outdoor
+  DEVICE_VARIANT := v1
+  TPLINK_BOARD_ID := EAP225OD-V1
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
+endef
+TARGET_DEVICES += tplink_eap225od-v1
+
 define Device/tplink_eap245-v1
   $(Device/tplink_eap2x5_1port)
   DEVICE_MODEL := EAP245
diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
b/tools/firmware-utils/src/tplink-safeloader.c
index a20304150b..e38729eb8a 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -1291,6 +1291,35 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
 
+   /** Firmware layout for the EAP225-Outdoor v1 */
+   {
+   .id = "EAP225OD-V1",
+   .support_list =
+   

[RFC PATCH 2/7] ath79: export more QCA956x GMAC settings to DT

2020-07-17 Thread Sander Vanheule
Allow configuration of rgmii-ge0, mii-ge0, gmii-ge0, mii-ge0-master,
mii-ge0-slave, ge0-sgmii, txen-delay, txd-delay, rxdv-delay and
rxd-delay in device-tree for qca956x SoCs.

Signed-off-by: Julien Dusser 
Signed-off-by: Sander Vanheule 
---
 .../net/ethernet/atheros/ag71xx/ag71xx_gmac.c  | 14 ++
 1 file changed, 14 insertions(+)

diff --git 
a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c 
b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c
index cc0a15d3a4..57b8bf2eec 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c
@@ -88,9 +88,23 @@ static void ag71xx_setup_gmac_956x(struct device_node *np, 
void __iomem *base)
 {
u32 val = __raw_readl(base + QCA956X_GMAC_REG_ETH_CFG);
 
+   ag71xx_of_bit(np, "rgmii-ge0", , QCA956X_ETH_CFG_RGMII_GE0);
+   ag71xx_of_bit(np, "mii-ge0", , QCA956X_ETH_CFG_MII_GE0);
+   ag71xx_of_bit(np, "gmii-ge0", , QCA956X_ETH_CFG_GMII_GE0);
+   ag71xx_of_bit(np, "mii-ge0-master", , 
QCA956X_ETH_CFG_MII_GE0_MASTER);
+   ag71xx_of_bit(np, "mii-ge0-slave", , QCA956X_ETH_CFG_MII_GE0_SLAVE);
+   ag71xx_of_bit(np, "ge0-sgmii", , QCA956X_ETH_CFG_GE0_SGMII);
ag71xx_of_bit(np, "switch-phy-swap", , QCA956X_ETH_CFG_SW_PHY_SWAP);
ag71xx_of_bit(np, "switch-phy-addr-swap", ,
QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+   ag71xx_of_set(np, "txen-delay", , QCA956X_ETH_CFG_TXE_DELAY_SHIFT,
+ QCA956X_ETH_CFG_TXE_DELAY_MASK);
+   ag71xx_of_set(np, "txd-delay", , QCA956X_ETH_CFG_TXD_DELAY_SHIFT,
+ QCA956X_ETH_CFG_TXD_DELAY_MASK);
+   ag71xx_of_set(np, "rxdv-delay", , QCA956X_ETH_CFG_RDV_DELAY_SHIFT,
+ QCA956X_ETH_CFG_RDV_DELAY_MASK);
+   ag71xx_of_set(np, "rxd-delay", , QCA956X_ETH_CFG_RXD_DELAY_SHIFT,
+ QCA956X_ETH_CFG_RXD_DELAY_MASK);
 
__raw_writel(val, base + QCA956X_GMAC_REG_ETH_CFG);
 }
-- 
2.26.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 7/7] ath79: support for TP-Link EAP225 v3

2020-07-17 Thread Sander Vanheule
TP-Link EAP225 v3 is an AC1350 (802.11ac Wave-2) ceiling mount access
point.

Device specifications:
* SoC: QCA9563 @ 775MHz
* RAM: 128MiB DDR2
* Flash: 16MiB SPI-NOR
* Wireless 2.4GHz (SoC): b/g/n, 3x3
* Wireless 5Ghz (QCA9886): a/n/ac, 2x2 MU-MINO
* Ethernet (AR8033): 1× 1GbE, 803.2at PoE

Flashing instructions:
* ssh into target device and run `cliclientd stopcs`
* Upgrade with factory image via web interface

Debricking:
* Serial port can be soldered on PCB J3 (1: TXD, 2: RXD, 3: GND, 4: VCC)
* Bridge unpopulated resistors R225 (TXD) and R237 (RXD).
  Do NOT bridge R230.
* Use 3.3V, 115200 baud, 8n1
* Interrupt bootloader with by holding CTRL+B during boot
* tftp initramfs to flash via Luci web-interface

MAC addresses:
MAC address (as on device label) is stored in device info partition at
an offset of 8 bytes. ath9k device has same address as ethernet, ath10k
uses address incremented by 1.
From OEM boot log:

Using interface ath0 with hwaddr b0:...:3e and ssid "..."
Using interface ath10 with hwaddr b0:...:3f and ssid "..."

Tested by forum user blinkstar88

Signed-off-by: Sander Vanheule 
---
 .../ath79/dts/qca9563_tplink_eap225-v3.dts| 21 ++
 .../generic/base-files/etc/board.d/02_network |  1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |  1 +
 target/linux/ath79/image/generic-tp-link.mk   |  9 ++
 tools/firmware-utils/src/tplink-safeloader.c  | 28 +++
 5 files changed, 60 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap225-v3.dts

diff --git a/target/linux/ath79/dts/qca9563_tplink_eap225-v3.dts 
b/target/linux/ath79/dts/qca9563_tplink_eap225-v3.dts
new file mode 100644
index 00..391494b8dc
--- /dev/null
+++ b/target/linux/ath79/dts/qca9563_tplink_eap225-v3.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+
+#include "qca9563_tplink_eap2x5_1port.dtsi"
+
+/ {
+   compatible = "tplink,eap225-v3", "qca,qca9563";
+   model = "TP-Link EAP225 v3";
+};
+
+_status_green {
+   status = "okay";
+   gpios = < 7 GPIO_ACTIVE_HIGH>;
+};
+
+_status_amber {
+   status = "okay";
+   gpios = < 9 GPIO_ACTIVE_HIGH>;
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network 
b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 9bcee6da0e..2b11c00abb 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -38,6 +38,7 @@ ath79_setup_interfaces()
pisen,wmb001n|\
pisen,wmm003n|\
siemens,ws-ap3610|\
+   tplink,eap225-v3|\
tplink,eap225od-v1|\
tplink,eap245-v1|\
tplink,cpe210-v2|\
diff --git 
a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
 
b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index b964c302d5..a3992d02b8 100644
--- 
a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ 
b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -194,6 +194,7 @@ case "$FIRMWARE" in
ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
+   tplink,eap225-v3|\
tplink,eap225od-v1)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 
+1)
diff --git a/target/linux/ath79/image/generic-tp-link.mk 
b/target/linux/ath79/image/generic-tp-link.mk
index 9ac24908fe..70d62f5287 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -372,6 +372,15 @@ define Device/tplink_eap2x5_1port
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory | pad-extra 
128
 endef
 
+define Device/tplink_eap225-v3
+  $(Device/tplink_eap2x5_1port)
+  DEVICE_MODEL := EAP225
+  DEVICE_VARIANT := v3
+  TPLINK_BOARD_ID := EAP225-V3
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
+endef
+TARGET_DEVICES += tplink_eap225-v3
+
 define Device/tplink_eap225od-v1
   $(Device/tplink_eap2x5_1port)
   DEVICE_MODEL := EAP225-Outdoor
diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
b/tools/firmware-utils/src/tplink-safeloader.c
index e38729eb8a..c4b9dd7865 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -1291,6 +1291,34 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
 
+   /** Firmware layout for the EAP225 v3 */
+   {
+   .id = "EAP225-V3",
+   .support_list =
+   "SupportList:\r\n"
+   "EAP225(TP-Link|UN|AC1350-D):3.0\r\n",
+   .soft_ver = NULL,
+   .soft_ver_compat_level = 1,
+
+   .partitions = {
+ 

[RFC PATCH 3/7] ath79: add QCA956x SERDES init workaround

2020-07-17 Thread Sander Vanheule
This commit add a workaround for non working SGMII link observed on some
QCA956x SoCs. The workaround originates part from the U-Boot source code
from QCA, part from the implementation from TP-Link found in the GPL
tarball for the EAP245v1.

Extends commit 0d416a8d3b990e3b78628f0e7546527709c877f7 for QCA956x.
Note that reset is the same on QCA955x and QCA956x, same register offset
and values.

Auto calibration is done on u-boot, but always fall back to default value
0x7. Add a DTS entry serdes-cal in case a device require another value.

Signed-off-by: Julien Dusser 
Signed-off-by: Sander Vanheule 
---
 .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 78 +++
 1 file changed, 78 insertions(+)

diff --git 
a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c 
b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index d611007a86..1a22dbfd4d 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -577,6 +577,79 @@ static void ag71xx_bit_clear(void __iomem *reg, u32 bit)
__raw_readl(reg);
 }
 
+/* Set SGMII VCO resistor value */
+static void ag71xx_serdes_cal_qca956x(struct device_node *np)
+{
+   struct device_node *np_dev;
+   void __iomem *gmac_base;
+   int err = 0;
+   u32 serdes_cal;
+   u32 t;
+
+   np = of_get_child_by_name(np, "gmac-config");
+   if (!np)
+   return;
+
+   if(of_property_read_u32(np, "serdes-cal", _cal))
+   /* By default, use middle value for resistor calibration */
+   serdes_cal = 0x7;
+
+   np_dev = of_parse_phandle(np, "device", 0);
+   if (!np_dev)
+   goto out;
+
+   gmac_base = of_iomap(np_dev, 0);
+   if (!gmac_base) {
+   pr_err("%pOF: can't map GMAC registers\n", np_dev);
+   err = -ENOMEM;
+   goto err_iomap;
+   }
+
+   pr_info("%pOF: fixup SERDES calibration to value %i\n", np_dev, 
serdes_cal);
+   t = __raw_readl(gmac_base + QCA956X_GMAC_REG_SGMII_SERDES);
+   t &= ~(QCA956X_SGMII_SERDES_RES_CALIBRATION_MASK
+   << QCA956X_SGMII_SERDES_RES_CALIBRATION_SHIFT);
+   t |= (serdes_cal & QCA956X_SGMII_SERDES_RES_CALIBRATION_MASK)
+   << QCA956X_SGMII_SERDES_RES_CALIBRATION_SHIFT;
+   __raw_writel(t, gmac_base + QCA956X_GMAC_REG_SGMII_SERDES);
+
+   ath79_pll_wr(QCA956X_PLL_ETH_SGMII_SERDES_REG,
+   QCA956X_PLL_ETH_SGMII_SERDES_LOCK_DETECT
+   | QCA956X_PLL_ETH_SGMII_SERDES_EN_PLL);
+
+   t = __raw_readl(gmac_base + QCA956X_GMAC_REG_SGMII_SERDES);
+
+   /* missing in QCA u-boot code, clear before setting */
+   t &= ~(QCA956X_SGMII_SERDES_CDR_BW_MASK
+   << QCA956X_SGMII_SERDES_CDR_BW_SHIFT |
+   QCA956X_SGMII_SERDES_TX_DR_CTRL_MASK
+   << 
QCA956X_SGMII_SERDES_TX_DR_CTRL_SHIFT |
+   QCA956X_SGMII_SERDES_VCO_REG_MASK
+   << QCA956X_SGMII_SERDES_VCO_REG_SHIFT);
+
+   t |= (3 << QCA956X_SGMII_SERDES_CDR_BW_SHIFT) |
+   (1 << QCA956X_SGMII_SERDES_TX_DR_CTRL_SHIFT) |
+   QCA956X_SGMII_SERDES_PLL_BW |
+   QCA956X_SGMII_SERDES_EN_SIGNAL_DETECT |
+   QCA956X_SGMII_SERDES_FIBER_SDO |
+   (3 << QCA956X_SGMII_SERDES_VCO_REG_SHIFT);
+
+   __raw_writel(t, gmac_base + QCA956X_GMAC_REG_SGMII_SERDES);
+
+   ath79_device_reset_clear(QCA956X_RESET_SGMII_ANALOG);
+   ath79_device_reset_clear(QCA956X_RESET_SGMII);
+
+   while (!(__raw_readl(gmac_base + QCA956X_GMAC_REG_SGMII_SERDES)
+   & QCA956X_SGMII_SERDES_LOCK_DETECT_STATUS))
+   ;
+
+   iounmap(gmac_base);
+err_iomap:
+   of_node_put(np_dev);
+out:
+   of_node_put(np);
+}
+
 static void ag71xx_sgmii_init_qca955x(struct device_node *np)
 {
struct device_node *np_dev;
@@ -1423,6 +1496,11 @@ static int ag71xx_probe(struct platform_device *pdev)
if (!res)
return -EINVAL;
 
+   if (of_property_read_bool(np, "qca956x-serdes-fixup")) {
+   ag71xx_serdes_cal_qca956x(np);
+   ag71xx_sgmii_init_qca955x(np);
+   }
+
err = ag71xx_setup_gmac(np);
if (err)
return err;
-- 
2.26.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 5/7] ath79: support for TP-Link EAP245 v1

2020-07-17 Thread Sander Vanheule
TP-Link EAP245 v1 is an AC1750 (802.11ac Wave-1) ceiling mount access point.

Device specifications:
* SoC: QCA9563 @ 775MHz
* RAM: 128MiB DDR2
* Flash: 16MiB SPI-NOR
* Wireless 2.4GHz (SoC): b/g/n, 3x3
* Wireless 5Ghz (QCA9880): a/n/ac, 3x3
* Ethernet (AR8033): 1× 1GbE, 803.2at PoE

Flashing instructions:
* Extract /usr/bin/uclited from the device via ssh and apply the binary
  patch listed below. The patch is required to prevent `uclited -u` in
  the last step from crashing.
* Exploit the user management page in the web interface to start telnetd
  by changing the username to `;/usr/sbin/telnetd -l/bin/sh&`.
* Immediately change the malformed username back to something valid
  (e.g. 'admin') to make ssh work again.
* Use the root shell via telnet to make /tmp world writeable (chmod 777)
* Copy the patched uclited programme back to the device at /tmp/uclited
  (via ssh)
* Upload the factory image to /tmp/upgrade.bin (via ssh)
* Run `chmod +x /tmp/uclited && /tmp/uclited -u` to flash OpenWrt.

--- xxd uclited
+++ xxd uclited-patched
@@ -53796,7 +53796,7 @@
 000d2240: 8c44  0320 f809   8fbc 0010  .D... ..
 000d2250: 8fa6 0a4c 02c0 2821 8f82 87b8    ...L..(!
-000d2260: 8c44  0c13 45e0 27a7 0018 8fbc 0010  .DE.'...
+000d2260: 8c44  2402    8fbc 0010  .D..$...
 000d2270: 1040 001d  1821 8f99 8374 3c04 0058  .@.!...t<..X
 000d2280: 3c05 0056 2484 a898 24a5 9a30 0320 f809  <..V$...$..0. ..

Debricking:
* Serial port can be soldered on PCB J3 (1: TXD, 2: RXD, 3: GND, 4: VCC)
* Bridge unpopulated resistors R225 (TXD) and R237 (RXD).
  Do NOT bridge R230.
* Use 3.3V, 115200 baud, 8n1
* Interrupt bootloader with by holding CTRL+B during boot
* tftp initramfs to flash via Luci web-interface

Tested on the EAP245v1 running the latest firmware (v1.4.0). The binary
patch might not apply to uclited from other firmware versions.

Signed-off-by: Sander Vanheule 
---
 .../ath79/dts/qca9563_tplink_eap245-v1.dts| 26 +
 .../generic/base-files/etc/board.d/02_network |  1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |  3 +-
 target/linux/ath79/image/generic-tp-link.mk   |  9 ++
 tools/firmware-utils/src/tplink-safeloader.c  | 28 +++
 5 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts

diff --git a/target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts 
b/target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
new file mode 100644
index 00..8a11d2e469
--- /dev/null
+++ b/target/linux/ath79/dts/qca9563_tplink_eap245-v1.dts
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+
+#include "qca9563_tplink_eap2x5_1port.dtsi"
+
+/ {
+   compatible = "tplink,eap245-v1", "qca,qca9563";
+   model = "TP-Link EAP245 v1";
+};
+
+_status_green {
+   status = "okay";
+   gpios = < 7 GPIO_ACTIVE_HIGH>;
+};
+
+_status_amber {
+   status = "okay";
+   gpios = < 9 GPIO_ACTIVE_HIGH>;
+};
+
+_status_red {
+   status = "okay";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network 
b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 7524806d72..d19f885e27 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -38,6 +38,7 @@ ath79_setup_interfaces()
pisen,wmb001n|\
pisen,wmm003n|\
siemens,ws-ap3610|\
+   tplink,eap245-v1|\
tplink,cpe210-v2|\
tplink,cpe210-v3|\
tplink,cpe510-v2|\
diff --git 
a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
 
b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 2926796d65..d722f2dcaf 100644
--- 
a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ 
b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -63,7 +63,8 @@ case "$FIRMWARE" in
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env 
ethaddr) +1)
;;
-   engenius,ews511ap)
+   engenius,ews511ap|\
+   tplink,eap245-v1)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth0/address) +1)
;;
diff --git a/target/linux/ath79/image/generic-tp-link.mk 
b/target/linux/ath79/image/generic-tp-link.mk
index d2cc8d09bd..a4a14ed889 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -372,6 +372,15 @@ define Device/tplink_eap2x5_1port
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory | pad-extra 
128
 endef
 
+define Device/tplink_eap245-v1
+  $(Device/tplink_eap2x5_1port)

Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Bjørn Mork
Rosen Penev  writes:
>> On Jul 17, 2020, at 3:06 AM, Felix Fietkau  wrote:

>>> +--- a/ui_common.h
>>>  b/ui_common.h
>>> +@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
>>> + 
>>> + extern options_t options;
>>> + 
>>> +-sorted_list_type screen_list;
>>> +-host_pair_line totals;
>>> +-int peaksent, peakrecv, peaktotal;
>>> ++static sorted_list_type screen_list;
>>> ++static host_pair_line totals;
>>> ++static int peaksent, peakrecv, peaktotal;
>>> + extern history_type history_totals;
>>> +-hash_type* screen_hash;
>>> +-hash_type* service_hash;
>>> ++static hash_type* screen_hash;
>>> ++static hash_type* service_hash;
>>
>> Declaring these variables as static in a header file seems wrong to me.
>> Shouldn't this be declared as a global variable in one of the .c files
>> and extern here?
>
> Sure. static creates a smaller patch though.

How does that help if the result is buggy?  I assume these variables are
declared in a header because their values are actually shared.


Bjørn

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Koen Vandeputte


On 17.07.20 11:56, Rosen Penev wrote:



On Jul 17, 2020, at 2:50 AM, Petr Štetiar  wrote:

Rosen Penev  [2020-07-13 22:43:51]:

Hi,


GCC 10 defaults to fno-common, which demains unique defenitions.

whats the exact error here? Wouldn't it make sense to move this into packages 
feed?

+1

No idea what this package is for or the reason for its presence here.


It's a ncurses based tool which shows how much bandwidth is going to a 
specific destination (shows the DNS name if there is one)


Pretty handy to check in realtime how much traffic is going to specific 
sites



What about upstream, looks like they might find this patch handy.

Seems relatively dead upstream. Last commit one year ago and second to last 
three years ago.

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


RE: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread mail
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Petr Štetiar
> Sent: Freitag, 17. Juli 2020 11:50
> To: Rosen Penev 
> Cc: openwrt-devel@lists.openwrt.org
> Subject: Re: [PATCH] iftop: fix compilation with GCC 10
> 
> Rosen Penev  [2020-07-13 22:43:51]:
> 
> Hi,
> 
> > GCC 10 defaults to fno-common, which demains unique defenitions.
> 
> whats the exact error here? Wouldn't it make sense to move this into
> packages feed?

I couldn't find any reference to/dependency on that package anywhere in main 
repo, and description there also describes it as something 
nice-to-have-when-you-need-it. Sounds like packages feed material to me.

Best

Adrian

> What about upstream, looks like they might find this patch handy.
> 
> -- ynezz
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Jo-Philipp Wich
Hi,

I've sent a fix using extern declarations upstream, lets see what happens.

~ Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Rosen Penev


> On Jul 17, 2020, at 3:06 AM, Felix Fietkau  wrote:
> 
> On 2020-07-14 07:43, Rosen Penev wrote:
>> GCC 10 defaults to fno-common, which demains unique defenitions.
>> 
>> Signed-off-by: Rosen Penev 
>> ---
>> package/network/utils/iftop/Makefile  |  2 +-
>> .../utils/iftop/patches/010-gcc10.patch   | 20 +++
>> 2 files changed, 21 insertions(+), 1 deletion(-)
>> create mode 100644 package/network/utils/iftop/patches/010-gcc10.patch
>> 
>> diff --git a/package/network/utils/iftop/Makefile 
>> b/package/network/utils/iftop/Makefile
>> index 98fe15c8f5..aa467c2876 100644
>> --- a/package/network/utils/iftop/Makefile
>> +++ b/package/network/utils/iftop/Makefile
>> @@ -8,7 +8,7 @@
>> include $(TOPDIR)/rules.mk
>> 
>> PKG_NAME:=iftop
>> -PKG_RELEASE:=1
>> +PKG_RELEASE:=2
>> 
>> PKG_SOURCE_PROTO:=git
>> PKG_SOURCE_URL:=https://code.blinkace.com/pdw/iftop.git
>> diff --git a/package/network/utils/iftop/patches/010-gcc10.patch 
>> b/package/network/utils/iftop/patches/010-gcc10.patch
>> new file mode 100644
>> index 00..882565a039
>> --- /dev/null
>> +++ b/package/network/utils/iftop/patches/010-gcc10.patch
>> @@ -0,0 +1,20 @@
>> +--- a/ui_common.h
>>  b/ui_common.h
>> +@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
>> + 
>> + extern options_t options;
>> + 
>> +-sorted_list_type screen_list;
>> +-host_pair_line totals;
>> +-int peaksent, peakrecv, peaktotal;
>> ++static sorted_list_type screen_list;
>> ++static host_pair_line totals;
>> ++static int peaksent, peakrecv, peaktotal;
>> + extern history_type history_totals;
>> +-hash_type* screen_hash;
>> +-hash_type* service_hash;
>> ++static hash_type* screen_hash;
>> ++static hash_type* service_hash;
> Declaring these variables as static in a header file seems wrong to me.
> Shouldn't this be declared as a global variable in one of the .c files
> and extern here?
Sure. static creates a smaller patch though.
> 
> - Felix

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Felix Fietkau
On 2020-07-14 07:43, Rosen Penev wrote:
> GCC 10 defaults to fno-common, which demains unique defenitions.
> 
> Signed-off-by: Rosen Penev 
> ---
>  package/network/utils/iftop/Makefile  |  2 +-
>  .../utils/iftop/patches/010-gcc10.patch   | 20 +++
>  2 files changed, 21 insertions(+), 1 deletion(-)
>  create mode 100644 package/network/utils/iftop/patches/010-gcc10.patch
> 
> diff --git a/package/network/utils/iftop/Makefile 
> b/package/network/utils/iftop/Makefile
> index 98fe15c8f5..aa467c2876 100644
> --- a/package/network/utils/iftop/Makefile
> +++ b/package/network/utils/iftop/Makefile
> @@ -8,7 +8,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=iftop
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>  
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_URL:=https://code.blinkace.com/pdw/iftop.git
> diff --git a/package/network/utils/iftop/patches/010-gcc10.patch 
> b/package/network/utils/iftop/patches/010-gcc10.patch
> new file mode 100644
> index 00..882565a039
> --- /dev/null
> +++ b/package/network/utils/iftop/patches/010-gcc10.patch
> @@ -0,0 +1,20 @@
> +--- a/ui_common.h
>  b/ui_common.h
> +@@ -33,12 +33,12 @@ typedef struct host_pair_line_tag {
> + 
> + extern options_t options;
> + 
> +-sorted_list_type screen_list;
> +-host_pair_line totals;
> +-int peaksent, peakrecv, peaktotal;
> ++static sorted_list_type screen_list;
> ++static host_pair_line totals;
> ++static int peaksent, peakrecv, peaktotal;
> + extern history_type history_totals;
> +-hash_type* screen_hash;
> +-hash_type* service_hash;
> ++static hash_type* screen_hash;
> ++static hash_type* service_hash;
Declaring these variables as static in a header file seems wrong to me.
Shouldn't this be declared as a global variable in one of the .c files
and extern here?

- Felix

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Rosen Penev


> On Jul 17, 2020, at 2:50 AM, Petr Štetiar  wrote:
> 
> Rosen Penev  [2020-07-13 22:43:51]:
> 
> Hi,
> 
>> GCC 10 defaults to fno-common, which demains unique defenitions.
> 
> whats the exact error here? Wouldn't it make sense to move this into packages 
> feed?
No idea what this package is for or the reason for its presence here.
> What about upstream, looks like they might find this patch handy.
Seems relatively dead upstream. Last commit one year ago and second to last 
three years ago.
> 
> -- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iftop: fix compilation with GCC 10

2020-07-17 Thread Petr Štetiar
Rosen Penev  [2020-07-13 22:43:51]:

Hi,

> GCC 10 defaults to fno-common, which demains unique defenitions.

whats the exact error here? Wouldn't it make sense to move this into packages 
feed?
What about upstream, looks like they might find this patch handy.

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ipq40xx: add open-drain support to pinctrl-msm

2020-07-17 Thread Petr Štetiar
Brian Norris  [2020-07-17 07:23:48]:

Hi,

> Submitted upstream.

nice, thanks.

> Shouldn't affect existing devices, but enables new device support.

I'm just wondering why this patch has to be in the tree now. It would make
more sense to add this as separate commit/patch in the patch series adding
support for such new device needing this feature.

Or is there any other valid reason I'm missing right now?

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] dropbear: make rsa-sha2-256 pubkeys usable again

2020-07-17 Thread Petr Štetiar
Matt Johnston  [2020-07-16 21:24:43]:

Hi,

> I can't reproduce a problem authenticating to a Dropbear 2020.80 server with
> rsa keys. I've tried with either dbclient 2019.78 (using ssh-rsa sha1
> signatures) or dbclient 2020.80 (rsa-sha2-256 signatures). Could you give me
> some steps to reproduce it?

just use any other SSH client which is implemented according to rfc8332, like
OpenSSH as those would likely send the public keys with 'ssh-rsa' string:

   Since RSA keys are not dependent on the choice of hash function, the
   new public key algorithms reuse the "ssh-rsa" public key format as
   defined in [RFC4253]:

   string"ssh-rsa"
   mpint e
   mpint n

   All aspects of the "ssh-rsa" format are kept, including the encoded
   string "ssh-rsa".  This allows existing RSA keys to be used with the
   new public key algorithms, without requiring re-encoding or affecting
   already trusted key fingerprints.

In other words, OpenSSH client sends the key with `ssh-rsa` string, but
Dropbear checks for `rsa-sha2-256` and thus refusing the client.

Server:

 $ dropbear -V
 Dropbear v2020.80

 $ dropbear -F -s -v
 TRACE  (2907) 2.994471: buf_put_sign type 101 rsa-sha2-256
 TRACE  (2907) 3.008211: enter send_msg_ext_info
 TRACE  (2907) 3.008608: algolist add 20 
'rsa-sha2-256,ssh-rsa���@E�W7��'�_��U��q}�+*L#�

+R�g���d$p��vqp���

   ��,@��n):�TfIÂj��_'
 ...

 TRACE  (2907) 3.999860: checkpubkey: opened authorized_keys OK
 TRACE  (2907) 4.001785: checkpubkey_line: line pos = 8 len = 724
 TRACE  (2907) 4.003487: checkpubkey: base64_decode success
 TRACE  (2907) 4.004858: leave checkpubkey: ret=0
 TRACE  (2907) 4.006211: enter buf_get_rsa_pub_key
 TRACE  (2907) 4.007392: leave buf_get_rsa_pub_key: success
 TRACE  (2907) 4.008283: enter buf_verify
 [2907] Jul 17 08:30:56 Exit before auth from <192.168.200.1:49142>: (user 
'root', 0 fails): Non-matching signing type

   ^--- here it fails in buf_verify as expected
sigtype=DROPBEAR_SIGNATURE_RSA_SHA256, but actual sigtype is 
DROPBEAR_SIGNATURE_RSA_SHA1

 TRACE  (2907) 4.010526: enter session_cleanup

Client:

 $ ssh -v root@192.168.200.77
 OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
 ...
 debug1: kex: host key algorithm: rsa-sha2-256
 ...
 debug1: kex_input_ext_info: server-sig-algs=
 debug1: SSH2_MSG_SERVICE_ACCEPT received
 debug1: Authentications that can continue: publickey
 debug1: Next authentication method: publickey
 debug1: Offering public key: RSA 
SHA256:ZLONs7adjPBljemwKAX5dXDiKPDVh4fsStkqi2eJsiI cardno:000610530066
 debug1: Server accepts key: pkalg rsa-sha2-256 blen 535
 Connection closed by 192.168.200.77 port 22

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 3/3] scripts: mkhash fail on hashing a folder

2020-07-17 Thread Paul Spooren

Hi,

On 16.07.20 21:20, Bjørn Mork wrote:

Paul Spooren  writes:


To avoid hashing of folders `fopen()` is called in `r+` mode which fails
on folders, as their are not writeable. Regular files work as before.

This prevents mkhash from working with read-only files.  That's
unexpected, and IMHO worse than the problem you are trying to fix.


Thank you, I created a v2 using stat().


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 2/2] scripts: mkhash fail on hashing a folder

2020-07-17 Thread Paul Spooren
mkhash currently returns the hash of an empty input when trying to hash
a folder. This can be missleading in caseswhere e.g. an env variable is
undefined which should contain a filename. `mkhash ./path/to/$FILE`
would exit with code 0 and return a legit looking checksum.

A better behaviour would be to fail with exit code 1, which imitates the
behaviour of `md5sum` and `sha256sum`.

To avoid hashing of folders the `stat()` is checked.

Hashing empty inputs result in the following checksums:
md5: d41d8cd98f00b204e9800998ecf8427e
sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Signed-off-by: Paul Spooren 
---
 scripts/mkhash.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/mkhash.c b/scripts/mkhash.c
index ea3bd60ce1..13d50176c8 100644
--- a/scripts/mkhash.c
+++ b/scripts/mkhash.c
@@ -85,6 +85,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define ARRAY_SIZE(_n) (sizeof(_n) / sizeof((_n)[0]))
 
@@ -770,7 +771,14 @@ static int hash_file(struct hash_type *t, const char 
*filename, bool add_filenam
if (!filename || !strcmp(filename, "-")) {
str = t->func(stdin);
} else {
-   FILE *f = fopen(filename, "r");
+   struct stat path_stat;
+   stat(filename, _stat);
+   if (S_ISDIR(path_stat.st_mode)) {
+   fprintf(stderr, "Failed to open '%s': Is a 
directory\n", filename);
+   return 1;
+   }
+
+   FILE *f = fopen(filename, "r+");
 
if (!f) {
fprintf(stderr, "Failed to open '%s'\n", filename);
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 1/2] scripts: mkhash fix return code handling

2020-07-17 Thread Paul Spooren
If hashing a file fails mkhash shouldn't just silently fail. Now check
after each call of `hash_file()` the return and exit early in case of
errors. The return value which was previously ignored and would always
return 0.

Signed-off-by: Paul Spooren 
---
 scripts/mkhash.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/mkhash.c b/scripts/mkhash.c
index e26ca3a350..ea3bd60ce1 100644
--- a/scripts/mkhash.c
+++ b/scripts/mkhash.c
@@ -823,8 +823,11 @@ int main(int argc, char **argv)
if (argc < 2)
return hash_file(t, NULL, add_filename);
 
-   for (i = 0; i < argc - 1; i++)
-   hash_file(t, argv[1 + i], add_filename);
+   for (i = 0; i < argc - 1; i++) {
+   int ret =  hash_file(t, argv[1 + i], add_filename);
+   if (ret)
+   return ret;
+   }
 
return 0;
 }
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v7] ramips: add support for JS76x8 series DEV boards

2020-07-17 Thread Robinson Wu
This commit adds support for the Jotale JS76x8 series development boards.
These devices have the following specifications:

- SOC: MT7628AN/NN, MT7688AN, MT7628DAN
- RAM of MT7628AN/NN and MT7688AN: 64/128/256 MB (DDR2)
- RAM of MT7628DAN: 64 MB (DDR2)
- FLASH:8/16/32 MB (SPI NOR)
- Ethernet:3x 10/100 Mbps ethernet ports (MT76x8 built-in switch)
- WIFI:1x 2T2R 2.4 GHz Wi-Fi
- LEDs:1x system status green LED, 1x wifi green LED,
   3x ethernet green LED
- Buttons:1x reset button, 2x user defined button
- 1x microSD slot
- 4x USB 2.0 port
- 1x mini-usb debug UART
- 1x DC jack for main power (DC 5V)
- 1x TTL/RS232 UART
- 1x TTL/RS485 UART
- 13x GPIO header
- 1x audio codec(wm8960)

Installation via OpenWrt:

The original firmware is OpenWrt, so both LuCI and sysupgrade can be used.

Installation via U-boot web:

1. Power on board with reset button pressed, release it
   after wifi led start blinking.
2. Setup static IP 192.168.1.123/4 on your PC.
3. Go to 192.168.1.8 in browser and upload "sysupgrade" image.

Installation via U-boot tftp:
1. Connect to serial console at the mini usb, which has been connected to UART0
   on board (115200 8N1)
2. Setup static IP 192.168.1.123/4 on your PC.
3. Place openwrt-firmware.bin on your PC tftp server (192.168.1.123).
3. Connect one of LAN ports on board to your PC.
4. Start terminal software (e.g. screen /dev/ttyUSB0 115200) on PC.
5. Apply power to board.
6. Interrupt U-boot with keypress of "2".
7. At u-boot prompts:
   Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N) Y
   Input device IP (192.168.1.8) ==:192.168.1.8
   Input server IP (192.168.1.123) ==:192.168.1.123
   Input Linux Kernel filename (root_uImage) ==:openwrt-firmware.bin
8. board will download file from tftp server, write it to flash and reboot.

Signed-off-by: Robinson Wu 
---
 .../ramips/dts/mt7628an_jotale_js76x8-16m.dts  |  12 ++
 .../ramips/dts/mt7628an_jotale_js76x8-32m.dts  |  12 ++
 .../linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts |  12 ++
 .../linux/ramips/dts/mt7628an_jotale_js76x8.dtsi   | 145 +
 target/linux/ramips/image/mt76x8.mk|  27 
 .../ramips/mt76x8/base-files/etc/board.d/01_leds   |   6 +
 .../mt76x8/base-files/etc/board.d/02_network   |   6 +
 7 files changed, 220 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts
 create mode 100644 target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi

diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts
new file mode 100644
index 000..53ed6d8
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-16m.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "mt7628an_jotale_js76x8.dtsi"
+
+/ {
+   compatible = "jotale,js76x8-16m", "jotale,js76x8", 
"mediatek,mt7628an-soc";
+   model = "Jotale JS76x8 (16M)";
+};
+
+ {
+   reg = <0x5 0xfb>;
+};
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
new file mode 100644
index 000..851e6db
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "mt7628an_jotale_js76x8.dtsi"
+
+/ {
+   compatible = "jotale,js76x8-32m", "jotale,js76x8", 
"mediatek,mt7628an-soc";
+   model = "Jotale JS76x8 (32M)";
+};
+
+ {
+   reg = <0x5 0x1fb>;
+};
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts
new file mode 100644
index 000..8cac3fb
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-8m.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "mt7628an_jotale_js76x8.dtsi"
+
+/ {
+   compatible = "jotale,js76x8-8m", "mediatek,mt7628an-soc";
+   model = "Jotale JS76x8 (8M)";
+};
+
+ {
+   reg = <0x5 0x7b>;
+};
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi 
b/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
new file mode 100644
index 000..cc858a9
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
@@ -0,0 +1,145 @@
+#include "mt7628an.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "jotale,js76x8", "mediatek,mt7628an-soc";
+
+   aliases {
+   led-boot = _system;
+   led-failsafe = _system;
+   led-running = _system;
+   led-upgrade = _system;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_system: system {
+   label = "js76x8:green:system";
+   gpios = < 37 GPIO_ACTIVE_LOW>;
+   };
+
+   wifi {
+   label = 

[PATCH] ipq40xx: add open-drain support to pinctrl-msm

2020-07-17 Thread Brian Norris
Submitted upstream. Shouldn't affect existing devices, but enables new
device support.

https://lore.kernel.org/linux-gpio/20200703080646.23233-1-computersforpe...@gmail.com/

Currently queued for-next:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next=13355ca35cd16f5024655ac06e228b3c199e52a9

Signed-off-by: Brian Norris 
---
Submitting this separately, partly because the device-support patches
are a bit bigger and likely will take a little work.

 .../090-pinctrl-msm-open-drain.patch  | 90 +++
 1 file changed, 90 insertions(+)
 create mode 100644 
target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch

diff --git a/target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch 
b/target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch
new file mode 100644
index ..9bb05f32844a
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch
@@ -0,0 +1,90 @@
+From 5b08c1d567ee8e6af94696b3e549997cbdb2bb80 Mon Sep 17 00:00:00 2001
+From: Jaiganesh Narayanan 
+Date: Thu, 1 Sep 2016 10:40:38 +0530
+Subject: [PATCH] pinctrl: qcom: ipq4019: add open drain support
+
+Signed-off-by: Jaiganesh Narayanan 
+[ Brian: adapted from from the Chromium OS kernel used on IPQ4019-based
+  WiFi APs. ]
+Signed-off-by: Brian Norris 
+---
+https://lore.kernel.org/linux-gpio/20200703080646.23233-1-computersforpe...@gmail.com/
+
+ drivers/pinctrl/qcom/pinctrl-ipq4019.c |  1 +
+ drivers/pinctrl/qcom/pinctrl-msm.c | 13 +
+ drivers/pinctrl/qcom/pinctrl-msm.h |  2 ++
+ 3 files changed, 16 insertions(+)
+
+diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c 
b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
+index 8bdb5bd393d2..63915cb210ff 100644
+--- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c
 b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
+@@ -254,6 +254,7 @@ DECLARE_QCA_GPIO_PINS(99);
+   .mux_bit = 2,   \
+   .pull_bit = 0,  \
+   .drv_bit = 6,   \
++  .od_bit = 12,   \
+   .oe_bit = 9,\
+   .in_bit = 0,\
+   .out_bit = 1,   \
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c 
b/drivers/pinctrl/qcom/pinctrl-msm.c
+index 83b7d64bc4c1..dac0404dadf4 100644
+--- a/drivers/pinctrl/qcom/pinctrl-msm.c
 b/drivers/pinctrl/qcom/pinctrl-msm.c
+@@ -233,6 +233,10 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
+   *bit = g->pull_bit;
+   *mask = 3;
+   break;
++  case PIN_CONFIG_DRIVE_OPEN_DRAIN:
++  *bit = g->od_bit;
++  *mask = 1;
++  break;
+   case PIN_CONFIG_DRIVE_STRENGTH:
+   *bit = g->drv_bit;
+   *mask = 7;
+@@ -310,6 +314,12 @@ static int msm_config_group_get(struct pinctrl_dev 
*pctldev,
+   if (!arg)
+   return -EINVAL;
+   break;
++  case PIN_CONFIG_DRIVE_OPEN_DRAIN:
++  /* Pin is not open-drain */
++  if (!arg)
++  return -EINVAL;
++  arg = 1;
++  break;
+   case PIN_CONFIG_DRIVE_STRENGTH:
+   arg = msm_regval_to_drive(arg);
+   break;
+@@ -382,6 +392,9 @@ static int msm_config_group_set(struct pinctrl_dev 
*pctldev,
+   else
+   arg = MSM_PULL_UP;
+   break;
++  case PIN_CONFIG_DRIVE_OPEN_DRAIN:
++  arg = 1;
++  break;
+   case PIN_CONFIG_DRIVE_STRENGTH:
+   /* Check for invalid values */
+   if (arg > 16 || arg < 2 || (arg % 2) != 0)
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h 
b/drivers/pinctrl/qcom/pinctrl-msm.h
+index 9452da18a78b..dc7f8c84744b 100644
+--- a/drivers/pinctrl/qcom/pinctrl-msm.h
 b/drivers/pinctrl/qcom/pinctrl-msm.h
+@@ -38,6 +38,7 @@ struct msm_function {
+  * @mux_bit:  Offset in @ctl_reg for the pinmux function 
selection.
+  * @pull_bit: Offset in @ctl_reg for the bias configuration.
+  * @drv_bit:  Offset in @ctl_reg for the drive strength 
configuration.
++ * @od_bit:   Offset in @ctl_reg for controlling open drain.
+  * @oe_bit:   Offset in @ctl_reg for controlling output enable.
+  * @in_bit:   Offset in @io_reg for the input bit value.
+  * @out_bit:  Offset in @io_reg for the output bit value.
+@@ -75,6 +76,7 @@ struct msm_pingroup {
+   unsigned pull_bit:5;
+   unsigned drv_bit:5;
+ 
++  unsigned od_bit:5;
+   unsigned oe_bit:5;
+   unsigned in_bit:5;
+   unsigned out_bit:5;
+-- 
+2.17.1
+
-- 
2.27.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org

Re: [PATCH 3/3] scripts: mkhash fail on hashing a folder

2020-07-17 Thread Bjørn Mork
Paul Spooren  writes:

> To avoid hashing of folders `fopen()` is called in `r+` mode which fails
> on folders, as their are not writeable. Regular files work as before.

This prevents mkhash from working with read-only files.  That's
unexpected, and IMHO worse than the problem you are trying to fix.


Bjørn

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel