From f490295bf213c5e181d16cbe53c163c1c9983e45 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Mon, 23 Jan 2023 13:01:13 +0900 Subject: [PATCH] ipq807x: add support for Buffalo WXR-5950AX12 Buffalo WXR-5950AX12 is a 2.4/5 GHz band 11ax (Wi-Fi 6) router, based on IPQ8074A. Specification: - SoC : Qualcomm IPQ8074A - RAM : DDR3 1024 MiB (2x Nanya NT5CC256M16ER-EK) - Flash : RAW NAND 256 MiB (Winbond W29N02GZBIBA) - WLAN : 2.4/5 GHz (IPQ8074A) - Ethernet : 5 ports - WAN : 100/1000/2500/10000 Mbps x1 (AQR113C) - LAN : 100/1000/2500/10000 Mbps x1 (AQR113C), 10/100/1000 Mbps x3 (QCA8075) - LED/Keys : 8x/5x - UART : pin header on PCB (J7) - assignment: 3.3V, GND, TX, RX from disc marking - settings : 115200n8 - Power : 12 VDC, 4 A Flash instruction using initramfs image: 1. Prepare TFTP server with IP address 192.168.11.10 2. Rename OpenWrt initramfs image to "WXR-5950AX12-initramfs.uImage and place it to TFTP directory 3. Hold AOSS (WPS) button and power on WXR-5950AX12 4. WXR-5950AX12 downloads initramfs image from TFTP server and boots with it automatically 5. Upload sysupgrade image to WXR-5950AX12 and perform sysupgrade 6. Wait ~120 seconds to complete flashing Partition layout: 0x000000000000-0x000000100000 : "0:sbl1" 0x000000100000-0x000000200000 : "0:mibib" 0x000000200000-0x000000280000 : "0:bootconfig" 0x000000280000-0x000000300000 : "0:bootconfig1" 0x000000300000-0x000000600000 : "0:qsee" 0x000000600000-0x000000900000 : "0:qsee_1" 0x000000900000-0x000000980000 : "0:devcfg" 0x000000980000-0x000000a00000 : "0:devcfg_1" 0x000000a00000-0x000000a80000 : "0:apdp" 0x000000a80000-0x000000b00000 : "0:apdp_1" 0x000000b00000-0x000000b80000 : "0:rpm" 0x000000b80000-0x000000c00000 : "0:rpm_1" 0x000000c00000-0x000000c80000 : "0:cdt" 0x000000c80000-0x000000d00000 : "0:cdt_1" 0x000000d00000-0x000000d80000 : "0:appsblenv" 0x000000d80000-0x000000e80000 : "0:appsbl" 0x000000e80000-0x000000f80000 : "0:appsbl_1" 0x000000f80000-0x000001000000 : "0:art" 0x000001000000-0x000001080000 : "0:art_1" 0x000001080000-0x000001100000 : "0:orgdata" 0x000001100000-0x000001180000 : "0:orgdata_1" 0x000001180000-0x000005180000 : "rootfs" 0x000005180000-0x000009180000 : "rootfs_recover" 0x000009180000-0x000010000000 : "user_property" Notes: - WXR-5950AX12 has 2x OS images on NAND flash. The 1st image is for normal operation and the 2nd one is for recoverying or firmware upgrading on stock. - Stock U-Boot checks MD5 hashes in "fw_hash" volume in each "root*" partition when booting. This is just a comparation of hash strings. Behaviors: - both "fw_hash" volumes exist, hashes are rootfs == rootfs_recover ---> boot from rootfs - both "fw_hash" volumes exist, hashes are rootfs != rootfs_recover ---> boot from rootfs_recover Note: this behavior is used for firmware upgrading on stock - "fw_hash" volume in rootfs is missing ---> boot from rootfs_recover - "fw_hash" volume in rootfs_recover is missing ---> boot from rootfs - "fw_hash" volumes in both root* partition are missing ---> boot from rootfs_recover Reverting to stock firmware: 1. Decrypt official image by buffalo-enc and remove header example of decryption: $ buffalo-enc -i wxr_5950ax12_jp_305 -o wxr_5950ax12_jp_305.dec \ -d -k olaffuB -O 0xc8 example of removing header (v3.05): - before $ hexdump -n 64 -v -C wxr_5950ax12_jp_305.dec 00000000 57 58 52 2d 35 39 35 30 41 58 31 32 5f 33 2e 30 |WXR-5950AX12_3.0| 00000010 35 5f 31 2e 30 31 5f 4a 50 5f 6a 70 5f 71 63 61 |5_1.01_JP_jp_qca| 00000020 0a 66 69 6c 65 6c 65 6e 3d 34 35 33 35 30 39 31 |.filelen=4535091| 00000030 32 0a 55 42 49 23 01 00 00 00 00 00 00 00 00 00 |2.UBI#..........| 00000040 - after $ hexdump -n 64 -v -C wxr_5950ax12_jp_305.ubi 00000000 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 00 |UBI#............| 00000010 00 00 08 00 00 00 10 00 78 cf c4 91 00 00 00 00 |........x.......| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 3d 2a 64 fd |............=*d.| 00000040 2. Boot WXR-5950AX12 with OpenWrt initramfs image 3. Upload modified stock image to WXR-5950AX12 4. Find partitions "rootfs" and "rootfs_recover" example: root@OpenWrt:/# cat /proc/mtd dev: size erasesize name ... mtd22: 04000000 00020000 "rootfs" mtd23: 04000000 00020000 "rootfs_recover" ... in this case, "rootfs" is mtd22 and "rootfs_recover" is mtd23 5. Format "rootfs"/"rootfs_recover" partition with the uploaded image example: ubiformat /dev/mtd22 -f /tmp/wxr_5950ax12_jp_305.ubi ubiformat /dev/mtd23 -f /tmp/wxr_5950ax12_jp_305.ubi 6. Remove "rootfs"/"rootfs_data" volume from user_property partition example: . /lib/upgrade/nand.sh UBI=$(nand_attach_ubi user_property) ubirmvol /dev/$UBI -N rootfs ubirmvol /dev/$UBI -N rootfs_data 7. Reboot MAC addresses: LAN : 50:C4:DD:xx:xx:28 (0:APPSBLENV, ethaddr (text)) WAN : 50:C4:DD:xx:xx:28 (0:APPSBLENV, ethaddr (text)) 2.4 GHz: 50:C4:DD:xx:xx:30 (0:APPSBLENV, wlan0addr (text)) 5 GHz : 50:C4:DD:xx:xx:38 (0:APPSBLENV, wlan1addr (text)) Reviewed-by: Robert Marko Signed-off-by: INAGAKI Hiroshi --- package/firmware/ipq-wifi/Makefile | 2 + .../board-buffalo_wxr-5950ax12.ipq8074 | Bin 0 -> 131184 bytes .../ipq807x/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 1 + .../ipq807x/base-files/lib/upgrade/buffalo.sh | 55 +++ .../base-files/lib/upgrade/platform.sh | 8 + .../boot/dts/qcom/ipq8074-wxr-5950ax12.dts | 376 ++++++++++++++++++ target/linux/ipq807x/image/generic.mk | 13 + 8 files changed, 456 insertions(+) create mode 100644 package/firmware/ipq-wifi/board-buffalo_wxr-5950ax12.ipq8074 create mode 100644 target/linux/ipq807x/base-files/lib/upgrade/buffalo.sh create mode 100644 target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 861eec13dc9..8e7fc4da39a 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -26,6 +26,7 @@ endef ALLWIFIBOARDS:= \ aruba_ap-365 \ + buffalo_wxr-5950ax12 \ devolo_magic-2-wifi-next \ dynalink_dl-wrx36 \ edgecore_eap102 \ @@ -125,6 +126,7 @@ endef # Add $(eval $(call generate-ipq-wifi-package,,)) $(eval $(call generate-ipq-wifi-package,aruba_ap-365,Aruba AP-365)) +$(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12)) $(eval $(call generate-ipq-wifi-package,devolo_magic-2-wifi-next,devolo Magic 2 WiFi next)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) diff --git a/package/firmware/ipq-wifi/board-buffalo_wxr-5950ax12.ipq8074 b/package/firmware/ipq-wifi/board-buffalo_wxr-5950ax12.ipq8074 new file mode 100644 index 0000000000000000000000000000000000000000..57badaa53553d9c81797c6ef761d37f7358ea8f2 GIT binary patch literal 131184 zc-rlK33OEFmFE8z6(y{olBg<4Aha(9jnfz-B($If1j0x{XfH_!AutF7Mg|OG6^oD% z`;PFE#jGgK9GU=pyytTWhGg+KCiL-U9JDEA|J~>f;_vuyXFB!}$ zfixi9ukNM(``)|%dYAt_N>wWt6+T>8UGm5y%O5UUQCPWHY}v9!0M$aJH?auZ`t(XcMND`^DiOvjLs@9Na+GZ2m9JzPuZ8CO0wvdYWh(QGSB5gzcsZ0< z^OXyp=AU=FQ8SgOW_qWZ>78n(_l4#=)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ootdev -N fw_hash &> /dev/null || true + + ubirmvol /dev/$ubi_propdev -N user_property_ubi &> /dev/null || true + ubirmvol /dev/$ubi_propdev -N extra_property &> /dev/null || true +} + +# Re-create small dummy ubi_rootfs volume and update +# fw_hash volume to pass the checking by U-Boot +# - rootfs (mtd22) +# - re-create "ubi_rootfs" volume +# - re-create and update "fw_hash" volume +# - rootfs_recover (mtd23) +# - update "fw_hash" volume +buffalo_upgrade_optvol() { + local ubi_rootdev ubi_rcvrdev + local hashvol_root hashvol_rcvr + + if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \ + ! ubi_rcvrdev="$(nand_attach_ubi rootfs_recover)"; then + echo "failed to attach UBI volume \"rootfs\" or \"rootfs_recover\", rebooting..." + reboot -f + fi + + ubimkvol /dev/$ubi_rootdev -N ubi_rootfs -S 1 + ubimkvol /dev/$ubi_rootdev -N fw_hash -S 1 -t static + + if ! hashvol_root="$(nand_find_volume $ubi_rootdev fw_hash)" || \ + ! hashvol_rcvr="$(nand_find_volume $ubi_rcvrdev fw_hash)"; then + echo "\"fw_hash\" volume in \"rootfs\" or \"rootfs_recover\" not found, rebooting..." + reboot -f + fi + + echo -n "00000000000000000000000000000000" > /tmp/dummyhash.txt + ubiupdatevol /dev/$hashvol_root /tmp/dummyhash.txt + ubiupdatevol /dev/$hashvol_rcvr /tmp/dummyhash.txt +} diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh index 4a6a91b5f5d..683015898a3 100644 --- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh @@ -43,6 +43,14 @@ platform_pre_upgrade() { platform_do_upgrade() { case "$(board_name)" in + buffalo,wxr-5950ax12) + CI_KERN_UBIPART="rootfs" + CI_ROOT_UBIPART="user_property" + buffalo_upgrade_prepare + nand_do_flash_file "$1" || nand_do_upgrade_failed + nand_do_restore_config || nand_do_upgrade_failed + buffalo_upgrade_optvol + ;; dynalink,dl-wrx36) nand_do_upgrade "$1" ;; diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts new file mode 100644 index 00000000000..d9b083c4d05 --- /dev/null +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts @@ -0,0 +1,376 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include +#include + +/ { + model = "Buffalo WXR-5950AX12"; + compatible = "buffalo,wxr-5950ax12", "qcom,ipq8074"; + + aliases { + serial0 = &blsp1_uart5; + led-boot = &led_power_white; + led-failsafe = &led_power_red; + led-running = &led_power_white; + led-upgrade = &led_power_white; + label-mac-device = &dp5_syn; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " ubi.mtd=user_property root=/dev/ubiblock1_0"; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "white:router"; + gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-1 { + label = "red:router"; + gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led_power_red: led-2 { + label = "red:power"; + gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led_power_white: led-3 { + label = "white:power"; + gpios = <&tlmm 34 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led-4 { + label = "white:internet"; + gpios = <&tlmm 43 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-5 { + label = "red:internet"; + gpios = <&tlmm 44 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-6 { + label = "red:wireless"; + gpios = <&tlmm 55 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; + }; + + led-7 { + label = "white:wireless"; + gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_WLAN; + }; + }; + + keys { + compatible = "gpio-keys"; + + /* + * mode: 3x position switch + * + * - ROUTER + * - AP + * - WB (Wireless Bridge) + */ + ap { + label = "mode-ap"; + gpios = <&tlmm 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + bridge { + label = "mode-wb"; + gpios = <&tlmm 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + /* + * op: 2x position switch + * + * - AUTO + * - MANUAL (select Router/AP/WB manually) + */ + manual { + label = "op-manual"; + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&tlmm 51 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&tlmm 54 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + reg_usb_vbus: regulator-5v-vbus { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&tlmm 64 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + + partition-0-appsblenv { + compatible = "fixed-partitions"; + label = "0:appsblenv"; + read-only; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "u-boot,env"; + label = "env-data"; + reg = <0x0 0x40000>; + + macaddr_appsblenv_ethaddr: ethaddr { + }; + }; + }; + }; + }; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + /* + * RESET pins of phy chips + * + * WXR-5950AX12 has 2x RESET pins for QCA8075 and AQR113C. + * The pin of QCA8075 is for the chip and not phys in the chip, the + * pin of AQR113C is for 2x chips. So both pins are not appropriate + * to declare them as reset-gpios in phy nodes. + * Multiple entries in reset-gpios of mdio may not be supported, but + * leave the following as-is to show that the those reset pin exists. + */ + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>, /* QCA8075 RESET */ + <&tlmm 63 GPIO_ACTIVE_LOW>; /* AQR113C RESET (2x) */ + + aqr113c_1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x0>; + }; + + aqr113c_2: ethernet-phy@8 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x8>; + }; + + qca8075_1: ethernet-phy@18 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x18>; + }; + + qca8075_2: ethernet-phy@19 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x19>; + }; + + qca8075_3: ethernet-phy@1a { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1a>; + }; + + qca8075_4: ethernet-phy@1b { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1b>; + }; + + qca8075_5: ethernet-phy@1c { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1c>; + }; +}; + +&switch { + status = "okay"; + + switch_cpu_bmp = <0x1>; + switch_lan_bmp = <0x3e>; + switch_wan_bmp = <0x40>; + switch_mac_mode = <0xb>; + switch_mac_mode1 = <0xd>; + switch_mac_mode2 = <0xd>; + bm_tick_mode = <0>; + tm_tick_mode = <0>; + + qcom,port_phyinfo { + port@0 { + port_id = <1>; + phy_address = <0x18>; + }; + + port@1 { + port_id = <2>; + phy_address = <0x19>; + }; + + port@2 { + port_id = <3>; + phy_address = <0x1a>; + }; + + port@3 { + port_id = <4>; + phy_address = <0x1b>; + }; + + port@4 { + port_id = <5>; + ethernet-phy-ieee802.3-c45; + phy_address = <0x0>; + }; + + port@5 { + port_id = <6>; + ethernet-phy-ieee802.3-c45; + phy_address = <0x8>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan4"; + nvmem-cells = <&macaddr_appsblenv_ethaddr>; + nvmem-cell-names = "mac-address-ascii"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; + nvmem-cells = <&macaddr_appsblenv_ethaddr>; + nvmem-cell-names = "mac-address-ascii"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan2"; + nvmem-cells = <&macaddr_appsblenv_ethaddr>; + nvmem-cell-names = "mac-address-ascii"; +}; + +&dp5_syn { + status = "okay"; + phy-handle = <&aqr113c_1>; + label = "wan"; + nvmem-cells = <&macaddr_appsblenv_ethaddr>; + nvmem-cell-names = "mac-address-ascii"; +}; + +&dp6_syn { + status = "okay"; + phy-handle = <&aqr113c_2>; + label = "lan1"; + nvmem-cells = <&macaddr_appsblenv_ethaddr>; + nvmem-cell-names = "mac-address-ascii"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; + + vbus-supply = <®_usb_vbus>; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Buffalo-WXR-5950AX12"; +}; diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 3145e1b53f1..38770a5f24f 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -17,6 +17,19 @@ define Device/UbiFit IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef +define Device/buffalo_wxr-5950ax12 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Buffalo + DEVICE_MODEL := WXR-5950AX12 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@hk01 + SOC := ipq8074 + DEVICE_PACKAGES := ipq-wifi-buffalo_wxr-5950ax12 +endef +TARGET_DEVICES += buffalo_wxr-5950ax12 + define Device/dynalink_dl-wrx36 $(call Device/FitImage) $(call Device/UbiFit) -- 2.47.2