Re: uqmi: add dms_get_operating_mode
Hi Henrik, On Wed, Dec 01, 2021 at 01:46:01AM +0100, Henrik Ginstmark wrote: > Hi > > Is it possible to add dms_get_operating_mode command? Doesn't seem much of a stretch, so why not ;) > Then it would be possible to verify if the modem is in flight mode or not. > > Or how can I contribute to uqmi? Generally, follow this guideline https://openwrt.org/submitting-patches When sending a patch for a sub-project like uqmi, please make sure to prefix the message subject to clearly indicate the patch has to be applied on uqmi.git and not on openwrt.git (just like you did) What is missing here is mostly a patch description, and your Signed-off-by: ... Cheers Daniel > > > BR > Henrik Ginstmark > > --- > commands-dms.c > > @@ -375,6 +375,38 @@ qmi_set_dms_reset_request(msg); > return QMI_CMD_REQUEST; > } > > +static void > +cmd_dms_get_operating_mode_cb(struct qmi_dev *qmi, struct qmi_request > *req, struct qmi_msg *msg) > +{ > + struct qmi_dms_get_operating_mode_response res; > + > + const char *modes[] = { > + [QMI_DMS_OPERATING_MODE_ONLINE] = "online", > + [QMI_DMS_OPERATING_MODE_LOW_POWER] = "low_power", > + [QMI_DMS_OPERATING_MODE_FACTORY_TEST] = "factory_test", > + [QMI_DMS_OPERATING_MODE_OFFLINE] = "offline", > + [QMI_DMS_OPERATING_MODE_RESET] = "reset", > + [QMI_DMS_OPERATING_MODE_SHUTTING_DOWN] = "shutting_down", > + [QMI_DMS_OPERATING_MODE_PERSISTENT_LOW_POWER] = "persistent_low_power", > + [QMI_DMS_OPERATING_MODE_MODE_ONLY_LOW_POWER] = "mode_only_low_power", > + }; > + int s = 0; > + > + qmi_parse_dms_get_operating_mode_response(msg, ); > + if (res.set.mode && > +res.data.mode < ARRAY_SIZE(modes)) > + s = res.data.mode; > + > + blobmsg_add_string(, NULL, modes[s]); > +} > + > +static enum qmi_cmd_result > +cmd_dms_get_operating_mode_prepare(struct qmi_dev *qmi, struct > qmi_request *req, struct qmi_msg *msg, char *arg) > +{ > + qmi_set_dms_get_operating_mode_request(msg); > + return QMI_CMD_REQUEST; > +} > + > #define cmd_dms_set_operating_mode_cb no_cb > static enum qmi_cmd_result > cmd_dms_set_operating_mode_prepare(struct qmi_dev *qmi, struct > qmi_request *req, struct qmi_msg *msg, char *arg) > > > --- > commands-dms.h > > @@ -37,6 +37,7 @@ > __uqmi_command(dms_get_imsi, get-imsi, no, QMI_SERVICE_DMS), \ > __uqmi_command(dms_get_imei, get-imei, no, QMI_SERVICE_DMS), \ > __uqmi_command(dms_get_msisdn, get-msisdn, no, QMI_SERVICE_DMS), \ > + __uqmi_command(dms_get_operating_mode, > get-device-operating-mode, no, QMI_SERVICE_DMS), \ > __uqmi_command(dms_set_operating_mode, > set-device-operating-mode, required, QMI_SERVICE_DMS), \ > __uqmi_command(dms_reset, reset-dms, no, QMI_SERVICE_DMS), \ > __uqmi_command(dms_set_fcc_authentication, fcc-auth, no, > QMI_SERVICE_DMS) \ > @@ -67,6 +58,7 @@ > " --get-imei: Get International > Mobile Equipment ID\n" \ > " --get-msisdn: Get the MSISDN > (telephone number)\n" \ > " --reset-dms: Reset the DMS service\n" > \ > + " --get-device-operating-mode Get the device > operating mode\n" \ > " --set-device-operating-modeSet the device > operating mode\n" \ > "(modes: online, > low_power, factory_test, offline\n" \ > " > reset,shutting_down, persistent_low_power,\n" \ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
uqmi: add dms_get_operating_mode
Hi Is it possible to add dms_get_operating_mode command? Then it would be possible to verify if the modem is in flight mode or not. Or how can I contribute to uqmi? BR Henrik Ginstmark --- commands-dms.c @@ -375,6 +375,38 @@ qmi_set_dms_reset_request(msg); return QMI_CMD_REQUEST; } +static void +cmd_dms_get_operating_mode_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg) +{ + struct qmi_dms_get_operating_mode_response res; + + const char *modes[] = { + [QMI_DMS_OPERATING_MODE_ONLINE] = "online", + [QMI_DMS_OPERATING_MODE_LOW_POWER] = "low_power", + [QMI_DMS_OPERATING_MODE_FACTORY_TEST] = "factory_test", + [QMI_DMS_OPERATING_MODE_OFFLINE] = "offline", + [QMI_DMS_OPERATING_MODE_RESET] = "reset", + [QMI_DMS_OPERATING_MODE_SHUTTING_DOWN] = "shutting_down", + [QMI_DMS_OPERATING_MODE_PERSISTENT_LOW_POWER] = "persistent_low_power", + [QMI_DMS_OPERATING_MODE_MODE_ONLY_LOW_POWER] = "mode_only_low_power", + }; + int s = 0; + + qmi_parse_dms_get_operating_mode_response(msg, ); + if (res.set.mode && +res.data.mode < ARRAY_SIZE(modes)) + s = res.data.mode; + + blobmsg_add_string(, NULL, modes[s]); +} + +static enum qmi_cmd_result +cmd_dms_get_operating_mode_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + qmi_set_dms_get_operating_mode_request(msg); + return QMI_CMD_REQUEST; +} + #define cmd_dms_set_operating_mode_cb no_cb static enum qmi_cmd_result cmd_dms_set_operating_mode_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) --- commands-dms.h @@ -37,6 +37,7 @@ __uqmi_command(dms_get_imsi, get-imsi, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_get_imei, get-imei, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_get_msisdn, get-msisdn, no, QMI_SERVICE_DMS), \ + __uqmi_command(dms_get_operating_mode, get-device-operating-mode, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_operating_mode, set-device-operating-mode, required, QMI_SERVICE_DMS), \ __uqmi_command(dms_reset, reset-dms, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_fcc_authentication, fcc-auth, no, QMI_SERVICE_DMS) \ @@ -67,6 +58,7 @@ " --get-imei: Get International Mobile Equipment ID\n" \ " --get-msisdn: Get the MSISDN (telephone number)\n" \ " --reset-dms: Reset the DMS service\n" \ + " --get-device-operating-mode Get the device operating mode\n" \ " --set-device-operating-modeSet the device operating mode\n" \ "(modes: online, low_power, factory_test, offline\n" \ " reset,shutting_down, persistent_low_power,\n" \ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: zram-swap: default to lzo instead of lzo-rle compression
Am Montag, 29. November 2021, 10:57:37 CET schrieb Rui Salvaterra: > Hi, Sven, > > On Sun, 28 Nov 2021 at 01:40, Sven Roederer wrote: > > Rui, not sure if to call it a bug. At the end there is a hardcoded default > > algo in the module, that is used initially when creating the device. The > > check for the valid algo is done later at device-activation. > > I spend some time in this code and have a patch ready, which checks for > > algos before announcing them. > > It's not a bug, but it's also not exactly an unsurprising behaviour. > This is the real issue: > > https://elixir.bootlin.com/linux/v5.10.82/source/crypto/Makefile#L153 > > obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o > > Even though they're built as separate modules, they depend on a single > kconfig symbol. Moreover, lzo-rle uses most of the original lzo > functions (adding just RLE on top), so they should arguably just be > merged. I don't know how receptive upstream is to that idea, but it > seems logical to me. > Rui, during my work I also had the impression, that both files probably share a lot of common code. Based on your comment I had a closer look ... Back in 2019 (v5.1) the linux guys explicitly split the code into separate files to avoid potential data-corrution. https://github.com/torvalds/linux/commit/45ec975efb527625629d123f305 So I don't expect joining the code again will be accepted upstream. Back to the initial issue, I just send my patch of the selection-algorithm to the list for tests and comments. When it's proven to work, I'm fine with trying to push upstream. Sven ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH] kernel: make zram honor available compressors when selecting the initial algo
When initializing the ZRAM it has a hardcoded default of "lzo-rle" compressor. This compressor is not available in OpenWrt as only "lzo" is provided. The current behaviour make the PROCD_ZRAM_TMPFS feature failing, as procd-init is relying on the kernels default-algo, which is not present. So setting tmpfs falls back to not use ZRAM. Patch the kernel to keep the current preference to "lzo-rle" but check that it is present. If not, fall back to "lzo" or any other of the known compressors. See also: * http://lists.openwrt.org/pipermail/openwrt-devel/2020-September/031430.html * 419f149e482641ddc520f80a7ab2038f7e2ebc8a Signed-off-by: Sven Roederer --- .../pending-5.4/801-zram_default-algo.patch | 109 ++ 1 file changed, 109 insertions(+) create mode 100644 target/linux/generic/pending-5.4/801-zram_default-algo.patch diff --git a/target/linux/generic/pending-5.4/801-zram_default-algo.patch b/target/linux/generic/pending-5.4/801-zram_default-algo.patch new file mode 100644 index 00..332bf24fed --- /dev/null +++ b/target/linux/generic/pending-5.4/801-zram_default-algo.patch @@ -0,0 +1,109 @@ +diff -ur linux-5.4.154.orig/drivers/block/zram/zcomp.c linux-5.4.154/drivers/block/zram/zcomp.c +--- linux-5.4.154.orig/drivers/block/zram/zcomp.c 2021-10-17 10:42:35.0 +0200 linux-5.4.154/drivers/block/zram/zcomp.c 2021-11-29 02:07:04.118702563 +0100 +@@ -14,24 +14,6 @@ + + #include "zcomp.h" + +-static const char * const backends[] = { +- "lzo", +- "lzo-rle", +-#if IS_ENABLED(CONFIG_CRYPTO_LZ4) +- "lz4", +-#endif +-#if IS_ENABLED(CONFIG_CRYPTO_LZ4HC) +- "lz4hc", +-#endif +-#if IS_ENABLED(CONFIG_CRYPTO_842) +- "842", +-#endif +-#if IS_ENABLED(CONFIG_CRYPTO_ZSTD) +- "zstd", +-#endif +- NULL +-}; +- + static void zcomp_strm_free(struct zcomp_strm *zstrm) + { + if (!IS_ERR_OR_NULL(zstrm->tfm)) +diff -ur linux-5.4.154.orig/drivers/block/zram/zcomp.h linux-5.4.154/drivers/block/zram/zcomp.h +--- linux-5.4.154.orig/drivers/block/zram/zcomp.h 2021-10-17 10:42:35.0 +0200 linux-5.4.154/drivers/block/zram/zcomp.h 2021-11-29 02:05:57.777496700 +0100 +@@ -6,6 +6,24 @@ + #ifndef _ZCOMP_H_ + #define _ZCOMP_H_ + ++static const char * const backends[] = { ++"lzo-rle", ++"lzo", ++#if IS_ENABLED(CONFIG_CRYPTO_LZ4) ++"lz4", ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_LZ4HC) ++"lz4hc", ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_842) ++"842", ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_ZSTD) ++"zstd", ++#endif ++NULL ++}; ++ + struct zcomp_strm { + /* compression/decompression buffer */ + void *buffer; +diff -ur linux-5.4.154.orig/drivers/block/zram/zram_drv.c linux-5.4.154/drivers/block/zram/zram_drv.c +--- linux-5.4.154.orig/drivers/block/zram/zram_drv.c 2021-10-17 10:42:35.0 +0200 linux-5.4.154/drivers/block/zram/zram_drv.c2021-11-29 02:04:57.400399244 +0100 +@@ -41,7 +41,6 @@ + static DEFINE_MUTEX(zram_index_mutex); + + static int zram_major; +-static const char *default_compressor = "lzo-rle"; + + /* Module params (documentation at end) */ + static unsigned int num_devices = 1; +@@ -1882,6 +1881,7 @@ + struct zram *zram; + struct request_queue *queue; + int ret, device_id; ++ int comp_count = 0; + + zram = kzalloc(sizeof(struct zram), GFP_KERNEL); + if (!zram) +@@ -1915,6 +1915,24 @@ + goto out_free_queue; + } + ++ /* check default compressors and select 1st available */ ++ for (; backends[comp_count]; comp_count++) { ++ if (crypto_has_alg(backends[comp_count], 0, 0)) { ++ pr_info("Using %s compressor as zram default\n", ++ backends[comp_count]); ++ strlcpy(zram->compressor, backends[comp_count], ++ sizeof(zram->compressor)); ++ } else { ++ pr_warn("%s compressor not found. Checking next ...\n", ++ backends[comp_count]); ++ } ++ } ++ if (!zram->compressor) { ++ pr_err("Error finding a default compressor\n"); ++ ret = -ENXIO; ++ goto out_free_queue; ++ } ++ + zram->disk->major = zram_major; + zram->disk->first_minor = device_id; + zram->disk->fops = _devops; +@@ -1957,8 +1975,6 @@ + (BDI_CAP_STABLE_WRITES | BDI_CAP_SYNCHRONOUS_IO); + device_add_disk(NULL, zram->disk, zram_disk_attr_groups); + +- strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor)); +- + zram_debugfs_register(zram); + pr_info("Added device: %s\n", zram->disk->disk_name); + return device_id; -- 2.30.2 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org
Re: [PATCH] u-boot-tools: add new package for mkimage & dumpimage
Hi Rafał, On 30.11.2021 14:00, Rafał Miłecki wrote: From: Rafał Miłecki Those tools can be useful for targets that use ITB firmware format. They may need them to extract firmware images to flash them. Truly a cosmetic thing but all other U-Boot related packages we currently carry in the tree are named "uboot-..." (no dash). -- Cheers, Piotr Signed-off-by: Rafał Miłecki --- package/boot/u-boot-tools/Makefile| 50 +++ .../patches/0001-tools-disable-kwbimage.patch | 25 ++ 2 files changed, 75 insertions(+) create mode 100644 package/boot/u-boot-tools/Makefile create mode 100644 package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch diff --git a/package/boot/u-boot-tools/Makefile b/package/boot/u-boot-tools/Makefile new file mode 100644 index 00..e77e27e679 --- /dev/null +++ b/package/boot/u-boot-tools/Makefile @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=u-boot-tools +PKG_DISTNAME:=u-boot +PKG_VERSION:=2021.10 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:= \ +https://ftp.denx.de/pub/u-boot \ +ftp://ftp.denx.de/pub/u-boot \ +https://mirror.cyberbits.eu/u-boot +PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4 +PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=Licenses/README + +include $(INCLUDE_DIR)/package.mk + +define Package/u-boot-tools + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Boot Loaders + TITLE:=U-Boot tools + URL:=https://www.denx.de/wiki/U-Boot +endef + +define Build/Configure + $(MAKE) -C $(PKG_BUILD_DIR) defconfig + $(MAKE) -C $(PKG_BUILD_DIR) syncconfig + $(SED) 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config +endef + +ifeq ($(ARCH),aarch64) +MAKE_FLAGS += ARCH=arm cross_tools +else +MAKE_FLAGS += cross_tools +endif + +define Package/u-boot-tools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/dumpimage $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mkimage $(1)/usr/bin +endef + +$(eval $(call BuildPackage,u-boot-tools)) diff --git a/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch b/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch new file mode 100644 index 00..69a42ec383 --- /dev/null +++ b/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch @@ -0,0 +1,25 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 30 Nov 2021 11:29:19 +0100 +Subject: [PATCH] tools: disable kwbimage +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Without CONFIG_TOOLS_LIBCRYPTO kwbimage doesn't compile because of +multiple "undefined reference"s to SSL functions. + +Signed-off-by: Rafał Miłecki +--- + tools/Makefile | 1 - + 1 file changed, 1 deletion(-) + +--- a/tools/Makefile b/tools/Makefile +@@ -117,7 +117,6 @@ dumpimage-mkimage-objs := aisimage.o \ + imximage.o \ + imx8image.o \ + imx8mimage.o \ +- kwbimage.o \ + lib/md5.o \ + lpc32xximage.o \ + mxsimage.o \ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH] cherry-pick Xiaomi AC2350 for 21.02
Attached in the form of patch for openwrt-21.02 current HEAD, please can this be applied =) We have tested 21.02 build on the AC2350 all we can:- * 2.4ghz wifi * 5ghz wifi * Ethernet Switch config, matches up with physical labels * Reset button works * LEDs (2 different 2 colour LEDs) work exactly as described * 1508 mini Jumbo on Wan with 1500MTU PPPoE-WAN. * Works fine for 2 weeks * IPv6 working (did not test turning on flow offloading, a known current issue anyhow). Kept activity up, speed tests, port forwarding, streaming, no apparent issues!. --Simon >From d19972de1dd627c7ad3e51d85fe3f88b135ad044 Mon Sep 17 00:00:00 2001 From: Evgeniy Isaev Date: Tue, 11 May 2021 13:45:51 +0500 Subject: [PATCH] ath79: add support for Xiaomi AIoT Router AC2350 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Device specifications * SoC: QCA9563 @ 775MHz (MIPS 74Kc) * RAM: 128MiB DDR2 * Flash: 16MiB SPI-NOR (EN25QH128) * Wireless 2.4GHz (SoC): b/g/n, 3x3 * Wireless 5Ghz (QCA9988): a/n/ac, 4x4 MU-MIMO * IoT Wireless 2.4GHz (QCA6006): currently unusable * Ethernet (AR8327): 3 LAN × 1GbE, 1 WAN × 1GbE * LEDs: Internet (blue/orange), System (blue/orange) * Buttons: Reset * UART: through-hole on PCB ([VCC 3.3v](RX)(GND)(TX) 115200, 8n1) * Power: 12VDC, 1,5A MAC addresses map (like in OEM firmware) art@0x0 88:C3:97:*:57 wan/label art@0x1002 88:C3:97:*:2D lan/wlan2g art@0x5006 88:C3:97:*:2C wlan5g Obtain SSH Access 1. Download and flash the firmware version 1.3.8 (China). 2. Login to the router web interface and get the value of `stok=` from the URL 3. Open a new tab and go to the following URL (replace with the stok value gained above; line breaks are only for easier handling, please put together all four lines into a single URL without any spaces): http://192.168.31.1/cgi-bin/luci/;stok=/api/misystem/set_config_iotdev ?bssid=any_id=any=-h%0Anvram%20set%20ssh_en%3D1%0Anvram%20commit %0Ased%20-i%20%27s%2Fchannel%3D.%2A%2Fchannel%3D%5C%5C%22debug%5C%5C%22%2F g%27%20%2Fetc%2Finit.d%2Fdropbear%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A 4. Wait 30-60 seconds (this is the time required to generate keys for the SSH server on the router). Create Full Backup 1. Obtain SSH Access. 2. Create backup of all flash (on router): dd if=/dev/mtd0 of=/tmp/ALL.backup 3. Copy backup to PC (on PC): scp root@192.168.31.1:/tmp/ALL.backup ./ Tip: backup of the original firmware, taken three times, increases the chances of recovery :) Calculate The Password * Locally using shell (replace "12345/E0QM98765" with your router's serial number): On Linux printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | \ md5sum - | head -c8 && echo On macOS printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | \ md5 | head -c8 * Locally using python script (replace "12345/E0QM98765" with your router's serial number): wget https://raw.githubusercontent.com/eisaev/ax3600-files/master/scripts/calc_passwd.py python3.7 -c 'from calc_passwd import calc_passwd; print(calc_passwd("12345/E0QM98765"))' * Online https://www.oxygen7.cn/miwifi/ Debricking (lite) If you have a healthy bootloader, you can use recovery via TFTP using programs like TinyPXE on Windows or dnsmasq on Linux. To switch the router to TFTP recovery mode, hold down the reset button, connect the power supply, and release the button after about 10 seconds. The router must be connected directly to the PC via the LAN port. Debricking You will need a full dump of your flash, a CH341 programmer, and a clip for in-circuit programming. Install OpenWRT 1. Obtain SSH Access. 2. Create script (on router): echo '#!/bin/sh' > /tmp/flash_fw.sh echo >> /tmp/flash_fw.sh echo '. /bin/boardupgrade.sh' >> /tmp/flash_fw.sh echo >> /tmp/flash_fw.sh echo 'board_prepare_upgrade' >> /tmp/flash_fw.sh echo 'mtd erase rootfs_data' >> /tmp/flash_fw.sh echo 'mtd write /tmp/openwrt.bin firmware' >> /tmp/flash_fw.sh echo 'sleep 3' >> /tmp/flash_fw.sh echo 'reboot' >> /tmp/flash_fw.sh echo >> /tmp/flash_fw.sh chmod +x /tmp/flash_fw.sh 3. Copy `openwrt-ath79-generic-xiaomi_aiot-ac2350-squashfs-sysupgrade.bin` to the router (on PC): scp openwrt-ath79-generic-xiaomi_aiot-ac2350-squashfs-sysupgrade.bin \ root@192.168.31.1:/tmp/openwrt.bin 4. Flash OpenWRT (on router): /bin/ash /tmp/flash_fw.sh & 5. SSH connection will be interrupted - this is normal. 6. Wait for the indicator to turn blue. Signed-off-by: Evgeniy Isaev [improve commit message formatting slightly] Signed-off-by: Adrian Schmutzler --- .../ath79/dts/qca9563_xiaomi_aiot-ac2350.dts | 177 ++ .../generic/base-files/etc/board.d/01_leds| 3 + .../generic/base-files/etc/board.d/02_network | 6 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 5 + target/linux/ath79/image/generic.mk | 9 + 5 files
Re: ath79: add Embedded Wireless Balin Platform
Hello, I have some comments below. On 30/11/2021 17:06, Catrinel Catrinescu wrote: Add the Embedded Wireless "Balin" platform, it is in ar71xx too SoC: QCA AR9344 or AR9350 RAM: DDR2-RAM 64MBytes Flash: SPI-NOR 16MBytes WLAN: 2 x 2 MIMO 2.4 & 5 GHz IEEE802.11 a/b/g/n Ethernet: 3 x 10/100 Mb/s USB: 1 x USB2.0 Host/Device bootstrap-pin at power-up PCI-Express: 1 x lane PCIe 1.2 UART: 1 x Normal, 1 x High-Speed JTAG: 1 x EJTAG GPIO: 10 x Input/Output multiplexed The module comes already with the current vanilla OpenWrt firmware. To update, use "sysupgrade" image directly in vendor firmware. I'm guessing here. But the vanilla OpenWrt firmware that your device ships with is still based on the ar71xx target? If so, could you please add in your commit message something about that "sysupgrade -n --force " will be needed for the first sysupgrade to the ath79 release? (with '-n = restores device back to "factory settings"') Alternatively, it is possible to do this without the flags as well. This requires migration scripts for led, net, etc... As well as adding the previous EW-BALIN boardname to the SUPPORTED_DEVICES variable in the generic.mk portion of this patch. This makes it possible to get the "sysupgrade " upgrade procedure path. [..] + + { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <5000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { is that uboot: label used somewhere? + label = "u-boot"; + reg = <0x00 0x04>; + read-only; + }; + + partition@4 { + label = "u-boot-env"; + reg = <0x04 0x01>; + }; + + partition@5 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x05 0xfa>; + }; + + art: partition@ff { + label = "art"; + reg = <0xff 0x01>; + read-only; you can add the mac-address (+calibration) as nvmem cells right here. There's no need to have this as a separate entity (i.e.: { ... }) below. (the art: label could be redundant as well) + }; + }; + }; +}; +/* + { + status = "okay"; + + ath9k: wifi@0,0 { + compatible = "pci168c,0030"; + reg = <0x 0 0 0 0>; + nvmem-cells = <_art_c>; + nvmem-cell-names = "mac-address"; + qca,no-eeprom; hmm, this is commented out. So, the pcie will not be working without making changes. Maybe it would be advantageous to move the comment block at least inside the node around the ath9k part? (So the mini pcie slot works with the provided images.) ... Or remove the comment block completely so that the ath9k minipcie (which I assume comes with the eval board) works out of the box? about "working out of the box": The "qca,no-eeprom" usually goes along with a change to target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom. The initialization will fail otherwise. This is because no eeprom is provided to the driver. But instead of adding an entry to 10-ath9k-eeprom, you can now specify a "calibration" nvmem cell and drop the "qca,no-eeprom" property. For an example: the WNDR3700 series and TP-Link Archer C7(v1+v2 with ath10k) have been updated to use the nvmem-cells. (of course, this is a bit tricky. Because this both nvmem and qca,no-eeprom are detrimental if an ath9k minipcie card is connected that is not the one that came with the eval board.) + #gpio-cells = <2>; + gpio-controller; + }; +}; +*/ +_switch { + + /delete-property/qca,phy4-mii-enable; +}; + + { + status = "okay"; + + nvmem-cells = <_art_1002>; + nvmem-cell-names = "mac-address"; + mac-address-increment-byte = <3>; + mac-address-increment = <0x40>; this has been converted to nvmem. Great! + + gmac-config { + device = <>; + switch-phy-swap = <0>; + switch-only-mode = <1>; + }; +}; + + { + status = "okay"; + + mtd-cal-data = < 0x1000>; the ath9k ahb devices do also work with the nvmem-cells "calibration" cells in this configuration. +}; + from here ... + { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_1002:
ath79: add Embedded Wireless Balin Platform
Add the Embedded Wireless "Balin" platform, it is in ar71xx too SoC: QCA AR9344 or AR9350 RAM: DDR2-RAM 64MBytes Flash: SPI-NOR 16MBytes WLAN: 2 x 2 MIMO 2.4 & 5 GHz IEEE802.11 a/b/g/n Ethernet: 3 x 10/100 Mb/s USB: 1 x USB2.0 Host/Device bootstrap-pin at power-up PCI-Express: 1 x lane PCIe 1.2 UART: 1 x Normal, 1 x High-Speed JTAG: 1 x EJTAG GPIO: 10 x Input/Output multiplexed The module comes already with the current vanilla OpenWrt firmware. To update, use "sysupgrade" image directly in vendor firmware. Signed-off-by: Catrinel Catrinescu --- .../dts/ar9344_embeddedwireless_balin.dts | 136 ++ .../generic/base-files/etc/board.d/02_network | 4 + target/linux/ath79/image/generic.mk | 9 ++ 3 files changed, 149 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts diff --git a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts new file mode 100644 index 00..a18f665341 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include + +/ { + model = "Embedded Wireless Balin"; + compatible = "embeddedwireless,balin", "qca,ar9344"; + + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = _system; + led-failsafe = _system; + led-running = _system; + led-upgrade = _system; + }; + + leds { + compatible = "gpio-leds"; + + led_system: system { + label = "green:system"; + gpios = < 14 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + linux,code = ; + gpios = < 18 GPIO_ACTIVE_HIGH>; + debounce-interval = <60>; + }; + }; +}; + + { + clock-frequency = <4000>; +}; + + { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <5000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x00 0x04>; + read-only; + }; + + partition@4 { + label = "u-boot-env"; + reg = <0x04 0x01>; + }; + + partition@5 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x05 0xfa>; + }; + + art: partition@ff { + label = "art"; + reg = <0xff 0x01>; + read-only; + }; + }; + }; +}; +/* + { + status = "okay"; + + ath9k: wifi@0,0 { + compatible = "pci168c,0030"; + reg = <0x 0 0 0 0>; + nvmem-cells = <_art_c>; + nvmem-cell-names = "mac-address"; + qca,no-eeprom; + #gpio-cells = <2>; + gpio-controller; + }; +}; +*/ +_switch { + + /delete-property/qca,phy4-mii-enable; +}; + + { + status = "okay"; + + nvmem-cells = <_art_1002>; + nvmem-cell-names = "mac-address"; + mac-address-increment-byte = <3>; + mac-address-increment = <0x40>; + + gmac-config { + device = <>; + switch-phy-swap = <0>; + switch-only-mode = <1>; + }; +}; + + { + status = "okay"; + + mtd-cal-data = < 0x1000>; +}; + + { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_1002: macaddr@1002 { + reg = <0x1002 0x6>; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 01e364a8fe..8c09932bd7 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -265,6 +265,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan" ;; +
[PATCH] u-boot-tools: add new package for mkimage & dumpimage
From: Rafał Miłecki Those tools can be useful for targets that use ITB firmware format. They may need them to extract firmware images to flash them. Signed-off-by: Rafał Miłecki --- package/boot/u-boot-tools/Makefile| 50 +++ .../patches/0001-tools-disable-kwbimage.patch | 25 ++ 2 files changed, 75 insertions(+) create mode 100644 package/boot/u-boot-tools/Makefile create mode 100644 package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch diff --git a/package/boot/u-boot-tools/Makefile b/package/boot/u-boot-tools/Makefile new file mode 100644 index 00..e77e27e679 --- /dev/null +++ b/package/boot/u-boot-tools/Makefile @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=u-boot-tools +PKG_DISTNAME:=u-boot +PKG_VERSION:=2021.10 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:= \ +https://ftp.denx.de/pub/u-boot \ +ftp://ftp.denx.de/pub/u-boot \ +https://mirror.cyberbits.eu/u-boot +PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4 +PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=Licenses/README + +include $(INCLUDE_DIR)/package.mk + +define Package/u-boot-tools + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Boot Loaders + TITLE:=U-Boot tools + URL:=https://www.denx.de/wiki/U-Boot +endef + +define Build/Configure + $(MAKE) -C $(PKG_BUILD_DIR) defconfig + $(MAKE) -C $(PKG_BUILD_DIR) syncconfig + $(SED) 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config +endef + +ifeq ($(ARCH),aarch64) +MAKE_FLAGS += ARCH=arm cross_tools +else +MAKE_FLAGS += cross_tools +endif + +define Package/u-boot-tools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/dumpimage $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mkimage $(1)/usr/bin +endef + +$(eval $(call BuildPackage,u-boot-tools)) diff --git a/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch b/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch new file mode 100644 index 00..69a42ec383 --- /dev/null +++ b/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch @@ -0,0 +1,25 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 30 Nov 2021 11:29:19 +0100 +Subject: [PATCH] tools: disable kwbimage +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Without CONFIG_TOOLS_LIBCRYPTO kwbimage doesn't compile because of +multiple "undefined reference"s to SSL functions. + +Signed-off-by: Rafał Miłecki +--- + tools/Makefile | 1 - + 1 file changed, 1 deletion(-) + +--- a/tools/Makefile b/tools/Makefile +@@ -117,7 +117,6 @@ dumpimage-mkimage-objs := aisimage.o \ + imximage.o \ + imx8image.o \ + imx8mimage.o \ +- kwbimage.o \ + lib/md5.o \ + lpc32xximage.o \ + mxsimage.o \ -- 2.31.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH v2 2/2] realtek: add support for Panasonic Switch-M8eG PN28080K
Panasonic Switch-M8eG PN28080K is a 8 + 1 port gigabit switch, based on RTL8380M. Specification: - SoC : Realtek RTL8380M - RAM : DDR3 128 MiB (Winbond W631GG8KB-15) - Flash : SPI-NOR 32 MiB (Macronix MX25L25635FMI-10G) - Ethernet : 10/100/1000 Mbps x8 + 1 - port 1-8: TP, RTL8218B (SoC) - port 9 : SFP, RTL8380M (SoC) - LEDs/Keys : 7x / 1x - UART : RS-232 port on the front panel (connector: RJ-45) - 3:TX, 4:GND, 5:GND, 6:RX (pin number: RJ-45) - 9600n8 - Power : 100-240 VAC, 50/60 Hz, 0.5 A - Plug: IEC 60320-C13 - Stock OS : VxWorks based Flash instruction using initramfs image: 1. Prepare the TFTP server with the IP address 192.168.1.111 2. Rename the OpenWrt initramfs image to "0101A8C0.img" and place it to the TFTP directory 3. Download the official upgrading firmware (ex: pn28080k_v3.rom) and place it to the TFTP directory 4. Boot M8eG and interrupt the U-Boot with Ctrl + C keys 5. Execute the following commands and boot with the OpenWrt initramfs image rtk network on tftpboot 0x8100 bootm 6. Backup mtdblock files to the computer by scp or anything and reboot 7. Interrupt the U-Boot and execute the following commands to re-create filesystem in the flash ffsmount c:/ ffsfmt c:/ this step takes a long time, about ~ 4 mins 8. Execute the following commands to put the official images to the filesystem updatert example: updatert pn28080k_v3.rom this step takes about ~ 40 secs 9. Set the environment variables of the U-Boot by the following commands setenv loadaddr 0xb4e0 setenv bootcmd bootm saveenv 10: Download the OpenWrt initramfs image and boot with it tftpboot 0x8100 0101A8C0.img bootm 11: On the initramfs image, download the sysupgrade image and perform sysupgrade with it sysupgrade 12: Wait ~ 120 seconds to complete flashing Note: - "Switch-M8eG" is a model name, and "PN28080K" is a model number. Switch-M8eG has an another (old) model number ("PN28080"), it's not a Realtek based hardware. - Switch-M8eG has a "POWER" LED (Green), but it's not connected to any GPIO pin. - The U-Boot checks the runtime images in the flash when booting and fails to execute anything in "bootcmd" variable if the images are not exsisting. - A filesystem is formed in the flash (0x10-0x1DF) on the stock firmware and it includes the stock images, configuration files and checksum files. It's unknown format, can't be managed on the OpenWrt. To get the enough space for OpenWrt, move the filesystem to the head of "fs_reserved" partition by execution of "ffsfmt" and "updatert". - On the other devices in the same series of Switch-M8eG PN28080K, the INT pin on the PCA9555 is not connected to anywhere. Back to the stock firmware: 1. Delete "loadaddr" variable and set "bootcmd" to the original value on U-Boot: setenv loadaddr setenv bootcmd 'bootm 0x8100' on OpenWrt: fw_setenv loadaddr fw_setenv bootcmd 'bootm 0x8100' 2. Perform reset or reboot on U-Boot: reset on OpenWrt: reboot Signed-off-by: INAGAKI Hiroshi --- v1 -> v2: - drop changes for kernel 5.4 - add interrupt-related properties to the nodes of PCA9539 and PCA9555 - use "gpio-keys" instead of "gpio-keys-polled" - update/remove comments in mtd partitions - use "led-*" scheme and add color/function properties for each node of LEDs - drop unnecessary default values from gpio-restart node .../rtl8380_panasonic_m8eg-pn28080k.dts | 123 ++ .../rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 229 ++ target/linux/realtek/image/Makefile | 10 + 3 files changed, 362 insertions(+) create mode 100644 target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts create mode 100644 target/linux/realtek/dts-5.10/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi diff --git a/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts b/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts new file mode 100644 index 00..7b6bfc7991 --- /dev/null +++ b/target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl838x.dtsi" +#include "rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi" + +#include + +/ { + compatible = "panasonic,m8eg-pn28080k", "realtek,rtl838x-soc"; + model = "Panasonic Switch-M8eG PN28080K"; + + aliases { + led-boot = _status_eco_green; + led-failsafe = _status_eco_amber; + led-running = _status_eco_green; + led-upgrade = _status_eco_green; + }; + + sfp0: sfp-p9 { + compatible = "sff,sfp"; + i2c-bus = <>; + tx-fault-gpio = < 0 GPIO_ACTIVE_HIGH>; + tx-disable-gpio = < 1
[PATCH v2 0/2] realtek: add support for Panasonic Switch-M8eG PN28080K
This is a continuation of the PR in GitHub[1] and v1 patch series. This patch series adds support for Panasonic Switch-M8eG PN28080K. Panasonic Switch-M*eG PN28xx0K series has the following models: - Switch-M8eG PN28080K (RTL8380M, 8 + 1 SFP) - 1-9 : RTL8380M (SoC) - Switch-M16eG PN28160K (RTL8382M?, 14 + 2 combo) - ? - Switch-M24eG PN28240K (RTL8382M, 22 + 2 combo) - 1-8 : RTL8218B - 9-16: RTL8382M (SoC) - 17-24: RTL8218FB - Switch-M48eG PN28480K (RTL8393M, 44 + 4 combo) - 1-40: RTL8218B - 41-48: RTL8218FB (Note: I don't have a Switch-M16eG PN28160K and the hardware specification is unknown) These models have the many common parts, so 3rd commit creates a dtsi for This series. Note: - "Switch-M*eG" is a model name and "PN28xx0K" is a model number. Each model has two model number, "PN28xx0" and "PN28xx0K". But the first one (PN28xx0) is a Broadcom SoC based hardware. - This series uses the VxWorks-based kernel in stock firmware. [1]: https://github.com/openwrt/openwrt/pull/4209 v1 -> v2: - drop 5.4 changes - add interrupt-related properties to the nodes of PCA9539 and PCA9555 - use "gpio-keys" instead of "gpio-keys-polled" - update/remove comments in mtd partitions - use "led-*" scheme and add color/function properties for each node of LEDs - drop unnecessary default values from gpio-restart node INAGAKI Hiroshi (2): realtek: enable pca953x driver for target realtek: add support for Panasonic Switch-M8eG PN28080K target/linux/realtek/config-5.10 | 3 + .../rtl8380_panasonic_m8eg-pn28080k.dts | 123 ++ .../rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 229 ++ target/linux/realtek/image/Makefile | 10 + 4 files changed, 365 insertions(+) create mode 100644 target/linux/realtek/dts-5.10/rtl8380_panasonic_m8eg-pn28080k.dts create mode 100644 target/linux/realtek/dts-5.10/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi -- 2.33.0.windows.2 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH v2 1/2] realtek: enable pca953x driver for target
The system status LED on Panasonic Switch-M8eG PN28080K is connected to a PCA9539PW. To use the LED as a status LED of OpenWrt while booting, enable the pca953x driver and built-in to the kernel. Also enable CONFIG_GPIO_PCA953X_IRQ to use interrupt via RTL83xx GPIO. Signed-off-by: INAGAKI Hiroshi --- v1 -> v2: - drop changes in config-5.4 - enable CONFIG_GPIO_PCA953X_IRQ to use interrupt target/linux/realtek/config-5.10 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/realtek/config-5.10 b/target/linux/realtek/config-5.10 index f75cf92897..33409d693d 100644 --- a/target/linux/realtek/config-5.10 +++ b/target/linux/realtek/config-5.10 @@ -70,6 +70,8 @@ CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GPIOLIB=y CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_PCA953X=y +CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_REALTEK_OTTO=y CONFIG_GPIO_RTL8231=y CONFIG_GPIO_RTL838X=y @@ -165,6 +167,7 @@ CONFIG_REALTEK_OTTO_WDT=y CONFIG_REALTEK_PHY=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL838X=y -- 2.33.0.windows.2 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH] kernal: skip hpower setting for the module which has no revs
Thank you very much. I am looking forward to the next release of OpenWRT! ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel