aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorMaximilian Martin <mm@simonwunderlich.de>2023-06-13 12:55:59 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2023-06-25 12:59:26 +0200
commit906e2a1b994ed0d965ed582f188ab94eca988b87 (patch)
tree8d590fab889f33a92c7f1f693b0574d120d524c5 /target
parente4fe3097ef6a961874b66932a0ac4be18070630a (diff)
ath79: Add support for MOXA AWK-1137C
Device specifications: ====================== * Qualcomm/Atheros AR9344 * 128 MB of RAM * 16 MB of SPI NOR flash * 2x 10/100 Mbps Ethernet * 2T2R 2.4/5 GHz Wi-Fi * 4x GPIO-LEDs (1x wifi, 2x ethernet, 1x power) * 1x GPIO-button (reset) * 2x fast ethernet - lan1 + builtin switch port 1 + used as WAN interface - lan2 + builtin switch port 2 + used as LAN interface * 9-30V DC * external antennas Flashing instructions: ====================== Log in to https://192.168.127.253/ Username: admin Password: moxa Open Maintenance > Firmware Upgrade and install the factory image. Serial console access: ====================== Connect a RS232-USB converter to the maintenance port. Pinout: (reset button left) [GND] [NC] [RX] [TX] Firmware Recovery: ================== When the WLAN and SYS LEDs are flashing, the device is in recovery mode. Serial console access is required to proceed with recovery. Download the original image from MOXA and rename it to 'awk-1137c.rom'. Set up a TFTP server at 192.168.127.1 and connect to a lan port. Follow the instructions on the serial console to start the recovery. Signed-off-by: Maximilian Martin <mm@simonwunderlich.de>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts184
-rw-r--r--target/linux/ath79/generic/base-files/etc/board.d/01_leds4
-rw-r--r--target/linux/ath79/generic/base-files/etc/board.d/02_network8
-rw-r--r--target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom4
-rwxr-xr-xtarget/linux/ath79/generic/base-files/etc/init.d/bootcount3
-rw-r--r--target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh3
-rw-r--r--target/linux/ath79/image/generic.mk14
7 files changed, 219 insertions, 1 deletions
diff --git a/target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts b/target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts
new file mode 100644
index 0000000000..d2c5171402
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9344.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+ compatible = "moxa,awk-1137c", "qca,ar9344";
+ model = "MOXA AWK-1137C";
+
+ aliases {
+ led-boot = &led_status_red;
+ led-failsafe = &led_status_red;
+ led-running = &led_status_green;
+ led-upgrade = &led_status_red;
+ label-mac-device = &eth1;
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ pinctrl-names = "default";
+
+ led_status_green: led-0 {
+ label = "green:status";
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_STATUS;
+ function-enumerator = <0>;
+ gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+ };
+
+ led_status_red: led-1 {
+ label = "red:status";
+ color = <LED_COLOR_ID_RED>;
+ function = LED_FUNCTION_STATUS;
+ function-enumerator = <1>;
+ gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+ };
+
+ led-2 {
+ label = "green:wifi";
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WLAN;
+ function-enumerator = <0>;
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ led-3 {
+ label = "green:lan1";
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WAN;
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ };
+
+ led-4 {
+ label = "green:lan2";
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_LAN;
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ };
+
+ led-5 {
+ label = "yellow:wifi";
+ color = <LED_COLOR_ID_YELLOW>;
+ function = LED_FUNCTION_WLAN;
+ function-enumerator = <1>;
+ gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0assoc";
+ };
+ };
+};
+
+&ref {
+ clock-frequency = <40000000>;
+};
+
+&spi {
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <40000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x000000 0x040000>;
+ read-only;
+ };
+
+ partition@40000 {
+ label = "u-boot-env";
+ reg = <0x040000 0x010000>;
+ };
+
+ partition@50000 {
+ label = "firmware";
+ reg = <0x050000 0xe00000>;
+ compatible = "denx,uimage";
+ };
+
+ partition@e50000 {
+ label = "log1";
+ reg = <0xe50000 0x020000>;
+ read-only;
+ };
+
+ partition@e70000 {
+ label = "log2";
+ reg = <0xe70000 0x020000>;
+ read-only;
+ };
+
+ partition@e90000 {
+ label = "version";
+ reg = <0xe90000 0x020000>;
+ read-only;
+ };
+
+ partition@eb0000 {
+ label = "config1";
+ reg = <0xeb0000 0x020000>;
+ read-only;
+ };
+
+ partition@ed0000 {
+ label = "config2";
+ reg = <0xed0000 0x020000>;
+ read-only;
+ };
+
+ partition@ef0000 {
+ label = "config-data";
+ reg = <0xef0000 0x0c0000>;
+ read-only;
+ };
+
+ partition@fb0000 {
+ label = "mib0";
+ reg = <0xfb0000 0x030000>;
+ read-only;
+ };
+
+ art: partition@fe0000 {
+ label = "art";
+ reg = <0xfe0000 0x010000>;
+ read-only;
+ };
+
+ partition@ff0000 {
+ label = "fis";
+ reg = <0xff0000 0x010000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&eth1 {
+ status = "okay";
+};
+
+&wmac {
+ status = "okay";
+ qca,no-eeprom;
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 10c67991fd..65cf7b3292 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -302,6 +302,10 @@ tplink,cpe210-v3)
meraki,mr16)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"
;;
+moxa,awk-1137c)
+ ucidef_set_led_switch "wan" "LAN1" "green:lan1" "switch0" "0x02"
+ ucidef_set_led_switch "lan" "LAN2" "green:lan2" "switch0" "0x04"
+ ;;
netgear,wnr2200-8m|\
netgear,wnr2200-16m)
ucidef_set_led_netdev "wan-amber" "WAN (amber)" "amber:wan" "eth0"
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 d18eddf5b7..64869701c6 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
@@ -240,7 +240,8 @@ ath79_setup_interfaces()
ubnt,routerstation)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
- comfast,cf-e375ac)
+ comfast,cf-e375ac|\
+ moxa,awk-1137c)
ucidef_add_switch "switch0" \
"0@eth0" "1:wan" "2:lan"
;;
@@ -731,6 +732,11 @@ ath79_setup_macs()
lan_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
label_mac=$lan_mac
;;
+ moxa,awk-1137c)
+ lan_mac=$(mtd_get_mac_ascii u-boot-env mac_addr)
+ wan_mac=$(mtd_get_mac_ascii u-boot-env mac_addr)
+ label_mac=$lan_mac
+ ;;
nec,wf1200cr|\
nec,wg1200cr)
lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index c46573ece5..3b089885b3 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -62,6 +62,10 @@ case "$FIRMWARE" in
caldata_extract "art" 0x1000 0x440
ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
;;
+ moxa,awk-1137c)
+ caldata_extract "art" 0x1000 0x440
+ ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env mac_addr)
+ ;;
nec,wg800hp)
caldata_extract "art" 0x1000 0x440
ath9k_patch_mac $(mtd_get_mac_text board_data 0x680)
diff --git a/target/linux/ath79/generic/base-files/etc/init.d/bootcount b/target/linux/ath79/generic/base-files/etc/init.d/bootcount
index 7807559d81..01c446b1bb 100755
--- a/target/linux/ath79/generic/base-files/etc/init.d/bootcount
+++ b/target/linux/ath79/generic/base-files/etc/init.d/bootcount
@@ -8,6 +8,9 @@ boot() {
adtran,bsap1840)
fconfig -s -w -d $(find_mtd_part "RedBoot config") -n boot_cntb -x 0
;;
+ moxa,awk-1137c)
+ fw_setenv fwr_verify 0
+ ;;
qihoo,c301)
local n=$(fw_printenv activeregion | cut -d = -f 2)
fw_setenv "image${n}trynum" 0
diff --git a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
index 5fa23e8eb6..8b39a17eb0 100644
--- a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
+++ b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
@@ -28,6 +28,9 @@ preinit_set_mac_address() {
fortinet,fap-221-b)
ip link set dev eth0 address $(mtd_get_mac_text u-boot 0x3ff80 12)
;;
+ moxa,awk-1137c)
+ ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env mac_addr)
+ ;;
tplink,deco-s4-v2)
base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
ip link set dev eth0 address $base_mac
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 1a558c30a0..6a2131f5ae 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -9,6 +9,7 @@ DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION
DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE
DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL
+DEVICE_VARS += MOXA_MAGIC MOXA_HWID
DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING
DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES
@@ -1819,6 +1820,19 @@ define Device/mercury_mw4530r-v1
endef
TARGET_DEVICES += mercury_mw4530r-v1
+define Device/moxa_awk-1137c
+ SOC := ar9344
+ DEVICE_MODEL := AWK-1137C
+ DEVICE_VENDOR := MOXA
+ MOXA_MAGIC := 0x8919123028877702
+ MOXA_HWID := 0x01080000
+ IMAGE_SIZE := 14336k
+ DEVICE_PACKAGES := uboot-envtools
+ IMAGES += factory.rom
+ IMAGE/factory.rom := $$(IMAGE/sysupgrade.bin) | moxa-encode-fw
+endef
+TARGET_DEVICES += moxa_awk-1137c
+
define Device/nec_wx1200cr
DEVICE_VENDOR := NEC
IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs