Skip to content

ramips: add support for TP-Link Archer C20 v4#1620

Closed
Linaro1985 wants to merge 2 commits into
lede-project:masterfrom
Linaro1985:archer-c20v4
Closed

ramips: add support for TP-Link Archer C20 v4#1620
Linaro1985 wants to merge 2 commits into
lede-project:masterfrom
Linaro1985:archer-c20v4

Conversation

@Linaro1985
Copy link
Copy Markdown
Contributor

@Linaro1985 Linaro1985 commented Jan 9, 2018

TP-Link Archer C20 v4 is a router with 5-port FE switch and
non-detachable antennas. It's based on MediaTek MT7628N+MT7610EN.

Specification:

  • MediaTek MT7628N/N (580 Mhz)
  • 64 MB of RAM
  • 8 MB of FLASH
  • 2T2R 2.4 GHz and 1T1R 5 GHz
  • 5x 10/100 Mbps Ethernet
  • 3x external, non-detachable antennas
  • UART (J1) header on PCB (115200 8n1)
  • 7x LED (GPIO-controlled*), 2x button, power input switch
  • WAN LED in this devices is a dual-color, dual-leads type which isn't
    (fully) supported by gpio-leds driver. This type of LED requires both
    GPIOs state change at the same time to select color or turn it off.
    For now, we support/use only the green part of the LED.
  • MT7610EN ac chip isn't not supported by LEDE. Therefore 5Ghz won't
    work.

Flash instruction:

The only way to flash LEDE image in ArcherC20v4 is to use
tftp recovery mode in U-Boot:

  1. Configure PC with static IP 192.168.0.66/24 and tftp server.
  2. Rename "openwrt-ramips-mt7628-ArcherC20v4-squashfs-tftp-recovery.bin"
    to "tp_recovery.bin" and place it in tftp server directory.
  3. Connect PC with one of LAN ports, press the reset button, power up
    the router and keep button pressed for around 6-7 seconds, until
    device starts downloading the file.
  4. Router will download file from server, write it to flash and reboot.

Signed-off-by: Maxim Anisimov maxim.anisimov.ua@gmail.com
LEDE_Bootlog.txt

@mkresin
Copy link
Copy Markdown
Contributor

mkresin commented Jan 9, 2018

Please create an extra commit for renaming the c20 to c20v1. It shouldn't be in the commit adding support for the c20v4.

The rename will cause issues for people using a c20v1. But I'm fine to do so, since we don't have support for the c20v1 in stable and keeping compatibility within in the development version (master) isn't than crucial.

Copy link
Copy Markdown
Contributor

@mkresin mkresin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use git commit --amend to add changes to your commit. Use git push --force to overwrite your github repository/branch. The PR will afterwards update automatically. Please don't close this PR and open a new one.

*"C20 v1")
name="c20v1"
;;
*"C20 v4")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the C20 v4 here and use the compatible string as boardname in all files (tplink,c20v4).

Comment thread target/linux/ramips/image/mt76x8.mk Outdated
endef
DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION

define Device/ArcherC20v4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use define Device/tplink_c20v4 here.

Comment thread target/linux/ramips/image/mt76x8.mk Outdated
TPLINK_HWREVADD := 0x4
TPLINK_HVERSION := 3
endef
TARGET_DEVICES += ArcherC20v4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TARGET_DEVICES += tplink_c20v4

Comment thread target/linux/ramips/dts/ArcherC20v4.dts Outdated
&pinctrl {
state_default: pinctrl0 {
gpio {
ralink,group = "p0led_an", "p2led_an", "perst", "refclk", "wdt", "wled_an";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be:

ralink,group = "i2s", "refclk", "p0led_an", "p1led_an", "p2led_an", "p3led_an", "p4led_an", "wdt";

  • power led uses a pin of the i2s group
  • rfkill button uses the refclk pin
  • reset button used the wdt pin
  • wlan2g led uses the p4led_an pin
  • wlan5g led uses the p3led_an pin
  • wps led uses the p2led_an pin
  • lan led used the p1led_an pin
  • green wan led uses the p0led_an pin
  • orange wan led uses gpio pin which can be configured only as gpio

@Linaro1985
Copy link
Copy Markdown
Contributor Author

All done! Please, check it. Thanks!

@mkresin
Copy link
Copy Markdown
Contributor

mkresin commented Jan 9, 2018

Looks good so far. I have one more change request. Would you please seperate boardname and version number with a minus. The same in the dts as well of course:

  • tplink,c20-v1
  • tplink,c20-v4

Please add a commit message to the "ramips: rename TP-Link Archer C20 to TP-Link Archer C20 v1" commit. Explain why you have done the changes and add a note that you migrated the board to the generic board detection. Have a look at #594 for some related commit messages.

@Linaro1985
Copy link
Copy Markdown
Contributor Author

Linaro1985 commented Jan 9, 2018

I have just finished changes. I hope that commit message now is correct. Thanks.

@mkresin
Copy link
Copy Markdown
Contributor

mkresin commented Jan 9, 2018

Not yet. You need to change Device/tplink_c20v4 to Device/tplink_c20-v4 as well. Same for the tplink_c20v1 and the TARGET_DEVICES variable.

Please do a full runtime test on your c20-v4 afterwards including a sysupgrade and so on.

@Linaro1985
Copy link
Copy Markdown
Contributor Author

Linaro1985 commented Jan 9, 2018

You need to change Device/tplink_c20v4 to Device/tplink_c20-v4 as well. Same for the tplink_c20v1 and the TARGET_DEVICES variable.

Done

Please do a full runtime test on your c20-v4 afterwards including a sysupgrade and so on.

Unfortunately I have no device by the hand. Users of a forum help me with testing. Therefore it will take some time.

@mkresin
Copy link
Copy Markdown
Contributor

mkresin commented Jan 9, 2018

Just leave a note if the test was done. A new bootlog would be handy as well.

Comment thread target/linux/ramips/image/mt76x8.mk Outdated
endef
DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION

define Device/tplink_c20-v4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the alphabetical order

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general @heinzek is correct here. But I have already a commit in my staging tree which will break to alphabetical order anyway. Hence I've not requested to keep alphabetical order and it doesn't really matter till my stuff is committed as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will correct it.

Comment thread target/linux/ramips/image/mt76x8.mk Outdated
DEVICE_TITLE := TP-Link ArcherC20 v4
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc200004
TPLINK_HWREV := 0x283
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 0x238? I see in EU firmware HWREV 0x1

Copy link
Copy Markdown
Contributor Author

@Linaro1985 Linaro1985 Jan 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my region firmware HWREV is 0x283. I didn't check a HWREV code for other regions. It turns out that a code everywhere different. At the moment there is no problem because of we can't install firmware via tp-link webinterface (For example, for Archer C20 v1 it's true). Is there options in this case? Maybe the EU region should be by default?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look here: 24043a0

Factory image notes:

These devices use version 3 of TP-Link header, fortunately without RSA
signature (at least in case of devices sold in Europe). The difference
lays in the requirement for a non-zero value in "Additional Hardware
Version" field. Ideally, it should match the value stored in vendor
firmware header on device ("0x4"/"0x13" for these devices) but it seems
that anything other than "0" is correct.

You can set a random "non-zero" value in this field and everything is OK

Copy link
Copy Markdown
Contributor Author

@Linaro1985 Linaro1985 Jan 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heinzek But I have difference only in HWREV code! HWREVADD (Additional Hardware
Version) is the same for EU and RU regions.
2018-01-11_214328_cr

@@ -0,0 +1,170 @@
/dts-v1/;

#include "mt7628an.dtsi"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can include TL-WR84XN.dtsi and remove:
chosen, memory, spi, ehci, ohci
In "wmac" leave only "mtd-mac-address-increment",
In "Ethernet" remove "mtd-mac-address"

ps. Maybe its good time to change filename from TL-WR84XN.dtsi to TPLINK_8M.dtsi ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't include the TL-WR84XN.dtsi or at least not as long as the file is named TL-WR84XN.dtsi. Such DTS files are a pain to read.

TPLINK_8M.dtsi is way better. But it shouldn't happen in context of this PR. I'm, fine to merge an extra PR which does these kind of optimizations.

Copy link
Copy Markdown
Contributor Author

@Linaro1985 Linaro1985 Jan 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't include the TL-WR84XN.dtsi

Ok

@Linaro1985
Copy link
Copy Markdown
Contributor Author

New logfile: LEDE_Bootlog.txt
The user from a forum has tested new firmware release and reported that everything works normally except sysupgrade procedure via webinterface.

test4 sysupgrade.bin
using webinterface (Window 10, Firefox 57.0.5 (64bit)
Error: The uploaded image file does not contain a supported format. Make sure that you choose the > generic image format for your platform.
Command Line upgrade successful.

Any ideas?

@mkresin
Copy link
Copy Markdown
Contributor

mkresin commented Jan 11, 2018

test4 sysupgrade.bin
using webinterface (Window 10, Firefox 57.0.5 (64bit)
Error: The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.

Command Line upgrade successful.

Any ideas?

To be honest, it doesn't make any sense. If the upgrade via command line works without any errors, it should work via LuCI as well. LuCI is just a web frontend for for the sysupgrade command and doesn't do any extra checks. Nevertheless, I really would like to know what went wrong for your tester. Would you please ask for a (putty/serial) logfile of a sysupgrade done via command line. It could be of course that the tester used a wrong image with LuCI or has some kind of caching issues with the browser.

@heinzek Any advice what to do with the HWREV? You are way more familiar with the tp-link images than I.

@Linaro1985
Copy link
Copy Markdown
Contributor Author

Linaro1985 commented Jan 11, 2018

@mkresin The user from a forum has started sysupgrade process via webinterface once again and everything has passed perfectly. So there is no any problem.
LEDE_UpgradeLog.txt

TP-Link Archer C20 v4 is a router with 5-port FE switch and
non-detachable antennas. It's based on MediaTek MT7628N+MT7610EN.

Specification:
- MediaTek MT7628N/N (580 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 2T2R 2.4 GHz and 1T1R 5 GHz
- 5x 10/100 Mbps Ethernet
- 3x external, non-detachable antennas
- UART (J1) header on PCB (115200 8n1)
- 7x LED (GPIO-controlled*), 2x button, power input switch

* WAN LED in this devices is a dual-color, dual-leads type which isn't
  (fully) supported by gpio-leds driver. This type of LED requires both
  GPIOs state change at the same time to select color or turn it off.
  For now, we support/use only the green part of the LED.
* MT7610EN ac chip isn't not supported by LEDE. Therefore 5Ghz won't
  work.

Flash instruction:

The only way to flash LEDE image in ArcherC20v4 is to use
tftp recovery mode in U-Boot:

1. Configure PC with static IP 192.168.0.66/24 and tftp server.
2. Rename "openwrt-ramips-mt7628-ArcherC20v4-squashfs-tftp-recovery.bin"
   to "tp_recovery.bin" and place it in tftp server directory.
3. Connect PC with one of LAN ports, press the reset button, power up
   the router and keep button pressed for around 6-7 seconds, until
   device starts downloading the file.
4. Router will download file from server, write it to flash and reboot.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
This changes device name from "TP-Link Archer C20" to "TP-Link Archer C20 v1"
because of TPLINK released new TP-Link Archer C20 v4. Additionally
migration to the generic board detection has been made.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
@Linaro1985
Copy link
Copy Markdown
Contributor Author

Linaro1985 commented Jan 13, 2018

The difference lays in the requirement for a non-zero value in "Additional Hardware Version" field.

In case of Archer C20 v4 it's not true, because of difference only in HWREV code for EU and RU regions. The devices by hardware are identical. EU firmware header data was seted to resolve this question. I hope that this variant will ok. Please accept patches if there are no other problems. Thanks!

@mkresin
Copy link
Copy Markdown
Contributor

mkresin commented Jan 14, 2018

Thanks! Merged into my staging tree.

@mkresin mkresin closed this Jan 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants