-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
lantiq: [WIP] Add support for Archer D2 v1 #4059
base: main
Are you sure you want to change the base?
Conversation
reg = <0x1>; | ||
compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; | ||
}; | ||
phy2: ethernet-phy@2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use tabs instead of spaces.
@ThatMishakov Driver performance comparison on xRX200:
|
I have tried applying the patches and changing dtb to use DSA, but I get
and no Ethernet. What could be the issue? |
Oh, congrats for your work! I never got past Ethernet problem with my FRITZ!BOX 3272. |
b65185e
to
8591a95
Compare
Hello. It looks like I've been getting those errors because I didn't apply the patches from #3085 properly, but now after doing that, I am getting
What could be the issue? I have pushed the changed dts files |
Hi, |
I have changed things up and now PHYs seem to at least be recognised, however, I get no link, the switch does not seem to work, the second PHY is detected intermittedly (sometimes it complains about MDIO port 2 not existing) and the router freezes when I disconnect the ethernet cable (if it was connected at boot) and nothing happens when I connect the ethernet cable to the router while it is booted up. What could that mean? Also, when probing the GPIO pins, I have noticed that I could break the ethernet by activating some of them, might that be the coulprit?
though the 3 other ports seem to be initialized. |
#3085 (comment) |
Thanks for pointing this out. I have discovered that everything actually works (apart from port 2 for some reason and swapped port labels) and ethernet wasn't working because I had included an outdated /etc/config/network with my build (so I would not have ip conflicts). Anyway, what is the best way to trigger LAN led now (that @eth0 is always active) and how can I find out what's wrong with the port 2? |
Nice that it works. GPIO from internal phys are routed via STP (Serial to parralel shift register driver) and STP can control some GPIO of the cascade automaticaly. I think you should use patch for STP from my tree. It can be also controlled manualy. |
lantiq,phy1 = <0x2>; | ||
lantiq,phy2 = <0x2>; | ||
lantiq,phy3 = <0x2>; | ||
lantiq,phy5 = <0x2>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop lantiq,phy5 = <0x2>;
on the xrx300 there are only three internal PHY which can control some bits of cascade automaticaly.
device_type = "memory"; | ||
}; | ||
|
||
cputemp@0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this node. lantiq,cputemp supports only xrx200.
}; | ||
|
||
ts: ts@106F00 { | ||
compatible = "lantiq,ts-xrx300"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropp this node. There is no driver for thermal sensor :(
}; | ||
|
||
|
||
dcdc@106a00 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is no driver for the DCDC controller.
reg = <0x106a00 0x200>; | ||
}; | ||
|
||
vmmc: vmmc@103000 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VMMC (Voice Micro Microcontroller??) is used only for VoiP. This device doesnt have FXS and this node is unnececary.
lantiq,groups = <0x7>; | ||
lantiq,dsl = <0x0>; | ||
lantiq,phy1 = <0x0>; | ||
lantiq,phy2 = <0x0>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
lantiq,phy3 = <0x0>;
#size-cells = <0>; | ||
|
||
gphy0: gphy@20 { | ||
// compatible = "lantiq,xrx300-gphy"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop unnececary (commented) lines.
interrupts = <63 61>; | ||
}; | ||
|
||
ppe@e234000 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there is no driver for hardware NAT (PPE - L3 packet accalerator)
}; | ||
|
||
wlan@a000000 { | ||
compatible ="lantiq,wlan-xrx300"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wlan is unsupported. Drop this node.
led-dsl = &led_dsl; | ||
led-internet = &led_internet; | ||
led-wifi = &led_wlan; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use tabs instead spaces. You can use checkpatch script to find similar minor mistakes.
flash@0 { | ||
compatible = "jedec,spi-nor"; | ||
reg = <1>; | ||
spi-max-frequency = <25000000>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it go faster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but other devices with the same flash chip (https://openwrt.org/toh/qxwlan/e600g) had it set to this frequency
Edit: Ok, it looks to support up to 133mhz clock frequency
Edit2: Seems to workf fine at 104mhz
Edit 3: It's also unstable at 104mhz. Is the right memory specified in wiki?
pinctrl-names = "default"; | ||
}; | ||
|
||
//&gphy0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can keey this. This control which firmware should be loaded to PHY:
- GPHY_MODE_GE - Gibabit firmware
- GPHY_MODE_FE - Fast Ethernet firmware
|
||
|
||
&gswip_mdio { | ||
phy4: ethernet-phy@4 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort this noded
}; | ||
|
||
&gswip_ports { | ||
port@4 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort port by numbers
|
||
partition@20000 { | ||
reg = <0x20000 0xf90000>; | ||
label = "firmware"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does firmware partition contains GPHY firmware?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand, this is a kernel+rootfs partition, which gets overwriten by OpenWRT. But by the look of things (and binwalk output) OEM firmware does contain the GPHY firmware here (https://static.tp-link.com/res/down/soft/Archer_D2(EU)_V1_160216.zip)
I have just tried setting the router as my main gateway (I have GPON connection) and after setting the port 4 to be WAN with VLAN 20, the port went down with the following log:
and DEVICE_CLAIM_FAILED erro is shown in LuCi. Setting port as WAN without VLAN seems to work normally. Is it some known issue? |
|
||
adsl { | ||
compatible = "lantiq,adsl-arx100"; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken indent.
}; | ||
|
||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken indent.
resets = <&reset0 28 13>, <&reset1 8 8>; | ||
reset-names = "gphy"; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line can be dropped.
@@ -0,0 +1,264 @@ | |||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | |||
/dts-v1/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop dts-v1 here (in favor of dtsi).
target/linux/lantiq/image/tp-link.mk
Outdated
TPLINK_FLASHLAYOUT := 16Mltq | ||
IMAGE_SIZE := 15808k | ||
DEVICE_PACKAGES:= kmod-mt76x0e wpad-basic-wolfssl kmod-usb-dwc2 kmod-usb-ledtrig-usbport | ||
SUPPORTED_DEVICES += Archer-D2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's nonsense, please remove it.
tplink,archer-d2) | ||
ucidef_set_led_netdev "lan" "lan" "lan" "eth0" | ||
;; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken indent und unneeded empty line.
@@ -55,6 +55,10 @@ buffalo,wbmr-300hpd) | |||
netgear,dm200) | |||
ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" | |||
;; | |||
tplink,archer-d2) | |||
ucidef_set_led_netdev "lan" "lan" "lan" "eth0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you label the LED properly, this can be probably merged with the case above.
@@ -66,6 +66,9 @@ lantiq_setup_interfaces() | |||
ucidef_add_switch "switch0" \ | |||
"0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0" | |||
;; | |||
tplink,archer-d2) | |||
ucidef_set_interface_lan "lan1 lan2 lan3 lan4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DSA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but it requieres #3085 and also has some issues. Thinking about it, do I need to add WIP/RFC to the title?
@@ -165,7 +168,8 @@ lantiq_setup_macs() | |||
wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) | |||
;; | |||
tplink,vr200|\ | |||
tplink,vr200v) | |||
tplink,vr200v|\ | |||
tplink,archer-d2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorting.
@@ -53,3 +69,5 @@ Signed-off-by: Mathias Kresin <dev@kresin.me> | |||
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO); | |||
clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); | |||
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE); | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty lines can be dropped here?
6a721fc
to
4353dd5
Compare
I have noticed that EASY388.dtsi from UGW-7.5.1.40 has additional interrupts (32, 69, 95) for ethernet. Is it known what they are for, are they different from xRX200 (vr9) and could they somehow be related to the ethernet issues? |
030f8c8
to
705905c
Compare
I had rebased my commits onto the main master. @adschm Lantiq seems to have switched to DSA, could you please see if I need to change anything? |
They are from DWR-966 GPL sources[1]. Original filenames: ltq_fw_PHY11G_IP_1v5_xRx3xx_A21_R8434.bin ltq_fw_PHY22F_IP_1v5_xRx3xx_A21_RC434.bin [1] https://github.com/brunompena/dwr-966/tree/master/target/linux/lantiq/files/firmware/lantiq Signed-off-by: Mikhail Kovalev <mkm12342001@gmail.com>
b2ab1dc
to
8c32750
Compare
This router is very similar to the TP-Link Archer VR200, with the exception of having the newer SoC Hardware: - SoC: Lantiq ARX 368 - CPU: 2x MIPS 34Kc 500 MHz - RAM: Zentel A3R12E40CBF-8E 64MB DDR2 16-bit - Flash: Winbond W25Q128 16MB SPI 16-pin SOIC - Ethernet: 4x 10/100/1000 BASE-TX Ethernet Interface (3x SoC & 1x XWAY PEF7071V via RGMII) - WiFi 2.4GHz: Lantiq XWAY WAVE300 (SoC) - WiFi 5GHz: MT7610EN 802.11ac 1×1:1 - Switch: Internal Infineon - ADSL: Lantiq XWAY ARX368(SoC) (PSB 50368) - USB: 1x USB 2.0 - LEDs: Power, DSL, Internet, LAN, Wireless, USB, WPS - Buttons: Reset, WiFi, WPS Backup: - Boot up OpenWRT initramfs image (see below) - Create full MTD backup from OpenWRT via ssh: https://openwrt.org/docs/guide-user/installation/generic.backup Booting initramfs image: - Set tftp server on some static ip, preferably 192.168.1.100 (or use dynamic, but beware of possible ip conflicts) - Copy initramfs image to the main tftp directory: $ sudo cp openwrt-lantiq-xrx200-tplink_archer-d2-initramfs-kernel.bin /srv/tftp/ - Connect the ethernet cable to the router - Connect serial - Power on the router - Immediately stop the uBoot autoboot by pressing 't' - (Optional, if your ip address is different from 192.168.1.100) Set tftp server ip: $ setenv serverip 192.168.1.100 - (Optional, if 192.168.1.1 conflicts with you lan) Set router ip: $ setenv ipaddr 192.168.1.1 - Boot the initramfs image: $ tftpboot openwrt-lantiq-xrx200-tplink_archer-d2-initramfs-kernel.bin $ bootm Installation: - Boot the initramfs image - Upload sysupgrade image to the router: (on your computer) $ scp openwrt-lantiq-xrx200-tplink_archer-d2-squashfs-sysupgrade.bin root@192.168.1.1:/tmp - Apply update: (from serial console or ssh) $ sysupgrade /tmp/openwrt-lantiq-xrx200-tplink_archer-d2-squashfs-sysupgrade.bin Restoring original firmware: - Obtain the original firmware - Unzip it and strip the header: $ unzip Archer_D2\(EU\)_V1_160216.zip $ dd if=Archer_D2v1_1.4.0_0.8.0_up_boot\(160216\)_2016-02-16_15.44.20.bin of=tplink-stripped.bin skip=257 bs=512 - Set up tftp server and copy the stripped firmware: $ sudo cp tplink-stripped.bin /srv/tftp - Connect the router to ethernet and serial - Turn on the router and stop uBoot autobooting by pressing 't' - Optionaly set the devices ip (default is 192.168.1.1): $ setenv ipaddr 192.168.1.1 - Optionally change the tftp server address (default is 192.168.1.100): $ setenv serverip 192.168.1.100 - Copy the stripped image to router's memory: $ tftpboot tplink-stripped.bin - Erase rootfs flash area: $ sf erase 0x20000 0xf00000 - Write the image from memory to flash: $ sf write 0x80800000 0x20000 0xf00000 - Once finished, reboot the device: $ reset Known issues: - 2.4Ghz WiFi doesn't work because of the lack of WAVE300 drivers - 5GHz WiFi is effectively useless as for some reason mt76 driver would not allow transmission power higher than 11 dBm - ADSL is untested and might be broken - LAN3 port sometimes fails to initialize during the boot Signed-off-by: Mikhail Kovalev <mkm12342001@gmail.com>
xrx200 subtarget now has support for different SoCs (vr9, xRX300/xRX330), so set SoC version for every board to avoid confusion. Signed-off-by: Mikhail Kovalev <mkm12342001@gmail.com>
This patch allows to use all PHYs on GRX300 and GRX330. The ARX300 has 3 and the GRX330 has 4 integrated PHYs connected to different ports compared to VRX200. Each integrated PHY can work as single Gigabit Ethernet PHY (GMII) or as double Fast Ethernet PHY (MII). Allowed port configurations: xRX200: GMAC0: RGMII, MII, REVMII or RMII port GMAC1: RGMII, MII, REVMII or RMII port GMAC2: GPHY0 (GMII) GMAC3: GPHY0 (MII) GMAC4: GPHY1 (GMII) GMAC5: GPHY1 (MII) or RGMII port xRX300: GMAC0: RGMII port GMAC1: GPHY2 (GMII) GMAC2: GPHY0 (GMII) GMAC3: GPHY0 (MII) GMAC4: GPHY1 (GMII) GMAC5: GPHY1 (MII) or RGMII port xRX330: GMAC0: RGMII, GMII or RMII port GMAC1: GPHY2 (GMII) GMAC2: GPHY0 (GMII) GMAC3: GPHY0 (MII) or GPHY3 (GMII) GMAC4: GPHY1 (GMII) GMAC5: GPHY1 (MII), RGMII or RMII port Tested on D-Link DWR966 (xRX330) with OpenWRT. Signed-off-by: Mikhail Kovalev <mkm12342001@gmail.com>
8c32750
to
00a67cd
Compare
@abajk I had just rebased to the latest main master, and the interrupts still hang after a few seconds of iperf3 with no errors. Might new tx-burst-length be related to it? What can I do to diagnose or fix it and can you please look into it? It still looks like a DSA driver issue and I don't think I can fix it myself. |
The hang of RX exists from the beginning. I don't think it's related to burst length. GPL sources set a few extra registers because of "This configuration is required to address congestion problems due to bursty traffic.". You should try to do the same and see if it fixes the prolem. |
#interrupt-cells = <1>; | ||
interrupt-controller; | ||
compatible = "lantiq,icu"; | ||
reg = <0x80200 0x28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should look like this:
reg = <0x80200 0xc8 /* icu0 */
0x80300 0xc8>; /* icu1 */
@ThatMishakov any chance rebasing the changes to current master? |
I'm a bit busy right now, but will probably try this weekend |
any updates on this? |
|
||
wifi@0,0 { | ||
reg = <0 0 0 0 0>; | ||
mediatek,mtd-eeprom = <&radio 0x0000>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mtd-eeprom is deprecated in favor of nvmem
mediatek,mtd-eeprom = <&radio 0x0000>; | ||
big-endian; | ||
ieee80211-freq-limit = <5000000 6000000>; | ||
mtd-mac-address = <&romfile 0xf100>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mtd-mac* is gone. nvmem is the replacement.
@ThatMishakov: Any progress on it? |
This is an ar10 (xrx300) consumer adsl modem/router with 4 gbit ports, dual-band wifi and a single usb port.
This pull request adds support for this router and some general support for ar10 platform. It also includes some patches from #3102 as they are needed for Ethernet ports to work properly and I've rebased it on #3085 (is that a good idea?)
Hardware:
Backup:
https://openwrt.org/docs/guide-user/installation/generic.backup
Booting initramfs image:
possible ip conflicts)
$ sudo cp openwrt-lantiq-xrx200-tplink_archer-d2-initramfs-kernel.bin /srv/tftp/
tftp server ip:
$ setenv serverip 192.168.1.100
$ setenv ipaddr 192.168.1.1
$ tftpboot openwrt-lantiq-xrx200-tplink_archer-d2-initramfs-kernel.bin
$ bootm
Installation:
(on your computer) $ scp openwrt-lantiq-xrx200-tplink_archer-d2-squashfs-sysupgrade.bin root@192.168.1.1:/tmp
(from serial console or ssh) $ sysupgrade /tmp/openwrt-lantiq-xrx200-tplink_archer-d2-squashfs-sysupgrade.bin
Restoring original firmware:
$ unzip Archer_D2(EU)_V1_160216.zip
$ dd if=Archer_D2v1_1.4.0_0.8.0_up_boot(160216)_2016-02-16_15.44.20.bin of=tplink-stripped.bin skip=257 bs=512
$ sudo cp tplink-stripped.bin /srv/tftp
$ setenv ipaddr 192.168.1.1
$ setenv serverip 192.168.1.100
$ tftpboot tplink-stripped.bin
$ sf erase 0x20000 0xf00000
$ sf write 0x80800000 0x20000 0xf00000
$ reset
Known issues:
would not allow transmission power higher than 11 dBm
OpenWrt bootlog:
https://pastebin.com/gQqGwLV4
P.S. This is the first time I'm using git for anything "serious"/contributing to a large project. Please tell me if I'm doing something wrong.