From 3961b717761c03c970b37d0469328098c3140853 Mon Sep 17 00:00:00 2001 From: Roy H Date: Tue, 11 Mar 2025 11:35:34 +0700 Subject: [PATCH] ath79: add support for Longdata APS256 Forum discussion : https://forum.openwrt.org/t/aps-256va-help-for-identification/143653/52 Specification: Power: 12-36V input via 5,5/2,1 DC barrel jack, or 5V Micro USB-B CPU: Atheros AR9344 rev 2 RAM: 128MB Flash: 16MB WI-Fi: 2.4GHz Fast Ethernet: 1 WAN and 2 LAN USB: 2 x USB-A, 1 x micro-USB-B (for power input) WWAN: 3G modem via extended mini-PCIE form factor (can be replaced with Wifi 5GHz card) The device come with custom openwrt BB an CC. Because of limited LAN port, I disable GMAC0, so the WAN port can be connected to GMAC1 and function as LAN port as well. Enable ssh access and Backup: 1. open router admin page via LAN cable 2. browse 192.168.111.1:8000 3. login with password 123456 4. click wifi icon on top menu 5. change the path at the end of the url (after random hash) with /admin/system/flashops it will looks like this: http://192.168.111.1:8000/cgi-bin/luci/;stok=29698152cf64c980177a04f86c99ea0d/admin/system/flashops (the hash after "stok=" will be different) 6. restore the config with this modified backup (can be created manually by changing dropbear config to allow ssh) https://drive.google.com/file/d/1Vs-k7DHBSRZFfkxv1cMOmgAPZfB-RUen/view?usp=sharing 7. now you can login to ssh with root user and 123456 password, and backup all partition and upgrade firmware !!! BACKUP EVERY PARTITION !!! Flashing instructions: - Flash directly from factory web interface accessed from "Enable ssh access" step 5 Signed-off-by: Roy H Link: https://github.com/openwrt/openwrt/pull/17939 Signed-off-by: Hauke Mehrtens --- .../ath79/dts/ar9344_longdata_aps256.dts | 178 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 5 + .../generic/base-files/etc/board.d/02_network | 4 + target/linux/ath79/image/generic.mk | 10 + 4 files changed, 197 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_longdata_aps256.dts diff --git a/target/linux/ath79/dts/ar9344_longdata_aps256.dts b/target/linux/ath79/dts/ar9344_longdata_aps256.dts new file mode 100644 index 00000000000..0e867bca400 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_longdata_aps256.dts @@ -0,0 +1,178 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include +#include + +/ { + model = "LONGDATA APS256"; + compatible = "longdata,aps256", "qca,ar9344"; + + aliases { + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + label-mac-device = &wmac; + }; + + leds: leds { + compatible = "gpio-leds"; + + wlan2g { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_system: system { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + wan { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + + lan1 { + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + color = ; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + lan2 { + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + color = ; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <33000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x020000 0xfd0000>; + }; + + partition@7f0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + macaddr_art_1002: macaddr@1002 { + compatible = "mac-base"; + reg = <0x1002 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; +}; + +&gpio { + +}; + +&builtin_switch { + /delete-property/ qca,phy4-mii-enable; /* need to delete this to make all 5 FE ports work */ +}; + +&usb_phy { + status = "okay"; +}; + +&usb { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + hub_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_art_1002 0>; + nvmem-cell-names = "mac-address"; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <0>; + switch-only-mode = <1>; + }; +}; + 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 b9142c8a079..4eddde1115b 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 @@ -298,6 +298,11 @@ kuwfi,c910) ucidef_set_led_switch "lan1" "LAN1" "white:lan1" "switch0" "0x10" ucidef_set_led_switch "lan2" "LAN2" "white:lan2" "switch0" "0x02" ;; +longdata,aps256) + ucidef_set_led_switch "wan" "WAN" "blue:wan" "switch0" "0x20" + ucidef_set_led_switch "lan1" "LAN1" "blue:lan-1" "switch0" "0x04" + ucidef_set_led_switch "lan2" "LAN2" "blue:lan-2" "switch0" "0x02" + ;; meraki,mr12|\ tplink,cpe210-v2|\ tplink,cpe210-v3) 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 c3de8bed7fc..b1e5818567d 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 @@ -419,6 +419,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "5:wan" "6@eth1" "4:lan" ;; + longdata,aps256) + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:2" "2:lan:1" "5:wan" + ;; meraki,mr12) ucidef_set_interface_lan "eth0" ucidef_add_switch "switch0" \ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 7f0a7b43ded..9c749360533 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2038,6 +2038,16 @@ define Device/librerouter_librerouter-v1 endef TARGET_DEVICES += librerouter_librerouter-v1 +define Device/longdata_aps256 + SOC := ar9344 + DEVICE_VENDOR := LONGDATA + DEVICE_MODEL := APS256 + DEVICE_PACKAGES := kmod-usb2 + IMAGE_SIZE := 16192k + SUPPORTED_DEVICES += aps256 +endef +TARGET_DEVICES += longdata_aps256 + define Device/meraki_mr12 SOC := ar7242 DEVICE_VENDOR := Meraki