Last active
December 26, 2021 04:50
-
-
Save andreasrsa/480a27faa8db4ffc6ca887d42c1f70a8 to your computer and use it in GitHub Desktop.
Newer Patch for Archer C5 v4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b8db4ad0bc572974cbe3b5cf47287f1bb37c218b Mon Sep 17 00:00:00 2001 From: DENG Qingfang [email protected] Date: Mon, 18 May 2020 16:38:12 +0800 Subject: [PATCH] ramips: add support for TP-Link Archer C5 v4 | |
TP-Link Archer C5 v4 is a dual band router with 5 GbE ports Advertised as AC1200 for its 867Mbps (2x2) 5GHz band and 300 Mbps (2x2) 2.4GHz band. | |
Specs: | |
SoC: MediaTek MT7620A | |
Ethernet: 5x GbE ports (Realtek RTL8367S) | |
Wireless 2.4GHz: MediaTek MT7620A | |
Wireless 5GHz: MediaTek MT7612E | |
RAM: 64MiB | |
ROM: 8MiB (GD25Q64CSIG) | |
1 USB 2.0 port | |
2 Buttons (WPS and reset) | |
8 LEDs | |
Flash instructions: Currently one has to install OpenWrt only via the serial console | |
Rename the factory.bin to to test.bin | |
start a TFTP server from IP address 192.168.0.225 and serve the image named test.bin | |
connect your device to the LAN port | |
power up the router and press 4 on the console to stop the boot process. | |
enter the following commands on the router console tftp 0x80060000 test.bin erase tplink 0x20000 0x7a0000 cp.b 0x80060000 0x20000 0x7a0000 reset | |
Signed-off-by: DENG Qingfang [email protected] | |
.../dts/mt7620a_tplink_archer-c5-v4.dts | 204 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 16 ++ .../mt7620/base-files/etc/board.d/01_leds | 4 + .../mt7620/base-files/etc/board.d/02_network | 7 + 4 files changed, 231 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts | |
diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts b/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts new file mode 100644 index 0000000000..0c61969a64 - /dev/null + b/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7620a.dtsi" + +#include <dt-bindings/input/input.h> +#include <dt-bindings/gpio/gpio.h> + +/ { | |
compatible = "tplink,archer-c5-v4", "ralink,mt7620a-soc"; | |
model = "TP-Link Archer C5 v4"; | |
aliases { | |
led-boot = &led_power; | |
led-failsafe = &led_power; | |
led-running = &led_power; | |
led-upgrade = &led_power; | |
label-mac-device = ðernet; | |
}; | |
chosen { | |
bootargs = "console=ttyS0,115200"; | |
}; | |
leds { | |
compatible = "gpio-leds"; | |
led_power: power { | |
label = "archer-c5-v4:green:power"; | |
gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; | |
}; | |
wlan2g { | |
label = "archer-c5-v4:green:wlan2g"; | |
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; | |
linux,default-trigger = "phy1tpt"; | |
}; | |
wlan5g { | |
label = "archer-c5-v4:green:wlan5g"; | |
gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; | |
linux,default-trigger = "phy0tpt"; | |
}; | |
wan { | |
label = "archer-c5-v4:green:wan"; | |
gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; | |
}; | |
wan_orange { | |
label = "archer-c5-v4:orange:wan"; | |
gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; | |
}; | |
lan { | |
label = "archer-c5-v4:green:lan"; | |
gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; | |
}; | |
usb { | |
label = "archer-c5-v4:green:usb"; | |
gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; | |
trigger-sources = <&ohci_port1>, <&ehci_port1>; | |
linux,default-trigger = "usbport"; | |
}; | |
wps { | |
label = "archer-c5-v4:green:wps"; | |
gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; | |
}; | |
}; | |
keys { | |
compatible = "gpio-keys"; | |
reset { | |
label = "reset"; | |
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; | |
linux,code = <KEY_RESTART>; | |
}; | |
rfkill { | |
label = "rfkill"; | |
gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; | |
linux,code = <KEY_RFKILL>; | |
}; | |
}; | |
rtl8367s { | |
compatible = "realtek,rtl8367c"; | |
cpu_port = <7>; | |
realtek,extif2 = <1 0 1 1 1 1 1 1 2>; | |
mii-bus = <&mdio0>; | |
phy-id = <29>; | |
}; +}; | |
+&gpio2 { | |
status = "okay"; +}; | |
+&spi0 { | |
status = "okay"; | |
flash@0 { | |
compatible = "jedec,spi-nor"; | |
reg = <0>; | |
spi-max-frequency = <60000000>; | |
partitions { | |
compatible = "fixed-partitions"; | |
#address-cells = <1>; | |
#size-cells = <1>; | |
partition@0 { | |
label = "u-boot"; | |
reg = <0x0 0x20000>; | |
read-only; | |
}; | |
partition@20000 { | |
compatible = "tplink,firmware"; | |
label = "firmware"; | |
reg = <0x20000 0x7a0000>; | |
}; | |
partition@7c0000 { | |
label = "config"; | |
reg = <0x7c0000 0x10000>; | |
read-only; | |
}; | |
rom: partition@7d0000 { | |
label = "rom"; | |
reg = <0x7d0000 0x10000>; | |
read-only; | |
}; | |
partition@7e0000 { | |
label = "romfile"; | |
reg = <0x7e0000 0x10000>; | |
read-only; | |
}; | |
radio: partition@7f0000 { | |
label = "radio"; | |
reg = <0x7f0000 0x10000>; | |
read-only; | |
}; | |
}; | |
}; +}; | |
+&state_default { | |
gpio { | |
groups = "i2c", "uartf", "ephy", "rgmii2"; | |
function = "gpio"; | |
}; +}; | |
+ðernet { | |
pinctrl-names = "default"; | |
mtd-mac-address = <&rom 0xf100>; | |
pinctrl-0 = <&rgmii1_pins &mdio_pins>; | |
port@5 { | |
status = "okay"; | |
mediatek,fixed-link = <1000 1 1 1>; | |
phy-mode = "rgmii"; | |
}; | |
mdio0: mdio-bus { | |
status = "okay"; | |
reset-gpios = <&gpio2 20 GPIO_ACTIVE_LOW>; | |
reset-delay-us = <10000>; | |
}; +}; | |
+&ehci { | |
status = "okay"; +}; | |
+&ohci { | |
status = "okay"; +}; | |
+&wmac { | |
ralink,mtd-eeprom = <&radio 0>; | |
mtd-mac-address = <&rom 0xf100>; +}; | |
+&pcie { | |
status = "okay"; +}; | |
+&pcie0 { | |
wifi@0,0 { | |
reg = <0x0000 0 0 0 0>; | |
mediatek,mtd-eeprom = <&radio 0x8000>; | |
ieee80211-freq-limit = <5000000 6000000>; | |
mtd-mac-address = <&rom 0xf100>; | |
mtd-mac-address-increment = <2>; | |
}; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index d9725c9e69..cda58ea708 100644 - a/target/linux/ramips/image/mt7620.mk + b/target/linux/ramips/image/mt7620.mk @@ -1003,6 +1003,22 @@ define Device/tplink_archer-c2-v1 endef TARGET_DEVICES += tplink_archer-c2-v1 | |
+define Device/tplink_archer-c5-v4 | |
$(Device/tplink-v2) | |
SOC := mt7620a | |
IMAGE_SIZE := 7808k | |
TPLINK_FLASHLAYOUT := 8Mmtk | |
TPLINK_HWID := 0x04DA857C | |
TPLINK_HWREV := 0x0C000600 | |
TPLINK_HWREVADD := 0x04000000 | |
IMAGES += tftp-recovery.bin | |
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin) | |
DEVICE_MODEL := Archer C5 | |
DEVICE_VARIANT := v4 | |
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-mt76x2 kmod-switch-rtl8367b +endef +TARGET_DEVICES += tplink_archer-c5-v4 | |
define Device/tplink_archer-c50-v1 $(Device/tplink-v2) SOC := mt7620a diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index ec86ed4b3f..fe61026255 100755 - a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds + b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -194,6 +194,10 @@ tplink,archer-c20i) ucidef_set_led_switch "lan" "lan" "$boardname:blue:lan" "switch0" "0x1e" ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x01" ;; +tplink,archer-c5-v4) | |
ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch1" "0x0f" | |
ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch1" "0x10" | |
;; tplink,archer-c50-v1) ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e" ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 3fdd42bbff..38b4ad03d9 100755 - a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network + b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -207,6 +207,12 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" | |
"1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0" ;; | |
tplink,archer-c5-v4) | |
ucidef_add_switch "switch0" | |
ucidef_add_switch_attr "switch0" "enable" "0" | |
ucidef_add_switch "switch1" | |
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "7@eth0" | |
;; tplink,archer-mr200) ucidef_add_switch "switch0" | |
"0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0" @@ -347,6 +353,7 @@ ramips_setup_macs() tplink,archer-c2-v1| | |
tplink,archer-c20-v1| | |
tplink,archer-c20i| | |
tplink,archer-c5-v4| | |
tplink,archer-c50-v1| | |
tplink,archer-mr200) wan_mac=\((macaddr_add "\)(mtd_get_mac_binary rom 0xf100)" 1) | |
2.30.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment