Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ThatMishakov
Copy link

@ThatMishakov ThatMishakov commented Apr 8, 2021

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:

  • 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:

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

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.

reg = <0x1>;
compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
};
phy2: ethernet-phy@2 {
Copy link
Contributor

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.

@abajk
Copy link
Contributor

abajk commented Apr 8, 2021

@ThatMishakov
I think the best approach is to use DSA driver[1]. Patch for xrx300 and xrx330 has been accepted upstream[2].

Driver performance comparison on xRX200:

Test       OpenWRT driver        DSA driver         Increase
WAN->LAN   130 Mb/s              327 Mb/s           +151 %
LAN->WAN   132 Mb/s              315 Mb/s           +138 %
  1. lantiq: xrx200: switch to the mainline DSA driver #3085
  2. https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=a09d042b086202735c4ed64573cdd79933020001

@ThatMishakov
Copy link
Author

@ThatMishakov
I think the best approach is to use DSA driver[1]. Patch for xrx300 and xrx330 has been accepted upstream[2].

Driver performance comparison on xRX200:

Test       OpenWRT driver        DSA driver         Increase
WAN->LAN   130 Mb/s              327 Mb/s           +151 %
LAN->WAN   132 Mb/s              315 Mb/s           +138 %
1. #3085

2. https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=a09d042b086202735c4ed64573cdd79933020001

I have tried applying the patches and changing dtb to use DSA, but I get

[   11.100739] gswip 1e108000.switch: Failed to lookup gate clock
[   11.105279] gswip 1e108000.switch: gphy fw probe failed
[   11.110463] gswip: probe of 1e108000.switch failed with error -2
[   11.117084] lantiq,xrx200-net 1e10b308.eth: failed to get clock
[   11.122369] lantiq,xrx200-net: probe of 1e10b308.eth failed with error -2

and no Ethernet. What could be the issue?
Also, should I just push --force the (broken) DSA changes?

@mrkiko
Copy link
Contributor

mrkiko commented Apr 9, 2021

Oh, congrats for your work! I never got past Ethernet problem with my FRITZ!BOX 3272.

@ThatMishakov ThatMishakov force-pushed the archer-d2 branch 2 times, most recently from b65185e to 8591a95 Compare April 9, 2021 11:56
@ThatMishakov
Copy link
Author

@ThatMishakov
I think the best approach is to use DSA driver[1]. Patch for xrx300 and xrx330 has been accepted upstream[2].
Driver performance comparison on xRX200:

Test       OpenWRT driver        DSA driver         Increase
WAN->LAN   130 Mb/s              327 Mb/s           +151 %
LAN->WAN   132 Mb/s              315 Mb/s           +138 %
1. #3085

2. https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=a09d042b086202735c4ed64573cdd79933020001

I have tried applying the patches and changing dtb to use DSA, but I get

[   11.100739] gswip 1e108000.switch: Failed to lookup gate clock
[   11.105279] gswip 1e108000.switch: gphy fw probe failed
[   11.110463] gswip: probe of 1e108000.switch failed with error -2
[   11.117084] lantiq,xrx200-net 1e10b308.eth: failed to get clock
[   11.122369] lantiq,xrx200-net: probe of 1e10b308.eth failed with error -2

and no Ethernet. What could be the issue?
Also, should I just push --force the (broken) DSA changes?

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

[   11.268097] gswip 1e108000.switch: dsa switch register failed: -51
[   11.688417] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.694617] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.701829] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.709139] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.716495] DSA: tree 0 setup
[   11.719175] gswip 1e108000.switch: probed GSWIP version 21 mod 0

What could be the issue? I have pushed the changed dts files

@abajk
Copy link
Contributor

abajk commented Apr 9, 2021

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

[   11.268097] gswip 1e108000.switch: dsa switch register failed: -51
[   11.688417] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.694617] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.701829] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.709139] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.716495] DSA: tree 0 setup
[   11.719175] gswip 1e108000.switch: probed GSWIP version 21 mod 0

What could be the issue? I have pushed the changed dts files

Hi,
You can use this code as reference[1]. It needs to be cleaned up but it boots correctly on xrx330.

[1]. https://github.com/abajk/openwrt/commits/dwr966-gswip

@ThatMishakov
Copy link
Author

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

[   11.268097] gswip 1e108000.switch: dsa switch register failed: -51
[   11.688417] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.694617] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.701829] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.709139] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy
[   11.716495] DSA: tree 0 setup
[   11.719175] gswip 1e108000.switch: probed GSWIP version 21 mod 0

What could be the issue? I have pushed the changed dts files

Hi,
You can use this code as reference[1]. It needs to be cleaned up but it boots correctly on xrx330.

[1]. https://github.com/abajk/openwrt/commits/dwr966-gswip

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?
This is the error that I'm getting on the bootup now:
[ 11.383864] gswip 1e108000.switch: dsa switch register failed: -517
And sometimes

[   11.647335] mdio_bus 1e108000.switch-mii: MDIO device at address 2 is missing.
[   11.728061] gswip 1e108000.switch lan2 (uninitialized): no phy at 2
[   11.732965] gswip 1e108000.switch lan2 (uninitialized): failed to connect to port 2: -19
[   11.741035] lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy

though the 3 other ports seem to be initialized.
My bootlog now:
https://pastebin.com/ULdx4hLp

@jospezial
Copy link

This is the error that I'm getting on the bootup now:
[ 11.383864] gswip 1e108000.switch: dsa switch register failed: -517

#3085 (comment)
Seems to be normal.

@ThatMishakov
Copy link
Author

This is the error that I'm getting on the bootup now:
[ 11.383864] gswip 1e108000.switch: dsa switch register failed: -517

#3085 (comment)
Seems to be normal.

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?

@abajk
Copy link
Contributor

abajk commented Apr 9, 2021

This is the error that I'm getting on the bootup now:
[ 11.383864] gswip 1e108000.switch: dsa switch register failed: -517

#3085 (comment)
Seems to be normal.

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>;
Copy link
Contributor

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 {
Copy link
Contributor

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";
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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>;
Copy link
Contributor

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";
Copy link
Contributor

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 {
Copy link
Contributor

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";
Copy link
Contributor

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;
};
Copy link
Contributor

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>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it go faster?

Copy link
Author

@ThatMishakov ThatMishakov Apr 9, 2021

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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";
Copy link
Contributor

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?

Copy link
Author

@ThatMishakov ThatMishakov Apr 9, 2021

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)

@ThatMishakov
Copy link
Author

ThatMishakov commented Apr 9, 2021

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:

Fri Apr  9 16:52:29 2021 kern.info kernel: [   31.594164] gswip 1e108000.switch lan4: configuring for phy/rgmii link mode
Fri Apr  9 16:52:29 2021 kern.info kernel: [   31.610110] 8021q: adding VLAN 0 to HW filter on device lan4

and DEVICE_CLAIM_FAILED erro is shown in LuCi. Setting port as WAN without VLAN seems to work normally. Is it some known issue?
Edit: Also, the network is very unstable and would stop working during the load (The same exact issue as #3085 (comment)). I have also seen all gmii ports not get initialized (1-3) after reboot after a kernel panic
Edit 2: It also kernel panics a lot and I seem to have had the TX queue problem. https://pastebin.com/Syf3Pm3k

@hauke hauke added the target/lantiq pull request/issue for lantiq target label Apr 10, 2021

adsl {
compatible = "lantiq,adsl-arx100";
};
Copy link
Member

Choose a reason for hiding this comment

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

Broken indent.

};

};
};
Copy link
Member

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

Copy link
Member

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/;
Copy link
Member

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).

TPLINK_FLASHLAYOUT := 16Mltq
IMAGE_SIZE := 15808k
DEVICE_PACKAGES:= kmod-mt76x0e wpad-basic-wolfssl kmod-usb-dwc2 kmod-usb-ledtrig-usbport
SUPPORTED_DEVICES += Archer-D2
Copy link
Member

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

Copy link
Member

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"
Copy link
Member

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"
Copy link
Member

Choose a reason for hiding this comment

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

DSA?

Copy link
Author

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)
Copy link
Member

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


Copy link
Member

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?

@ThatMishakov ThatMishakov force-pushed the archer-d2 branch 2 times, most recently from 6a721fc to 4353dd5 Compare April 11, 2021 11:42
@ThatMishakov
Copy link
Author

ThatMishakov commented Apr 11, 2021

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?

@ThatMishakov ThatMishakov changed the title lantiq: Add support for Archer D2 v1 lantiq: [WIP] Add support for Archer D2 v1 Apr 11, 2021
@ThatMishakov ThatMishakov force-pushed the archer-d2 branch 2 times, most recently from 030f8c8 to 705905c Compare July 3, 2021 21:18
@ThatMishakov
Copy link
Author

ThatMishakov commented Jul 3, 2021

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?
Also, I was unfortunately very busy while DSA change was being accepted, and this router still has its RX/TX breaking after a few minutes of use. What can I do about that?

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>
@ThatMishakov ThatMishakov force-pushed the archer-d2 branch 2 times, most recently from b2ab1dc to 8c32750 Compare December 11, 2021 23:19
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>
@ThatMishakov
Copy link
Author

@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.

@abajk
Copy link
Contributor

abajk commented Dec 12, 2021

@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
Copy link
Contributor

@abajk abajk Dec 12, 2021

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 */

@GoliathLabs
Copy link
Contributor

@ThatMishakov any chance rebasing the changes to current master?

@ThatMishakov
Copy link
Author

I'm a bit busy right now, but will probably try this weekend

@GoliathLabs
Copy link
Contributor

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>;
Copy link
Contributor

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>;
Copy link
Contributor

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.

@Neustradamus
Copy link

@ThatMishakov: Any progress on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changes target/lantiq pull request/issue for lantiq target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants