openwrt/target/linux
Nick French 20581ee8b5 ath79: add support for TP-Link Deco S4
Add support for TP-Link Deco S4 wifi router

The label refers to the device as S4R and the TP-Link firmware
site calls it the Deco S4 v2. (There does not appear to be a v1)

Hardware (and FCC id) are identical to the Deco M4R v2 but the
flash layout is ordered differently and the OEM firmware encrypts
some config parameters (including the label mac address) in flash

In order to set the encrypted mac address, the wlan's caldata
node is removed from the DTS so the mac can be decrypted with
the help of the uencrypt tool and patched into the wlan fw
via hotplug

Specifications:
SoC: QCA9563-AL3A
RAM: Zentel A3R1GE40JBF
Wireless 2.4GHz: QCA9563-AL3A (main SoC)
Wireless 5GHz: QCA9886
Ethernet Switch: QCA8337N-AL3C
Flash: 16 MB SPI NOR

UART serial access (115200N1) on board via solder pads:
RX = TP1 pad
TX = TP2 pad
GND = C201 (pad nearest board edge)

The device's bootloader and web gui will only accept images that
were signed using TP-Link's RSA key, however a memory safety bug
in the bootloader can be leveraged to install openwrt without
accessing the serial console. See developer forum S4 support page
for link to a "firmware" file that starts a tftp client, or you
may generate one on your own like this:
```
python - > deco_s4_faux_fw_tftp.bin <<EOF
import sys
from struct import pack

b = pack('>I', 0x00008000) + b'X'*16 + b"fw-type:" \
  + b'x'*256 + b"S000S001S002" + pack('>I', 0x80060200) \

b += b"\x00"*(0x200-len(b)) \
  + pack(">33I", *[0x3c0887fc, 0x35083ddc, 0xad000000, 0x24050000,
                   0x3c048006, 0x348402a0, 0x3c1987f9, 0x373947f4,
                   0x0320f809, 0x00000000, 0x24050000, 0x3c048006,
                   0x348402d0, 0x3c1987f9, 0x373947f4, 0x0320f809,
                   0x00000000, 0x24050000, 0x3c048006, 0x34840300,
                   0x3c1987f9, 0x373947f4, 0x0320f809, 0x00000000,
                   0x24050000, 0x3c048006, 0x34840400, 0x3c1987f9,
                   0x373947f4, 0x0320f809, 0x00000000, 0x1000fff1,
                   0x00000000])

b += b"\xff"*(0x2A0-len(b)) + b"setenv serverip 192.168.0.2\x00"
b += b"\xff"*(0x2D0-len(b)) + b"setenv ipaddr 192.168.0.1\x00"
b += b"\xff"*(0x300-len(b)) + b"tftpboot 0x81000000 initramfs-kernel.bin\x00"
b += b"\xff"*(0x400-len(b)) + b"bootm 0x81000000\x00"
b += b"\xff"*(0x8000-len(b))

sys.stdout.buffer.write(b)
EOF
```

Installation:
1. Run tftp server on pc with static ip 192.168.0.2
2. Place openwrt "initramfs-kernel.bin" image in tftp root dir
3. Connect pc to router ethernet port1
4. While holding in reset button on bottom of router, power on router
5. From pc access router webgui at http://192.168.0.1
6. Upload deco_s4_faux_fw_tftp.bin
7. Router will load and execture in-memory openwrt
8. Switch pc back to dhcp or static 192.168.1.x
9. Flash openwrt sysupgrade image via luci/ssh at 192.168.1.1

Revert to stock:
Press and hold reset button while powering device to start the
bootloader's recovery mode, where stock firmware can be uploaded
via web gui at 192.168.0.1

Please note that one additional non-github commits is also needed:
firmware-utils: add tplink-safeloader support for Deco S4

Signed-off-by: Nick French <nickfrench@gmail.com>
2022-09-11 21:54:00 +02:00
..
airoha airoha: Add new target platform 2022-09-05 11:12:32 +02:00
apm821xx kernel: bump 5.10 to 5.10.142 2022-09-11 01:30:11 +02:00
archs38 kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
armvirt kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
at91 kernel: bump 5.10 to 5.10.142 2022-09-11 01:30:11 +02:00
ath25 kernel: bump 5.10 to 5.10.137 2022-08-23 10:37:04 +02:00
ath79 ath79: add support for TP-Link Deco S4 2022-09-11 21:54:00 +02:00
bcm27xx kernel: fix build on bcm27xx target platform 2022-09-10 01:26:53 +01:00
bcm47xx kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
bcm53xx kernel: bump 5.10 to 5.10.142 2022-09-11 01:30:11 +02:00
bcm63xx kernel: bump 5.15 to 5.15.62 2022-08-23 10:37:04 +02:00
bcm4908 bcm4908: fix Asus GT-AX6000 image 2022-09-03 20:43:07 +02:00
bmips kernel: bump 5.15 to 5.15.67 2022-09-09 21:08:37 +01:00
gemini kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
generic generic: move ledbar driver from mediatek target 2022-09-11 20:26:42 +01:00
imx kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
ipq40xx ipq40xx: add GL-AP1300 label-mac-device 2022-09-11 16:24:11 +02:00
ipq806x kernel: bump 5.15 to 5.15.62 2022-08-23 10:37:04 +02:00
kirkwood kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
lantiq lantiq: xrx200: backport upstream network fixes 2022-09-11 01:30:11 +02:00
layerscape kernel: bump 5.10 to 5.10.137 2022-08-23 10:37:04 +02:00
malta kernel: Activate CONFIG_INPUT_MISC on all targets 2022-08-10 21:36:17 +02:00
mediatek mediatek: fix ledbar of UniFi 6 LR when running custom U-Boot 2022-09-11 20:26:42 +01:00
mpc85xx mpc85xx: Make AP3825i boot env partition writable 2022-09-11 01:30:11 +02:00
mvebu mvebu: PCI: aardvark: Implement workaround for PCIe Completion Timeout 2022-09-11 01:30:11 +02:00
mxs kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
octeon kernel: bump 5.15 to 5.15.63 2022-08-25 22:07:43 +02:00
octeontx kernel: bump 5.10 to 5.10.138 2022-08-25 20:23:59 +02:00
omap kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
oxnas oxnas: add testing support for Linux 5.15 2022-09-11 02:49:28 +01:00
pistachio kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
qoriq kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
ramips ramips: add support for Ubiquiti UniFi FlexHD 2022-09-11 20:26:42 +01:00
realtek realtek: add support for TP-Link SG2452P v4 aka T1600G-52PS v4 2022-09-10 22:13:52 +02:00
rockchip rockchip: add system-LED aliases specific to OpenWrt 2022-09-10 01:55:54 +02:00
sunxi kernel: bump 5.10 to 5.10.137 2022-08-23 10:37:04 +02:00
tegra kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
uml generic: enable CRYPTO_LIB_BLAKE2S[_X86|_ARM] 2022-06-24 17:10:24 +02:00
x86 x86: setup netdev paths for MX100 2022-09-10 21:16:39 +02:00
zynq kernel: Activate CONFIG_GPIOLIB in generic configuration 2022-08-10 21:36:17 +02:00
Makefile target: use SPDX license identifiers on Makefiles 2021-02-10 15:47:18 +01:00