New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ath79: add support for TP-LINK Archer C7 v4 #1726
Conversation
Based upon work on ath79 Archer A7/C7 v5, but I fixed few issues like LED aliases in DTS (led-boot and others) and fixed initialization of ar8327 (removed irrelevant LED initialization and aligned init of port6 with ar71xx init). This should probably be fixed the same on C7 v5, too. C7 v4 and C7 v5 have completely different GPIOs (LEDs) and have two USBs, so I created new DTS instead of trying to bring a common base. |
Just a note for ar8327 init values (Archer C7 v4 uses QCA8337N chip):
Without change 2 the PORT 6 is shown as connected, but with this change it is shown as "down" (in the |
In your commit message you mention a QCA9888, but the C7 uses a QCA9880. The dtsi seems to be not necessary as there is no Archer A7 v4. So everything should be contained in the C7 v4 dts. |
60784c2
to
028d6b4
Compare
@blocktrron Commit message - fixed. Single DTS - fixed. I force-pushed the updated commit. |
Quick-tested on two routers, both boot, power LED blinks during boot, normal startup. Updated patch works :-) |
Tested also with pull request #1635 (kernel 4.19) on one of my two routers and it works fine so far. |
Should I update |
Can you check the MAC addresses? I doubt the eth0 it's ok, as the wan interface in the stock firmware is the lan mac plus one. If you took as reference the ar7xx code it's wrong. |
I think that it behaves the same as ar71xx code, so it might be wrong (I have not run stock for a long time). How it should be? eth0 MAC same as 2.4GHz wifi, but 5GHz should be +1? This should be easy to change in 02_network. Currently it is eth0 MAC = phy#1 MAC (2.4GHz), phy#0 MAC (5GHz) is -1. |
@howl Nope, it is correct. Same as stock. 2.4GHz MAC = LAN MAC |
Yes, but wan LAN MAC +1, in ar71xx lan, wifi2g and wifi5g are ok, but wan mac conflicts with lan and wifi2g and it should be plus 1. I think eth0 is wan and eth1 is lan. Don't have mine near nowadays to recheck. Edit just to be clear: |
Yes, that looks correct. Stock: 5 GHz xx-xx-xx-xx-xx-AA This is out of my knowledge, I just tried to understand the DTS. I see only eth0 on openwrt and have no clue on what could be done in order to introduce eth1 with different MAC... |
I will try to help you if I can, I'm in the same situation. Anyways if you are using your branch in your router check if wan it's ok, perhaps with ath79 openwrt brings the correct mac despite not specified. Edit: in v4 and v5 eth0 could be lan and eth1 wan, v2 is the c7 that have eth0 wan and eth1 lan. I'm going to take back my v4 tomorrow to check. |
Despite not having yet the v4, I have take a look to the code and I have found that there is only eth0 in v4 and v5. So at first sight only one mac can be defined in dts. The same situation is with tl-wr1043nd-v4, previous versions have eth0 wan and eth1 lan, but v4 has only eth0. The approach I can see that makes setting the wan mac for the wan vlan in eth0 is in target/linux/ath79/base-files/etc/board.d/02_network file. The first function ath79_setup_interfaces() define the interfaces and vlans. The second one ath79_setup_mac() set up macs for situations like the one we have here, so tl-wr1043nd-v4 have: If I not in a mistake you need to add also in that file the following case: In tl-wr1043nd-v4 the mtd is labeled product-info and you have labeled it config: If they get labeled with the same name the case for the wr1043nd-v4 could be used for archer-c7-v4. |
In ar71xx is also called config you used the same names. Any ways I'm trying to set the mac as it should be but It doesn't seems possible without using macvlan. I think your pull request can be accepted as is till some experienced developer shows how to define the mac address for a vlan at first boot. Will try to find more devices that have the lan and wan in the same switch how they handle this. |
The wan_mac trick should work actually. I have just tried to generate fresh /etc/config/network, the "wan" was generated as eth0.2 (VLAN 2) with macaddr option set and when I added it to my live configuration, the interface listed with |
Tested with clean-config flash, eth0.2 interface has the +1 MAC. When you test it from PC and watch Wireshark, it really shows DHCP requests from +1 MAC. Other ports show communication from +0 MAC. The VLAN game works well here, the change in |
Yes I tested too macaddr, but couldn't test at first boot the wan_mac code xD Good port @oldium, that change for the wan mac I think should be in more tp-link devices that use one physical switch for lan and wan ethernet ports. PD: The only thing left you need to do is to merge this in one commit, I did a pull request recently and ended up doing also more than one commit in the pull and cannot be merged in main openwrt's git in that situation. If you cannot remove the last commit and use amend to add also changes in the first commit I think you are going to create a new pull request with only one commit. |
TP-Link Archer C7 v4 is a dual-band AC1750 router, based on Qualcomm/Atheros QCA9561+QCA9880. Specification: - 775/650/258 MHz (CPU/DDR/AHB) - 128 MB of RAM (DDR2) - 16 MB of FLASH (SPI NOR) - 3T3R 2.4 GHz - 3T3R 5 GHz - 5x 10/100/1000 Mbps Ethernet - 7x LED, 2x button - UART header on PCB Flash instruction: 1. Upload openwrt-ath79-generic-tplink_archer-c7-v4-squashfs-factory.bin via Web interface Flash instruction using TFTP recovery: 1. Set PC to fixed ip address 192.168.0.66 2. Download openwrt-ath79-generic-tplink_archer-c7-v4-squashfs-factory.bin and rename it to ArcherC7v4_tp_recovery.bin 3. Start a tftp server with the file tp_recovery.bin in its root directory 4. Turn off the router 5. Press and hold Reset button 6. Turn on router with the reset button pressed and wait ~15 seconds 7. Release the reset button and after a short time the firmware should be transferred from the tftp server 8. Wait ~30 second to complete recovery. Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
9bf301d
to
88b87d5
Compare
@howl Force-committed squashed commit, ready for merge :-) |
@howl It is worth mentioning that Archer C7 v5 DTS most probably should be fixed according to this pull request, because its DTS contains the following issues:
I do not have Archer C7 v5, so I cannot test any changes - I cannot provide a verified pull request that way. |
@oldium me neither, I only have v2 and v4, I suppouse v5 is very similar and only one usb port removed. I will try to ping at email the original author of the v5 support to check it. Another thing, the usb leds gets on properly when usb 1 and 2 have a usb device? I don't know about led definitions in dts file, if they don't work is very easy to change the dts definition and add it to board.d led configuration. If they work leave it as is. @dedeckeh If you have time could you check this PR? It could possibly appoint to mac issues in several tp-link recent version routers. wan mac conflicting with lan mac in only one switch routers. In this pr is solved for the archer-c7-v4 but there are more tp-links with only one switch. |
@howl |
Thanks for hints and help :-) |
I tried to find the labels in the manual, but they don't specify. I don't think is an important change.In ar71xx I think the upper led is the one used for usb 1 and the lower one is the one used for usb 2. I don't have privileges to merge, but I'm sure when someone watch this it's going to be merged without problems. Good work @oldium. |
The correct MAC address for this device is lan_mac +1, there is no need to set lan_mac so use base_mac variable instead lan_mac. Based on this PR for ath79: openwrt/openwrt#1726 Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com> [fix alphabetical ordering, reword subject] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
The correct MAC address for this device is lan_mac +1, there is no need to set lan_mac so use base_mac variable instead lan_mac. Based on this PR for ath79: #1726 Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com> [fix alphabetical ordering, reword subject] Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 4bcf581)
The correct MAC address for this device is lan_mac +1, there is no need to set lan_mac so use base_mac variable instead lan_mac. Based on this PR for ath79: openwrt/openwrt#1726 Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com> [fix alphabetical ordering, reword subject] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Merged. Thanks. |
The correct MAC address for this device is lan_mac +1, there is no need to set lan_mac so use base_mac variable instead lan_mac. Based on this PR for ath79: openwrt#1726 Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com> [fix alphabetical ordering, reword subject] Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 4bcf581)
@oldium, I have created a pull request to swap usb leds. Already have to check in the original firmwares, but doing it makes usb1 led and usb2 led with their respective ports and match the behaviour that v2 have with openwrt, down led usb1 and upper led usb2. |
Good, I will test it later this week |
These devices share the network config with C7v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This device shares the network config with v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
These devices share the network config with C7v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This device shares the network config with v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
These devices share the network config with C7v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt/openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This device shares the network config with v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt/openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
These devices share the network config with C7v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This device shares the network config with v4, thus the WAN MAC also needs to be fixed the same way. However, the partition where the MAC address resides has been changed. Based on: openwrt#1726 Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
The correct MAC address for this device is lan_mac +1, there is no need to set lan_mac so use base_mac variable instead lan_mac. Based on this PR for ath79: openwrt#1726 Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com> [fix alphabetical ordering, reword subject] Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit c81890f)
TP-Link Archer C7 v4 is a dual-band AC1750 router, based on Qualcomm/Atheros
QCA9561+QCA9880.
Specification:
Flash instruction:
Flash instruction using TFTP recovery:
and rename it to ArcherC7v4_tp_recovery.bin
the firmware should be transferred from the tftp server