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
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
425 changes: 425 additions & 0 deletions target/linux/lantiq/files/arch/mips/boot/dts/lantiq/ar10.dtsi

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "ar10.dtsi"

#include <dt-bindings/input/input.h>
#include <dt-bindings/mips/lantiq_rcu_gphy.h>

/ {
compatible = "tplink,archer-d2", "lantiq,xway", "lantiq,ar10";
model = "TP-Link Archer D2 v1";

memory@0 {
device_type = "memory";
reg = <0x0 0x4000000>;
};

aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;

led-dsl = &led_dsl;
led-internet = &led_internet;
led-wifi = &led_wlan;
};

keys {
compatible = "gpio-keys-polled";
poll-interval = <100>;

reset {
label = "reset";
gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};

wifi {
label = "wifi";
gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
linux,code = <KEY_RFKILL>;
linux,input-type = <EV_SW>;
};

wps {
label = "wps";
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};

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

led_power: power {
label = "white:power";
gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
default-state = "keep";
};

led_dsl: dsl {
label = "white:dsl";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
};

led_internet: internet {
label = "white:internet";
gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
};

usb {
label = "white:usb";
gpios = <&gpio 26 GPIO_ACTIVE_LOW>;
trigger-sources = <&ehci_port1>;
linux,default-trigger = "usbport";
};

lan {
label = "white:lan";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};

led_wlan: wlan {
label = "white:wlan";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};

wps {
label = "white:wps";
gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
};
};

usb_vbus: regulator-usb-vbus {
compatible = "regulator-fixed";

regulator-name = "USB_VBUS";

regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;

gpio = <&gpio 25 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
};

&spi {
status = "okay";

flash@0 {
compatible = "jedec,spi-nor";
reg = <1>;
spi-max-frequency = <25000000>;
m25p,fast-read;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

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

partition@20000 {
reg = <0x20000 0xf90000>;
label = "firmware";
};

partition@fb0000 {
reg = <0xfb0000 0x10000>;
label = "radioDECT";
read-only;
};

partition@fc0000 {
reg = <0xfc0000 0x10000>;
label = "config";
read-only;
};

romfile: partition@fd0000 {
reg = <0xfd0000 0x10000>;
label = "romfile";
read-only;
};

partition@fe0000 {
reg = <0xfe0000 0x10000>;
label = "rom";
read-only;
};

radio: partition@ff0000 {
reg = <0xff0000 0x10000>;
label = "radio";
read-only;
};
};
};
};

&eth0 {
pinctrl-names = "default";
mtd-mac-address = <&romfile 0xf100>;
};

&gswip {
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
};

&gphy0 {
lantiq,gphy-mode = <GPHY_MODE_GE>;
};
&gphy1 {
lantiq,gphy-mode = <GPHY_MODE_GE>;
};
&gphy2 {
lantiq,gphy-mode = <GPHY_MODE_GE>;
};

&gswip_mdio {
phy1: ethernet-phy@1 {
reg = <0x1>;
};
phy2: ethernet-phy@2 {
reg = <0x2>;
};
phy4: ethernet-phy@4 {
reg = <0x4>;
};
phy5: ethernet-phy@5 {
reg = <0x5>;
};
};

&gswip_ports {
port@1 {
reg = <1>;
phy-mode = "internal";
phy-handle = <&phy1>;
label = "lan1";
};
port@2 {
reg = <2>;
phy-mode = "internal";
phy-handle = <&phy2>;
label = "lan3";
};
port@4 {
reg = <4>;
phy-mode = "internal";
phy-handle = <&phy4>;
label = "lan2";
};
port@5 {
reg = <5>;
phy-mode = "rgmii";
phy-handle = <&phy5>;
label = "lan4";
};
};

&stp {
status = "okay";
lantiq,phy1 = <0x2>;
lantiq,phy2 = <0x2>;
lantiq,phy3 = <0x2>;
};

&usb0 {
status = "okay";
vbus-supply = <&usb_vbus>;
};

&usb_phy0 {
status = "okay";
};

&pcie0 {
pcie@0 {
reg = <0 0 0 0 0>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
device_type = "pci";

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

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.

mtd-mac-address-increment = <2>;
};
};
};
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions target/linux/lantiq/image/tp-link.mk
Original file line number Diff line number Diff line change
@@ -17,6 +17,17 @@ define Device/lantiqTpLink
check-size | append-metadata
endef

define Device/tplink_archer-d2
$(Device/lantiqTpLink)
DEVICE_MODEL := Archer D2
DEVICE_VARIANT := v1
SOC := ar10
Copy link
Member

Choose a reason for hiding this comment

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

If we start to have separate SOC values for xrx200, the SOC variable should be set individually for all devices far clarity.

TPLINK_FLASHLAYOUT := 16Mltq
IMAGE_SIZE := 15808k
DEVICE_PACKAGES:= kmod-mt76x0e wpad-basic-wolfssl kmod-usb-dwc2 kmod-usb-ledtrig-usbport
endef
TARGET_DEVICES += tplink_archer-d2

define Device/tplink_tdw8970
$(Device/dsa-migration)
$(Device/lantiqTpLink)
3 changes: 3 additions & 0 deletions target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
@@ -55,6 +55,9 @@ buffalo,wbmr-300hpd)
netgear,dm200)
ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0"
;;
tplink,archer-d2)
ucidef_set_led_netdev "lan" "lan" "white:lan" "eth0"
;;
esac

board_config_flush
10 changes: 6 additions & 4 deletions target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ lantiq_setup_interfaces()
avm,fritz7362sl|\
avm,fritz7430|\
buffalo,wbmr-300hpd|\
tplink,archer-d2|\
tplink,tdw8970|\
tplink,tdw8980|\
tplink,vr200|\
@@ -136,14 +137,15 @@ lantiq_setup_macs()
lan_mac=$(mtd_get_mac_binary ART 0x0)
wan_mac=$(macaddr_add "$lan_mac" 1)
;;
tplink,tdw8970|\
tplink,tdw8980)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1)
;;
tplink,archer-d2|\
tplink,vr200|\
tplink,vr200v)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1)
;;
tplink,tdw8970|\
tplink,tdw8980)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1)
;;
esac

[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
2 changes: 1 addition & 1 deletion target/linux/lantiq/xrx200/config-5.10
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_NULL2=y
CONFIG_CRYPTO_ZSTD=y
CONFIG_EXTRA_FIRMWARE="lantiq/xrx200_phy11g_a14.bin lantiq/xrx200_phy11g_a22.bin lantiq/xrx200_phy22f_a14.bin lantiq/xrx200_phy22f_a22.bin"
CONFIG_EXTRA_FIRMWARE="lantiq/xrx200_phy11g_a14.bin lantiq/xrx200_phy11g_a22.bin lantiq/xrx200_phy22f_a14.bin lantiq/xrx200_phy22f_a22.bin lantiq/xrx300_phy11g_a21.bin lantiq/xrx300_phy22f_a21.bin"
CONFIG_EXTRA_FIRMWARE_DIR="firmware"
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_GRO_CELLS=y