Skip to content

Commit

Permalink
imx: add Aqara Gateway ZHWG11LM support
Browse files Browse the repository at this point in the history
Aqara ZHWG11LM is a is a wall-mounted zigbee-to-internet gateway.
It is almost a twin of Xiaomi DGNWG05LM with another wifi chip.

Device specifications:
* SoC: Freescale iMX6ULL
* RAM: 256MiB
* Flash: 256MiB NAND flash
* Wireless 2.4GHz (RTL8189ES): b/g/n
* Zigbee Chip: NXP jn5169
* Ring of RGB leds
* BTN0 button
* Sound chip TFA9882 + speaker

Flashing instructions:

Flashing requires a flashing tool from NXP: https://github.com/NXPmicro/mfgtools

* solder wires and attach to system UART and usb connector
* stop uboot by pressing any key
* enter `bmode usb` to enable flashing over USB
* run `mfgtoolcli` on the main computer to write kernel, dtb and rootfs to the device

Known issues:
- RTL8189ES driver is buggy and may cause freezes and kernel panics
- Removing wdev disables the device until reboot. Patch is required.

Signed-off-by: Ivan Belokobylskiy <[email protected]>
  • Loading branch information
devbis committed Nov 18, 2024
1 parent 3308dbf commit 8459f04
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 11 deletions.
7 changes: 4 additions & 3 deletions package/boot/uboot-envtools/files/imx_cortexa7
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ touch /etc/config/ubootenv
board=$(board_name)

case "$board" in
technexion,imx7d-pico-pi)
ubootenv_add_uci_config "/dev/mmcblk2" "0xc0000" "0x2000" "0x2000"
;;
aqara,zhwg11lm|\
xiaomi,dgnwg05lm)
ubootenv_add_uci_config "/dev/mtd0" "0x2e0000" "0x20000" "0x20000" "4"
;;
technexion,imx7d-pico-pi)
ubootenv_add_uci_config "/dev/mmcblk2" "0xc0000" "0x2000" "0x2000"
;;
esac

config_load ubootenv
Expand Down
3 changes: 2 additions & 1 deletion package/boot/uboot-imx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ endef

define U-Boot/xiaomi_dgnwg05lm
NAME:=Xiaomi Lumi gateway
BUILD_DEVICES:=xiaomi_dgnwg05lm
BUILD_DEVICES:=aqara_zhwg11lm xiaomi_dgnwg05lm
endef

UBOOT_TARGETS := \
apalis_imx6 \
aqara_zhwg11lm \
mx6cuboxi \
pico-pi-imx7d \
wandboard \
Expand Down
14 changes: 8 additions & 6 deletions target/linux/imx/cortexa7/base-files/lib/upgrade/platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ platform_check_image() {
local board=$(board_name)

case "$board" in
technexion,imx7d-pico-pi)
return 0
;;
aqara,zhwg11lm |\
xiaomi,dgnwg05lm )
local platform_dir_name=$(echo $board | sed 's/,/_/g')
nand_do_platform_check $platform_dir_name $1
return $?;
;;
technexion,imx7d-pico-pi)
return 0
;;
esac

echo "Sysupgrade is not yet supported on $board."
Expand All @@ -33,12 +34,13 @@ platform_do_upgrade() {
local board=$(board_name)

case "$board" in
technexion,imx7d-pico-pi)
imx_sdcard_do_upgrade "$1"
;;
aqara,zhwg11lm |\
xiaomi,dgnwg05lm )
nand_do_upgrade "$1"
;;
technexion,imx7d-pico-pi)
imx_sdcard_do_upgrade "$1"
;;
esac
}

Expand Down
12 changes: 11 additions & 1 deletion target/linux/imx/image/cortexa7.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define Device/xiaomi_gateway-lumi
kmod-ledtrig-activity kmod-ledtrig-oneshot \
kmod-ledtrig-transient kmod-ledtrig-gpio \
kmod-i2c-core kmod-iio-core kmod-iio-vf610 \
kmod-sound-core kmod-sound-soc-imx \
kmod-hid kmod-sound-core kmod-sound-soc-imx \
kmod-sound-soc-tfa9882 alsa-utils \
wpa-supplicant ca-certificates hostapd \
nand-utils kobs-ng
Expand All @@ -62,3 +62,13 @@ define Device/xiaomi_dgnwg05lm
imx6ull-xiaomi-dgnwg05lm
endef
TARGET_DEVICES += xiaomi_dgnwg05lm

define Device/aqara_zhwg11lm
$(Device/xiaomi_gateway-lumi)
DEVICE_VENDOR := Aqara
DEVICE_MODEL := ZHWG11LM
DEVICE_PACKAGES += kmod-rtl8189es-ol
DEVICE_DTS := \
imx6ull-aqara-zhwg11lm
endef
TARGET_DEVICES += aqara_zhwg11lm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Aqara ZHWG11LM is a is a wall-mounted zigbee-to-internet gateway.
Device specifications:
* SoC: Freescale iMX6ULL
* RAM: 256MiB
* Flash: 256MiB NAND flash
* Wireless 2.4GHz (RTL8189ES): b/g/n
* Zigbee Chip: NXP jn5169
* Ring of RGB leds
* BTN0 button
* Sound chip TFA9882 + speaker

Tested on: Aqara Gateway ZHWG11LM

Signed-off-by: Ivan Belokobylskiy <[email protected]>

--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -673,6 +673,7 @@ dtb-$(CONFIG_SOC_IMX6UL) += \
imx6ul-tx6ul-mainboard.dtb \
imx6ull-14x14-evk.dtb \
imx6ull-xiaomi-dgnwg05lm.dtb \
+ imx6ull-aqara-zhwg11lm.dtb \
imx6ull-colibri-eval-v3.dtb \
imx6ull-colibri-wifi-eval-v3.dtb \
imx6ull-myir-mys-6ulx-eval.dtb \
--- /dev/null
+++ b/arch/arm/boot/dts/imx6ull-aqara-zhwg11lm.dts
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "imx6ull-xiaomi-lumi.dtsi"
+
+/ {
+ model = "Aqara Gateway ZHWG11LM";
+ compatible = "aqara,zhwg11lm", "xiaomi,gateway-lumi", "fsl,imx6ull";
+};

0 comments on commit 8459f04

Please sign in to comment.