ath79: add support for NEC Aterm WF1200CR

NEC Aterm WF1200CR is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on
QCA9561.

Specification:

- SoC		: Qualcomm Atheros QCA9561
- RAM		: DDR2 128 MiB (W971GG6SB-25)
- Flash		: SPI-NOR 8 MiB (MX25L6433FM2I-08G)
- WLAN		: 2.4/5 GHz 2T2R
  - 2.4 GHz	: QCA9561 (SoC)
  - 5 GHz	: QCA9888
- Ethernet	: 2x 10/100 Mbps
  - Switch	: QCA9561 (SoC)
- LEDs/Keys	: 8x/3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - JP1: Vcc, GND, NC, TX, RX from "JP1" marking
  - 115200n8
- Power		: 12 VDC, 0.9 A

Flash instruction using factory image (stock: < v1.3.2):

1. Boot WF1200CR normally with "Router" mode
2. Access to "http://192.168.10.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click update ("更新") button to
   perform firmware update
4. Wait ~150 seconds to complete flashing

Alternate flash instruction using initramfs image (stock: >= v1.3.2):

1. Prepare the TFTP server with the IP address 192.168.1.10 and place
   the OpenWrt initramfs image to the TFTP directory with the name
   "0101A8C0.img"
2. Connect serial console to WF1200CR
3. Boot WF1200CR and interrupt with any key after the message
   "Hit any key to stop autoboot:  2", the U-Boot starts telnetd after
   the message "starting telnetd server from server 192.168.1.1"
4. login the telnet (address: 192.168.1.1)
5. Perform the following commands to modify "bootcmd" variable
   temporary and check the value
   (to ignore the limitation of available commands, "tp; " command at
   the first is required as dummy, and the output of "printenv" is
   printed on the serial console)

   tp; set bootcmd 'set autostart yes; tftpboot'
   tp; printenv

6. Save the modified variable with the following command and reset
   device

   tp; saveenv
   tp; reset

7. The U-Boot downloads initramfs image from TFTP server and boots it
8. On initramfs image, download the sysupgrade image to the device and
   perform the following commands to erase stock firmware and sysupgrade

   mtd erase firmware
   sysupgrade <sysupgrade image>

9. After the rebooting by completion of sysupgrade, start U-Boot telnetd
   and login with the same way above (3, 4)
10. Perform the following commands to reset "bootcmd" variable to the
    default and reset the device

    tp; run seattle
    tp; reset

    (the contents of "seattle":
     setenv bootcmd 'bootm 0x9f070040' && saveenv)
11. Wait booting-up the device

Known issues:

- the following 6x LEDs are connected to the gpio controller on QCA9888
  chip and the implementation of control via the controller is missing in
  ath10k/ath10k-ct

  - "ACTIVE" (Red/Green)
  - "2.4GHz" (Red/Green)
  - "5GHz"   (Red/Green)

Note:

- after the version v1.3.2 of stock firmware, "offline update" by
  uploading image by user is deleted and the factory image cannot be
  used

- the U-Boot on WF1200CR doesn't configure the port-side LEDs on WAN/LAN
  and the configuration is required on OpenWrt

  - gpio-hog: set the direction of GPIO 14(WAN)/19(LAN) to output
  - pinmux: set GPIO 14/19 as switch-controlled LEDs

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
This commit is contained in:
INAGAKI Hiroshi 2021-03-25 00:19:59 +09:00 committed by Adrian Schmutzler
parent a3d8c1295e
commit a4e2766a5b
5 changed files with 197 additions and 6 deletions

View File

@ -0,0 +1,166 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca956x.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "NEC Aterm WF1200CR";
compatible = "nec,wf1200cr", "qca,qca9561";
aliases {
led-boot = &led_power_green;
led-failsafe = &led_power_red;
led-running = &led_power_green;
led-upgrade = &led_power_green;
};
leds {
compatible = "gpio-leds";
/* other LEDs are connected to ath10k (QCA9888) gpiochip */
led_power_green: power_green {
label = "green:power";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
led_power_red: power_red {
label = "red:power";
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};
router {
label = "rt";
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
linux,code = <BTN_0>;
linux,input-type = <EV_SW>;
debounce-interval = <60>;
};
wps {
label = "wps";
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
debounce-interval = <60>;
};
};
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x040000>;
read-only;
};
partition@40000 {
label = "devdata";
reg = <0x040000 0x010000>;
read-only;
};
partition@50000 {
label = "devconf";
reg = <0x050000 0x010000>;
read-only;
};
partition@60000 {
label = "misc";
reg = <0x060000 0x010000>;
read-only;
};
partition@70000 {
compatible = "seama";
label = "firmware";
reg = <0x070000 0x780000>;
};
partition@7f0000 {
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
};
};
};
};
&eth0 {
status = "okay";
pll-data = <0x03000101 0x00000101 0x00001919>;
phy-handle = <&swphy0>;
gmac-config {
device = <&gmac>;
switch-phy-swap = <1>;
switch-phy-addr-swap = <0>;
};
};
&eth1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_swled_enable_pins>;
};
&gpio {
switch_leds {
gpio-hog;
gpios = <14 GPIO_ACTIVE_HIGH>, /* WAN */
<19 GPIO_ACTIVE_HIGH>; /* LAN */
output-high;
line-name = "led:wan-lan";
};
};
&pinmux {
pinmux_swled_enable_pins: swled_enable_pins {
pinctrl-single,bits =
<0xc 0x240000 0xff0000>, /* WAN */
<0x10 0x10000000 0xff000000>; /* LAN */
};
};
&pcie {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
};
};
&wmac {
status = "okay";
qca,no-eeprom;
};

View File

@ -300,6 +300,11 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
;;
nec,wf1200cr)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
"0@eth0" "1:lan"
;;
nec,wg1200cr|\
qxwlan,e1700ac-v2-8m|\
qxwlan,e1700ac-v2-16m|\
@ -599,6 +604,7 @@ ath79_setup_macs()
base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
wan_mac=$(macaddr_add "$base_mac" 1)
;;
nec,wf1200cr|\
nec,wg1200cr)
lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
wan_mac=$(mtd_get_mac_ascii devdata "wanmac")

View File

@ -32,6 +32,7 @@ case "$FIRMWARE" in
dlink,dir-842-c2|\
dlink,dir-842-c3|\
dlink,dir-859-a1|\
nec,wf1200cr|\
nec,wg1200cr|\
wd,mynet-n750)
caldata_extract "art" 0x1000 0x440

View File

@ -201,6 +201,7 @@ case "$FIRMWARE" in
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
nec,wf1200cr|\
nec,wg1200cr)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)

View File

@ -1417,20 +1417,37 @@ define Device/mercury_mw4530r-v1
endef
TARGET_DEVICES += mercury_mw4530r-v1
define Device/nec_wg1200cr
SOC := qca9563
define Device/nec_wx1200cr
DEVICE_VENDOR := NEC
IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \
append-metadata | check-size
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
endef
define Device/nec_wf1200cr
$(Device/nec_wx1200cr)
SOC := qca9561
DEVICE_MODEL := Aterm WF1200CR
IMAGE_SIZE := 7680k
SEAMA_MTDBLOCK := 5
SEAMA_SIGNATURE := wrgac62_necpf.2016gui_wf1200cr
IMAGES += factory.bin
IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \
seama-seal | nec-enc ryztfyutcrqqo69d | check-size
endef
TARGET_DEVICES += nec_wf1200cr
define Device/nec_wg1200cr
$(Device/nec_wx1200cr)
SOC := qca9563
DEVICE_MODEL := Aterm WG1200CR
IMAGE_SIZE := 7616k
SEAMA_MTDBLOCK := 6
SEAMA_SIGNATURE := wrgac72_necpf.2016gui_wg1200cr
IMAGES += factory.bin
IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \
append-metadata | check-size
IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \
seama-seal | nec-enc 9gsiy9nzep452pad | check-size
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
endef
TARGET_DEVICES += nec_wg1200cr