[PATCH] mt76: Add firmware package for MT7922

2023-10-13 Thread Daniel Danzberger
Adds the 2 required firmware files for MT7922 chips.

Signed-off-by: Daniel Danzberger 
---
 package/kernel/mt76/Makefile | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index cc8221d7ce..dd75390ee7 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -262,6 +262,11 @@ define KernelPackage/mt7921-firmware
   TITLE:=MediaTek MT7921 firmware
 endef
 
+define KernelPackage/mt7922-firmware
+  $(KernelPackage/mt76-default)
+  TITLE:=MediaTek MT7922 firmware
+endef
+
 define KernelPackage/mt792x-common
   $(KernelPackage/mt76-default)
   TITLE:=MediaTek MT792x wireless driver common code
@@ -597,6 +602,14 @@ define KernelPackage/mt7921-firmware/install
$(1)/lib/firmware/mediatek
 endef
 
+define KernelPackage/mt7922-firmware/install
+   $(INSTALL_DIR) $(1)/lib/firmware/mediatek
+   cp \
+   $(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \
+   $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \
+   $(1)/lib/firmware/mediatek
+endef
+
 define Package/mt76-test/install
mkdir -p $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin
@@ -630,6 +643,7 @@ $(eval $(call KernelPackage,mt7916-firmware))
 $(eval $(call KernelPackage,mt7981-firmware))
 $(eval $(call KernelPackage,mt7986-firmware))
 $(eval $(call KernelPackage,mt7921-firmware))
+$(eval $(call KernelPackage,mt7922-firmware))
 $(eval $(call KernelPackage,mt792x-common))
 $(eval $(call KernelPackage,mt792x-usb))
 $(eval $(call KernelPackage,mt7921-common))
-- 
2.42.0


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


[PATCH] umbim: Add mbim message timeout option, -T

2023-07-08 Thread Daniel Danzberger
Some modems, depending on their state and connection quality can take
longer than 15 seconds to answer mbim message requests.

This commit adds the -T option, allowing the user to specifiy a custom
message timeout in seconds.

Default is still 15.

Signed-off-by: Daniel Danzberger 
---
 cli.c  | 9 +++--
 mbim-dev.c | 2 +-
 mbim.h | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/cli.c b/cli.c
index 3a845d4..6026a67 100644
--- a/cli.c
+++ b/cli.c
@@ -35,6 +35,7 @@
 
 int return_code = -1;
 int verbose;
+int msg_timeout_ms = 15 * 1000;
 
 struct mbim_handler *current_handler;
 static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 
0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E };
@@ -533,7 +534,8 @@ usage(void)
 #endif
"-d the device (/dev/cdc-wdmX)\n"
"-tthe transaction id\n"
-   "-n no close\n\n"
+   "-n no close\n"
+   "-TMBIM message timeout in seconds 
[15]\n\n"
"-v verbose\n\n");
return 1;
 }
@@ -548,7 +550,7 @@ main(int argc, char **argv)
int proxy = 0;
 #endif
 
-   while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
+   while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
switch (ch) {
case 'v':
verbose = 1;
@@ -563,6 +565,9 @@ main(int argc, char **argv)
no_open = 1;
transaction_id = atoi(optarg);
break;
+   case 'T':
+   msg_timeout_ms = atoi(optarg) * 1000;
+   break;
 #ifdef LIBQMI_MBIM_PROXY
case 'p':
proxy = 1;
diff --git a/mbim-dev.c b/mbim-dev.c
index 2a94d49..12d1189 100644
--- a/mbim-dev.c
+++ b/mbim-dev.c
@@ -78,7 +78,7 @@ mbim_send(void)
perror("writing data failed: ");
} else {
expected = le32toh(hdr->type) | 0x8000;
-   uloop_timeout_set(, 15000);
+   uloop_timeout_set(, msg_timeout_ms);
}
return ret;
 }
diff --git a/mbim.h b/mbim.h
index 746257e..28999b5 100644
--- a/mbim.h
+++ b/mbim.h
@@ -20,6 +20,7 @@
 
 extern int return_code;
 extern int verbose;
+extern int msg_timeout_ms;
 
 #include "mbim-type.h"
 #include "mbim-enum.h"
-- 
2.40.1


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


Re: [PATCH] umbim: Add mbim message timeout option, -T

2023-07-05 Thread Daniel Danzberger
On Wed, 2023-07-05 at 15:03 +, Eric wrote:
> On Wednesday, July 5th, 2023 at 06:08, Daniel Danzberger  
> wrote:
> > Some modems, depending on their state and connection quality can take
> > longer than 15 seconds to answer mbim message requests.
> > 
> > This commit adds the -T option, allowing the user to specifiy a custom
> > message timeout in seconds.
> > 
> > Default is still 15.
> > 
> > Signed-off-by: Daniel Danzberger dan...@dd-wrt.com
> > 
> > ---
> > cli.c | 9 +++--
> > mbim-dev.c | 2 +-
> > mbim.h | 1 +
> > 3 files changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/cli.c b/cli.c
> > index 3a845d4..b23fc6d 100644
> > --- a/cli.c
> > +++ b/cli.c
> > @@ -35,6 +35,7 @@
> > 
> > int return_code = -1;
> > int verbose;
> > +int msg_timeout_ms = 15 * 1000;
> > 
> > struct mbim_handler *current_handler;
> > static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 
> > 0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E
> > };
> > @@ -533,7 +534,8 @@ usage(void)
> > #endif
> > " -d  the device (/dev/cdc-wdmX)\n"
> > 
> > " -t  the transaction id\n"
> > 
> > - " -n no close\n\n"
> > + " -n no close\n"
> > + " -T MBIM message timeout in seconds [15]\n\n"
> 
> Shouldn't the usage indicate explicitly that it takes a parameter, as do -d 
> and -t?
> 
>    " -T     MBIM message timeout...
Yes, makes sense.
> 
> > " -v verbose\n\n");
> > return 1;
> > }
> > @@ -548,7 +550,7 @@ main(int argc, char **argv)
> > int proxy = 0;
> > #endif
> > 
> > - while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
> > + while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
> > switch (ch) {
> > case 'v':
> > verbose = 1;
> > @@ -563,6 +565,9 @@ main(int argc, char **argv)
> > no_open = 1;
> > transaction_id = atoi(optarg);
> > break;
> > + case 'T':
> > + msg_timeout_ms = atoi(optarg) * 1000;
> > + break;
> > #ifdef LIBQMI_MBIM_PROXY
> > case 'p':
> > proxy = 1;
> > diff --git a/mbim-dev.c b/mbim-dev.c
> > index 2a94d49..12d1189 100644
> > --- a/mbim-dev.c
> > +++ b/mbim-dev.c
> > @@ -78,7 +78,7 @@ mbim_send(void)
> > perror("writing data failed: ");
> > } else {
> > expected = le32toh(hdr->type) | 0x8000;
> > 
> > - uloop_timeout_set(, 15000);
> > + uloop_timeout_set(, msg_timeout_ms);
> > }
> > return ret;
> > }
> > diff --git a/mbim.h b/mbim.h
> > index 746257e..28999b5 100644
> > --- a/mbim.h
> > +++ b/mbim.h
> > @@ -20,6 +20,7 @@
> > 
> > extern int return_code;
> > extern int verbose;
> > +extern int msg_timeout_ms;
> > 
> > #include "mbim-type.h"
> > #include "mbim-enum.h"
> > --
> > 2.40.1
> 
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


[PATCH] umbim: Add mbim message timeout option, -T

2023-07-05 Thread Daniel Danzberger
Some modems, depending on their state and connection quality can take
longer than 15 seconds to answer mbim message requests.

This commit adds the -T option, allowing the user to specifiy a custom
message timeout in seconds.

Default is still 15.

Signed-off-by: Daniel Danzberger 
---
 cli.c  | 9 +++--
 mbim-dev.c | 2 +-
 mbim.h | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/cli.c b/cli.c
index 3a845d4..b23fc6d 100644
--- a/cli.c
+++ b/cli.c
@@ -35,6 +35,7 @@
 
 int return_code = -1;
 int verbose;
+int msg_timeout_ms = 15 * 1000;
 
 struct mbim_handler *current_handler;
 static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 
0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E };
@@ -533,7 +534,8 @@ usage(void)
 #endif
"-d the device (/dev/cdc-wdmX)\n"
"-tthe transaction id\n"
-   "-n no close\n\n"
+   "-n no close\n"
+   "-T MBIM message timeout in seconds 
[15]\n\n"
"-v verbose\n\n");
return 1;
 }
@@ -548,7 +550,7 @@ main(int argc, char **argv)
int proxy = 0;
 #endif
 
-   while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
+   while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
switch (ch) {
case 'v':
verbose = 1;
@@ -563,6 +565,9 @@ main(int argc, char **argv)
no_open = 1;
transaction_id = atoi(optarg);
break;
+   case 'T':
+   msg_timeout_ms = atoi(optarg) * 1000;
+   break;
 #ifdef LIBQMI_MBIM_PROXY
case 'p':
proxy = 1;
diff --git a/mbim-dev.c b/mbim-dev.c
index 2a94d49..12d1189 100644
--- a/mbim-dev.c
+++ b/mbim-dev.c
@@ -78,7 +78,7 @@ mbim_send(void)
perror("writing data failed: ");
} else {
expected = le32toh(hdr->type) | 0x8000;
-   uloop_timeout_set(, 15000);
+   uloop_timeout_set(, msg_timeout_ms);
}
return ret;
 }
diff --git a/mbim.h b/mbim.h
index 746257e..28999b5 100644
--- a/mbim.h
+++ b/mbim.h
@@ -20,6 +20,7 @@
 
 extern int return_code;
 extern int verbose;
+extern int msg_timeout_ms;
 
 #include "mbim-type.h"
 #include "mbim-enum.h"
-- 
2.40.1


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


[PATCH] ramips: fix lzma-loader for ASIARF boards

2023-06-02 Thread Daniel Danzberger
This fixes a well known "LZMA ERROR 1" error, reported previously on
numerous of similar devices.

Signed-off-by: Daniel Danzberger 
---
 target/linux/ramips/image/mt7621.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index 28f6fef681..d399787ffe 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -214,6 +214,7 @@ TARGET_DEVICES += arcadyan_we420223-99
 
 define Device/asiarf_ap7621-001
   $(Device/dsa-migration)
+  $(Device/uimage-lzma-loader)
   IMAGE_SIZE := 16000k
   DEVICE_VENDOR := AsiaRF
   DEVICE_MODEL := AP7621-001
@@ -223,6 +224,7 @@ TARGET_DEVICES += asiarf_ap7621-001
 
 define Device/asiarf_ap7621-nv1
   $(Device/dsa-migration)
+  $(Device/uimage-lzma-loader)
   IMAGE_SIZE := 16000k
   DEVICE_VENDOR := AsiaRF
   DEVICE_MODEL := AP7621-NV1
-- 
2.39.2


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


[PATCH] airoha: Add new target platform

2022-08-03 Thread Daniel Danzberger
Airoha is a new ARM platform based on Cortex-A53 which has recently been
merged into linux-next.

Due to BootROM limitations on this platform, the Cortex-A53 can't run in
Aarch64 mode and code must be compiled for 32-Bit ARM.

This support is based mostly on those linux-next commits backported
for kernel 5.15.

Patches:
1 - platform support = linux-next
2 - clock driver = linux-next
3 - gpio driver = linux-next
4 - linux,usable-memory-range dts support = linux-next
5 - mtd spinand driver
6 - spi driver
7 - pci driver (kconfig only, uses mediatek PCI) = linux-next

Still missing:
- Ethernet driver
- Sysupgrade support

A.t.m there exists one subtarget EN7523 with only one evaluation
board.

The initramfs can be run with the following commands from u-boot:
-
u-boot> setenv bootfile \
openwrt-airoha-airoha_en7523-evb-initramfs-kernel.bin
u-boot> tftpboot
u-boot> bootm 0x8180
-

Signed-off-by: Daniel Danzberger 
---
 target/linux/airoha/Makefile  |  15 +
 target/linux/airoha/config-5.15   | 271 ++
 target/linux/airoha/dts/en7523-evb.dts|  73 
 target/linux/airoha/dts/en7523.dtsi   | 219 +++
 .../files/arch/arm/mach-airoha/Makefile   |   2 +
 .../files/arch/arm/mach-airoha/airoha.c   |  16 +
 .../airoha/files/drivers/clk/clk-en7523.c | 351 ++
 .../airoha/files/drivers/gpio/gpio-en7523.c   | 137 +++
 .../include/dt-bindings/clock/en7523-clk.h|  17 +
 target/linux/airoha/image/Makefile|  37 ++
 target/linux/airoha/image/en7523.mk   |   0
 .../0001-add-airoha-platform.patch|  35 ++
 .../0002-add-airoha-en7523-clk-driver.patch   |  32 ++
 .../0003-add-airoha-en7523-gpio-driver.patch  |  33 ++
 ...press-Parse-linux-usable-memory-rang.patch | 111 ++
 ...for-the-Airoha-EN7523-SoC-SPI-contro.patch | 346 +
 ...iatek-Allow-building-for-ARCH_AIROHA.patch |  35 ++
 ...nd-Add-support-for-Etron-EM73D044VCx.patch | 137 +++
 18 files changed, 1867 insertions(+)
 create mode 100644 target/linux/airoha/Makefile
 create mode 100644 target/linux/airoha/config-5.15
 create mode 100644 target/linux/airoha/dts/en7523-evb.dts
 create mode 100644 target/linux/airoha/dts/en7523.dtsi
 create mode 100644 target/linux/airoha/files/arch/arm/mach-airoha/Makefile
 create mode 100644 target/linux/airoha/files/arch/arm/mach-airoha/airoha.c
 create mode 100644 target/linux/airoha/files/drivers/clk/clk-en7523.c
 create mode 100644 target/linux/airoha/files/drivers/gpio/gpio-en7523.c
 create mode 100644 
target/linux/airoha/files/include/dt-bindings/clock/en7523-clk.h
 create mode 100644 target/linux/airoha/image/Makefile
 create mode 100644 target/linux/airoha/image/en7523.mk
 create mode 100644 
target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0002-add-airoha-en7523-clk-driver.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0003-add-airoha-en7523-gpio-driver.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0004-ARM-9124-1-uncompress-Parse-linux-usable-memory-rang.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0006-PCI-mediatek-Allow-building-for-ARCH_AIROHA.patch
 create mode 100644 
target/linux/generic/pending-5.15/487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch

diff --git a/target/linux/airoha/Makefile b/target/linux/airoha/Makefile
new file mode 100644
index 00..723bec8cd4
--- /dev/null
+++ b/target/linux/airoha/Makefile
@@ -0,0 +1,15 @@
+include $(TOPDIR)/rules.mk
+
+ARCH:=arm
+BOARD:=airoha
+BOARDNAME:=Airoha ARM
+CPU_TYPE:=cortex-a7
+FEATURES:=dt squashfs nand ramdisk gpio source-only
+
+KERNEL_PATCHVER:=5.15
+
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:=Image dtbs
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/airoha/config-5.15 b/target/linux/airoha/config-5.15
new file mode 100644
index 00..0fbf8a4995
--- /dev/null
+++ b/target/linux/airoha/config-5.15
@@ -0,0 +1,271 @@
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_32BIT_OFF_T=y
+CONFIG_ARCH_AIROHA=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+# CONFIG_ARM_HIGHBANK_CPUIDLE is not set
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_PAT

Re: [PATCH] airoha: Add new target platform

2022-08-01 Thread Daniel Danzberger
On Wed, 2022-07-27 at 14:49 +0200, Hauke Mehrtens wrote:
> Hi Daniel,
> 
> Is it possible to buy devices with this SoC in the retail market or on ebay?
> 
> On 7/27/22 13:57, Daniel Danzberger wrote:
> > Airoha is a new ARM platform based on Cortex A7 which has recently been
> > merged into linux-next.
> 
> The device tree says it is a arm,cortex-a53, see 
> target/linux/airoha/dts/en7523.dtsi
> > 
> .
> > diff --git a/target/linux/airoha/dts/en7523.dtsi 
> > b/target/linux/airoha/dts/en7523.dtsi
> > new file mode 100644
> > index 00..72478b225c
> > --- /dev/null
> > +++ b/target/linux/airoha/dts/en7523.dtsi
> > @@ -0,0 +1,219 @@
> .
> > +   cpus {
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   cpu-map {
> > +   cluster0 {
> > +   core0 {
> > +   cpu = <>;
> > +   };
> > +   core1 {
> > +   cpu = <>;
> > +   };
> > +   };
> > +   };
> > +
> > +   cpu0: cpu@0 {
> > +   device_type = "cpu";
> > +   compatible = "arm,cortex-a53";
> > +   reg = <0x0>;
> > +   enable-method = "psci";
> > +   clock-frequency = <8000>;
> > +   next-level-cache = <_0>;
> > +   };
> 
> Here it says cortex a53

Yes, that's correct. It is a cortex a53. The description in the commit message 
is wong.
Even though it's an ARMv8-A with arm64, it needs to run in 32 bit mode due to 
the BootROM limitations.

The commit message will be corrected in the version of that patch.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] airoha: Add new target platform

2022-08-01 Thread Daniel Danzberger
On Wed, 2022-07-27 at 14:53 +0200, Robert Marko wrote:
> On Wed, 27 Jul 2022 at 14:50, Hauke Mehrtens  wrote:
> > 
> > Hi Daniel,
> > 
> > Is it possible to buy devices with this SoC in the retail market or on ebay?
> > 
> > On 7/27/22 13:57, Daniel Danzberger wrote:
> > > Airoha is a new ARM platform based on Cortex A7 which has recently been
> > > merged into linux-next.
> 
> Is this the one where A53 core is being limited to AArch32 by the BootROM?
> 
Yes, that's the case.

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


Re: [PATCH] airoha: Add new target platform

2022-07-31 Thread Daniel Danzberger
On Wed, 2022-07-27 at 14:49 +0200, Hauke Mehrtens wrote

> > diff --git 
> > a/target/linux/airoha/patches-5.15/0005-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch
> >  b/target/linux/airoha/patches-5.15/0005-
> > mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch
> > new file mode 100644
> > index 00..a48e02fc08
> > --- /dev/null
> > +++ 
> > b/target/linux/airoha/patches-5.15/0005-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch
> > @@ -0,0 +1,137 @@
> > +diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile
> > +index 9c64d9fc..5f99ea72 100644
> > +--- a/drivers/mtd/nand/spi/Makefile
> >  b/drivers/mtd/nand/spi/Makefile
> 
> Please move this patch to generic in OpenWrt and try to get it upstream 
> too. It is likely that we will see this choip on other boards soon too.
Moved it to gerneric.

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


Re: [PATCH] airoha: Add new target platform

2022-07-31 Thread Daniel Danzberger
On Wed, 2022-07-27 at 14:49 +0200, Hauke Mehrtens wrote:
> Hi Daniel,
> 
> Is it possible to buy devices with this SoC in the retail market or on ebay?
Hi, not yet. At least I don't know of any. Maybe @john knows ?
> 
> Why do you select CONFIG_CC_OPTIMIZE_FOR_SIZE ? all other targets except 
> the mediatek/mt7629 use CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE.
I used mt7629 as a reference, but CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE works as 
well.
Once there is Wifi/Ethernet support, I will do some benchmarks and figure out 
which option works best.
> 
> > +CONFIG_CHR_DEV_SCH=y
> Why do you need CONFIG_CHR_DEV_SCH?
> 
> > +CONFIG_CLONE_BACKWARDS=y
> > +CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
> > +CONFIG_CMDLINE_FROM_BOOTLOADER=y
> .
> > +CONFIG_DCACHE_WORD_ACCESS=y
> > +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
> > +CONFIG_DEBUG_MISC=y
> > +CONFIG_DEFAULT_HOSTNAME="(airoha)"
> 
> Setting CONFIG_DEFAULT_HOSTNAME looks wrong.
> 
> > +CONFIG_DMA_OPS=y
> 
> > +CONFIG_HANDLE_DOMAIN_IRQ=y
> > +# CONFIG_HARDENED_USERCOPY is not set
> 
> Please activate CONFIG_HARDENED_USERCOPY.
> 
> > +CONFIG_HARDEN_BRANCH_PREDICTOR=y
> > +CONFIG_HARDIRQS_SW_RESEND=y
> 
> > +CONFIG_NEED_DMA_MAP_STATE=y
> > +CONFIG_NETFILTER=y
> > +CONFIG_NET_FLOW_LIMIT=y
> > +CONFIG_NET_SELFTESTS=y
> 
> Please do not activate these CONFIG_NET options here.
> 
> > +CONFIG_NLS=y
> 
> > +CONFIG_OF_MDIO=y
> > +CONFIG_OLD_SIGACTION=y
> > +CONFIG_OLD_SIGSUSPEND3=y
> 
> I think we do not need these CONFIG_OLT_* options.
> 
> > +CONFIG_OUTER_CACHE=y
> .
> > +CONFIG_SRCU=y
> > +CONFIG_STACKTRACE=y
> 
> This should not be activated for only one target.
> 
> > +# CONFIG_SWAP is not set
> > +CONFIG_SWCONFIG=y
> 
> Do you really need CONFIG_SWCONFIG?
I cleaned up the kernel config.
Removed all configs you mentioned and enabled CONFIG_HARDENED_USERCOPY.


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


[PATCH] airoha: Add new target platform

2022-07-27 Thread Daniel Danzberger
Airoha is a new ARM platform based on Cortex A7 which has recently been
merged into linux-next.

This support is based mostly on those linux-next commits backported
for kernel 5.15.

Patches:
1 - platform support = linux-next
2 - clock driver = linux-next
3 - gpio driver = linux-next
4 - linux,usable-memory-range dts support = linux-next
5 - mtd spinand driver
6 - spi driver
7 - pci driver (kconfig only, uses mediatek PCI) = linux-next

Still missing:
- Ethernet driver
- Sysupgrade support

A.t.m there exists one subtarget EN7523 with only one evaluation
board.

The initramfs can be run with the following commands from u-boot:
-
u-boot> setenv bootfile \
openwrt-airoha-airoha_en7523-evb-initramfs-kernel.bin
u-boot> tftpboot
u-boot> bootm 0x8180
-

Signed-off-by: Daniel Danzberger 
---
 target/linux/airoha/Makefile  |  15 +
 target/linux/airoha/config-5.15   | 278 ++
 target/linux/airoha/dts/en7523-evb.dts|  73 
 target/linux/airoha/dts/en7523.dtsi   | 219 +++
 .../files/arch/arm/mach-airoha/Makefile   |   2 +
 .../files/arch/arm/mach-airoha/airoha.c   |  16 +
 .../airoha/files/drivers/clk/clk-en7523.c | 351 ++
 .../airoha/files/drivers/gpio/gpio-en7523.c   | 137 +++
 .../include/dt-bindings/clock/en7523-clk.h|  17 +
 target/linux/airoha/image/Makefile|  37 ++
 target/linux/airoha/image/en7523.mk   |   0
 .../0001-add-airoha-platform.patch|  35 ++
 .../0002-add-airoha-en7523-clk-driver.patch   |  32 ++
 .../0003-add-airoha-en7523-gpio-driver.patch  |  33 ++
 ...press-Parse-linux-usable-memory-rang.patch | 111 ++
 ...nd-Add-support-for-Etron-EM73D044VCx.patch | 137 +++
 ...for-the-Airoha-EN7523-SoC-SPI-contro.patch | 346 +
 ...iatek-Allow-building-for-ARCH_AIROHA.patch |  35 ++
 18 files changed, 1874 insertions(+)
 create mode 100644 target/linux/airoha/Makefile
 create mode 100644 target/linux/airoha/config-5.15
 create mode 100644 target/linux/airoha/dts/en7523-evb.dts
 create mode 100644 target/linux/airoha/dts/en7523.dtsi
 create mode 100644 target/linux/airoha/files/arch/arm/mach-airoha/Makefile
 create mode 100644 target/linux/airoha/files/arch/arm/mach-airoha/airoha.c
 create mode 100644 target/linux/airoha/files/drivers/clk/clk-en7523.c
 create mode 100644 target/linux/airoha/files/drivers/gpio/gpio-en7523.c
 create mode 100644 
target/linux/airoha/files/include/dt-bindings/clock/en7523-clk.h
 create mode 100644 target/linux/airoha/image/Makefile
 create mode 100644 target/linux/airoha/image/en7523.mk
 create mode 100644 
target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0002-add-airoha-en7523-clk-driver.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0003-add-airoha-en7523-gpio-driver.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0004-ARM-9124-1-uncompress-Parse-linux-usable-memory-rang.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0005-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0006-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0007-PCI-mediatek-Allow-building-for-ARCH_AIROHA.patch

diff --git a/target/linux/airoha/Makefile b/target/linux/airoha/Makefile
new file mode 100644
index 00..723bec8cd4
--- /dev/null
+++ b/target/linux/airoha/Makefile
@@ -0,0 +1,15 @@
+include $(TOPDIR)/rules.mk
+
+ARCH:=arm
+BOARD:=airoha
+BOARDNAME:=Airoha ARM
+CPU_TYPE:=cortex-a7
+FEATURES:=dt squashfs nand ramdisk gpio source-only
+
+KERNEL_PATCHVER:=5.15
+
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:=Image dtbs
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/airoha/config-5.15 b/target/linux/airoha/config-5.15
new file mode 100644
index 00..6717e8d19b
--- /dev/null
+++ b/target/linux/airoha/config-5.15
@@ -0,0 +1,278 @@
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_32BIT_OFF_T=y
+CONFIG_ARCH_AIROHA=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+# CONFIG_ARM_HIGHBANK_CPUIDLE is not set
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_PATCH_IDIV=y
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_ARM_PSCI=y
+CONFIG_ARM_PSCI_FW=y
+# CONFIG_ARM_SMMU is not set
+CONFIG_ARM_THUMB=y
+CONFIG_A

[PATCH] rpcd: plugin: don't query ubusd for known object name

2022-07-27 Thread Daniel Danzberger
The object name is already known and stored in the ubus object,
so there is no need ubus_lookup() all objects and reverse resolve
the id to it's name on every plugin handler call.

Signed-off-by: Daniel Danzberger 
---
 plugin.c | 41 ++---
 1 file changed, 2 insertions(+), 39 deletions(-)

diff --git a/plugin.c b/plugin.c
index ea6e60f..7cd59c4 100644
--- a/plugin.c
+++ b/plugin.c
@@ -20,37 +20,6 @@
 
 static struct blob_buf buf;
 
-struct rpc_plugin_lookup_context {
-   uint32_t id;
-   char *name;
-   bool found;
-};
-
-static void
-rpc_plugin_lookup_plugin_cb(struct ubus_context *ctx,
-struct ubus_object_data *obj, void *priv)
-{
-   struct rpc_plugin_lookup_context *c = priv;
-
-   if (c->id == obj->id)
-   {
-   c->found = true;
-   sprintf(c->name, "%s", obj->path);
-   }
-}
-
-static bool
-rpc_plugin_lookup_plugin(struct ubus_context *ctx, struct ubus_object *obj,
- char *strptr)
-{
-   struct rpc_plugin_lookup_context c = { .id = obj->id, .name = strptr };
-
-   if (ubus_lookup(ctx, NULL, rpc_plugin_lookup_plugin_cb, ))
-   return false;
-
-   return c.found;
-}
-
 static void
 rpc_plugin_json_array_to_blob(struct array_list *a, struct blob_buf *blob);
 
@@ -204,7 +173,7 @@ rpc_plugin_call(struct ubus_context *ctx, struct 
ubus_object *obj,
 {
int rv = UBUS_STATUS_UNKNOWN_ERROR;
struct call_context *c;
-   char *plugin, *mptr;
+   char *mptr;
 
c = calloc_a(sizeof(*c), , strlen(method) + 1);
 
@@ -218,13 +187,7 @@ rpc_plugin_call(struct ubus_context *ctx, struct 
ubus_object *obj,
if (!c->input || !c->tok)
goto fail;
 
-   plugin = c->path + sprintf(c->path, "%s/", RPC_PLUGIN_DIRECTORY);
-
-   if (!rpc_plugin_lookup_plugin(ctx, obj, plugin))
-   {
-   rv = UBUS_STATUS_NOT_FOUND;
-   goto fail;
-   }
+   sprintf(c->path, "%s/%s", RPC_PLUGIN_DIRECTORY, obj->name);
 
c->argv[0] = c->path;
c->argv[1] = "call";
-- 
2.35.1


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


[PATCH] airoha: Add new target platform

2022-07-26 Thread Daniel Danzberger
Airoha is a new ARM platform based on Cortex A7 which has recently been
merged into linux-next.

This support is based mostly on those linux-next commits backported
for kernel 5.15.

Patches:
1 - platform support = linux-next
2 - clock driver = linux-next
3 - gpio driver = linux-next
4 - linux,usable-memory-range dts support = linux-next
5 - mtd spinand driver
6 - spi driver
7 - pci driver (kconfig only, uses mediatek PCI) = linux-next

Still missing:
- Ethernet driver
- Sysupgrade support

A.t.m there exists one subtarget EN7523 with only one evaluation
board.

The initramfs can be run with the following commands from u-boot:
-
u-boot> setenv bootfile \
openwrt-airoha-en7523-airoha_en7523-evb-initramfs-kernel.bin
u-boot> tftpboot
u-boot> bootm 0x8180
-

Signed-off-by: Daniel Danzberger 
---
 target/linux/airoha/Makefile  |  12 +
 target/linux/airoha/config-5.15   | 278 ++
 target/linux/airoha/dts/en7523-evb.dts|  73 
 target/linux/airoha/dts/en7523.dtsi   | 219 +++
 target/linux/airoha/en7523/target.mk  |  11 +
 .../files/arch/arm/mach-airoha/Makefile   |   2 +
 .../files/arch/arm/mach-airoha/airoha.c   |  16 +
 .../airoha/files/drivers/clk/clk-en7523.c | 351 ++
 .../airoha/files/drivers/gpio/gpio-en7523.c   | 137 +++
 .../include/dt-bindings/clock/en7523-clk.h|  17 +
 target/linux/airoha/image/Makefile|  25 ++
 target/linux/airoha/image/en7523.mk   |   9 +
 .../0001-add-airoha-platform.patch|  35 ++
 .../0002-add-airoha-en7523-clk-driver.patch   |  32 ++
 .../0003-add-airoha-en7523-gpio-driver.patch  |  33 ++
 ...press-Parse-linux-usable-memory-rang.patch | 111 ++
 ...nd-Add-support-for-Etron-EM73D044VCx.patch | 137 +++
 ...for-the-Airoha-EN7523-SoC-SPI-contro.patch | 346 +
 ...iatek-Allow-building-for-ARCH_AIROHA.patch |  35 ++
 19 files changed, 1879 insertions(+)
 create mode 100644 target/linux/airoha/Makefile
 create mode 100644 target/linux/airoha/config-5.15
 create mode 100644 target/linux/airoha/dts/en7523-evb.dts
 create mode 100644 target/linux/airoha/dts/en7523.dtsi
 create mode 100644 target/linux/airoha/en7523/target.mk
 create mode 100644 target/linux/airoha/files/arch/arm/mach-airoha/Makefile
 create mode 100644 target/linux/airoha/files/arch/arm/mach-airoha/airoha.c
 create mode 100644 target/linux/airoha/files/drivers/clk/clk-en7523.c
 create mode 100644 target/linux/airoha/files/drivers/gpio/gpio-en7523.c
 create mode 100644 
target/linux/airoha/files/include/dt-bindings/clock/en7523-clk.h
 create mode 100644 target/linux/airoha/image/Makefile
 create mode 100644 target/linux/airoha/image/en7523.mk
 create mode 100644 
target/linux/airoha/patches-5.15/0001-add-airoha-platform.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0002-add-airoha-en7523-clk-driver.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0003-add-airoha-en7523-gpio-driver.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0004-ARM-9124-1-uncompress-Parse-linux-usable-memory-rang.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0005-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0006-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch
 create mode 100644 
target/linux/airoha/patches-5.15/0007-PCI-mediatek-Allow-building-for-ARCH_AIROHA.patch

diff --git a/target/linux/airoha/Makefile b/target/linux/airoha/Makefile
new file mode 100644
index 00..5bafcf5899
--- /dev/null
+++ b/target/linux/airoha/Makefile
@@ -0,0 +1,12 @@
+include $(TOPDIR)/rules.mk
+
+ARCH:=arm
+BOARD:=airoha
+BOARDNAME:=Airoha ARM
+SUBTARGETS:=en7523
+
+KERNEL_PATCHVER:=5.15
+
+include $(INCLUDE_DIR)/target.mk
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/airoha/config-5.15 b/target/linux/airoha/config-5.15
new file mode 100644
index 00..6717e8d19b
--- /dev/null
+++ b/target/linux/airoha/config-5.15
@@ -0,0 +1,278 @@
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_32BIT_OFF_T=y
+CONFIG_ARCH_AIROHA=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+# CONFIG_ARM_HIGHBANK_CPUIDLE is not set
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_PATCH_IDIV=y
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_ARM_PSCI=y
+CONFIG_ARM_PSCI_FW=y
+# CONFIG

[PATCH] umbim: fix invalid mbim message string encoding

2022-05-10 Thread Daniel Danzberger
Strings in mbim messages have to follow these formatting rules:
 - 4 byte alignment, padded if not.
 - utf-16 little endian.

Fixes:
 - mbim connect fails with more than 1 string parameter (apn/user/pass)
   when they are not 4 byte aligned.

Signed-off-by: Daniel Danzberger 
---
 mbim-msg.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/mbim-msg.c b/mbim-msg.c
index 5ec04f4..8f21aa9 100644
--- a/mbim-msg.c
+++ b/mbim-msg.c
@@ -53,8 +53,10 @@ mbim_add_payload(uint8_t len)
 int
 mbim_encode_string(struct mbim_string *str, char *in)
 {
-   int l = strlen(in);
-   int s = mbim_add_payload(l * 2);
+   const int l = strlen(in);
+   const int utf16_len = l * 2;
+   const int pad_len = utf16_len % 4;
+   const int s = mbim_add_payload(utf16_len + pad_len);
uint8_t *p = _buffer[s];
int i;
 
@@ -62,14 +64,14 @@ mbim_encode_string(struct mbim_string *str, char *in)
return -1;
 
str->offset = htole32(s);
-   str->length = htole32(l * 2);
+   str->length = htole32(utf16_len);
+
for (i = 0; i < l; i++)
p[i * 2] = in[i];
 
return 0;
 }
 
-
 char *
 mbim_get_string(struct mbim_string *str, char *in)
 {
-- 
2.35.1


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


Re: [PATCH] umbim: fix invalid mbim message string encoding

2022-05-10 Thread Daniel Danzberger
On Tue, 2022-05-10 at 12:57 +0200, Bjørn Mork wrote:
>     Unless otherwise specified, all strings use UNICODE UTF-16LE
>     encodings limited to characters from the Basic Multilingual
>     Plane. Strings shall not be terminated by a NULL character.
> 
> > +   /* convert to utf-16 little endian */
> > for (i = 0; i < l; i++)
> > -   p[i * 2] = in[i];
> > +   p[i * 2] = htole16(in[i]);
> >  
> > return 0;
> >  }
> 
> 
> This new code is buggy.  It fails on BE and makes no difference on
> LE. Both p and in are byte arrays. The byte you write into p on a BE
> system will be aither 0x00 or 0xff depending on the MSB of in[i].

True, I will remove that le16 conversion part and retest.
> 
> The previous code was sort of correct, assuming that the input is mostly
> ascii mapping to the same value in unicode. Ideally we should do real
> utf16le conversion of the input. But then someone has to decide if the
> input is utf8 or something else first.  And you need a real utf16
> implementation.  Not sure it's worth it.  Did you ever see an operator
> use a non-ascii APN, username, password or pin code?
Agree, it's best for now to just leave it as is.

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


[PATCH] umbim: fix invalid mbim message string encoding

2022-05-10 Thread Daniel Danzberger
Strings in mbim messages have to follow these formatting rules:
 - 4 byte alignment, padded if not.
 - utf-16 little endian.

Fixes:
 - mbim connect fails with more than 1 string parameter (apn/user/pass)
   when they are not 4 byte aligned.

Signed-off-by: Daniel Danzberger 
---
 mbim-msg.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/mbim-msg.c b/mbim-msg.c
index 5ec04f4..8465091 100644
--- a/mbim-msg.c
+++ b/mbim-msg.c
@@ -53,8 +53,10 @@ mbim_add_payload(uint8_t len)
 int
 mbim_encode_string(struct mbim_string *str, char *in)
 {
-   int l = strlen(in);
-   int s = mbim_add_payload(l * 2);
+   const int l = strlen(in);
+   const int utf16_len = l * 2;
+   const int pad_len = utf16_len % 4;
+   const int s = mbim_add_payload(utf16_len + pad_len);
uint8_t *p = _buffer[s];
int i;
 
@@ -62,14 +64,15 @@ mbim_encode_string(struct mbim_string *str, char *in)
return -1;
 
str->offset = htole32(s);
-   str->length = htole32(l * 2);
+   str->length = htole32(utf16_len);
+
+   /* convert to utf-16 little endian */
for (i = 0; i < l; i++)
-   p[i * 2] = in[i];
+   p[i * 2] = htole16(in[i]);
 
return 0;
 }
 
-
 char *
 mbim_get_string(struct mbim_string *str, char *in)
 {
-- 
2.35.1


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


Re: Unknown licensing terms for binary blobs [Was: Re: [PATCH 1/2] firmware: Add cavium CPT hardware crypto firmware]

2022-02-19 Thread Daniel Danzberger
On Sat, 2022-02-19 at 20:21 +0100, Petr Štetiar wrote:
> Hauke Mehrtens  [2021-05-22 20:31:27]:
> 
> Hi Daniel, Tim,
> 
> > On 4/18/21 9:46 AM, Daniel Danzberger wrote:
> > > The firmware consists of 2 images:
> > >   - cpt8x-mc-ae.out
> > >   - cpt8x-mc-se.out
> > > 
> > > Both are required and requests by the kernel module 'cptpf'
> > > (drivers/crypto/cavium/cpt) to provide hardware crpyto support
> > > on cavium platforms like the octeontx
> > > 
> > > Signed-off-by: Daniel Danzberger 
> > > ---
> > >   package/firmware/cavium-cpt/Makefile | 52
> > > 
> > >   1 file changed, 52 insertions(+)
> > >   create mode 100644 package/firmware/cavium-cpt/Makefile
> > Hi,
> > 
> > Under which license are these two files distributed?
> 
> do you've have an idea? Thanks!
Hi,

I couldn't find any information about the license, but I played around
with this hardware crypto on some devices a while ago and found that
they are performing terrible :)
Much worse than the CPU. Gateworks even notices this on their website:
http://trac.gateworks.com/wiki/linux/encryption#PerformaceComparisons
http://trac.gateworks.com/wiki/newport/encryption

With that in mind I think my 2 original patches can be dropped.


> 
> Cheers,
> 
> Petr
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


[PATCH] nftables: install libnftables to staging dir

2021-10-04 Thread Daniel Danzberger
Makes libnftables library and headers available for other packages.

Signed-off-by: Daniel Danzberger 
---
 package/network/utils/nftables/Makefile | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/network/utils/nftables/Makefile 
b/package/network/utils/nftables/Makefile
index 7830596e84..e63e1f8cfb 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nftables
 PKG_VERSION:=0.9.6
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
@@ -61,6 +61,12 @@ endif
 TARGET_CFLAGS += -flto
 TARGET_LDFLAGS += -flto
 
+define Build/InstallDev
+   $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
+   $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+   $(CP) $(PKG_INSTALL_DIR)/usr/include/nftables $(1)/usr/include/
+endef
+
 define Package/nftables/install/Default
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/
-- 
2.33.0


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


[PATCH] nftables: install libnftables to staging dir

2021-09-28 Thread Daniel Danzberger
Makes libnftables library and headers available for other packages.

Signed-off-by: Daniel Danzberger 
---
 package/network/utils/nftables/Makefile | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/utils/nftables/Makefile 
b/package/network/utils/nftables/Makefile
index 7830596e84..32384aca0e 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -61,6 +61,12 @@ endif
 TARGET_CFLAGS += -flto
 TARGET_LDFLAGS += -flto
 
+define Build/InstallDev
+   $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
+   $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+   $(CP) $(PKG_INSTALL_DIR)/usr/include/nftables $(1)/usr/include/
+endef
+
 define Package/nftables/install/Default
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/
-- 
2.33.0


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


Re: [PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-12 Thread Daniel Danzberger
On Sat, 2021-09-04 at 15:18 +0200, Daniel Danzberger wrote:
> > > 
> > > > +CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y
> > > 
> > > CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y might not be a performance
> > > win,
> > > especially with only 1 GiB of RAM. Should be measured, otherwise
> > > MADVISE should be selected instead.
> > Same here, it was selected in the 5.4 kernel config and I have only
> > run
> > tested with this option so far.
> > Let me do some benchmarking with MADVISE before we continue here
> > ...
> Looks like none of the processes running even gets a huge page:
> --
> root@OpenWrt:~# grep AnonHugePages /proc/meminfo 
> AnonHugePages: 0 kB
> root@OpenWrt:~# 
> --
> Even my test tool that just allocs one 8MB block doesn't get one.
> Looks like CONFIG_TRANSPARENT_HUGEPAGE isn't working on this
> platform.
After further testing, huge pages only get used when memory is
allocated >= 2MB with mmap() on arm64.
Unlike on x86 where processes get a huge page when using malloc() or
mmap() >= 2MB.
So I think we can safely keep CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y like
in 5.4



-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans


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


[PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-12 Thread Daniel Danzberger
Changes from 5.4 to 5.10:
-
 - patches from 5.4 are all upstream for 5.10 execpt for
   0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

 - disable block device data integrity (DIF/DIX/T10) in default config
   (CONFIG_BLK_DEV_INTEGRITY)
   This feature is only supported by:
 - Enterprise SAS/SCSI HBAs and Disks
 - Software raid
 - NVMEs with metadata capabilities (most don't have this)
   None of which are part of any octeontx boards.

 - arm64 TEXT_OFFSET (0x8) has been removed after 5.4
   This will break Uimages with kernel load addresses that aren't 2MiB
   aligned any longer. Resulting in the kernel silently fail to boot.
   For Gatworks newport boards for example, the uimage kernel load
   and execute address is 0x2008. These need to be changed to
   0x2000 when running kernels beyond 5.4.

Tested-on: Gateworks Newport GW64xx

Signed-off-by: Daniel Danzberger 
---
 target/linux/octeontx/Makefile|   1 +
 target/linux/octeontx/config-5.10 | 423 ++
 ...r-Gateworks-PLX-PEX860x-switch-with-.patch |  59 +++
 3 files changed, 483 insertions(+)
 create mode 100644 target/linux/octeontx/config-5.10
 create mode 100644 
target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile
index c30799b744..44bbc76a43 100644
--- a/target/linux/octeontx/Makefile
+++ b/target/linux/octeontx/Makefile
@@ -10,6 +10,7 @@ BOARDNAME:=Octeon-TX
 FEATURES:=targz pcie gpio rtc usb fpu
 
 KERNEL_PATCHVER:=5.4
+KERNEL_TESTING_PATCHVER:=5.10
 
 define Target/Description
Build images for Octeon-TX CN80XX/CN81XX based boards
diff --git a/target/linux/octeontx/config-5.10 
b/target/linux/octeontx/config-5.10
new file mode 100644
index 00..6e9cdc1de2
--- /dev/null
+++ b/target/linux/octeontx/config-5.10
@@ -0,0 +1,423 @@
+CONFIG_64BIT=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HIBERNATION_HEADER=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=33
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_PROC_KCORE_TEXT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_STACKWALK=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_THUNDER=y
+CONFIG_ARM64=y
+CONFIG_ARM64_4K_PAGES=y
+CONFIG_ARM64_CNP=y
+CONFIG_ARM64_CRYPTO=y
+CONFIG_ARM64_ERRATUM_1165522=y
+CONFIG_ARM64_ERRATUM_1286807=y
+CONFIG_ARM64_ERRATUM_819472=y
+CONFIG_ARM64_ERRATUM_824069=y
+CONFIG_ARM64_ERRATUM_826319=y
+CONFIG_ARM64_ERRATUM_827319=y
+CONFIG_ARM64_ERRATUM_843419=y
+CONFIG_ARM64_HW_AFDBM=y
+CONFIG_ARM64_MODULE_PLTS=y
+CONFIG_ARM64_PAGE_SHIFT=12
+CONFIG_ARM64_PAN=y
+CONFIG_ARM64_PA_BITS=48
+CONFIG_ARM64_PA_BITS_48=y
+CONFIG_ARM64_PTR_AUTH=y
+CONFIG_ARM64_SVE=y
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_ARM64_UAO=y
+CONFIG_ARM64_VA_BITS=48
+# CONFIG_ARM64_VA_BITS_39 is not set
+CONFIG_ARM64_VA_BITS_48=y
+CONFIG_ARM64_VHE=y
+CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
+CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
+CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPUIDLE=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V2M=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_PSCI_FW=y
+CONFIG_ARM_SBSA_WATCHDOG=y
+CONFIG_ATA=y
+# CONFIG_ATA_SFF is not set
+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
+CONFIG_BALLOON_COMPACTION=y
+CONFIG_BLK_DEV_BSG=y
+CONFIG_BLK_DEV_BSGLIB=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_MQ_VIRTIO=y
+CONFIG_BLK_PM=y
+CONFIG_BLK_SCSI_REQUEST=y
+CONFIG_CAVIUM_ERRATUM_22375=y
+CONFIG_CAVIUM_ERRATUM_23144=y
+CONFIG_CAVIUM_ERRATUM_23154=y
+CONFIG_CAVIUM_ERRATUM_27456=y
+CONFIG_CAVIUM_ERRATUM_30115=y
+CONFIG_CAVIUM_TX2_ERRATUM_219=y
+CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMA=y
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+CONFIG_CMA_SIZE_MBYTES=16
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+CONFIG_COMMON_CLK=y
+CONFIG_COMMON_CLK_CS2000_CP=y
+# CONFIG_COMPAT_32BIT_TIME is not set
+CONFIG_CONFIGFS_FS=y
+CONFIG_CONTIG_ALLOC=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRASH_CORE=y
+CONFIG_CRASH_DUMP=y
+CONFIG_CRC16=y
+CONFIG_CRC7=y
+CONFIG_CRC_ITU_T=y
+CONFIG_CRC_T10DIF=y
+CONFIG_CRYPTO_AES_ARM64=y
+CONFIG_CRYPTO_AES_ARM64_CE=y
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
+CONFIG_CRYPTO_ANSI_CPRNG=y
+CONFIG_CRYPTO_CRC32=y
+CONFIG_CRYPTO_CRC32C=y
+CONFIG_CRYPTO_CRCT10DIF=y
+CONFIG_CRYPTO_CRYPTD=y
+CONFIG_CRYPTO_DRBG=y

Re: [PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-06 Thread Daniel Danzberger
On Fri, 2021-09-03 at 15:08 +0200, Daniel Danzberger wrote:
> 
> > 
> > > +CONFIG_HZ=250
> > 
> > Why 250 Hz? Does the 100 Hz all other targets use cause any
> > measurable
> > increase in latency?
> > [snipped]
> I did not notice this changed. The config I made for 5.10 was before
> your commit 3326b5e75c277b4fac21bffd2085df4aa40d2775 which changed
> the
> default frequency to 100 Hz.
> There should be no issue with 100 Hz on octecontx, but I will confirm
> this with new builds on my test devices.
Confirmed. No issues here with 100 Hz.
> 
> > 
> > > +CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y
> > 
> > CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y might not be a performance
> > win,
> > especially with only 1 GiB of RAM. Should be measured, otherwise
> > MADVISE should be selected instead.
> Same here, it was selected in the 5.4 kernel config and I have only
> run
> tested with this option so far.
> Let me do some benchmarking with MADVISE before we continue here ...
Looks like none of the processes running even gets a huge page:
--
root@OpenWrt:~# grep AnonHugePages /proc/meminfo 
AnonHugePages: 0 kB
root@OpenWrt:~# 
--
Even my test tool that just allocs one 8MB block doesn't get one.
Looks like CONFIG_TRANSPARENT_HUGEPAGE isn't working on this platform.

> > 
> > Best regards,
> > Rui
> > 
> 


-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans


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


Re: [PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-03 Thread Daniel Danzberger
> 
> [snipped]
> 
> > +CONFIG_EXT4_FS=y
> > +CONFIG_EXT4_FS_POSIX_ACL=y
> > +CONFIG_F2FS_FS=y
> > +CONFIG_FANOTIFY=y
> > +CONFIG_FAT_FS=y
> 
> Do all of these filesystems have to be built-in? We have config
> options for them.

I don't think so.
I took the kernel 5.4 config as a template, because I didn't want to
break things for others when upgrading to 5.10.
But I agree, there is no reason for a default buil-in.
> 
> [snipped]
> 
> > +CONFIG_HZ=250
> 
> Why 250 Hz? Does the 100 Hz all other targets use cause any
> measurable
> increase in latency?
> [snipped]
I did not notice this changed. The config I made for 5.10 was before
your commit 3326b5e75c277b4fac21bffd2085df4aa40d2775 which changed the
default frequency to 100 Hz.
There should be no issue with 100 Hz on octecontx, but I will confirm
this with new builds on my test devices.

> 
> > +CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y
> 
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y might not be a performance win,
> especially with only 1 GiB of RAM. Should be measured, otherwise
> MADVISE should be selected instead.
Same here, it was selected in the 5.4 kernel config and I have only run
tested with this option so far.
Let me do some benchmarking with MADVISE before we continue here ...
> 
> Best regards,
> Rui
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans


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


[PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-03 Thread Daniel Danzberger
Changes from 5.4 to 5.10:
-
 - patches from 5.4 are all upstream for 5.10 execpt for
   0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

 - disable block device data integrity (DIF/DIX/T10) in default config
   (CONFIG_BLK_DEV_INTEGRITY)
   This feature is only supported by:
 - Enterprise SAS/SCSI HBAs and Disks
 - Software raid
 - NVMEs with metadata capabilities (most don't have this)
   None of which are part of any octeontx boards.

 - arm64 TEXT_OFFSET (0x8) has been removed after 5.4
   This will break Uimages with kernel load addresses that aren't 2MiB
   aligned any longer. Resulting in the kernel silently fail to boot.
   For Gatworks newport boards for example, the uimage kernel load
   and execute address is 0x2008. These need to be changed to
   0x2000 when running kernels beyond 5.4.

Tested-on: Gateworks Newport GW64xx

Signed-off-by: Daniel Danzberger 
---
 target/linux/octeontx/Makefile|   1 +
 target/linux/octeontx/config-5.10 | 430 ++
 ...r-Gateworks-PLX-PEX860x-switch-with-.patch |  59 +++
 3 files changed, 490 insertions(+)
 create mode 100644 target/linux/octeontx/config-5.10
 create mode 100644 
target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile
index c30799b744..44bbc76a43 100644
--- a/target/linux/octeontx/Makefile
+++ b/target/linux/octeontx/Makefile
@@ -10,6 +10,7 @@ BOARDNAME:=Octeon-TX
 FEATURES:=targz pcie gpio rtc usb fpu
 
 KERNEL_PATCHVER:=5.4
+KERNEL_TESTING_PATCHVER:=5.10
 
 define Target/Description
Build images for Octeon-TX CN80XX/CN81XX based boards
diff --git a/target/linux/octeontx/config-5.10 
b/target/linux/octeontx/config-5.10
new file mode 100644
index 00..8b3a7f68b2
--- /dev/null
+++ b/target/linux/octeontx/config-5.10
@@ -0,0 +1,430 @@
+CONFIG_64BIT=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HIBERNATION_HEADER=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=33
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_PROC_KCORE_TEXT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_STACKWALK=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_THUNDER=y
+CONFIG_ARM64=y
+CONFIG_ARM64_4K_PAGES=y
+CONFIG_ARM64_CNP=y
+CONFIG_ARM64_CRYPTO=y
+CONFIG_ARM64_ERRATUM_1165522=y
+CONFIG_ARM64_ERRATUM_1286807=y
+CONFIG_ARM64_ERRATUM_819472=y
+CONFIG_ARM64_ERRATUM_824069=y
+CONFIG_ARM64_ERRATUM_826319=y
+CONFIG_ARM64_ERRATUM_827319=y
+CONFIG_ARM64_ERRATUM_843419=y
+CONFIG_ARM64_HW_AFDBM=y
+CONFIG_ARM64_MODULE_PLTS=y
+CONFIG_ARM64_PAGE_SHIFT=12
+CONFIG_ARM64_PAN=y
+CONFIG_ARM64_PA_BITS=48
+CONFIG_ARM64_PA_BITS_48=y
+CONFIG_ARM64_PTR_AUTH=y
+CONFIG_ARM64_SVE=y
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_ARM64_UAO=y
+CONFIG_ARM64_VA_BITS=48
+# CONFIG_ARM64_VA_BITS_39 is not set
+CONFIG_ARM64_VA_BITS_48=y
+CONFIG_ARM64_VHE=y
+CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
+CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
+CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPUIDLE=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V2M=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_PSCI_FW=y
+CONFIG_ARM_SBSA_WATCHDOG=y
+CONFIG_ATA=y
+# CONFIG_ATA_SFF is not set
+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
+CONFIG_BALLOON_COMPACTION=y
+CONFIG_BLK_DEV_BSG=y
+CONFIG_BLK_DEV_BSGLIB=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_MQ_VIRTIO=y
+CONFIG_BLK_PM=y
+CONFIG_BLK_SCSI_REQUEST=y
+CONFIG_CAVIUM_ERRATUM_22375=y
+CONFIG_CAVIUM_ERRATUM_23144=y
+CONFIG_CAVIUM_ERRATUM_23154=y
+CONFIG_CAVIUM_ERRATUM_27456=y
+CONFIG_CAVIUM_ERRATUM_30115=y
+CONFIG_CAVIUM_TX2_ERRATUM_219=y
+CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMA=y
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+CONFIG_CMA_SIZE_MBYTES=16
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+CONFIG_COMMON_CLK=y
+CONFIG_COMMON_CLK_CS2000_CP=y
+# CONFIG_COMPAT_32BIT_TIME is not set
+CONFIG_CONFIGFS_FS=y
+CONFIG_CONTIG_ALLOC=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRASH_CORE=y
+CONFIG_CRASH_DUMP=y
+CONFIG_CRC16=y
+CONFIG_CRC7=y
+CONFIG_CRC_ITU_T=y
+CONFIG_CRC_T10DIF=y
+CONFIG_CRYPTO_AES_ARM64=y
+CONFIG_CRYPTO_AES_ARM64_CE=y
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
+CONFIG_CRYPTO_ANSI_CPRNG=y
+CONFIG_CRYPTO_CRC32=y
+CONFIG_CRYPTO_CRC32C=y
+CONFIG_CRYPTO_CRCT10DIF=y
+CONFIG_CRYPTO_CRYPTD=y
+CONFIG_CRYPTO_DRBG=y

Re: [PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-03 Thread Daniel Danzberger
Hi,

forgot that. There were some more redundand symbols. New patch is on
the way ...

On Fri, 2021-09-03 at 10:26 +0100, Rui Salvaterra wrote:
> Hi, Daniel,
> 
> On Fri, 3 Sept 2021 at 10:18, Daniel Danzberger 
> wrote:
> > 
> 
> [snipped for context]
> 
> > +CONFIG_RCU_NEED_SEGCBLIST=y
> > +CONFIG_RCU_STALL_COMMON=y
> 
> Please refresh your kernel configuration. At least these two symbols
> are part of the generic kconfigs.
> 
> Thanks,
> Rui
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans


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


[PATCH] octeontx: add linux 5.10 testing kernel support

2021-09-03 Thread Daniel Danzberger
Changes from 5.4 to 5.10:
-
 - patches from 5.4 are all upstream for 5.10 execpt for
   0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

 - disable block device data integrity (DIF/DIX/T10) in default config
   (CONFIG_BLK_DEV_INTEGRITY)
   This feature is only supported by:
 - Enterprise SAS/SCSI HBAs and Disks
 - Software raid
 - NVMEs with metadata capabilities (most don't have this)
   None of which are part of any octeontx boards.

 - arm64 TEXT_OFFSET (0x8) has been removed after 5.4
   This will break Uimages with kernel load addresses that aren't 2MiB
   aligned any longer. Resulting in the kernel silently fail to boot.
   For Gatworks newport boards for example, the uimage kernel load
   and execute address is 0x2008. These need to be changed to
   0x2000 when running kernels beyond 5.4.

Tested-on: Gateworks Newport GW64xx

Signed-off-by: Daniel Danzberger 
---
 target/linux/octeontx/Makefile|   1 +
 target/linux/octeontx/config-5.10 | 442 ++
 ...r-Gateworks-PLX-PEX860x-switch-with-.patch |  59 +++
 3 files changed, 502 insertions(+)
 create mode 100644 target/linux/octeontx/config-5.10
 create mode 100644 
target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile
index c30799b744..44bbc76a43 100644
--- a/target/linux/octeontx/Makefile
+++ b/target/linux/octeontx/Makefile
@@ -10,6 +10,7 @@ BOARDNAME:=Octeon-TX
 FEATURES:=targz pcie gpio rtc usb fpu
 
 KERNEL_PATCHVER:=5.4
+KERNEL_TESTING_PATCHVER:=5.10
 
 define Target/Description
Build images for Octeon-TX CN80XX/CN81XX based boards
diff --git a/target/linux/octeontx/config-5.10 
b/target/linux/octeontx/config-5.10
new file mode 100644
index 00..baae584300
--- /dev/null
+++ b/target/linux/octeontx/config-5.10
@@ -0,0 +1,442 @@
+CONFIG_64BIT=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HIBERNATION_HEADER=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=33
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_PROC_KCORE_TEXT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_STACKWALK=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_THUNDER=y
+CONFIG_ARM64=y
+CONFIG_ARM64_4K_PAGES=y
+CONFIG_ARM64_CNP=y
+CONFIG_ARM64_CRYPTO=y
+CONFIG_ARM64_ERRATUM_1165522=y
+CONFIG_ARM64_ERRATUM_1286807=y
+CONFIG_ARM64_ERRATUM_819472=y
+CONFIG_ARM64_ERRATUM_824069=y
+CONFIG_ARM64_ERRATUM_826319=y
+CONFIG_ARM64_ERRATUM_827319=y
+CONFIG_ARM64_ERRATUM_843419=y
+CONFIG_ARM64_HW_AFDBM=y
+CONFIG_ARM64_MODULE_PLTS=y
+CONFIG_ARM64_PAGE_SHIFT=12
+CONFIG_ARM64_PAN=y
+CONFIG_ARM64_PA_BITS=48
+CONFIG_ARM64_PA_BITS_48=y
+CONFIG_ARM64_PTR_AUTH=y
+CONFIG_ARM64_SVE=y
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_ARM64_UAO=y
+CONFIG_ARM64_VA_BITS=48
+# CONFIG_ARM64_VA_BITS_39 is not set
+CONFIG_ARM64_VA_BITS_48=y
+CONFIG_ARM64_VHE=y
+CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
+CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
+CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPUIDLE=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_GIC_V2M=y
+CONFIG_ARM_GIC_V3=y
+CONFIG_ARM_GIC_V3_ITS=y
+CONFIG_ARM_GIC_V3_ITS_PCI=y
+CONFIG_ARM_PSCI_FW=y
+CONFIG_ARM_SBSA_WATCHDOG=y
+# CONFIG_ARM_SCMI_PROTOCOL is not set
+CONFIG_ATA=y
+# CONFIG_ATA_SFF is not set
+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
+CONFIG_BALLOON_COMPACTION=y
+CONFIG_BLK_DEV_BSG=y
+CONFIG_BLK_DEV_BSGLIB=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_MQ_VIRTIO=y
+CONFIG_BLK_PM=y
+CONFIG_BLK_SCSI_REQUEST=y
+CONFIG_CAVIUM_ERRATUM_22375=y
+CONFIG_CAVIUM_ERRATUM_23144=y
+CONFIG_CAVIUM_ERRATUM_23154=y
+CONFIG_CAVIUM_ERRATUM_27456=y
+CONFIG_CAVIUM_ERRATUM_30115=y
+CONFIG_CAVIUM_TX2_ERRATUM_219=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CMA=y
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+CONFIG_CMA_SIZE_MBYTES=16
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+CONFIG_COMMON_CLK=y
+CONFIG_COMMON_CLK_CS2000_CP=y
+# CONFIG_COMPAT_32BIT_TIME is not set
+CONFIG_CONFIGFS_FS=y
+CONFIG_CONTIG_ALLOC=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRASH_CORE=y
+CONFIG_CRASH_DUMP=y
+CONFIG_CRC16=y
+CONFIG_CRC7=y
+CONFIG_CRC_ITU_T=y
+CONFIG_CRC_T10DIF=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_AES_ARM64=y
+# CONFIG_CRYPTO_AES_ARM64_BS is not set
+CONFIG_CRYPTO_AES_ARM64_CE=y
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
+# CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set

[PATCH] fstools: libblkid-tiny: install header file to include dir

2021-08-02 Thread Daniel Danzberger
Hence libblkid-tiny is a shared lib, it makes sense to install it's
header to the system incldue/ dir for other applications to use it.

Signed-off-by: Daniel Danzberger 
---
 CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 422f27d..9a87979 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,7 @@ ADD_LIBRARY(blkid-tiny SHARED
libblkid-tiny/f2fs.c
)
 INSTALL(TARGETS blkid-tiny LIBRARY DESTINATION lib)
+INSTALL(FILES libblkid-tiny/libblkid-tiny.h DESTINATION include)
 
 ADD_LIBRARY(ubi-utils STATIC
libubi/libubi.c
-- 
2.30.2


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


[PATCH] fstools: libblkid-tiny: fix invalid open syscall return check

2021-08-02 Thread Daniel Danzberger
open() returns -1 on error, not 0 (stdin).

Signed-off-by: Daniel Danzberger 
---
 libblkid-tiny/libblkid-tiny.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libblkid-tiny/libblkid-tiny.c b/libblkid-tiny/libblkid-tiny.c
index 18db4ef..6e8cd81 100644
--- a/libblkid-tiny/libblkid-tiny.c
+++ b/libblkid-tiny/libblkid-tiny.c
@@ -196,7 +196,7 @@ int probe_block(char *block, struct blkid_struct_probe *pr)
 
pr->err = -1;
pr->fd = open(block, O_RDONLY);
-   if (!pr->fd)
+   if (pr->fd == -1)
return -1;
 
for (i = 0; i < ARRAY_SIZE(idinfos); i++) {
-- 
2.30.2


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


fstools: block: No mount after reload_config confusion

2021-05-06 Thread Daniel Danzberger
Hi,

when adding a new 'mount' to /etc/config/fstab and executing
reload_config afterwards, I noticed that the new 'mount' is not mounted
automatically.
It is mounted however after reboot or executing 'block mount' manually.

Checking the block util's 'autofs start' which is invoked after a
config change event, it seems like a mount is only invoked when the
device has already been mounted:

--
blockd_notify("hotplug", pr->dev, m, pr);
if ((!m || !m->autofs) && (mp = find_mount_point(pr->dev))) {
blockd_notify("mount", pr->dev, NULL, NULL);
free(mp);
}
--

Which makes no sense to me. Shouldn't it be the other way around ?
Like so:

diff --git a/block.c b/block.c
index c6d93d1..17d33d1 100644
--- a/block.c
+++ b/block.c
@@ -1179,9 +1179,11 @@ static int main_autofs(int argc, char **argv)
continue;
 
   blockd_notify("hotplug", pr->dev, m, pr);
-  if ((!m || !m->autofs) && (mp = find_mount_point(pr->dev))) {
-blockd_notify("mount", pr->dev, NULL, NULL);
-free(mp);
+  if ((!m || !m->autofs)) {
+if ((mp = find_mount_point(pr->dev)))
+   free(mp);
+else
+   blockd_notify("mount", pr->dev, NULL, NULL);
 }
}
   } else {

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans


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


[PATCH] fstools: block: fix segfault on mount with no target

2021-05-04 Thread Daniel Danzberger
When a UCI fstab mount config doesn't contain a target option,
a 'block mount' call segfaults when comparing a mount's target (NULL)
to a found mount point returned by find_mount_point()

Signed-off-by: Daniel Danzberger 
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block.c b/block.c
index f094216..c6d93d1 100644
--- a/block.c
+++ b/block.c
@@ -1021,7 +1021,7 @@ static int mount_device(struct probe_info *pr, int type)
 
mp = find_mount_point(pr->dev);
if (mp) {
-   if (m && m->type == TYPE_MOUNT && strcmp(m->target, mp)) {
+   if (m && m->type == TYPE_MOUNT && m->target && 
strcmp(m->target, mp)) {
ULOG_ERR("%s is already mounted on %s\n", pr->dev, mp);
err = -1;
} else
-- 
2.30.2


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


[PATCH] package: openssl: Enable built engines per default

2021-04-22 Thread Daniel Danzberger
Automatically enable an engine in the openssl.cnf if it has been build.
Before this change, /etc/openssl.cnf had to be edited manually on the
system to enable the engine.

Signed-off-by: Daniel Danzberger 
---
 package/libs/openssl/Makefile | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 7ab4c6ccd0..d101ee3aa2 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -375,9 +375,16 @@ define Package/libopenssl/install
$(if $(CONFIG_OPENSSL_ENGINE),$(INSTALL_DIR) 
$(1)/usr/lib/$(ENGINES_DIR))
 endef
 
+define Package/libopenssl-conf/enable
+   $(if $(CONFIG_PACKAGE_libopenssl-$(2)),sed -i 
s/^\#*$(2)=$(2)/$(2)=$(2)/ $(1)/etc/ssl/openssl.cnf)
+endef
+
 define Package/libopenssl-conf/install
$(INSTALL_DIR) $(1)/etc/ssl
$(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
+   $(call Package/libopenssl-conf/enable,$(1),devcrypto)
+   $(call Package/libopenssl-conf/enable,$(1),afalg)
+   $(call Package/libopenssl-conf/enable,$(1),padlock)
 endef
 
 define Package/openssl-util/install
-- 
2.30.2


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


[PATCH 2/2] kernel: crypto: add cavium cptpf module

2021-04-18 Thread Daniel Danzberger
Provides hardware crypto support for some cavium platforms like the
octeontx. Cryptodev support is also enabled for use from userspace.

Requires 2 firmwares (cpt8x-mc-ae.out + cpt8x-mc-se.out).
Provided by those packages:
 cavium-firmware-cpt-ae
 cavium-firmware-cpt-se

Supported ciphers:
-
root@OpenWrt:/# cat /proc/crypto | grep driver
driver   : cavium-ecb-des3_ede
driver   : cavium-cbc-des3_ede
driver   : cavium-cfb-aes
driver   : cavium-ecb-aes
driver   : cavium-cbc-aes
driver   : cavium-xts-aes
-

Signed-off-by: Daniel Danzberger 
---
 package/kernel/linux/modules/crypto.mk | 21 +
 1 file changed, 21 insertions(+)

diff --git a/package/kernel/linux/modules/crypto.mk 
b/package/kernel/linux/modules/crypto.mk
index 2775239e52..3da1dcab8c 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -944,6 +944,27 @@ endef
 
 KernelPackage/crypto-sha512/tegra=$(KernelPackage/crypto-sha512/arm)
 
+define KernelPackage/crypto-hw-cavium-cpt
+  TITLE:= OcteonTX Crypto Accelerator
+  DEPENDS:= \
+   +kmod-crypto-manager \
+   +cavium-firmware-cpt-ae \
+   +cavium-firmware-cpt-se
+  KCONFIG:= \
+   CONFIG_CRYPTO_HW=y \
+   CONFIG_CRYPTO_DEV_CPT \
+   CONFIG_CRYPTO_DEV_OCTEONTX_CPT \
+   CONFIG_CAVIUM_CPT \
+
+  FILES:=$(LINUX_DIR)/drivers/crypto/cavium/cpt/cptpf.ko \
+ $(LINUX_DIR)/drivers/crypto/cavium/cpt/cptvf.ko
+  AUTOLOAD:=$(call AutoLoad,90,cptpf cptvf)
+  $(call AddDepends/crypto)
+endef
+
+$(eval $(call KernelPackage,crypto-hw-cavium-cpt))
+
+
 define KernelPackage/crypto-sha512/x86/64
   FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko
   AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3)
-- 
2.30.2


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


[PATCH 1/2] firmware: Add cavium CPT hardware crypto firmware

2021-04-18 Thread Daniel Danzberger
The firmware consists of 2 images:
 - cpt8x-mc-ae.out
 - cpt8x-mc-se.out

Both are required and requests by the kernel module 'cptpf'
(drivers/crypto/cavium/cpt) to provide hardware crpyto support
on cavium platforms like the octeontx

Signed-off-by: Daniel Danzberger 
---
 package/firmware/cavium-cpt/Makefile | 52 
 1 file changed, 52 insertions(+)
 create mode 100644 package/firmware/cavium-cpt/Makefile

diff --git a/package/firmware/cavium-cpt/Makefile 
b/package/firmware/cavium-cpt/Makefile
new file mode 100644
index 00..7a0a36d54c
--- /dev/null
+++ b/package/firmware/cavium-cpt/Makefile
@@ -0,0 +1,52 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cavium-firmware-cpt
+PKG_VERSION:=2021-04-17
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cavium-firmware-cpt-default
+  TITLE:=Cavium firmware for CPT HW crypto ($(1) part)
+  SECTION:=firmware
+  CATEGORY:=Firmware
+endef
+
+define Download/cavium-firmware-cpt-ae
+  URL:=http://dev.gateworks.com/newport/cpt/1.0.0/
+  FILE:=cpt8x-mc-ae.out
+  HASH:=39063984d5f47e997ec2f15cef87394d719501e53ed121e0373161b86e72ad22
+endef
+$(eval $(call Download,cavium-firmware-cpt-ae))
+
+define Download/cavium-firmware-cpt-se
+  URL:=http://dev.gateworks.com/newport/cpt/1.0.0/
+  FILE:=cpt8x-mc-se.out
+  HASH:=7927b69eb693b7de67a3cc867083c1f5a3f2c3c586cfa11a542e6551091f7cc7
+endef
+$(eval $(call Download,cavium-firmware-cpt-se))
+
+define Package/cavium-firmware-cpt-ae
+  $(call Package/cavium-firmware-cpt-default,ae)
+endef
+
+define Package/cavium-firmware-cpt-se
+  $(call Package/cavium-firmware-cpt-default,se)
+endef
+
+define Build/Compile
+
+endef
+
+define Package/cavium-firmware-cpt-ae/install
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DATA) $(DL_DIR)/cpt8x-mc-ae.out $(1)/lib/firmware
+endef
+
+define Package/cavium-firmware-cpt-se/install
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DATA) $(DL_DIR)/cpt8x-mc-se.out $(1)/lib/firmware
+endef
+
+$(eval $(call BuildPackage,cavium-firmware-cpt-ae))
+$(eval $(call BuildPackage,cavium-firmware-cpt-se))
-- 
2.30.2


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


[OpenWrt-Devel] [PATCH 1/2] nl80211: add htmode to iwinfo_ops

2019-12-19 Thread Daniel Danzberger
This callback shows the currently active HTMODE of the device.

Signed-off-by: Daniel Danzberger 
---
 include/iwinfo.h |  4 ++-
 iwinfo_nl80211.c | 70 
 2 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index d035c9c..5e64294 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -88,8 +88,9 @@ enum iwinfo_htmode {
IWINFO_HTMODE_VHT80  = (1 << 4),
IWINFO_HTMODE_VHT80_80   = (1 << 5),
IWINFO_HTMODE_VHT160 = (1 << 6),
+   IWINFO_HTMODE_NOHT   = (1 << 7),
 
-   IWINFO_HTMODE_COUNT  = 7
+   IWINFO_HTMODE_COUNT  = 8
 };
 
 extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
@@ -231,6 +232,7 @@ struct iwinfo_ops {
int (*mbssid_support)(const char *, int *);
int (*hwmodelist)(const char *, int *);
int (*htmodelist)(const char *, int *);
+   int (*htmode)(const char *, int *);
int (*ssid)(const char *, char *);
int (*bssid)(const char *, char *);
int (*country)(const char *, char *);
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 4b6ef91..20d75e9 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2958,6 +2958,75 @@ out:
return -1;
 }
 
+struct chan_info {
+   int width;
+   int mode;
+};
+
+static int nl80211_get_htmode_cb(struct nl_msg *msg, void *arg)
+{
+   struct nlattr **tb = nl80211_parse(msg);
+   struct nlattr *cur;
+   struct chan_info *chn = arg;
+
+   if ((cur = tb[NL80211_ATTR_CHANNEL_WIDTH]))
+   chn->width = nla_get_u32(cur);
+
+   if ((cur = tb[NL80211_ATTR_BSS_HT_OPMODE]))
+   chn->mode = nla_get_u32(cur);
+
+   return NL_SKIP;
+}
+
+static int nl80211_get_htmode(const char *ifname, int *buf)
+{
+   struct chan_info chn = { .width = 0, .mode = 0 };
+   char *res;
+   int err;
+
+   res = nl80211_phy2ifname(ifname);
+   *buf = 0;
+
+   err =  nl80211_request(res ? res : ifname,
+   NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_get_htmode_cb, );
+   if (err)
+   return -1;
+
+   switch (chn.width) {
+   case NL80211_CHAN_WIDTH_20:
+   if (chn.mode == -1)
+   *buf = IWINFO_HTMODE_VHT20;
+   else
+   *buf = IWINFO_HTMODE_HT20;
+   break;
+   case NL80211_CHAN_WIDTH_40:
+   if (chn.mode == -1)
+   *buf = IWINFO_HTMODE_VHT40;
+   else
+   *buf = IWINFO_HTMODE_HT40;
+   break;
+   case NL80211_CHAN_WIDTH_80:
+   *buf = IWINFO_HTMODE_VHT80;
+   break;
+   case NL80211_CHAN_WIDTH_80P80:
+   *buf = IWINFO_HTMODE_VHT80_80;
+   break;
+   case NL80211_CHAN_WIDTH_160:
+   *buf = IWINFO_HTMODE_VHT160;
+   break;
+   case NL80211_CHAN_WIDTH_5:
+   case NL80211_CHAN_WIDTH_10:
+   case NL80211_CHAN_WIDTH_20_NOHT:
+   *buf = IWINFO_HTMODE_NOHT;
+   break;
+   default:
+   return -1;
+   }
+
+   return 0;
+}
+
 static int nl80211_get_htmodelist(const char *ifname, int *buf)
 {
struct nl80211_modes m = { 0 };
@@ -3147,6 +3216,7 @@ const struct iwinfo_ops nl80211_ops = {
.mbssid_support   = nl80211_get_mbssid_support,
.hwmodelist   = nl80211_get_hwmodelist,
.htmodelist   = nl80211_get_htmodelist,
+   .htmode   = nl80211_get_htmode,
.mode = nl80211_get_mode,
.ssid = nl80211_get_ssid,
.bssid= nl80211_get_bssid,
-- 
2.24.0


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


Re: [OpenWrt-Devel] [PATCH 2/2] iwinfo: add current hw and ht mode to info call

2019-12-19 Thread Daniel Danzberger
On 12/19/19 11:29 AM, Hauke Mehrtens wrote:
> On 11/27/19 6:29 PM, Daniel Danzberger wrote:
>> Signed-off-by: Daniel Danzberger 
>> ---
>>  iwinfo.c | 44 
>>  1 file changed, 44 insertions(+)
>>
>> diff --git a/iwinfo.c b/iwinfo.c
>> index a76b72a..7f46e3e 100644
>> --- a/iwinfo.c
>> +++ b/iwinfo.c
> 
> This file does not exist.
This is the rpcd part of the patch. The file exists in the rpcd repository.

> 
> Hauke
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


[OpenWrt-Devel] [PATCH 2/2] ustream-ssl: mbedtls: fix ssl client verification

2019-12-08 Thread Daniel Danzberger
The ustream_ssl_update_own_cert() function should, like the name suggests, only
update the local ssl peer's own certificate and not the any of the CA's.

By overwriting the CA's certifcates when setting the own certificate, the code
broke SSL client verification.

This bug was only triggerd when:
 ustream_ssl_context_set_crt_file()
was called after
 ustream_ssl_context_add_ca_crt_file()

Signed-off-by: Daniel Danzberger 
---
 ustream-mbedtls.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
index 85bbb1c..74c27a5 100644
--- a/ustream-mbedtls.c
+++ b/ustream-mbedtls.c
@@ -182,16 +182,9 @@ static void ustream_ssl_update_own_cert(struct 
ustream_ssl_ctx *ctx)
if (!ctx->cert.version)
return;
 
-   if (!ctx->server) {
-   mbedtls_ssl_conf_ca_chain(>conf, >cert, NULL);
-   return;
-   }
-
if (!ctx->key.pk_info)
return;
 
-   if (ctx->cert.next)
-   mbedtls_ssl_conf_ca_chain(>conf, ctx->cert.next, NULL);
mbedtls_ssl_conf_own_cert(>conf, >cert, >key);
 }
 
-- 
2.24.0


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


[OpenWrt-Devel] [PATCH 1/2] ustream-ssl: mbedtls: fix net_sockets.h include warning

2019-12-08 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 ustream-mbedtls.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ustream-mbedtls.h b/ustream-mbedtls.h
index 70bd4ea..0e5988a 100644
--- a/ustream-mbedtls.h
+++ b/ustream-mbedtls.h
@@ -19,7 +19,7 @@
 #ifndef __USTREAM_POLARSSL_H
 #define __USTREAM_POLARSSL_H
 
-#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.24.0


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


[OpenWrt-Devel] [PATCH 2/2] ustream-ssl: mbedtls: fix ssl client verification

2019-12-08 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 ustream-mbedtls.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
index 85bbb1c..74c27a5 100644
--- a/ustream-mbedtls.c
+++ b/ustream-mbedtls.c
@@ -182,16 +182,9 @@ static void ustream_ssl_update_own_cert(struct 
ustream_ssl_ctx *ctx)
if (!ctx->cert.version)
return;
 
-   if (!ctx->server) {
-   mbedtls_ssl_conf_ca_chain(>conf, >cert, NULL);
-   return;
-   }
-
if (!ctx->key.pk_info)
return;
 
-   if (ctx->cert.next)
-   mbedtls_ssl_conf_ca_chain(>conf, ctx->cert.next, NULL);
mbedtls_ssl_conf_own_cert(>conf, >cert, >key);
 }
 
-- 
2.24.0


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


[OpenWrt-Devel] [PATCH] uclient: Add string error function

2019-12-05 Thread Daniel Danzberger
This add's the uclient_strerror function, which resolves and error code
to a string message.

Signed-off-by: Daniel Danzberger 
---
 uclient.c | 20 
 uclient.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/uclient.c b/uclient.c
index 1137168..9f98cbc 100644
--- a/uclient.c
+++ b/uclient.c
@@ -422,3 +422,23 @@ void __hidden uclient_backend_reset_state(struct uclient 
*cl)
cl->error_code = 0;
uloop_timeout_cancel(>timeout);
 }
+
+const char * uclient_strerror(unsigned err)
+{
+   switch (err) {
+   case UCLIENT_ERROR_UNKNOWN:
+   return "unknown error";
+   case UCLIENT_ERROR_CONNECT:
+   return "connect failed";
+   case UCLIENT_ERROR_TIMEDOUT:
+   return "timeout";
+   case UCLIENT_ERROR_SSL_INVALID_CERT:
+   return "ssl invalid cert";
+   case UCLIENT_ERROR_SSL_CN_MISMATCH:
+   return "ssl cn mismatch";
+   case UCLIENT_ERROR_MISSING_SSL_CONTEXT:
+   return "missing ssl context";
+   default:
+   return "invalid error code";
+   }
+}
diff --git a/uclient.h b/uclient.h
index e3695db..4f37364 100644
--- a/uclient.h
+++ b/uclient.h
@@ -36,6 +36,7 @@ enum uclient_error_code {
UCLIENT_ERROR_SSL_INVALID_CERT,
UCLIENT_ERROR_SSL_CN_MISMATCH,
UCLIENT_ERROR_MISSING_SSL_CONTEXT,
+   __UCLIENT_ERROR_MAX
 };
 
 union uclient_addr {
@@ -126,5 +127,6 @@ int uclient_http_redirect(struct uclient *cl);
 int uclient_http_set_ssl_ctx(struct uclient *cl, const struct ustream_ssl_ops 
*ops,
 struct ustream_ssl_ctx *ctx, bool 
require_validation);
 int uclient_http_set_address_family(struct uclient *cl, int af);
+const char *uclient_strerror(unsigned err);
 
 #endif
-- 
2.24.0


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


[OpenWrt-Devel] [PATCH 1/2] nl80211: add htmode to iwinfo_ops

2019-11-27 Thread Daniel Danzberger
This callback shows the currently active HTMODE of the device.

Signed-off-by: Daniel Danzberger 
---
 include/iwinfo.h |  4 ++-
 iwinfo_nl80211.c | 70 
 2 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index d035c9c..5e64294 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -88,8 +88,9 @@ enum iwinfo_htmode {
IWINFO_HTMODE_VHT80  = (1 << 4),
IWINFO_HTMODE_VHT80_80   = (1 << 5),
IWINFO_HTMODE_VHT160 = (1 << 6),
+   IWINFO_HTMODE_NOHT   = (1 << 7),
 
-   IWINFO_HTMODE_COUNT  = 7
+   IWINFO_HTMODE_COUNT  = 8
 };
 
 extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
@@ -231,6 +232,7 @@ struct iwinfo_ops {
int (*mbssid_support)(const char *, int *);
int (*hwmodelist)(const char *, int *);
int (*htmodelist)(const char *, int *);
+   int (*htmode)(const char *, int *);
int (*ssid)(const char *, char *);
int (*bssid)(const char *, char *);
int (*country)(const char *, char *);
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 4b6ef91..36f1da2 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2958,6 +2958,75 @@ out:
return -1;
 }
 
+struct chan_info {
+   int width;
+   int mode;
+};
+
+static int nl80211_get_htmode_cb(struct nl_msg *msg, void *arg)
+{
+   struct nlattr **tb = nl80211_parse(msg);
+   struct nlattr *cur;
+   struct chan_info *chn = arg;
+
+   if ((cur = tb[NL80211_ATTR_CHANNEL_WIDTH]))
+   chn->width = nla_get_u32(cur);
+
+   if ((cur = tb[NL80211_ATTR_BSS_HT_OPMODE]))
+   chn->mode = nla_get_u32(cur);
+
+   return NL_SKIP;
+}
+
+static int nl80211_get_htmode(const char *ifname, int *buf)
+{
+   struct chan_info chn = { .width = 0, .mode = 0 };
+   char *res;
+   int err;
+
+   res = nl80211_phy2ifname(ifname);
+   *buf = 0;
+
+   err =  nl80211_request(res ? res : ifname,
+   NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_get_htmode_cb, );
+   if (err)
+   return -1;
+
+   switch (chn.width) {
+   case NL80211_CHAN_WIDTH_20_NOHT:
+   *buf = IWINFO_HTMODE_NOHT;
+   break;
+   case NL80211_CHAN_WIDTH_20:
+   if (chn.mode == -1)
+   *buf = IWINFO_HTMODE_VHT20;
+   else
+   *buf = IWINFO_HTMODE_HT20;
+   break;
+   case NL80211_CHAN_WIDTH_40:
+   if (chn.mode == -1)
+   *buf = IWINFO_HTMODE_VHT40;
+   else
+   *buf = IWINFO_HTMODE_HT40;
+   break;
+   case NL80211_CHAN_WIDTH_80:
+   *buf = IWINFO_HTMODE_VHT80;
+   break;
+   case NL80211_CHAN_WIDTH_80P80:
+   *buf = IWINFO_HTMODE_VHT80_80;
+   break;
+   case NL80211_CHAN_WIDTH_160:
+   *buf = IWINFO_HTMODE_VHT160;
+   break;
+   case NL80211_CHAN_WIDTH_5:
+   case NL80211_CHAN_WIDTH_10:
+   default:
+   break;
+   }
+
+   return 0;
+}
+
 static int nl80211_get_htmodelist(const char *ifname, int *buf)
 {
struct nl80211_modes m = { 0 };
@@ -3147,6 +3216,7 @@ const struct iwinfo_ops nl80211_ops = {
.mbssid_support   = nl80211_get_mbssid_support,
.hwmodelist   = nl80211_get_hwmodelist,
.htmodelist   = nl80211_get_htmodelist,
+   .htmode   = nl80211_get_htmode,
.mode = nl80211_get_mode,
.ssid = nl80211_get_ssid,
.bssid= nl80211_get_bssid,
-- 
2.24.0.rc1


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


[OpenWrt-Devel] [PATCH 2/2] iwinfo: add current hw and ht mode to info call

2019-11-27 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 iwinfo.c | 44 
 1 file changed, 44 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index a76b72a..7f46e3e 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -290,6 +290,48 @@ rpc_iwinfo_call_hwmodes(const char *name)
}
 }
 
+static void rpc_iwinfo_call_hw_ht_mode()
+{
+   const char *hwmode_str;
+   const char *htmode_str;
+   int32_t htmode = 0;
+
+   if (iw->htmode(ifname, ))
+   return;
+
+   switch (htmode) {
+   case IWINFO_HTMODE_HT20:
+   htmode_str = "HT20";
+   hwmode_str = "n";
+   break;
+   case IWINFO_HTMODE_HT40:
+   htmode_str = "HT40";
+   hwmode_str = "n";
+   break;
+   case IWINFO_HTMODE_VHT80:
+   htmode_str = "VHT80";
+   hwmode_str = "ac";
+   break;
+   case IWINFO_HTMODE_VHT80_80:
+   htmode_str = "VHT80+80";
+   hwmode_str = "ac";
+   break;
+   case IWINFO_HTMODE_VHT160:
+   htmode_str = "VHT160";
+   hwmode_str = "ac";
+   break;
+   case IWINFO_HTMODE_NOHT:
+   htmode_str = "20";
+   hwmode_str = "a/g";
+   break;
+   default:
+   htmode_str = hwmode_str = "unknown";
+   break;
+   }
+   blobmsg_add_string(, "hwmode", hwmode_str);
+   blobmsg_add_string(, "htmode", htmode_str);
+}
+
 static void
 rpc_iwinfo_call_str(const char *name, int (*func)(const char *, char *))
 {
@@ -341,6 +383,8 @@ rpc_iwinfo_info(struct ubus_context *ctx, struct 
ubus_object *obj,
rpc_iwinfo_call_htmodes("htmodes");
rpc_iwinfo_call_hwmodes("hwmodes");
 
+   rpc_iwinfo_call_hw_ht_mode();
+
c = blobmsg_open_table(, "hardware");
rpc_iwinfo_call_hardware_id("id");
rpc_iwinfo_call_str("name", iw->hardware_name);
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 0/2] iwinfo/rpcd: add current hw and ht mode to info call

2019-11-27 Thread Daniel Danzberger
These 2 patches extend the rpcd's iwinfo 'info' call with the current ht/hwmode.
Currently this call only shows the ht/hwmode capabilities, but not the 
currenlty set modes on the phy.

Patch 1 (iwinfo): Adds htmode callback to libiwinfo
Patch 2 (rpcd)  : Calls the htmode callback on info

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


[OpenWrt-Devel] [PATCH] ipq40xx: wpj419: use reset-gpios property for phy reset

2019-11-06 Thread Daniel Danzberger
The old GPIO based phy reset (phy-reset-gpio) will be removed form
the ipq40xx mdio driver in the future.

Signed-off-by: Daniel Danzberger 
---
 .../files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts 
b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
index b6eb99278b..e75d07606a 100644
--- a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
+++ b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
@@ -236,9 +236,10 @@
 
mdio@9 {
status = "okay";
-   phy-reset-gpio = < 47 0>;
pinctrl-0 = <_pins>;
pinctrl-names = "default";
+   reset-gpios = < 47 GPIO_ACTIVE_LOW>;
+   reset-delay-us = <5000>;
};
 
ess-psgmii@98000 {
-- 
2.24.0.rc1


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


[OpenWrt-Devel] [PATCH 1/1] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-11-01 Thread Daniel Danzberger
This device contains 2 flash devices. One NOR (32M) and one NAND (128M).
U-boot and caldata are on the NOR, the firmware on the NAND.

SoC:IPQ4019
CPU:4x 710MHz ARMv7
RAM:256MB
FLASH:  NOR:32MB NAND:128MB
ETH:2x GMAC Gigabit
POE:802.3 af/at POE, IEEE802.3af/IEEE802.3at(48-56V)
WIFI:   1x 2.4Ghz Atheros qca4019 2x2 MU-MIMO
1x 5.0Ghz Atheros qca4019 2x2 MU-MIMO
USB:1x 3.0
PCI:1x Mini PCIe
SIM:1x Slot
SD: 1x MicroSD slot
BTN:Reset
LED:- Power
- Ethernet
UART:  1x Serial Port 4 Pin Connector (UART)
   1x Serial Port 6 Pin Connector (High Speed UART)
POWER: 12V 2A

Installation

Initial flashing can only be done via u-boot using the following commands:

tftpboot openwrt-ipq40xx-generic-compex_wpj419-squashfs-nand-factory.ubi
nand erase.chip; nand write ${fileaddr} 0x0 ${filesize}
res

Signed-off-by: Daniel Danzberger 
---
 .../ipq40xx/base-files/etc/board.d/02_network |   1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |   2 +
 .../base-files/lib/upgrade/platform.sh|   3 +
 .../arch/arm/boot/dts/qcom-ipq4019-wpj419.dts | 374 ++
 target/linux/ipq40xx/image/Makefile   |  14 +
 .../901-arm-boot-add-dts-files.patch  |   3 +-
 6 files changed, 396 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts

diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network 
b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 25402b7eb4..dafd83234e 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -48,6 +48,7 @@ ipq40xx_setup_interfaces()
ucidef_set_interface_lan "eth0"
;;
avm,fritzrepeater-3000|\
+   compex,wpj419|\
compex,wpj428)
ucidef_set_interface_lan "eth0 eth1"
;;
diff --git 
a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 2336ef3c7b..d4e4cc49ec 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -70,6 +70,7 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
+   compex,wpj419 |\
compex,wpj428 |\
engenius,eap1300 |\
openmesh,a42 |\
@@ -133,6 +134,7 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
+   compex,wpj419 |\
compex,wpj428 |\
engenius,eap1300 |\
openmesh,a42 |\
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index 3445f2b50f..96f865c67e 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -73,6 +73,9 @@ platform_do_upgrade() {
CI_KERNPART="linux"
nand_do_upgrade "$1"
;;
+   compex,wpj419)
+   nand_do_upgrade "$1"
+   ;;
linksys,ea6350v3 |\
linksys,ea8300)
platform_do_upgrade_linksys "$1"
diff --git 
a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts 
b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
new file mode 100644
index 00..b6eb99278b
--- /dev/null
+++ b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
@@ -0,0 +1,374 @@
+/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019, Nguyen Dinh Phi 
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PR

[OpenWrt-Devel] [PATCH 0/1] ipq40xx: Add new device Compex WPJ419

2019-11-01 Thread Daniel Danzberger
Changes since the last PR:
- previous 2 patches have been dropped.
- spi-nand flash driver is used instead of the old mt29f.
- reboot hang problem is fixed by using the 'broken-flash-reset' dts property.
- u-boot-env partition is no longer read-only.
- bootargs are appended in the dts file and no longer need to be set in the 
bootloader.
- style and naming issues have been resovled.
- drop msm bus header and dts file.
- fix sysupgrade, add nand flash handler for wpj419
- Use only 64MB of the nand flash, because the bootloader expects the
  ubi part to be only 64MB. This is due to the old mt29f driver, whcih
  detected the flash with only 64MB instread of 128MB.

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


Re: [OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-31 Thread Daniel Danzberger
It turned out that the wifi wasn't working because of a missmatch in the mtd
"art" partition naming. The ath10k caldata hotplug script was expecting it named
"0:ART" instead of "art".
Wifi seems to work fine now.
I will drop those files in the next PR.

On 10/31/19 1:12 PM, Robert Marko wrote:
> On Thu, 31 Oct 2019 at 13:10, Daniel Danzberger  wrote:
>>
>> Hi Jeff,
>>>
>>>  .../arch/arm/boot/dts/qcom-ipq4019-bus.dtsi   | 1142 +
>>>  .../include/dt-bindings/msm/msm-bus-ids.h |  869 +
>>>
>>> The sudden appearance of a need the MSM bus and its IDs worries me.
>>>
>>> With 25 devices already on the ipq40xx platform without them, it feels
>>> like something is missing if they are needed by this one.
>>
>> I already tried it without those files, but the wifi won't get detected in 
>> that
>> case.
> That is because you are trying to reuse QSDK DTS, this wont wont
> neither its supported.
> You need to convert it to OpenWrt/Upstream kernel style and bindings.
> There are lot of examples in ipq40xx already.
>>
>>>
>>>
>>>> diff --git a/target/linux/ipq40xx/config-4.19 
>>>> b/target/linux/ipq40xx/config-4.19
>>>> index 8948b73ff7..3ee921abed 100644
>>>> --- a/target/linux/ipq40xx/config-4.19
>>>> +++ b/target/linux/ipq40xx/config-4.19
>>>> @@ -303,6 +303,9 @@ CONFIG_MTD_NAND_ECC=y
>>>>   CONFIG_MTD_NAND_QCOM=y
>>>>   CONFIG_MTD_SPI_NAND=y
>>>>   CONFIG_MTD_SPI_NOR=y
>>>> +CONFIG_MTD_SPINAND_MT29F=y
>>>> +CONFIG_MTD_SPINAND_GIGADEVICE=y
>>>> +CONFIG_MTD_SPINAND_ONDIEECC=y
>>>
>>>
>>> The CONFIG_SPINAND_* additions are not required for upstream SPI-NAND
>>>
>>>
>>>>   CONFIG_MTD_SPLIT_FIRMWARE=y
>>>>   CONFIG_MTD_SPLIT_FIT_FW=y
>>>>   CONFIG_MTD_UBI=y
>>>>
>>>> [...]
>>>>
>>>> diff --git
>>>> a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>> new file mode 100644
>>>> index 00..5553bbd166
>>>> --- /dev/null
>>>> +++ 
>>>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>> @@ -0,0 +1,371 @@
>>>> +/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
>>>> + * Copyright (c) 2019, Nguyen Dinh Phi 
>>>> + *
>>>> + * Permission to use, copy, modify, and/or distribute this software for 
>>>> any
>>>> + * purpose with or without fee is hereby granted, provided that the above
>>>> + * copyright notice and this permission notice appear in all copies.
>>>> + *
>>>> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 
>>>> WARRANTIES
>>>> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
>>>> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
>>>> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
>>>> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
>>>> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
>>>> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>>>> + *
>>>> + */
>>>> +
>>>>
>>>> [...]
>>>>
>>>> +
>>>> +spi_0: spi@78b5000 {
>>>> +pinctrl-0 = <_0_pins>;
>>>> +pinctrl-names = "default";
>>>> +status = "okay";
>>>> +cs-gpios = < 12 GPIO_ACTIVE_HIGH>, < 41 
>>>> GPIO_ACTIVE_HIGH>;
>>>> +num-cs = <2>;
>>>> +
>>>> +m25p80@0 {
>>>> +#address-cells = <1>;
>>>> +#size-cells = <1>;
>>>> +reg = <0>;
>>>> +linux,modalias = "m25p80", "n25q128a11";
>>>> +compatible = "jedec,spi-nor", "n25q128a11";
>>>> +spi-max-frequency = <2400>;
>>>
>>>
>>> I don't think you need linux,modalias here, nor the chip type in the 
>>> compatible
>>> line.
>>> I believe that the f

Re: [OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-31 Thread Daniel Danzberger
  reg = <0x0c 0x01>;
>> +    read-only;
>> +    };
> 
> 
> Someone may rip on you for capitalization of labels. (I'm not a committer.)
> 
> 
>> +
>> +    partition@d {
>> +    label = "0:DDRPARAMS";
>> +    reg = <0x0d 0x01>;
>> +    read-only;
>> +    };
>> +
>> +    partition@e {
>> +    label = "u-boot-env";
>> +    reg = <0x0e 0x01>;
>> +    read-only;
>> +    };
> 
> 
> U-Boot environment may want/need to be writable
> 
> 
>> +
>> +    partition@f {
>> +    label = "u-boot";
>> +    reg = <0x0f 0x08>;
>> +    read-only;
>> +    };
>> +
>> +    partition@17 {
>> +    label = "art";
>> +    reg = <0x17 0x01>;
>> +    read-only;
>> +    };
>> +    };
>> +    };
>> +
>> +    mt29f@1 {
>> +    #address-cells = <1>;
>> +    #size-cells = <1>;
>> +    reg = <1>;
>> +    status = "okay";
>> +    compatible = "spinand,mt29f";
>> +    spi-max-frequency = <2400>;
> 
> 
> Same comment on "mt29f" vs. something generic and descriptive.
> 
> 
> Converting to the upstream SPI-NAND driver here should be as simple as
> 
>     compatible = "spi-nand";
> 
> 
> 
>> +
>> +    partitions {
>> +    compatible = "fixed-partitions";
>> +
>> +    partition@0 {
>> +    label = "ubi";
>> +    reg = <0x000 0x800>;
>> +    };
>> +    };
>> +    };
>> +    };
>> +
>> [...]
> 
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


Re: [OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-31 Thread Daniel Danzberger
Well, that makes sense and now it works :)
I am just wondering why it has been working before with the other driver.

On 10/31/19 11:30 AM, Robert Marko wrote:
> On Thu, 31 Oct 2019 at 11:30, Daniel Danzberger  wrote:
>>
>> I am already using 'ubi.mtd=rootfs root=/dev/ubiblock0_1', which has worked 
>> before
> Well this is the issue, your ubi.mtd needs to be ubi.mtd=ubi
>>
>> On 10/31/19 11:26 AM, Robert Marko wrote:
>>> On Thu, 31 Oct 2019 at 11:25, Daniel Danzberger  wrote:
>>>>
>>>> On the deprecated staging driver, it somehow directly came up as "rootfs" 
>>>> and
>>>> not "ubi". Even though it has been named "ubi" in the dts.
>>>> Now the image won't boot because no rootfs is detected:
>>>>
>>>> 
>>>> [1.919001] Creating 1 MTD partitions on "spi0.1":
>>>> [1.925399] 0x-0x0800 : "ubi"
>>>> [1.940324] random: fast init done
>>>> ...
>>>> [3.170978] UBI error: cannot open mtd rootfs, error -2
>>>> [3.171027] hctosys: unable to open rtc device ([3.180802] Waiting 
>>>> for
>>>> root device /dev/ubiblock0_1...
>>> This is due to your bootargs, you can either use bootargs-append to
>>> set rootfs to ubi or change them in bootloader.
>>> This is classic on boards derived from QCA reference designs
>>>> 
>>>>
>>>>
>>>> On 10/31/19 11:19 AM, Robert Marko wrote:
>>>>> On Thu, 31 Oct 2019 at 11:17, Daniel Danzberger  wrote:
>>>>>>
>>>>>> Using 'compatible = "spi-nand"' worked and the device got detected by the
>>>>>> driver. However it won't create and "rootfs" partition like it did 
>>>>>> before.
>>>>>>
>>>>>> ---
>>>>>> [1.901930] spi-nand spi0.1: GigaDevice SPI NAND was found.
>>>>>> [1.905266] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 
>>>>>> 2048,
>>>>>> OOB size: 128
>>>>>> [1.911015] 1 fixed-partitions partitions found on MTD device spi0.1
>>>>>> [1.919010] Creating 1 MTD partitions on "spi0.1":
>>>>>> [1.925410] 0x-0x0800 : "ubi"
>>>>> It creates the partitions like set in DTS, ubi partition contains both
>>>>> kernel and rootfs.
>>>>>> ---
>>>>>>
>>>>>>
>>>>>> On 10/30/19 4:51 PM, Jeff Kletsky wrote:
>>>>>>> On 10/30/19 4:27 AM, Daniel Danzberger wrote:
>>>>>>>
>>>>>>>> This device contains 2 flash devices. One NOR (32M) and one NAND 
>>>>>>>> (128M).
>>>>>>>> U-boot and caldata are on the NOR, the firmware on the NAND.
>>>>>>>>
>>>>>>>>  SoC:IPQ4019
>>>>>>>>  CPU:4x 710MHz ARMv7
>>>>>>>>  RAM:256MB
>>>>>>>>  FLASH:  NOR:32MB NAND:128MB
>>>>>>>>
>>>>>>>> [...]
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>  .../arch/arm/boot/dts/qcom-ipq4019-bus.dtsi   | 1142 +
>>>>>>>  .../include/dt-bindings/msm/msm-bus-ids.h |  869 +
>>>>>>>
>>>>>>> The sudden appearance of a need the MSM bus and its IDs worries me.
>>>>>>>
>>>>>>> With 25 devices already on the ipq40xx platform without them, it feels
>>>>>>> like something is missing if they are needed by this one.
>>>>>>>
>>>>>>>
>>>>>>>> diff --git a/target/linux/ipq40xx/config-4.19 
>>>>>>>> b/target/linux/ipq40xx/config-4.19
>>>>>>>> index 8948b73ff7..3ee921abed 100644
>>>>>>>> --- a/target/linux/ipq40xx/config-4.19
>>>>>>>> +++ b/target/linux/ipq40xx/config-4.19
>>>>>>>> @@ -303,6 +303,9 @@ CONFIG_MTD_NAND_ECC=y
>>>>>>>>   CONFIG_MTD_NAND_QCOM=y
>>>>>>>>   CONFIG_MTD_SPI_NAND=y
>>>>>>>>   CONFIG_MTD_SPI_NOR=y
>>>>>>>> +CONFIG_MTD_SPINAND_MT29F=y
>>>>>>>> +CONFIG_MTD_SPINAND_GIGADEVICE=y

Re: [OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-31 Thread Daniel Danzberger
I am already using 'ubi.mtd=rootfs root=/dev/ubiblock0_1', which has worked 
before

On 10/31/19 11:26 AM, Robert Marko wrote:
> On Thu, 31 Oct 2019 at 11:25, Daniel Danzberger  wrote:
>>
>> On the deprecated staging driver, it somehow directly came up as "rootfs" and
>> not "ubi". Even though it has been named "ubi" in the dts.
>> Now the image won't boot because no rootfs is detected:
>>
>> 
>> [1.919001] Creating 1 MTD partitions on "spi0.1":
>> [1.925399] 0x-0x0800 : "ubi"
>> [1.940324] random: fast init done
>> ...
>> [3.170978] UBI error: cannot open mtd rootfs, error -2
>> [3.171027] hctosys: unable to open rtc device ([3.180802] Waiting for
>> root device /dev/ubiblock0_1...
> This is due to your bootargs, you can either use bootargs-append to
> set rootfs to ubi or change them in bootloader.
> This is classic on boards derived from QCA reference designs
>> 
>>
>>
>> On 10/31/19 11:19 AM, Robert Marko wrote:
>>> On Thu, 31 Oct 2019 at 11:17, Daniel Danzberger  wrote:
>>>>
>>>> Using 'compatible = "spi-nand"' worked and the device got detected by the
>>>> driver. However it won't create and "rootfs" partition like it did before.
>>>>
>>>> ---
>>>> [1.901930] spi-nand spi0.1: GigaDevice SPI NAND was found.
>>>> [1.905266] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 
>>>> 2048,
>>>> OOB size: 128
>>>> [1.911015] 1 fixed-partitions partitions found on MTD device spi0.1
>>>> [1.919010] Creating 1 MTD partitions on "spi0.1":
>>>> [1.925410] 0x-0x0800 : "ubi"
>>> It creates the partitions like set in DTS, ubi partition contains both
>>> kernel and rootfs.
>>>> ---
>>>>
>>>>
>>>> On 10/30/19 4:51 PM, Jeff Kletsky wrote:
>>>>> On 10/30/19 4:27 AM, Daniel Danzberger wrote:
>>>>>
>>>>>> This device contains 2 flash devices. One NOR (32M) and one NAND (128M).
>>>>>> U-boot and caldata are on the NOR, the firmware on the NAND.
>>>>>>
>>>>>>  SoC:IPQ4019
>>>>>>  CPU:4x 710MHz ARMv7
>>>>>>  RAM:256MB
>>>>>>  FLASH:  NOR:32MB NAND:128MB
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>>
>>>>>
>>>>>  .../arch/arm/boot/dts/qcom-ipq4019-bus.dtsi   | 1142 +
>>>>>  .../include/dt-bindings/msm/msm-bus-ids.h |  869 +
>>>>>
>>>>> The sudden appearance of a need the MSM bus and its IDs worries me.
>>>>>
>>>>> With 25 devices already on the ipq40xx platform without them, it feels
>>>>> like something is missing if they are needed by this one.
>>>>>
>>>>>
>>>>>> diff --git a/target/linux/ipq40xx/config-4.19 
>>>>>> b/target/linux/ipq40xx/config-4.19
>>>>>> index 8948b73ff7..3ee921abed 100644
>>>>>> --- a/target/linux/ipq40xx/config-4.19
>>>>>> +++ b/target/linux/ipq40xx/config-4.19
>>>>>> @@ -303,6 +303,9 @@ CONFIG_MTD_NAND_ECC=y
>>>>>>   CONFIG_MTD_NAND_QCOM=y
>>>>>>   CONFIG_MTD_SPI_NAND=y
>>>>>>   CONFIG_MTD_SPI_NOR=y
>>>>>> +CONFIG_MTD_SPINAND_MT29F=y
>>>>>> +CONFIG_MTD_SPINAND_GIGADEVICE=y
>>>>>> +CONFIG_MTD_SPINAND_ONDIEECC=y
>>>>>
>>>>>
>>>>> The CONFIG_SPINAND_* additions are not required for upstream SPI-NAND
>>>>>
>>>>>
>>>>>>   CONFIG_MTD_SPLIT_FIRMWARE=y
>>>>>>   CONFIG_MTD_SPLIT_FIT_FW=y
>>>>>>   CONFIG_MTD_UBI=y
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>> diff --git
>>>>>> a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>>>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>>>> new file mode 100644
>>>>>> index 00..5553bbd166
>>>>>> --- /dev/null
>>>>>> +++ 
>>>>>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>>>> @@ -

Re: [OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-31 Thread Daniel Danzberger
On the deprecated staging driver, it somehow directly came up as "rootfs" and
not "ubi". Even though it has been named "ubi" in the dts.
Now the image won't boot because no rootfs is detected:


[1.919001] Creating 1 MTD partitions on "spi0.1":
[1.925399] 0x-0x0800 : "ubi"
[1.940324] random: fast init done
...
[3.170978] UBI error: cannot open mtd rootfs, error -2
[3.171027] hctosys: unable to open rtc device ([3.180802] Waiting for
root device /dev/ubiblock0_1...



On 10/31/19 11:19 AM, Robert Marko wrote:
> On Thu, 31 Oct 2019 at 11:17, Daniel Danzberger  wrote:
>>
>> Using 'compatible = "spi-nand"' worked and the device got detected by the
>> driver. However it won't create and "rootfs" partition like it did before.
>>
>> ---
>> [1.901930] spi-nand spi0.1: GigaDevice SPI NAND was found.
>> [1.905266] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 
>> 2048,
>> OOB size: 128
>> [1.911015] 1 fixed-partitions partitions found on MTD device spi0.1
>> [1.919010] Creating 1 MTD partitions on "spi0.1":
>> [1.925410] 0x-0x0800 : "ubi"
> It creates the partitions like set in DTS, ubi partition contains both
> kernel and rootfs.
>> ---
>>
>>
>> On 10/30/19 4:51 PM, Jeff Kletsky wrote:
>>> On 10/30/19 4:27 AM, Daniel Danzberger wrote:
>>>
>>>> This device contains 2 flash devices. One NOR (32M) and one NAND (128M).
>>>> U-boot and caldata are on the NOR, the firmware on the NAND.
>>>>
>>>>  SoC:IPQ4019
>>>>  CPU:4x 710MHz ARMv7
>>>>  RAM:256MB
>>>>  FLASH:  NOR:32MB NAND:128MB
>>>>
>>>> [...]
>>>>
>>>>
>>>
>>>  .../arch/arm/boot/dts/qcom-ipq4019-bus.dtsi   | 1142 +
>>>  .../include/dt-bindings/msm/msm-bus-ids.h |  869 +
>>>
>>> The sudden appearance of a need the MSM bus and its IDs worries me.
>>>
>>> With 25 devices already on the ipq40xx platform without them, it feels
>>> like something is missing if they are needed by this one.
>>>
>>>
>>>> diff --git a/target/linux/ipq40xx/config-4.19 
>>>> b/target/linux/ipq40xx/config-4.19
>>>> index 8948b73ff7..3ee921abed 100644
>>>> --- a/target/linux/ipq40xx/config-4.19
>>>> +++ b/target/linux/ipq40xx/config-4.19
>>>> @@ -303,6 +303,9 @@ CONFIG_MTD_NAND_ECC=y
>>>>   CONFIG_MTD_NAND_QCOM=y
>>>>   CONFIG_MTD_SPI_NAND=y
>>>>   CONFIG_MTD_SPI_NOR=y
>>>> +CONFIG_MTD_SPINAND_MT29F=y
>>>> +CONFIG_MTD_SPINAND_GIGADEVICE=y
>>>> +CONFIG_MTD_SPINAND_ONDIEECC=y
>>>
>>>
>>> The CONFIG_SPINAND_* additions are not required for upstream SPI-NAND
>>>
>>>
>>>>   CONFIG_MTD_SPLIT_FIRMWARE=y
>>>>   CONFIG_MTD_SPLIT_FIT_FW=y
>>>>   CONFIG_MTD_UBI=y
>>>>
>>>> [...]
>>>>
>>>> diff --git
>>>> a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>> new file mode 100644
>>>> index 00..5553bbd166
>>>> --- /dev/null
>>>> +++ 
>>>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>>>> @@ -0,0 +1,371 @@
>>>> +/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
>>>> + * Copyright (c) 2019, Nguyen Dinh Phi 
>>>> + *
>>>> + * Permission to use, copy, modify, and/or distribute this software for 
>>>> any
>>>> + * purpose with or without fee is hereby granted, provided that the above
>>>> + * copyright notice and this permission notice appear in all copies.
>>>> + *
>>>> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 
>>>> WARRANTIES
>>>> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
>>>> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
>>>> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
>>>> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
>>>> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
>>>> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF T

Re: [OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-31 Thread Daniel Danzberger
Using 'compatible = "spi-nand"' worked and the device got detected by the
driver. However it won't create and "rootfs" partition like it did before.

---
[1.901930] spi-nand spi0.1: GigaDevice SPI NAND was found.
[1.905266] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 2048,
OOB size: 128
[1.911015] 1 fixed-partitions partitions found on MTD device spi0.1
[1.919010] Creating 1 MTD partitions on "spi0.1":
[1.925410] 0x-0x0800 : "ubi"
---


On 10/30/19 4:51 PM, Jeff Kletsky wrote:
> On 10/30/19 4:27 AM, Daniel Danzberger wrote:
> 
>> This device contains 2 flash devices. One NOR (32M) and one NAND (128M).
>> U-boot and caldata are on the NOR, the firmware on the NAND.
>>
>>  SoC:    IPQ4019
>>  CPU:    4x 710MHz ARMv7
>>  RAM:    256MB
>>  FLASH:  NOR:32MB NAND:128MB
>>
>> [...]
>>
>>
> 
>  .../arch/arm/boot/dts/qcom-ipq4019-bus.dtsi   | 1142 +
>  .../include/dt-bindings/msm/msm-bus-ids.h |  869 +
> 
> The sudden appearance of a need the MSM bus and its IDs worries me.
> 
> With 25 devices already on the ipq40xx platform without them, it feels
> like something is missing if they are needed by this one.
> 
> 
>> diff --git a/target/linux/ipq40xx/config-4.19 
>> b/target/linux/ipq40xx/config-4.19
>> index 8948b73ff7..3ee921abed 100644
>> --- a/target/linux/ipq40xx/config-4.19
>> +++ b/target/linux/ipq40xx/config-4.19
>> @@ -303,6 +303,9 @@ CONFIG_MTD_NAND_ECC=y
>>   CONFIG_MTD_NAND_QCOM=y
>>   CONFIG_MTD_SPI_NAND=y
>>   CONFIG_MTD_SPI_NOR=y
>> +CONFIG_MTD_SPINAND_MT29F=y
>> +CONFIG_MTD_SPINAND_GIGADEVICE=y
>> +CONFIG_MTD_SPINAND_ONDIEECC=y
> 
> 
> The CONFIG_SPINAND_* additions are not required for upstream SPI-NAND
> 
> 
>>   CONFIG_MTD_SPLIT_FIRMWARE=y
>>   CONFIG_MTD_SPLIT_FIT_FW=y
>>   CONFIG_MTD_UBI=y
>>
>> [...]
>>
>> diff --git
>> a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>> new file mode 100644
>> index 00..5553bbd166
>> --- /dev/null
>> +++ 
>> b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
>> @@ -0,0 +1,371 @@
>> +/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
>> + * Copyright (c) 2019, Nguyen Dinh Phi 
>> + *
>> + * Permission to use, copy, modify, and/or distribute this software for any
>> + * purpose with or without fee is hereby granted, provided that the above
>> + * copyright notice and this permission notice appear in all copies.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
>> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
>> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
>> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
>> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
>> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
>> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>> + *
>> + */
>> +
>>
>> [...]
>>
>> +
>> +    spi_0: spi@78b5000 {
>> +    pinctrl-0 = <_0_pins>;
>> +    pinctrl-names = "default";
>> +    status = "okay";
>> +    cs-gpios = < 12 GPIO_ACTIVE_HIGH>, < 41 
>> GPIO_ACTIVE_HIGH>;
>> +    num-cs = <2>;
>> +
>> +    m25p80@0 {
>> +    #address-cells = <1>;
>> +    #size-cells = <1>;
>> +    reg = <0>;
>> +    linux,modalias = "m25p80", "n25q128a11";
>> +    compatible = "jedec,spi-nor", "n25q128a11";
>> +    spi-max-frequency = <2400>;
> 
> 
> I don't think you need linux,modalias here, nor the chip type in the 
> compatible
> line.
> I believe that the following compatible line is sufficient
> 
>     compatible = "jedec,spi-nor";
> 
> 
> You might also want to consider "flash@0" or "nor@0" or "nor_flash@0",
> or the like, rather than a chip-specific name. (I'm not a committer.)
> 
> 
>> +
>> +    partitions {
>> +    compatible = "fixed-partitions";
>> +
>> +    partition@0 {
>&

Re: [OpenWrt-Devel] [PATCH 1/3] ipq40xx: Add gigadevice nandspi flash driver

2019-10-30 Thread Daniel Danzberger
> Is there a reason why the upstream SPI-NAND framework isn't being used?

No, I didn't know about it. The patches I used are copied from a compex openwrt
tree and have only been modified by me to run on kernel 4.19

I am going to checkout the new API and try to make the device work with it.

On 10/30/19 4:15 PM, Jeff Kletsky wrote:
> On 10/30/19 4:27 AM, Daniel Danzberger wrote:
> 
>> This patch adds support for Gigadevice SPI NAND device to the mt29f stagging
>> driver.
>>
>> Signed-off-by: Daniel Danzberger 
>> ---
>>   ...port-gigadevice-nandspi-flash-device.patch | 1778 +
>>   1 file changed, 1778 insertions(+)
>>   create mode 100644
>> target/linux/ipq40xx/patches-4.19/400-mtd-nand-support-gigadevice-nandspi-flash-device.patch
>>
>>
>>
>> [...]
> 
> 
> Is there a reason why the upstream SPI-NAND framework isn't being used?
> 
> This has been demanded of the ath79 target (see, for example
> https://github.com/openwrt/openwrt/pull/1428#issuecomment-441594401)
> 
> and is available to the ipq40xx target and appears to already be in use by:
> 
>   qcom-ipq4018-rt-ac58u.dts
>   qcom-ipq4018-ea6350v3.dts
>   qcom-ipq4018-ap120c-ac.dts
>   qcom-ipq4018-jalapeno.dts
> 
> 
> 
> Further, the mt29f driver has been removed from upstream Linux
> 
> commit 647ad49ca672
> Author: Boris Brezillon 
> Date:   Mon Oct 22 22:10:59 2018 +0200
> 
>     staging: Remove the mt29f_spinand driver
> 
>     A new SPI NAND subsystem has been added in drivers/mtd/nand/spi/ and
>     Micron's MT29F devices are now supported in
>     drivers/mtd/nand/spi/micron.c.
> 
>     Remove the old driver.
> 
> 
> 
> 
> The set of SPI-NAND chips supported by Linux 5.3 has already been
> backported to OpenWrt `master`, including; GigaDevice, Macronix,
> Micron, Paragon, Toshiba, and Winbond.
> 
> 
> commit b9d58f7e06
> Author: Jeff Kletsky 
> Date:   Thu Oct 24 09:54:11 2019 -0700
> 
>     kernel: mtd: spinand: Backport chip definitions
> 
>     generic: Add/rename patches for upstream consistency
> 
>     ipq40xx: generic-level patch replaces same-source patches-4.19/
> 082-v4.20-mtd-spinand-winbond-Add-support-for-W25N01GV.patch
> 
>     The SPI-NAND framework from Linux uses common driver code that is then
>     "tuned" by a tiny struct of chip-specific data that describes
>     available commands, timing, and layout (data and OOB data). Several
>     manufacturers and chips have been added since 4.19, several of which
>     are used in devices already supported by OpenWrt (typically with no or
>     "legacy" access to their NAND memory). This commit catches up the
>     supported-chip definitions through Linux 5.2-rc6 and linux/next.
> 
>     The driver is only compiled for platforms with CONFIG_MTD_SPI_NAND=y.
>     This presently includes ipq40xx and pistachio, with the addition of
>     ath79-nand in these commits (and not ath79-generic or ath79-tiny).
> 
>     Upstream patches refreshed against 4.19.75
> 
>     Build-tested-on: ipq40xx
>     Run-tested-on: ath79-nand
> 
> 
> 
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


[OpenWrt-Devel] [PATCH 1/3] ipq40xx: Add gigadevice nandspi flash driver

2019-10-30 Thread Daniel Danzberger
This patch adds support for Gigadevice SPI NAND device to the mt29f stagging 
driver.

Signed-off-by: Daniel Danzberger 
---
 ...port-gigadevice-nandspi-flash-device.patch | 1778 +
 1 file changed, 1778 insertions(+)
 create mode 100644 
target/linux/ipq40xx/patches-4.19/400-mtd-nand-support-gigadevice-nandspi-flash-device.patch

diff --git 
a/target/linux/ipq40xx/patches-4.19/400-mtd-nand-support-gigadevice-nandspi-flash-device.patch
 
b/target/linux/ipq40xx/patches-4.19/400-mtd-nand-support-gigadevice-nandspi-flash-device.patch
new file mode 100644
index 00..a3b98cd275
--- /dev/null
+++ 
b/target/linux/ipq40xx/patches-4.19/400-mtd-nand-support-gigadevice-nandspi-flash-device.patch
@@ -0,0 +1,1778 @@
+diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_ids.c
+index 5423c3bb..31aac787 100644
+--- a/drivers/mtd/nand/raw/nand_ids.c
 b/drivers/mtd/nand/raw/nand_ids.c
+@@ -185,6 +185,7 @@ static const struct nand_manufacturer nand_manufacturers[] 
= {
+   {NAND_MFR_INTEL, "Intel"},
+   {NAND_MFR_ATO, "ATO"},
+   {NAND_MFR_WINBOND, "Winbond"},
++  {NAND_MFR_GIGA, "Gigadevice"},
+ };
+
+ /**
+diff --git a/drivers/staging/mt29f_spinand/Kconfig 
b/drivers/staging/mt29f_spinand/Kconfig
+index f3f9cb3b..139c058c 100644
+--- a/drivers/staging/mt29f_spinand/Kconfig
 b/drivers/staging/mt29f_spinand/Kconfig
+@@ -14,3 +14,13 @@ config MTD_SPINAND_ONDIEECC
+   help
+ Internal ECC.
+ Enables Hardware ECC support for Micron SPI NAND.
++
++config MTD_SPINAND_GIGADEVICE
++  tristate "SPINAND Devcie Support for Gigadevice "
++  depends on MTD_SPINAND_MT29F
++  help
++ This enables support for accessing Gigadevice SPI NAND flash
++ devices.
++ If you have Gigadevice SPI NAND chip say yes.
++
++ If unsure, say no here.
+diff --git a/drivers/staging/mt29f_spinand/Makefile 
b/drivers/staging/mt29f_spinand/Makefile
+index e47af0f7..36df11e6 100644
+--- a/drivers/staging/mt29f_spinand/Makefile
 b/drivers/staging/mt29f_spinand/Makefile
+@@ -1 +1,2 @@
+ obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand.o
++obj-$(CONFIG_MTD_SPINAND_GIGADEVICE)  += giga_spinand.o
+diff --git a/drivers/staging/mt29f_spinand/giga_spinand.c 
b/drivers/staging/mt29f_spinand/giga_spinand.c
+new file mode 100644
+index ..a619e96d
+--- /dev/null
 b/drivers/staging/mt29f_spinand/giga_spinand.c
+@@ -0,0 +1,396 @@
++/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ */
++
++#include 
++#include 
++#include 
++#include 
++#include 
++#include "giga_spinand.h"
++
++/* Only ecc un-protected fields in the spare area included */
++static int winbond_ooblayout_64_ecc(struct mtd_info *mtd, int section,
++struct mtd_oob_region *oobregion) {
++  if (section > 3)
++return -ERANGE;
++
++  oobregion->offset = (section * 16) + 8;
++  oobregion->length = 9;
++  return 0;
++}
++
++static int winbond_ooblayout_64_free(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *oobregion) {
++  if (section > 3)
++return -ERANGE;
++
++  oobregion->offset = (section * 16) + 2;
++  oobregion->length = 2;
++  return 0;
++}
++
++static const struct mtd_ooblayout_ops winbond_ooblayout = {
++  .ecc = winbond_ooblayout_64_ecc,
++  .free = winbond_ooblayout_64_free,
++};
++
++static int ath79_ooblayout_64_ecc(struct mtd_info *mtd, int section,
++struct mtd_oob_region *oobregion) {
++  if (section > 7)
++return -ERANGE;
++  switch(section) {
++case 0:
++  oobregion->offset = 64;
++  oobregion->length = 8;
++  break;
++case 1:
++  oobregion->offset = 72;
++  oobregion->length = 8;
++  break;
++case 2:
++  oobregion->offset = 80;
++  oobregion->length = 8;
++  break;
++case 3:
++  oobregion->offset = 88;
++  oobregion->length = 8;
++  break;
++case 4:
++  oobregion->offset = 96;
++  oobregion->length = 8;
++  break;
++case 5:
++  oobregion->offset = 104;
++  oobregion->length = 8;
++  break;
++case 

[OpenWrt-Devel] [PATCH 0/3] ipq40xx: Add new device Compex WPJ419

2019-10-30 Thread Daniel Danzberger
These 3 patches add support for the Compex WPJ419 board.

Patch 1 adds the nandspi driver for the Gigadevice flash used on the wpj419.
Patch 2 fixes a reboot/shutdown hang.
Patch 3 Adds the actual wpj419 device support.


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


[OpenWrt-Devel] [PATCH 2/3] ipq40xx: mtd m25p80: fix hang on device shutdown

2019-10-30 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 .../401-mtd-m25p80-fix-shutdown-hang.patch| 21 +++
 1 file changed, 21 insertions(+)
 create mode 100644 
target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch

diff --git 
a/target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch 
b/target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch
new file mode 100644
index 00..779f7ec4af
--- /dev/null
+++ b/target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch
@@ -0,0 +1,21 @@
+diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
+index 270d3c95..39f90436 100644
+--- a/drivers/mtd/devices/m25p80.c
 b/drivers/mtd/devices/m25p80.c
+@@ -256,9 +256,16 @@ static int m25p_remove(struct spi_mem *spimem)
+ static void m25p_shutdown(struct spi_mem *spimem)
+ {
+   struct m25p *flash = spi_mem_get_drvdata(spimem);
++  u8 command[1];
++
++  command[0] = 0x66;
++  spi_write(spimem->spi, command, 1);
++  command[0] = 0x99;
++  spi_write(spimem->spi, command, 1);
+
+   spi_nor_restore(>spi_nor);
+ }
++
+ /*
+  * Do NOT add to this array without reading the following:
+  *
-- 
2.23.0


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


[OpenWrt-Devel] [PATCH 3/3] ipq40xx: ipq4019: Add new device Compex WPJ419

2019-10-30 Thread Daniel Danzberger
This device contains 2 flash devices. One NOR (32M) and one NAND (128M).
U-boot and caldata are on the NOR, the firmware on the NAND.

SoC:IPQ4019
CPU:4x 710MHz ARMv7
RAM:256MB
FLASH:  NOR:32MB NAND:128MB
ETH:2x GMAC Gigabit
POE:802.3 af/at POE, IEEE802.3af/IEEE802.3at(48-56V)
WIFI:   1x 2.4Ghz Atheros qca4019 2x2 MU-MIMO
1x 5.0Ghz Atheros qca4019 2x2 MU-MIMO
USB:1x 3.0
PCI:1x Mini PCIe
SIM:1x Slot
SD: 1x MicroSD slot
BTN:Reset
LED:- Power
- Ethernet
UART:  1x Serial Port 4 Pin Connector (UART)
   1x Serial Port 6 Pin Connector (High Speed UART)
POWER: 12V 2A

Installation

Initial flashing can only be done via u-boot using the following commands:

tftpboot openwrt-ipq40xx-generic-compex_wpj419-nand-squashfs-nand-factory.ubi
nand erase.chip; nand write ${fileaddr} 0x0 ${filesize}
set fsbootargs ubi.mtd=rootfs root=/dev/ubiblock0_1 rootfstype=squashfs
saveenv
res

Signed-off-by: Daniel Danzberger 
---
 .../ipq40xx/base-files/etc/board.d/02_network |1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |2 +
 target/linux/ipq40xx/config-4.19  |3 +
 .../arch/arm/boot/dts/qcom-ipq4019-bus.dtsi   | 1142 +
 .../arch/arm/boot/dts/qcom-ipq4019-wpj419.dts |  371 ++
 .../include/dt-bindings/msm/msm-bus-ids.h |  869 +
 target/linux/ipq40xx/image/Makefile   |   14 +
 .../901-arm-boot-add-dts-files.patch  |3 +-
 8 files changed, 2404 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-bus.dtsi
 create mode 100644 
target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-wpj419.dts
 create mode 100644 
target/linux/ipq40xx/files-4.19/include/dt-bindings/msm/msm-bus-ids.h

diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network 
b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 25402b7eb4..dafd83234e 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -48,6 +48,7 @@ ipq40xx_setup_interfaces()
ucidef_set_interface_lan "eth0"
;;
avm,fritzrepeater-3000|\
+   compex,wpj419|\
compex,wpj428)
ucidef_set_interface_lan "eth0 eth1"
;;
diff --git 
a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 2336ef3c7b..b18d17e422 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -71,6 +71,7 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
compex,wpj428 |\
+   compex,wpj419 |\
engenius,eap1300 |\
openmesh,a42 |\
openmesh,a62 |\
@@ -134,6 +135,7 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
compex,wpj428 |\
+   compex,wpj419 |\
engenius,eap1300 |\
openmesh,a42 |\
openmesh,a62 |\
diff --git a/target/linux/ipq40xx/config-4.19 b/target/linux/ipq40xx/config-4.19
index 8948b73ff7..3ee921abed 100644
--- a/target/linux/ipq40xx/config-4.19
+++ b/target/linux/ipq40xx/config-4.19
@@ -303,6 +303,9 @@ CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_NAND_QCOM=y
 CONFIG_MTD_SPI_NAND=y
 CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_SPINAND_MT29F=y
+CONFIG_MTD_SPINAND_GIGADEVICE=y
+CONFIG_MTD_SPINAND_ONDIEECC=y
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_FIT_FW=y
 CONFIG_MTD_UBI=y
diff --git 
a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-bus.dtsi 
b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-bus.dtsi
new file mode 100644
index 00..169505973f
--- /dev/null
+++ b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-bus.dtsi
@@ -0,0 +1,1142 @@
+/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR O

[OpenWrt-Devel] [PATCH] rpcd: uci: fix segfault and double free on set method

2019-10-28 Thread Daniel Danzberger
Invalid reuse of pointers from uci_ptr can cause the rcpd to segfault on 
already freed memory.
This bug could be trigged by calling 'set' with emtpy values on multiple non 
existing or already cleard options.

For example:
 ubus call uci set 
'{"config":"network","section":"wan","values":{"proto":"static","foo":"", 
"bar":""}}'

Signed-off-by: Daniel Danzberger 
---
 uci.c | 55 ++-
 1 file changed, 26 insertions(+), 29 deletions(-)

diff --git a/uci.c b/uci.c
index 1587a19..e6ddbb5 100644
--- a/uci.c
+++ b/uci.c
@@ -812,55 +812,58 @@ out:
  * option of if the existing options value differs from the blob value
  */
 static int
-rpc_uci_merge_set(struct blob_attr *opt, struct uci_ptr *ptr)
+rpc_uci_merge_set(struct blob_attr *opt,
+   struct uci_package *package,
+   const char *section)
 {
+   struct uci_ptr ptr = {};
struct blob_attr *cur;
int rem, rv;
 
-   ptr->o = NULL;
-   ptr->option = blobmsg_name(opt);
-   ptr->value = NULL;
+   ptr.p = package;
+   ptr.section = section;
+   ptr.option = blobmsg_name(opt);
 
-   if (!rpc_uci_verify_name(ptr->option))
+   if (!rpc_uci_verify_name(ptr.option))
return UBUS_STATUS_INVALID_ARGUMENT;
 
-   if (rpc_uci_lookup(ptr) || !ptr->s)
+   if (rpc_uci_lookup() || !ptr.s)
return UBUS_STATUS_NOT_FOUND;
 
if (blobmsg_type(opt) == BLOBMSG_TYPE_ARRAY)
{
-   if (ptr->o)
-   uci_delete(cursor, ptr);
+   if (ptr.o)
+   uci_delete(cursor, );
 
rv = UBUS_STATUS_INVALID_ARGUMENT;
 
blobmsg_for_each_attr(cur, opt, rem)
{
-   if (!rpc_uci_format_blob(cur, >value))
+   if (!rpc_uci_format_blob(cur, ))
continue;
 
-   uci_add_list(cursor, ptr);
+   uci_add_list(cursor, );
rv = 0;
}
 
return rv;
}
-   else if (ptr->o && ptr->o->type == UCI_TYPE_LIST)
+   else if (ptr.o && ptr.o->type == UCI_TYPE_LIST)
{
-   uci_delete(cursor, ptr);
+   uci_delete(cursor, );
 
-   if (!rpc_uci_format_blob(opt, >value))
+   if (!rpc_uci_format_blob(opt, ))
return UBUS_STATUS_INVALID_ARGUMENT;
 
-   uci_set(cursor, ptr);
+   uci_set(cursor, );
}
else
{
-   if (!rpc_uci_format_blob(opt, >value))
+   if (!rpc_uci_format_blob(opt, ))
return UBUS_STATUS_INVALID_ARGUMENT;
 
-   if (!ptr->o || !ptr->o->v.string || strcmp(ptr->o->v.string, 
ptr->value))
-   uci_set(cursor, ptr);
+   if (!ptr.o || !ptr.o->v.string || strcmp(ptr.o->v.string, 
ptr.value))
+   uci_set(cursor, );
}
 
return 0;
@@ -875,7 +878,7 @@ rpc_uci_set(struct ubus_context *ctx, struct ubus_object 
*obj,
struct blob_attr *cur;
struct uci_package *p = NULL;
struct uci_element *e;
-   struct uci_ptr ptr = { 0 };
+   const char *package, *section;
int rem, rv, err = 0;
 
blobmsg_parse(rpc_uci_set_policy, __RPC_S_MAX, tb,
@@ -892,17 +895,17 @@ rpc_uci_set(struct ubus_context *ctx, struct ubus_object 
*obj,
!rpc_uci_verify_section(blobmsg_data(tb[RPC_S_SECTION])))
return UBUS_STATUS_INVALID_ARGUMENT;
 
-   ptr.package = blobmsg_data(tb[RPC_S_CONFIG]);
+   package = blobmsg_data(tb[RPC_S_CONFIG]);
 
-   if (uci_load(cursor, ptr.package, ))
+   if (uci_load(cursor, package, ))
return rpc_uci_status();
 
if (tb[RPC_S_SECTION])
{
-   ptr.section = blobmsg_data(tb[RPC_S_SECTION]);
+   section = blobmsg_data(tb[RPC_S_SECTION]);
blobmsg_for_each_attr(cur, tb[RPC_S_VALUES], rem)
{
-   rv = rpc_uci_merge_set(cur, );
+   rv = rpc_uci_merge_set(cur, p, section);
 
if (rv)
err = rv;
@@ -916,12 +919,9 @@ rpc_uci_set(struct ubus_context *ctx, struct ubus_object 
*obj,
   tb[RPC_S_TYPE], 
tb[RPC_S_MATCH]))
continue;
 
-   ptr.s = NULL;
-   ptr.section = e->name;
-
blobmsg_for_each_attr(cur, tb[RPC_S_VALUES], rem)
{
-   rv = rpc_uci_merge_set(cur, );
+  

[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-NV1

2019-07-22 Thread Daniel Danzberger
SoC:Mediatek MT7621A
CPU:4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
256 KB L2 Cache (shared by Dual-Core)
RAM:DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (2 x LAN, 1 x WAN)
POE:(1x PD, 2x PSE)
USB:1x 3.0
PCI:3x Mini PCIe (3 USB2.0 + 2 x UIM interface)
GPS:Quectel L70B
SIM:2 Slots
BTN:Reset
LED:- Power
- Ethernet
- Wifi
- USB
UART:  UART is present as Pads with throughholes on the PCB.
   They are located on left side.
   3.3V - RX - GND - TX / 57600-8N1
   3.3V is the square pad

Installation

The stock image is a modified openwrt and can be overflashed via sysupgrade 
-F

Signed-off-by: Daniel Danzberger 
---
 .../ramips/base-files/etc/board.d/02_network  |   3 +
 .../ramips/dts/mt7621_asiarf_ap7621-001.dts   | 116 +
 .../ramips/dts/mt7621_asiarf_ap7621-nv1.dts   |   9 ++
 .../ramips/dts/mt7621_asiarf_ap7621.dtsi  | 120 ++
 target/linux/ramips/image/mt7621.mk   |  12 +-
 5 files changed, 144 insertions(+), 116 deletions(-)
 create mode 100644 target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts
 create mode 100644 target/linux/ramips/dts/mt7621_asiarf_ap7621.dtsi

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index a2b7d1cf33..1793acc459 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -227,6 +227,9 @@ ramips_setup_interfaces()
asiarf,ap7621-001)
ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
;;
+   asiarf,ap7621-nv1)
+   ucidef_add_switch "switch0" "0:wan" "2:lan" "3:lan" "6@eth0"
+   ;;
asiarf,awapn2403)
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
diff --git a/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts 
b/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts
index 2e1479d0c6..9926a9bd5a 100644
--- a/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts
+++ b/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts
@@ -1,123 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
 /dts-v1/;
-#include "mt7621.dtsi"
-
-#include 
-#include 
+#include "mt7621_asiarf_ap7621.dtsi"
 
 / {
compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
model = "AsiaRF AP7621-001";
-
-   chosen {
-   bootargs = "console=ttyS0,57600";
-   };
-
-   keys {
-   compatible = "gpio-keys";
-
-   reset {
-   label = "reset";
-   gpios = < 18 GPIO_ACTIVE_LOW>;
-   linux,code = ;
-   };
-   };
-
-   leds {
-   compatible = "gpio-leds";
-
-   wlan1 {
-   label = "ap7621-001:orange:wlan1";
-   gpios = < 11 GPIO_ACTIVE_LOW>;
-   };
-
-   wlan0 {
-   label = "ap7621-001:orange:wlan0";
-   gpios = < 12 GPIO_ACTIVE_LOW>;
-   };
-   };
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-
-   flash@0 {
-   compatible = "jedec,spi-nor";
-   reg = <0>;
-   spi-max-frequency = <4000>;
-
-   partitions {
-   compatible = "fixed-partitions";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   partition@0 {
-   label = "u-boot";
-   reg = <0x0 0x3>;
-   read-only;
-   };
-
-   partition@3 {
-   label = "u-boot-env";
-   reg = <0x3 0x2000>;
-   };
-
-   partition@32000 {
-   label = "2860";
-   reg = <0x32000 0x4000>;
-   };
-
-   partition@36000 {
-   label = "rtdev";
-   reg = <0x36000 0x2000>;
-   };
-
-   partition@38000 {
-   label = "Reserve";
-   reg = <0x38000 0x8000>;
-  

[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-NV1

2019-07-16 Thread Daniel Danzberger
SoC:Mediatek MT7621A
CPU:4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
256 KB L2 Cache (shared by Dual-Core)
RAM:DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (2 x LAN, 1 x WAN)
POE:(1x PD, 2x PSE)
USB:1x 3.0
PCI:3x Mini PCIe (3 USB2.0 + 2 x UIM interface)
GPS:Quectel L70B
SIM:2 Slots
BTN:Reset
LED:- Power
- Ethernet
- Wifi
- USB
UART:  UART is present as Pads with throughholes on the PCB.
   They are located on left side.
   3.3V - RX - GND - TX / 57600-8N1
   3.3V is the square pad

Installation

The stock image is a modified openwrt and can be overflashed via sysupgrade 
-F

Signed-off-by: Daniel Danzberger 
---
 target/linux/ramips/base-files/etc/board.d/02_network |  3 +++
 target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts  |  9 +
 target/linux/ramips/image/mt7621.mk   | 10 ++
 3 files changed, 22 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index c3b7cd4390..c348b91a36 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -228,6 +228,9 @@ ramips_setup_interfaces()
asiarf,ap7621-001)
ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
;;
+   asiarf,ap7621-nv1)
+   ucidef_add_switch "switch0" "0:wan" "2:lan" "3:lan" "6@eth0"
+   ;;
asiarf,awapn2403)
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
diff --git a/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts 
b/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts
new file mode 100644
index 00..93af3950d2
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "mt7621_asiarf_ap7621-001.dts"
+
+/ {
+   compatible = "asiarf,ap7621-nv1", "mediatek,mt7621-soc";
+   model = "AsiaRF AP7621-NV1";
+};
diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index e2928c80ce..1eb1a4cb99 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -106,6 +106,16 @@ define Device/asiarf_ap7621-001
 endef
 TARGET_DEVICES += asiarf_ap7621-001
 
+define Device/asiarf_ap7621-nv1
+  MTK_SOC := mt7621
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_VENDOR := AsiaRF
+  DEVICE_MODEL := AP7621-NV1
+  DEVICE_PACKAGES := \
+   kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3
+endef
+TARGET_DEVICES += asiarf_ap7621-nv1
+
 define Device/asus_rt-ac57u
   MTK_SOC := mt7621
   DEVICE_VENDOR := ASUS
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-NV1

2019-06-26 Thread Daniel Danzberger
SoC:Mediatek MT7621A
CPU:4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
256 KB L2 Cache (shared by Dual-Core)
RAM:DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (2 x LAN, 1 x WAN)
POE:(1x PD, 2x PSE)
USB:1x 3.0
PCI:3x Mini PCIe (3 USB2.0 + 2 x UIM interface)
GPS:Quectel L70B
SIM:2 Slots
BTN:Reset
LED:- Power
- Ethernet
- Wifi
- USB
UART:  UART is present as Pads with throughholes on the PCB.
   They are located on left side.
   3.3V - RX - GND - TX / 57600-8N1
   3.3V is the square pad

Installation

The stock image is a modified openwrt and can be overflashed via sysupgrade 
-F

Signed-off-by: Daniel Danzberger 
---
 target/linux/ramips/base-files/etc/board.d/02_network | 3 +++
 target/linux/ramips/dts/AP7621-NV1.dts| 9 +
 target/linux/ramips/image/mt7621.mk   | 9 +
 3 files changed, 21 insertions(+)
 create mode 100644 target/linux/ramips/dts/AP7621-NV1.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 02ef30cade..a276adb32c 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -42,6 +42,9 @@ ramips_setup_interfaces()
asiarf,ap7621-001)
ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
;;
+   asiarf,ap7621-nv1)
+   ucidef_add_switch "switch0" "0:wan" "2:lan" "3:lan" "6@eth0"
+   ;;
3g150b|\
3g300m|\
a5-v11|\
diff --git a/target/linux/ramips/dts/AP7621-NV1.dts 
b/target/linux/ramips/dts/AP7621-NV1.dts
new file mode 100644
index 00..aad222f155
--- /dev/null
+++ b/target/linux/ramips/dts/AP7621-NV1.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "AP7621-001.dts"
+
+/ {
+   compatible = "asiarf,ap7621-nv1", "mediatek,mt7621-soc";
+   model = "AsiaRF AP7621-NV1";
+};
diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index dce24308b8..b32cdf4100 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -659,3 +659,12 @@ define Device/asiarf_ap7621-001
 endef
 TARGET_DEVICES += asiarf_ap7621-001
 
+define Device/asiarf_ap7621-nv1
+  DTS := AP7621-NV1
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := AsiaRF AP7621-NV1
+  DEVICE_PACKAGES := \
+   kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3
+endef
+TARGET_DEVICES += asiarf_ap7621-nv1
+
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-NV1

2019-06-26 Thread Daniel Danzberger
The AP7621-NV1 is basically an AP7621-001 with additional peripherals:

- +1 Ethernet Port (POE: 1x PD, 2x PSE)
- 2 SIM slots
- 3 PICe USB2.0 + 2 x UIM interface

Installation:
Same as on the AP7621-001. Overflash with sysupgrade -F.

Signed-off-by: Daniel Danzberger 
---
 target/linux/ramips/base-files/etc/board.d/02_network | 3 +++
 target/linux/ramips/dts/AP7621-NV1.dts| 9 +
 target/linux/ramips/image/mt7621.mk   | 9 +
 3 files changed, 21 insertions(+)
 create mode 100644 target/linux/ramips/dts/AP7621-NV1.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 02ef30cade..a276adb32c 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -42,6 +42,9 @@ ramips_setup_interfaces()
asiarf,ap7621-001)
ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
;;
+   asiarf,ap7621-nv1)
+   ucidef_add_switch "switch0" "0:wan" "2:lan" "3:lan" "6@eth0"
+   ;;
3g150b|\
3g300m|\
a5-v11|\
diff --git a/target/linux/ramips/dts/AP7621-NV1.dts 
b/target/linux/ramips/dts/AP7621-NV1.dts
new file mode 100644
index 00..aad222f155
--- /dev/null
+++ b/target/linux/ramips/dts/AP7621-NV1.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "AP7621-001.dts"
+
+/ {
+   compatible = "asiarf,ap7621-nv1", "mediatek,mt7621-soc";
+   model = "AsiaRF AP7621-NV1";
+};
diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index dce24308b8..b32cdf4100 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -659,3 +659,12 @@ define Device/asiarf_ap7621-001
 endef
 TARGET_DEVICES += asiarf_ap7621-001
 
+define Device/asiarf_ap7621-nv1
+  DTS := AP7621-NV1
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := AsiaRF AP7621-NV1
+  DEVICE_PACKAGES := \
+   kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3
+endef
+TARGET_DEVICES += asiarf_ap7621-nv1
+
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-25 Thread Daniel Danzberger
SoC:Mediatek MT7621A
CPU:4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
256 KB L2 Cache (shared by Dual-Core)
RAM:DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (1 x LAN, 1 x WAN)
USB:1x 3.0
PCI:3x Mini PCIe
GPS:Quectel L70B
BTN:Reset
LED:- Power
- Ethernet
- Wifi
- USB
UART:  UART is present as Pads with throughholes on the PCB.
   They are located on left side.
   3.3V - RX - GND - TX / 57600-8N1
   3.3V is the square pad

Installation

The stock image is a modified openwrt and can be overflashed via sysupgrade 
-F

Signed-off-by: Daniel Danzberger 
---
 .../ramips/base-files/etc/board.d/02_network  |   3 +
 target/linux/ramips/dts/AP7621-001.dts| 128 ++
 target/linux/ramips/image/mt7621.mk   |  10 ++
 3 files changed, 141 insertions(+)
 create mode 100644 target/linux/ramips/dts/AP7621-001.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 52204eacbf..ffd1689263 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -39,6 +39,9 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" 
"6@eth0"
;;
+   asiarf,ap7621-001)
+   ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
+   ;;
3g150b|\
3g300m|\
a5-v11|\
diff --git a/target/linux/ramips/dts/AP7621-001.dts 
b/target/linux/ramips/dts/AP7621-001.dts
new file mode 100644
index 00..497c196fa7
--- /dev/null
+++ b/target/linux/ramips/dts/AP7621-001.dts
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
+   model = "AsiaRF AP7621-001";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x1c00>, <0x2000 0x400>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   reset {
+   label = "reset";
+   gpios = < 18 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   wlan1 {
+   label = "ap7621-001:orange:wlan1";
+   gpios = < 11 GPIO_ACTIVE_LOW>;
+   };
+
+   wlan0 {
+   label = "ap7621-001:orange:wlan0";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <4000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x2000>;
+   };
+
+   partition@32000 {
+   label = "2860";
+   reg = <0x32000 0x4000>;
+   };
+
+   partition@36000 {
+   label = "rtdev";
+   reg = <0x36000 0x2000>;
+   };
+
+   partition@38000 {
+   label = "Reserve";
+   reg = <0x38000 0x8000>;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+   };
+
+   firmware

Re: [OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-25 Thread Daniel Danzberger
I see. I will change the model property then...

On 6/25/19 10:39 AM, Petr Štetiar wrote:
> Daniel Danzberger  [2019-06-25 10:34:47]:
> 
>>>> +  model = "AP7621-001";
>>>
>>> Oh boy, this is tricky.
>>>
>>> <https://github.com/devicetree-org/devicetree-specification/blob/4b1dac80eaca45b4babf5299452a951008a5d864/source/devicenodes.rst>
>>> 'The recommended format ' (for the root node!) ' is 
>>> "manufacturer,model-number".'
>>>
>>> BUT. Thing is, this string here gets printed on the LuCI system
>>> page and from past experience "Manugacturer Model" works best.
>>>
>> I am not sure if using a blank instead of ',' is a good idea, because of
>> sysupgrade and the device tree board detection.
>> All other DTS files use ',' in DTS and '_' in their Makefile.
>>
>> Are you sure about this one ?
> 
> Yes, Christian is talking about model property, not the compatible property.
> 
>  model = "AsiaRF AP7621-001";
> 
> -- ynezz
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


Re: [OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-25 Thread Daniel Danzberger


On 6/24/19 10:17 PM, Christian Lamparter wrote:
>> diff --git a/target/linux/ramips/dts/AP7621-001.dts 
>> b/target/linux/ramips/dts/AP7621-001.dts
>> new file mode 100644
>> index 00..daab06ec90
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/AP7621-001.dts
>> @@ -0,0 +1,127 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>> +
>> +/dts-v1/;
>> +#include "mt7621.dtsi"
>> +
>> +#include 
>> +#include 
>> +
>> +/ {
>> +compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
>> +model = "AP7621-001";
> 
> Oh boy, this is tricky.
> 
> <https://github.com/devicetree-org/devicetree-specification/blob/4b1dac80eaca45b4babf5299452a951008a5d864/source/devicenodes.rst>
> 'The recommended format ' (for the root node!) ' is 
> "manufacturer,model-number".'
> 
> BUT. Thing is, this string here gets printed on the LuCI system
> page and from past experience "Manugacturer Model" works best.
>
I am not sure if using a blank instead of ',' is a good idea, because of
sysupgrade and the device tree board detection.
All other DTS files use ',' in DTS and '_' in their Makefile.

Are you sure about this one ?

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans

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


[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-25 Thread Daniel Danzberger
SoC:Mediatek MT7621A
CPU:4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
256 KB L2 Cache (shared by Dual-Core)
RAM:DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (1 x LAN, 1 x WAN)
USB:1x 3.0
PCI:3x Mini PCIe
GPS:Quectel L70B
BTN:Reset
LED:- Power
- Ethernet
- Wifi
- USB
UART:  UART is present as Pads with throughholes on the PCB.
   They are located on left side.
   3.3V - RX - GND - TX / 57600-8N1
   3.3V is the square pad

Installation

The stock image is a modified openwrt and can be overflashed via sysupgrade 
-F

Signed-off-by: Daniel Danzberger 
---
 .../ramips/base-files/etc/board.d/02_network  |   3 +
 target/linux/ramips/dts/AP7621-001.dts| 128 ++
 target/linux/ramips/image/mt7621.mk   |  10 ++
 3 files changed, 141 insertions(+)
 create mode 100644 target/linux/ramips/dts/AP7621-001.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 52204eacbf..ffd1689263 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -39,6 +39,9 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" 
"6@eth0"
;;
+   asiarf,ap7621-001)
+   ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
+   ;;
3g150b|\
3g300m|\
a5-v11|\
diff --git a/target/linux/ramips/dts/AP7621-001.dts 
b/target/linux/ramips/dts/AP7621-001.dts
new file mode 100644
index 00..de9b9d9d73
--- /dev/null
+++ b/target/linux/ramips/dts/AP7621-001.dts
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
+   model = "AP7621-001";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x1c00>, <0x2000 0x400>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   reset {
+   label = "reset";
+   gpios = < 18 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   wlan1 {
+   label = "ap7621-001:orange:wlan1";
+   gpios = < 11 GPIO_ACTIVE_LOW>;
+   };
+
+   wlan0 {
+   label = "ap7621-001:orange:wlan0";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <4000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x2000>;
+   };
+
+   partition@32000 {
+   label = "2860";
+   reg = <0x32000 0x4000>;
+   };
+
+   partition@36000 {
+   label = "rtdev";
+   reg = <0x36000 0x2000>;
+   };
+
+   partition@38000 {
+   label = "Reserve";
+   reg = <0x38000 0x8000>;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+   };
+
+   firmware

[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-24 Thread Daniel Danzberger
SoC:Mediatek MT7621A
CPU:4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
256 KB L2 Cache (shared by Dual-Core)
RAM:DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (1 x LAN, 1 x WAN)
USB:1x 3.0
PCI:3x Mini PCIe
GPS:Quectel L70B
BTN:Reset
LED:- Power
- Ethernet
- Wifi
- USB
UART:  UART is present as Pads with throughholes on the PCB.
   They are located on left side.
   3.3V - RX - GND - TX / 57600-8N1
   3.3V is the square pad

Installation

The stock image is a modified openwrt and can be overflashed via sysupgrade 
-F

Signed-off-by: Daniel Danzberger 
---
 .../ramips/base-files/etc/board.d/02_network  |   3 +
 target/linux/ramips/dts/AP7621-001.dts| 127 ++
 target/linux/ramips/image/mt7621.mk   |  10 ++
 3 files changed, 140 insertions(+)
 create mode 100644 target/linux/ramips/dts/AP7621-001.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 52204eacbf..ffd1689263 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -39,6 +39,9 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" 
"6@eth0"
;;
+   asiarf,ap7621-001)
+   ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
+   ;;
3g150b|\
3g300m|\
a5-v11|\
diff --git a/target/linux/ramips/dts/AP7621-001.dts 
b/target/linux/ramips/dts/AP7621-001.dts
new file mode 100644
index 00..daab06ec90
--- /dev/null
+++ b/target/linux/ramips/dts/AP7621-001.dts
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
+   model = "AP7621-001";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x1c00>, <0x2000 0x400>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   reset {
+   label = "reset";
+   gpios = < 18 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   wlan1 {
+   label = "ap7621-001:orange:wlan1";
+   gpios = < 11 GPIO_ACTIVE_LOW>;
+   };
+
+   wlan0 {
+   label = "ap7621-001:orange:wlan0";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+status = "okay";
+
+flash@0 {
+compatible = "jedec,spi-nor";
+reg = <0>;
+spi-max-frequency = <4000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x2000>;
+   };
+
+   partition@32000 {
+   label = "2860";
+   reg = <0x32000 0x4000>;
+   };
+
+   partition@36000 {
+   label = "rtdev";
+   reg = <0x36000 0x2000>;
+   };
+
+   partition@38000 {
+   label = "Reserve";
+   reg = <0x38000 0x8000>;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+

Re: [OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-24 Thread Daniel Danzberger
hi,

Once I add in  'ralink,group = "uart2", "wdt";', I get the following errors and
the flash isn't going to be initialized.
---
[2.823681] mt7621-pci 1e14.pcie: could not find pctldev for node
/pinctrl/pcie, deferring probe
[2.842075] spi-mt7621 1e000b00.spi: could not find pctldev for node
/pinctrl/spi_pins, deferring probe
---

The flash works fine with 40Mhz.
I also removed the pcie0/1 wlan nodes, hence the board comes with plain PCIE
slots without any wifi attached.


On 6/22/19 4:46 AM, Chuanhong Guo wrote:
> Hi!
> 
> Some comments inline :)
> 
> On Fri, Jun 21, 2019 at 11:50 PM Daniel Danzberger  wrote:
>>
>> Signed-off-by: Daniel Danzberger 
> 
> When adding new device support, commit message should include a brief
> description of the hardware and an installation guide.
> You could check recent commits [1] for some examples.
> 
>> ---
>>  .../ramips/base-files/etc/board.d/02_network  |   5 +
>>  target/linux/ramips/base-files/lib/ramips.sh  |   3 +
>>  target/linux/ramips/dts/AP7621-001.dts| 157 ++
>>  target/linux/ramips/image/mt7621.mk   |  12 ++
>>  target/linux/ramips/mt7621/config-4.14|   1 +
>>  5 files changed, 178 insertions(+)
>>  create mode 100644 target/linux/ramips/dts/AP7621-001.dts
>>
>> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
>> b/target/linux/ramips/base-files/etc/board.d/02_network
>> index 52204eacbf..ee0c23eeb5 100755
>> --- a/target/linux/ramips/base-files/etc/board.d/02_network
>> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
>> @@ -39,6 +39,11 @@ ramips_setup_interfaces()
>> ucidef_add_switch "switch0" \
>> "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" 
>> "6@eth0"
>> ;;
>> +   ap7621-001)
>> +   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
> 
> There is no need to explicitly define lan and wan interfaces here.
> This will be handled by ucidef_add_switch.
> 
>> +   ucidef_set_interfaces relay ifname "'wwan' 'lan'" protocol 
>> relay
>> +   ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
>> +   ;;
>> 3g150b|\
>> 3g300m|\
>> a5-v11|\
>> diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
>> b/target/linux/ramips/base-files/lib/ramips.sh
>> index 093303892c..2350e88354 100755
>> --- a/target/linux/ramips/base-files/lib/ramips.sh
>> +++ b/target/linux/ramips/base-files/lib/ramips.sh
>> @@ -46,6 +46,9 @@ ramips_board_detect() {
>> *"ALL5003")
>> name="all5003"
>> ;;
>> +   *"AP7621-001")
>> +   name="ap7621-001"
>> +   ;;
> 
> This board detection is deprecated.
> The first compatible string will be used as board name if an entry
> isn't added here.
> 
>> *"AR670W")
>> name="ar670w"
>> ;;
>> diff --git a/target/linux/ramips/dts/AP7621-001.dts 
>> b/target/linux/ramips/dts/AP7621-001.dts
>> new file mode 100644
>> index 00..587c26457e
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/AP7621-001.dts
>> @@ -0,0 +1,157 @@
>> +/dts-v1/;
>> +#include "mt7621.dtsi"
>> +
>> +#include 
>> +#include 
>> +
>> +/ {
>> +   compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
>> +   model = "AP7621-001";
>> +
>> +   memory@0 {
>> +   device_type = "memory";
>> +   reg = <0x0 0x1c00>, <0x2000 0x400>;
>> +   };
>> +
>> +   chosen {
>> +   bootargs = "console=ttyS0,57600";
>> +   };
>> +
>> +   palmbus: palmbus@1E00 {
>> +   i2c@900 {
>> +   status = "okay";
>> +   };
>> +   };
> 
> What is i2c used for? If there isn't something already connected on
> board, it should be disabled.
> 
>> +
>> +   gpio-keys-polled {
> 
> Rename this one to "keys" according to Generic Names Recommendation in
> device tree specification. [2]
> 
>> +   compatible = "gpio-keys-polled";
> 
> Interrupt based gpio-keys can be used here instead of gpio

[OpenWrt-Devel] [PATCH] ramips: mt7621: Add new device AsiaRF AP7621-001

2019-06-21 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 .../ramips/base-files/etc/board.d/02_network  |   5 +
 target/linux/ramips/base-files/lib/ramips.sh  |   3 +
 target/linux/ramips/dts/AP7621-001.dts| 157 ++
 target/linux/ramips/image/mt7621.mk   |  12 ++
 target/linux/ramips/mt7621/config-4.14|   1 +
 5 files changed, 178 insertions(+)
 create mode 100644 target/linux/ramips/dts/AP7621-001.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 52204eacbf..ee0c23eeb5 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -39,6 +39,11 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" 
"6@eth0"
;;
+   ap7621-001)
+   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+   ucidef_set_interfaces relay ifname "'wwan' 'lan'" protocol relay
+   ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
+   ;;
3g150b|\
3g300m|\
a5-v11|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 093303892c..2350e88354 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -46,6 +46,9 @@ ramips_board_detect() {
*"ALL5003")
name="all5003"
;;
+   *"AP7621-001")
+   name="ap7621-001"
+   ;;
*"AR670W")
name="ar670w"
;;
diff --git a/target/linux/ramips/dts/AP7621-001.dts 
b/target/linux/ramips/dts/AP7621-001.dts
new file mode 100644
index 00..587c26457e
--- /dev/null
+++ b/target/linux/ramips/dts/AP7621-001.dts
@@ -0,0 +1,157 @@
+/dts-v1/;
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "asiarf,ap7621-001", "mediatek,mt7621-soc";
+   model = "AP7621-001";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x1c00>, <0x2000 0x400>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   palmbus: palmbus@1E00 {
+   i2c@900 {
+   status = "okay";
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <20>;
+
+   reset {
+   label = "reset";
+   gpios = < 18 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   wlan1 {
+   label = "ap7621-001:orange:wlan1";
+   gpios = < 11 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   wlan0 {
+   label = "ap7621-001:orange:wlan0";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+status = "okay";
+
+m25p80@0 {
+#address-cells = <1>;
+#size-cells = <1>;
+compatible = "jedec,spi-nor";
+reg = <0>;
+spi-max-frequency = <1000>;
+m25p,chunked-io = <32>;
+
+partition@0 {
+label = "u-boot";
+reg = <0x0 0x3>;
+read-only;
+};
+
+//  partition@3 {
+//  label = "u-boot-env";
+//  reg = <0x3 0x1>;
+//  };
+
+partition@3 {
+label = "u-boot-env";
+reg = <0x3 0x2000>;
+};
+
+partition@32000 {
+label = "2860";
+reg = <0x32000 0x4000>;
+};
+
+partition@36000 {
+label = "rtdev";
+reg = <0x36000 0x2000>;
+};
+
+partition@38000 {
+label 

[OpenWrt-Devel] [PATCH 1/3][rpcd] iwinfo: show more stats from assoclist.

2019-02-18 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 iwinfo.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index 1849196..d476ce3 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -458,10 +458,22 @@ rpc_iwinfo_assoclist(struct ubus_context *ctx, struct 
ubus_object *obj,
 
blobmsg_add_string(, "mac", mac);
blobmsg_add_u32(, "signal", a->signal);
+   blobmsg_add_u32(, "signal_avg", a->signal_avg);
blobmsg_add_u32(, "noise", a->noise);
blobmsg_add_u32(, "inactive", a->inactive);
+   blobmsg_add_u32(, "connected_time", 
a->connected_time);
+   blobmsg_add_u32(, "thr", a->thr);
+   blobmsg_add_u8(, "authorized", a->is_authorized);
+   blobmsg_add_u8(, "authenticated", 
a->is_authenticated);
+   blobmsg_add_string(, "preamble", 
a->is_preamble_short ? "short" : "long");
+   blobmsg_add_u8(, "wme", a->is_wme);
+   blobmsg_add_u8(, "mfp", a->is_mfp);
+   blobmsg_add_u8(, "tdls", a->is_tdls);
 
e = blobmsg_open_table(, "rx");
+   blobmsg_add_u64(, "drop_misc", a->rx_drop_misc);
+   blobmsg_add_u32(, "packets", a->rx_packets);
+   blobmsg_add_u32(, "bytes", a->rx_bytes);
blobmsg_add_u32(, "rate", a->rx_rate.rate);
blobmsg_add_u32(, "mcs", a->rx_rate.mcs);
blobmsg_add_u8(, "40mhz", a->rx_rate.is_40mhz);
@@ -469,6 +481,10 @@ rpc_iwinfo_assoclist(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_close_table(, e);
 
e = blobmsg_open_table(, "tx");
+   blobmsg_add_u32(, "failed", a->tx_failed);
+   blobmsg_add_u32(, "retries", a->tx_retries);
+   blobmsg_add_u32(, "packets", a->tx_packets);
+   blobmsg_add_u32(, "bytes", a->tx_bytes);
blobmsg_add_u32(, "rate", a->tx_rate.rate);
blobmsg_add_u32(, "mcs", a->tx_rate.mcs);
blobmsg_add_u8(, "40mhz", a->tx_rate.is_40mhz);
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 3/3][rpcd] iwinfo: add mesh infos in assoclist.

2019-02-18 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 iwinfo.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index 983001a..a76b72a 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -470,6 +470,13 @@ rpc_iwinfo_assoclist(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_u8(, "mfp", a->is_mfp);
blobmsg_add_u8(, "tdls", a->is_tdls);
 
+   blobmsg_add_u16(, "mesh llid", a->llid);
+   blobmsg_add_u16(, "mesh plid", a->plid);
+   blobmsg_add_string(, "mesh plink", a->plink_state);
+   blobmsg_add_string(, "mesh local PS", a->local_ps);
+   blobmsg_add_string(, "mesh peer PS", a->peer_ps);
+   blobmsg_add_string(, "mesh non-peer PS", 
a->nonpeer_ps);
+
e = blobmsg_open_table(, "rx");
blobmsg_add_u64(, "drop_misc", a->rx_drop_misc);
blobmsg_add_u32(, "packets", a->rx_packets);
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 2/3][rpcd] iwinfo: add survey.

2019-02-18 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 iwinfo.c | 40 
 1 file changed, 40 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index d476ce3..983001a 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -511,6 +511,45 @@ rpc_iwinfo_assoclist(struct ubus_context *ctx, struct 
ubus_object *obj,
return UBUS_STATUS_OK;
 }
 
+static int
+rpc_iwinfo_survey(struct ubus_context *ctx, struct ubus_object *obj,
+struct ubus_request_data *req, const char *method,
+struct blob_attr *msg)
+{
+   char res[IWINFO_BUFSIZE];
+   struct iwinfo_survey_entry *e;
+   void *c, *d;
+   int i, rv, len;
+
+   blob_buf_init(, 0);
+
+   rv = rpc_iwinfo_open(msg);
+
+   c = blobmsg_open_array(, "results");
+
+   if (rv || iw->survey(ifname, res, ) || len < 0)
+   return UBUS_STATUS_OK;
+
+   for (i = 0; i < len; i += sizeof(struct iwinfo_survey_entry)) {
+   e = (struct iwinfo_survey_entry *)[i];
+
+   d = blobmsg_open_table(, NULL);
+   blobmsg_add_u32(, "mhz", e->mhz);
+   blobmsg_add_u32(, "noise", e->noise);
+   blobmsg_add_u64(, "active_time", e->active_time);
+   blobmsg_add_u64(, "busy_time", e->busy_time);
+   blobmsg_add_u64(, "busy_time_ext", e->busy_time_ext);
+   blobmsg_add_u64(, "rx_time", e->rxtime);
+   blobmsg_add_u64(, "tx_time", e->txtime);
+   blobmsg_close_table(, d);
+   }
+
+   blobmsg_close_array(, c);
+   ubus_send_reply(ctx, req, buf.head);
+   rpc_iwinfo_close();
+   return UBUS_STATUS_OK;
+}
+
 static int
 rpc_iwinfo_freqlist(struct ubus_context *ctx, struct ubus_object *obj,
 struct ubus_request_data *req, const char *method,
@@ -791,6 +830,7 @@ rpc_iwinfo_api_init(const struct rpc_daemon_ops *o, struct 
ubus_context *ctx)
UBUS_METHOD("freqlist",rpc_iwinfo_freqlist,
rpc_device_policy),
UBUS_METHOD("txpowerlist", rpc_iwinfo_txpowerlist, 
rpc_device_policy),
UBUS_METHOD("countrylist", rpc_iwinfo_countrylist, 
rpc_device_policy),
+   UBUS_METHOD("survey",  rpc_iwinfo_survey,  
rpc_device_policy),
UBUS_METHOD("phyname", rpc_iwinfo_phyname, 
rpc_uci_policy),
};
 
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] mt7621: add kexec smp shutdown patch.

2019-02-17 Thread Daniel Danzberger
This patch shuts down all secondary cpus before executing machine_kexec.
This avoids paging errors and random hangups when doing kexec.

Signed-off-by: Daniel Danzberger 
---
 .../120-mt7621-kexec-smp-shutdown.patch   | 65 +++
 1 file changed, 65 insertions(+)
 create mode 100644 
target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch

diff --git 
a/target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch 
b/target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch
new file mode 100644
index 00..a4c0e59521
--- /dev/null
+++ b/target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch
@@ -0,0 +1,65 @@
+From 17288381dfc3e920d81cfd4e63e33e3630d54a58 Mon Sep 17 00:00:00 2001
+From: Daniel Danzberger 
+Date: Sat, 22 Dec 2018 22:20:37 +0100
+Subject: [PATCH] mt7621: kexec: shutdown secondary cpus
+
+Signed-off-by: Daniel Danzberger 
+---
+ arch/mips/ralink/mt7621.c | 20 
+ 1 file changed, 20 insertions(+)
+
+diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c
+index 801edf9..34dced6 100644
+--- a/arch/mips/ralink/mt7621.c
 b/arch/mips/ralink/mt7621.c
+@@ -13,6 +13,7 @@
+ #include 
+ #include 
+ #include 
++#include 
+ #include 
+
+ #include 
+@@ -23,6 +24,7 @@
+ #include 
+ #include 
+ #include 
++#include 
+
+ #include 
+
+@@ -271,6 +273,21 @@ static int udelay_recal(void)
+ }
+ device_initcall(udelay_recal);
+
++#ifdef CONFIG_KEXEC
++static void mt7621_kexec_shutdown(void)
++{
++  int reboot_cpu = 0;
++  int cpu;
++
++  for_each_online_cpu(cpu) {
++  if (cpu != reboot_cpu)
++  cpu_down(cpu);
++  }
++  cpu_hotplug_disable();
++}
++#endif
++
++
+ void prom_soc_init(struct ralink_soc_info *soc_info)
+ {
+   void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE);
+@@ -325,6 +342,9 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
+
+   rt2880_pinmux_data = mt7621_pinmux_data;
+
++#ifdef CONFIG_KEXEC
++  _machine_kexec_shutdown = mt7621_kexec_shutdown;
++#endif
+
+   if (!register_cps_smp_ops())
+   return;
+--
+2.11.0
+
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] config-kernel: export kernels blkio cgroup configs.

2019-02-14 Thread Daniel Danzberger
These options can enable the blkio.weight + blkio.throttle cgroups.

Signed-off-by: Daniel Danzberger 
---
 config/Config-kernel.in | 12 
 1 file changed, 12 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index f38cc792dd..c89e1f9f2e 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -519,6 +519,18 @@ if KERNEL_CGROUPS
  CONFIG_CFQ_GROUP_IOSCHED=y; for enabling throttling policy, 
set
  CONFIG_BLK_DEV_THROTTLING=y.
 
+   config KERNEL_CFQ_GROUP_IOSCHED
+   bool "Block IO controller cgroup blkio.weigtht"
+   default n
+
+   config KERNEL_BLK_DEV_THROTTLING
+   bool "Block IO controller cgroup blkio.throttle"
+   default n
+
+   config KERNEL_BLK_DEV_THROTTLING_LOW
+   bool "Block IO controller cgroup blkio.throttle low limit 
interface support"
+   default n
+
config KERNEL_DEBUG_BLK_CGROUP
bool "Enable Block IO controller debugging"
default n
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] libiwinfo: nl80211: add mesh stats on assoclist.

2018-10-31 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 include/iwinfo.h |  6 +
 iwinfo_nl80211.c | 76 
 2 files changed, 82 insertions(+)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 49ee7f0..02ad623 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -126,6 +126,12 @@ struct iwinfo_assoclist_entry {
uint8_t is_mfp:1;
uint8_t is_tdls:1;
uint32_t thr;
+   uint16_t llid;
+   uint16_t plid;
+   char plink_state[16];
+   char local_ps[16];
+   char peer_ps[16];
+   char nonpeer_ps[16];
 };
 
 struct iwinfo_survey_entry {
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index ca78742..5154230 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1756,6 +1756,57 @@ static int nl80211_get_survey_cb(struct nl_msg *msg, 
void *arg)
return NL_SKIP;
 }
 
+
+static void plink_state_to_str(char *dst, unsigned state)
+{
+   switch (state) {
+   case NL80211_PLINK_LISTEN:
+   strcpy(dst, "LISTEN");
+   break;
+   case NL80211_PLINK_OPN_SNT:
+   strcpy(dst, "OPN_SNT");
+   break;
+   case NL80211_PLINK_OPN_RCVD:
+   strcpy(dst, "OPN_RCVD");
+   break;
+   case NL80211_PLINK_CNF_RCVD:
+   strcpy(dst, "CNF_RCVD");
+   break;
+   case NL80211_PLINK_ESTAB:
+   strcpy(dst, "ESTAB");
+   break;
+   case NL80211_PLINK_HOLDING:
+   strcpy(dst, "HOLDING");
+   break;
+   case NL80211_PLINK_BLOCKED:
+   strcpy(dst, "BLOCKED");
+   break;
+   default:
+   strcpy(dst, "UNKNOWN");
+   break;
+   }
+}
+
+static void power_mode_to_str(char *dst, struct nlattr *a)
+{
+   enum nl80211_mesh_power_mode pm = nla_get_u32(a);
+
+   switch (pm) {
+   case NL80211_MESH_POWER_ACTIVE:
+   strcpy(dst, "ACTIVE");
+   break;
+   case NL80211_MESH_POWER_LIGHT_SLEEP:
+   strcpy(dst, "LIGHT SLEEP");
+   break;
+   case NL80211_MESH_POWER_DEEP_SLEEP:
+   strcpy(dst, "DEEP SLEEP");
+   break;
+   default:
+   strcpy(dst, "UNKNOWN");
+   break;
+   }
+}
+
 static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
 {
struct nl80211_array_buf *arr = arg;
@@ -1783,6 +1834,13 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
[NL80211_STA_INFO_STA_FLAGS] =
{ .minlen = sizeof(struct nl80211_sta_flag_update) },
[NL80211_STA_INFO_EXPECTED_THROUGHPUT]   = { .type = NLA_U32
},
+   /* mesh */
+   [NL80211_STA_INFO_LLID]  = { .type = NLA_U16},
+   [NL80211_STA_INFO_PLID]  = { .type = NLA_U16},
+   [NL80211_STA_INFO_PLINK_STATE]   = { .type = NLA_U8 },
+   [NL80211_STA_INFO_LOCAL_PM]  = { .type = NLA_U32},
+   [NL80211_STA_INFO_PEER_PM]   = { .type = NLA_U32},
+   [NL80211_STA_INFO_NONPEER_PM]= { .type = NLA_U32},
};
 
static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
@@ -1852,6 +1910,24 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT])
e->thr = 
nla_get_u32(sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]);
 
+   /* mesh */
+   if (sinfo[NL80211_STA_INFO_LLID])
+   e->llid = nla_get_u16(sinfo[NL80211_STA_INFO_LLID]);
+
+   if (sinfo[NL80211_STA_INFO_PLID])
+   e->plid = nla_get_u16(sinfo[NL80211_STA_INFO_PLID]);
+
+   if (sinfo[NL80211_STA_INFO_PLINK_STATE])
+   plink_state_to_str(e->plink_state,
+   
nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE]));
+
+   if (sinfo[NL80211_STA_INFO_LOCAL_PM])
+   power_mode_to_str(e->local_ps, 
sinfo[NL80211_STA_INFO_LOCAL_PM]);
+   if (sinfo[NL80211_STA_INFO_PEER_PM])
+   power_mode_to_str(e->peer_ps, 
sinfo[NL80211_STA_INFO_PEER_PM]);
+   if (sinfo[NL80211_STA_INFO_NONPEER_PM])
+   power_mode_to_str(e->nonpeer_ps, 
sinfo[NL80211_STA_INFO_NONPEER_PM]);
+
/* Station flags */
if (sinfo[NL80211_STA_INFO_STA_FLAGS])
{
-- 
2.11.0


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


Re: [OpenWrt-Devel] [PATCH 2/2] iwinfo: nl80211: add survey.

2018-07-05 Thread Daniel Danzberger
Yes, everything returned by NL80211_CMD_GET_SURVEY.
Its equivalent to: # iw wlan0 survey dump

On 07/04/2018 10:32 PM, Nick wrote:
> I wanted to add this info too. See previous emails: "iwinfo: add channel
> survey"
> I think you are making the survey for all channels?
> My attention was only a survey for the used channel.
> 
> 
> On 03.07.2018 15:32, Daniel Danzberger wrote:
>> Signed-off-by: Daniel Danzberger 
>> ---
>>  include/iwinfo.h | 11 
>>  iwinfo_nl80211.c | 69 
>>  2 files changed, 80 insertions(+)
>>
>> diff --git a/include/iwinfo.h b/include/iwinfo.h
>> index 4111205..49ee7f0 100644
>> --- a/include/iwinfo.h
>> +++ b/include/iwinfo.h
>> @@ -128,6 +128,16 @@ struct iwinfo_assoclist_entry {
>>  uint32_t thr;
>>  };
>>  
>> +struct iwinfo_survey_entry {
>> +uint64_t active_time;
>> +uint64_t busy_time;
>> +uint64_t busy_time_ext;
>> +uint64_t rxtime;
>> +uint64_t txtime;
>> +uint32_t mhz;
>> +uint8_t noise;
>> +};
>> +
>>  struct iwinfo_txpwrlist_entry {
>>  uint8_t  dbm;
>>  uint16_t mw;
>> @@ -223,6 +233,7 @@ struct iwinfo_ops {
>>  int (*scanlist)(const char *, char *, int *);
>>  int (*freqlist)(const char *, char *, int *);
>>  int (*countrylist)(const char *, char *, int *);
>> +int (*survey)(const char *, char *, int *);
>>  int (*lookup_phy)(const char *, char *);
>>  void (*close)(void);
>>  };
>> diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
>> index 0e0206b..71465b5 100644
>> --- a/iwinfo_nl80211.c
>> +++ b/iwinfo_nl80211.c
>> @@ -1678,6 +1678,59 @@ static void nl80211_parse_rateinfo(struct nlattr **ri,
>>  re->is_40mhz = (re->mhz == 40);
>>  }
>>  
>> +static int nl80211_get_survey_cb(struct nl_msg *msg, void *arg)
>> +{
>> +struct nl80211_array_buf *arr = arg;
>> +struct iwinfo_survey_entry *e = arr->buf;
>> +struct nlattr **attr = nl80211_parse(msg);
>> +struct nlattr *sinfo[NL80211_SURVEY_INFO_MAX + 1];
>> +int rc;
>> +
>> +static struct nla_policy survey_policy[NL80211_SURVEY_INFO_MAX + 1] = {
>> +[NL80211_SURVEY_INFO_FREQUENCY] = { .type = NLA_U32 },
>> +[NL80211_SURVEY_INFO_NOISE]  = { .type = NLA_U8 },
>> +[NL80211_SURVEY_INFO_TIME] = { .type = NLA_U64   },
>> +[NL80211_SURVEY_INFO_TIME_BUSY] = { .type = NLA_U64   },
>> +[NL80211_SURVEY_INFO_TIME_EXT_BUSY] = { .type = NLA_U64   },
>> +[NL80211_SURVEY_INFO_TIME_RX] = { .type = NLA_U64   },
>> +[NL80211_SURVEY_INFO_TIME_TX] = { .type = NLA_U64   },
>> +};
>> +
>> +rc = nla_parse_nested(sinfo, NL80211_SURVEY_INFO_MAX,
>> +attr[NL80211_ATTR_SURVEY_INFO],
>> +survey_policy);
>> +if (rc)
>> +return NL_SKIP;
>> +
>> +/* advance to end of array */
>> +e += arr->count;
>> +memset(e, 0, sizeof(*e));
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
>> +e->mhz = nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]);
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_NOISE])
>> +e->noise = nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]);
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_TIME])
>> +e->active_time = nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME]);
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_TIME_BUSY])
>> +e->busy_time = 
>> nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_BUSY]);
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_TIME_EXT_BUSY])
>> +e->busy_time_ext = 
>> nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_EXT_BUSY]);
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_TIME_RX])
>> +e->rxtime = nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_RX]);
>> +
>> +if (sinfo[NL80211_SURVEY_INFO_TIME_TX])
>> +e->txtime = nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_TX]);
>> +
>> +arr->count++;
>> +return NL_SKIP;
>> +}
>> +
>>  static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
>>  {
>>  struct nl80211_array_buf *arr = arg;
>> @@ -1812,6 +1865,21 @@ static int nl80211_get_assoclist_cb(struct nl_msg 
>> *msg, void *arg)
>>  return NL_SKIP;
>>  }
>>  
>> +static int nl80211_get_surv

[OpenWrt-Devel] [PATCH 2/2] iwinfo: nl80211: add survey.

2018-07-03 Thread Daniel Danzberger
Signed-off-by: Daniel Danzberger 
---
 include/iwinfo.h | 11 
 iwinfo_nl80211.c | 69 
 2 files changed, 80 insertions(+)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 4111205..49ee7f0 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -128,6 +128,16 @@ struct iwinfo_assoclist_entry {
uint32_t thr;
 };
 
+struct iwinfo_survey_entry {
+   uint64_t active_time;
+   uint64_t busy_time;
+   uint64_t busy_time_ext;
+   uint64_t rxtime;
+   uint64_t txtime;
+   uint32_t mhz;
+   uint8_t noise;
+};
+
 struct iwinfo_txpwrlist_entry {
uint8_t  dbm;
uint16_t mw;
@@ -223,6 +233,7 @@ struct iwinfo_ops {
int (*scanlist)(const char *, char *, int *);
int (*freqlist)(const char *, char *, int *);
int (*countrylist)(const char *, char *, int *);
+   int (*survey)(const char *, char *, int *);
int (*lookup_phy)(const char *, char *);
void (*close)(void);
 };
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 0e0206b..71465b5 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1678,6 +1678,59 @@ static void nl80211_parse_rateinfo(struct nlattr **ri,
re->is_40mhz = (re->mhz == 40);
 }
 
+static int nl80211_get_survey_cb(struct nl_msg *msg, void *arg)
+{
+   struct nl80211_array_buf *arr = arg;
+   struct iwinfo_survey_entry *e = arr->buf;
+   struct nlattr **attr = nl80211_parse(msg);
+   struct nlattr *sinfo[NL80211_SURVEY_INFO_MAX + 1];
+   int rc;
+
+   static struct nla_policy survey_policy[NL80211_SURVEY_INFO_MAX + 1] = {
+   [NL80211_SURVEY_INFO_FREQUENCY] = { .type = NLA_U32 },
+   [NL80211_SURVEY_INFO_NOISE]  = { .type = NLA_U8 },
+   [NL80211_SURVEY_INFO_TIME] = { .type = NLA_U64   },
+   [NL80211_SURVEY_INFO_TIME_BUSY] = { .type = NLA_U64   },
+   [NL80211_SURVEY_INFO_TIME_EXT_BUSY] = { .type = NLA_U64   },
+   [NL80211_SURVEY_INFO_TIME_RX] = { .type = NLA_U64   },
+   [NL80211_SURVEY_INFO_TIME_TX] = { .type = NLA_U64   },
+   };
+
+   rc = nla_parse_nested(sinfo, NL80211_SURVEY_INFO_MAX,
+   attr[NL80211_ATTR_SURVEY_INFO],
+   survey_policy);
+   if (rc)
+   return NL_SKIP;
+
+   /* advance to end of array */
+   e += arr->count;
+   memset(e, 0, sizeof(*e));
+
+   if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
+   e->mhz = nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]);
+
+if (sinfo[NL80211_SURVEY_INFO_NOISE])
+   e->noise = nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]);
+
+if (sinfo[NL80211_SURVEY_INFO_TIME])
+   e->active_time = nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME]);
+
+if (sinfo[NL80211_SURVEY_INFO_TIME_BUSY])
+   e->busy_time = 
nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_BUSY]);
+
+if (sinfo[NL80211_SURVEY_INFO_TIME_EXT_BUSY])
+e->busy_time_ext = 
nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_EXT_BUSY]);
+
+if (sinfo[NL80211_SURVEY_INFO_TIME_RX])
+e->rxtime = nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_RX]);
+
+if (sinfo[NL80211_SURVEY_INFO_TIME_TX])
+   e->txtime = nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_TX]);
+
+   arr->count++;
+   return NL_SKIP;
+}
+
 static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
 {
struct nl80211_array_buf *arr = arg;
@@ -1812,6 +1865,21 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
return NL_SKIP;
 }
 
+static int nl80211_get_survey(const char *ifname, char *buf, int *len)
+{
+   struct nl80211_array_buf arr = { .buf = buf, .count = 0 };
+   int rc;
+
+   rc = nl80211_request(ifname, NL80211_CMD_GET_SURVEY,
+   NLM_F_DUMP, nl80211_get_survey_cb, );
+   if (!rc)
+   *len = (arr.count * sizeof(struct iwinfo_survey_entry));
+   else
+   *len = 0;
+
+   return 0;
+}
+
 static int nl80211_get_assoclist(const char *ifname, char *buf, int *len)
 {
DIR *d;
@@ -2862,6 +2930,7 @@ const struct iwinfo_ops nl80211_ops = {
.scanlist = nl80211_get_scanlist,
.freqlist = nl80211_get_freqlist,
.countrylist  = nl80211_get_countrylist,
+   .survey   = nl80211_get_survey,
.lookup_phy   = nl80211_lookup_phyname,
.close= nl80211_close
 };
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 0/2] iwinfo: Query more info from nl80211

2018-07-03 Thread Daniel Danzberger
The following 2 patches add some more stats to libiwinfo.
There is another patch for the rpcd iwinfo module that uses them.

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


[OpenWrt-Devel] [PATCH 1/2] iwinfo: nl80211: add more stats to assoclist.

2018-07-03 Thread Daniel Danzberger
+ NL80211_STA_INFO_SIGNAL_AVG
+ NL80211_STA_INFO_RX_DROP_MISC
+ NL80211_STA_INFO_CONNECTED_TIME

Signed-off-by: Daniel Danzberger 
---
 include/iwinfo.h |  3 +++
 iwinfo_nl80211.c | 12 
 2 files changed, 15 insertions(+)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 929f697..4111205 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -105,10 +105,13 @@ struct iwinfo_rate_entry {
 struct iwinfo_assoclist_entry {
uint8_t mac[6];
int8_t signal;
+   int8_t signal_avg;
int8_t noise;
uint32_t inactive;
+   uint32_t connected_time;
uint32_t rx_packets;
uint32_t tx_packets;
+   uint64_t rx_drop_misc;
struct iwinfo_rate_entry rx_rate;
struct iwinfo_rate_entry tx_rate;
uint32_t rx_bytes;
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index ecd2d6a..0e0206b 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1694,10 +1694,13 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
[NL80211_STA_INFO_RX_BITRATE]= { .type = NLA_NESTED },
[NL80211_STA_INFO_TX_BITRATE]= { .type = NLA_NESTED },
[NL80211_STA_INFO_SIGNAL]= { .type = NLA_U8 },
+   [NL80211_STA_INFO_SIGNAL_AVG]= { .type = NLA_U8 },
[NL80211_STA_INFO_RX_BYTES]  = { .type = NLA_U32},
[NL80211_STA_INFO_TX_BYTES]  = { .type = NLA_U32},
[NL80211_STA_INFO_TX_RETRIES]= { .type = NLA_U32},
[NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32},
+   [NL80211_STA_INFO_CONNECTED_TIME]= { .type = NLA_U32},
+   [NL80211_STA_INFO_RX_DROP_MISC]  = { .type = NLA_U64},
[NL80211_STA_INFO_T_OFFSET]  = { .type = NLA_U64},
[NL80211_STA_INFO_STA_FLAGS] =
{ .minlen = sizeof(struct nl80211_sta_flag_update) },
@@ -1725,9 +1728,15 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
if (sinfo[NL80211_STA_INFO_SIGNAL])
e->signal = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]);
 
+   if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
+   e->signal_avg = 
nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]);
+
if (sinfo[NL80211_STA_INFO_INACTIVE_TIME])
e->inactive = 
nla_get_u32(sinfo[NL80211_STA_INFO_INACTIVE_TIME]);
 
+   if (sinfo[NL80211_STA_INFO_CONNECTED_TIME])
+   e->connected_time = 
nla_get_u32(sinfo[NL80211_STA_INFO_CONNECTED_TIME]);
+
if (sinfo[NL80211_STA_INFO_RX_PACKETS])
e->rx_packets = 
nla_get_u32(sinfo[NL80211_STA_INFO_RX_PACKETS]);
 
@@ -1759,6 +1768,9 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
if (sinfo[NL80211_STA_INFO_T_OFFSET])
e->t_offset = 
nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]);
 
+   if (sinfo[NL80211_STA_INFO_RX_DROP_MISC])
+   e->rx_drop_misc = 
nla_get_u64(sinfo[NL80211_STA_INFO_RX_DROP_MISC]);
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT])
e->thr = 
nla_get_u32(sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]);
 
-- 
2.18.0


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


Re: [OpenWrt-Devel] [LEDE-DEV] MMAP memory out of sync on AR71xx Rambutan (8devices) board.

2018-05-29 Thread Daniel Danzberger
I posted the issue on the alsa-devel mailing list and they are pushing a patch
that allows the snd_usb_audio module to pass the parameter use_vmalloc=0.

That causes the snd_usb_audio driver to use DMA coherent memory for the pcm
buffer, which always mmaps() correctly to userspace in all my tests.

The patch is queued for 4.18.

Here is the patch + conversation from alsa-devel:
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-May/136408.html

The problem seems to be memory coherence on MIPS.
I haven't figured out yet, how mmap() can work without issues when the ELF
loader mmaps() libraries for example, but mmap() fails in my mmaptest kernel
module when simply mapping a single page.

As far as I tested, mmap() always works when memory is mapped by the filesystem
code. However, I am going to expand my mmaptest utils to debug this.

There should be a better fix than using DMA coherent memory...


BTW: Is someone using X on the affected MIPS devices ? The problem should exist
there as well, because X heavily relies on mmap() for rendering.

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