Support for new Archer c5 v4

I found the datasheet and driver for RTL8367S


Driver code

But I don't know how to port it to OpenWrt

Hello,

I have one problem with Archer C5 V4 router (vpn to external server not work on WIFI) and and ask from TP Link for one firmware to solve problem.
Today I receive one beta firmware from TP Link.
If it is useful for somebody I put the link for download.

https://1drv.ms/f/s!Ak2D4WUIZLKPiu1Tc3CwX3w73F-AuA

Maybe soon we will have a OpenWrt firmware version to download.

Thanks

1 Like

Thanks for your firmware, but I found only 36~48 channels are available for 5GHz

I have one - c5 (ac1200) v4
If you need any info or testing - you're welcome

After some digging into the driver code, I found it very similar to RTL8367RB's driver
Assume RTL8367S uses the same SMI interface as RTL8367RB's, the only thing to do is to determine the GPIO#. But how?

What channels are available on your router's firmware?

sorry for the wait
36-64 and 132-165

the firmware for EUROPE version has appeared:

https://www.tp-link.com/ro/download/Archer-C5-V4.html#Firmware

a short review with real pictures of the router i am talkiing about are found here:

I was able to port openwrt to archer c5v4 maybe later I will post it on github

3 Likes

Nice! I was waiting for that!

I hope you didn't forget to post it..

Mediatek have a patch for the RTL8367S for 4.14. With this, one can port the C5 with full gigabit support. The problem is that the 7620 have only 1Gb backplane, so the sum of all ports is limited to 1Gb. But still, better than fast :slight_smile:

Attached is the DTS for Archer C5. The rest of the port is easy, just remember to change the switch in the boot script 02_network to:

ucidef_add_switch "switch1" \
			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
/dts-v1/;

#include "mt7620a.dtsi"

#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	compatible = "tplink,c5", "ralink,mt7620a-soc";
	model = "TP-Link ArcherC5 v4";

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	gpio-leds {
		compatible = "gpio-leds";

		wps {
			label = "c5:green:wps";
			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
		};

		usb {
			label = "c5:green:usb";
			gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
		};
		lan {
			label = "c5:green:lan";
			gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
		};
		wan_orange {
			label = "c5:orange:wan";
			gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
		};
		wan {
			label = "c5:green:wan";
			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
		};
		wlan5g {
			label = "c5:green:wlan5g";
			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
		};
		wlan2g {
			label = "c5:green:wlan2g";
			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
		};

	};

	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		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>;
		};	
	};

	rtkgsw {
		compatible = "mediatek,rtk-gsw";
		mediatek,mdio = <&mdio0>;
		mediatek,reset-pin = <&gpio2 14 0>;
	};
};

&gpio2 {
        status = "okay";
};

&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;

		partition@0 {
			label = "u-boot";
			reg = <0x0 0x20000>;
			read-only;
		};

		partition@20000 {
			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;
		};
	};
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "i2c", "uartf", "nd_sd";
			ralink,function = "gpio";
		};
	};
};

&ethernet {
	pinctrl-names = "default";
	mtd-mac-address = <&rom 0xf100>;
	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;

	port@5 {
		status = "okay";
		mediatek,fixed-link = <1000 1 1 1>;
		phy-mode = "rgmii";
	};

	mdio0: mdio-bus {
		status = "okay";
		phy0: ethernet-phy@0 {
		        reg = <0>;
		        phy-mode = "rgmii";
		};

		phy1: ethernet-phy@1 {
		        reg = <1>;
		        phy-mode = "rgmii";
		};

		phy2: ethernet-phy@2 {
		        reg = <2>;
		        phy-mode = "rgmii";
		};

		phy3: ethernet-phy@3 {
		        reg = <3>;
		        phy-mode = "rgmii";
		};

		phy4: ethernet-phy@4 {
		        reg = <4>;
		        phy-mode = "rgmii";
		};

    };
};

&ehci {
	status = "okay";
};

&ohci {
	status = "okay";
};

&gsw {
	mediatek,port4 = "gmac";
};

&pcie {
	status = "okay";
};
3 Likes

:pray: :+1:

Does anyone have the upgrade file ready to share? please thank you.

Hi everyone, I have the Brazilian version of this router (Archer C5 V4). I tried to use the above firmwares, but none worked.
When I try to update, the following message appears:

Error Code: 4503
Uploaded file was not accepted.

Can anybody help me?

Sorry for my English, I'm using Google Translator.

Thank you, Leandro.

Nice job, please do post it! :wink:

The Web interface of Archer C5 only accept signed firmwares. The openwrt firmware must be flashed using the boot loader. Use the serial interface to tftp the firmware to it.

There is no Brazilian official firmware, besides the one that came with the router.

1 Like

Is there another way beside serial console to flash?Maybe fake sign the firmware.For instance to flash RU version on EU device.There are some specific functions that is interesting on russian version.

Could you provide the openwrt firmware? I did not find it on the site.

Thank you, Leandro.

I have a TP-Link Archer C5 v4, the version for "all EU member states and EFTA countries". They claim the firmware uses GPL code, but at https://www.tp-link.com/en/support/gpl-code/ they only provide downloads for v1 and v2. I wrote them to request GPL files for v4 and was replied (from gpl[at]tp-link[dot]com) with the link below:
https://mega.nz/#F!8wVwwS4D!-oelkBkxGoPX4vLXBVqtcg

It is a huge 1.2 GB tar.gz archive with a lot of files, and the readme in the root of the archive contains the following:

> TP-LINK GPL code readme

  1. This package contains all GPL code used by TP-LINK Routers with Linux OS.
  2. All components have been built successfully on Fedora release Linux 14 Workstation.
  3. Compiling components in this package on platforms other than Fedora release Linux 14 Workstation may cause unexpected results.
  4. Recommended using "root" or "sudo" command to build the code.
  5. After building the code, you will get the bootloader and linux kernel image, then you can make rootfs with mksquashfs too, but you can't upgrade these images to your router through web management page.

Build Instructions

  1. All build targets are in ./GPL_ArcherC5V4/BBA_1.5_platform/build/, you should enter this directory to build components.

Simple Build
./buildall.sh

Expert Build

  1. Build toolchain:
    make env_build

  2. Build components:
    1)Build u-boot bootloader
    make boot_build

    2)Build linux kernel image
    make kernel_build

    3)Build some kernel modules, such as netfilter, netsched.
    make modules_build

    4)Build some application, such as busybox, iptables and so on.
    make apps_build

    5)Build rootfs
    make fs_build

    6)Build image
    make image_build

HTH,
C