[PATCH v4 3/3] bcm63xx: add support for Tp-Link Archer VR400 v1

Daniel González Cabanelas dgcbueu at gmail.com
Thu Dec 1 12:23:39 PST 2022


The Archer VR400 v1 is an EOL xDSL router with 802.11bgn/802.11ac wifi.

Hardware:
 - SoC: Broadcom BCM63167
 - CPU: dual core BMIPS4350 V8.0 @400MHz
 - RAM: 128 MB DDR2
 - Flash: 16 MB SPI NOR
 - Ethernet LAN: 3x 100Mbit
 - Ethernet WAN: 1x GbE
 - Wifi 2.4 GHz: SoC integrated BCM435F 802.11b/g/n 
 - WiFi 5 GHz: onboard BCM4352 802.11ac
 - USB: 1x 2.0
 - Buttons: 3x, 1 reset
 - LEDs: 10x, all green

Installation via UART serial console and TFTP:
 - Configure a static IP on the computer e.g: 192.168.1.7
 - Put the openwrt-factory.bin in a TFTP server in the computer
 - Power on the router with the serial console connected
 - While initializing the bootloader press any key to reach the CLI
 - At the CFE command line, execute the command:
   f 192.168.1.7:openwrt-factory.bin image
 - Wait until it finish.

Back to OEM firmware:
 - Stop the bootloader with the serial console
 - Flash the OEM firmware using the CFE web UI: http://192.168.1.1

Unsupported:
 - xDSL
 - Wifi 2.4 GHz
 - WiFi 5 GHz, BCM4352, might eventually get basic support.

Signed-off-by: Daniel González Cabanelas <dgcbueu at gmail.com>
Signed-off-by: Artemii Karavashkin <artem.sid.key at gmail.com>
---
Changes in v2:
 - added USB packages.
Changes in v3:
 - no changes
Changes in v4:
 - fixed linux node name partition in dts to match the offset

 .../bcm63xx/base-files/etc/board.d/01_leds    |   4 +
 .../bcm63xx/base-files/etc/board.d/02_network |   4 +
 .../dts/bcm63167-tplink-archer-vr400-v1.dts   | 177 ++++++++++++++++++
 target/linux/bcm63xx/image/bcm63xx.mk         |  14 ++
 .../patches-5.10/519-board_bcm63268.patch     |  52 ++++-
 ...31-board_bcm6348-bt-voyager-2500v-bb.patch |   2 +-
 .../patches-5.15/519-board_bcm63268.patch     |  52 ++++-
 ...31-board_bcm6348-bt-voyager-2500v-bb.patch |   2 +-
 8 files changed, 299 insertions(+), 8 deletions(-)
 create mode 100644 target/linux/bcm63xx/dts/bcm63167-tplink-archer-vr400-v1.dts

diff --git a/target/linux/bcm63xx/base-files/etc/board.d/01_leds b/target/linux/bcm63xx/base-files/etc/board.d/01_leds
index 75e8afef9d..92fb1bc408 100644
--- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds
+++ b/target/linux/bcm63xx/base-files/etc/board.d/01_leds
@@ -94,6 +94,10 @@ sercomm,h500-s-vfes)
 telsey,cpva502plus)
 	ucidef_set_led_netdev "lan" "LAN" "amber:link" "eth0"
 	;;
+tplink,archer-vr400-v1)
+	ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0.2"
+	ucidef_set_led_usbdev "usb" "USB" "green:usb" "1-1"
+	;;
 esac
 
 board_config_flush
diff --git a/target/linux/bcm63xx/base-files/etc/board.d/02_network b/target/linux/bcm63xx/base-files/etc/board.d/02_network
index b48aa57d2e..32547bf448 100644
--- a/target/linux/bcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm63xx/base-files/etc/board.d/02_network
@@ -159,6 +159,10 @@ sky,sr102)
 	ucidef_add_switch "switch0" \
 		"0:lan" "1:lan" "2:lan" "3:wan" "8t at eth0"
 	;;
+tplink,archer-vr400-v1)
+	ucidef_add_switch "switch0" \
+		"0:lan:3" "1:lan:2" "2:lan:1" "3:wan" "8t at eth0"
+	;;
 *)
 	ucidef_set_interfaces_lan_wan "eth1" "eth0"
 	;;
diff --git a/target/linux/bcm63xx/dts/bcm63167-tplink-archer-vr400-v1.dts b/target/linux/bcm63xx/dts/bcm63167-tplink-archer-vr400-v1.dts
new file mode 100644
index 0000000000..a3dbca7d78
--- /dev/null
+++ b/target/linux/bcm63xx/dts/bcm63167-tplink-archer-vr400-v1.dts
@@ -0,0 +1,177 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Device Tree file for TP-Link Archer VR400 v1
+ *
+ * Copyright (C) 2022 Daniel González Cabanelas <dgcbueu at gmail.com>
+ * Copyright (C) 2022 Artemii Karavashkin <artem.sid.key at gmail.com>
+ */
+
+#include "bcm63268.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "TP-Link Archer VR400 v1";
+	compatible = "tplink,archer-vr400-v1", "brcm,bcm63167", "brcm,bcm63268";
+
+	aliases {
+		led-boot = &led_power_green;
+		led-failsafe = &led_power_green;
+		led-running = &led_power_green;
+		led-upgrade = &led_power_green;
+	};
+
+	chosen {
+		bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
+		stdout-path = "serial0:115200n8";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&pinctrl 32 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+			debounce-interval = <60>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&pinctrl 33 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+			debounce-interval = <60>;
+		};
+
+		rfkill {
+			label = "rfkill";
+			gpios = <&pinctrl 35 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKILL>;
+			debounce-interval = <60>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		wifi2g_green {
+			label = "green:wifi2g";
+			gpios = <&pinctrl 36 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&leds {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_leds>;
+
+	usb_green {
+		reg = <1>;
+		active-low;
+		label = "green:usb";
+	};
+
+	wan_green {
+		reg = <8>;
+		active-low;
+		label = "green:wan";
+	};
+
+	ephy0_act {
+		reg = <9>;
+		brcm,hardware-controlled;
+	};
+
+	ephy1_act {
+		reg = <10>;
+		brcm,hardware-controlled;
+	};
+
+	ephy2_act {
+		reg = <11>;
+		brcm,hardware-controlled;
+	};
+
+	gphy0_act {
+		reg = <12>;
+		brcm,hardware-controlled;
+	};
+
+	wifi5g_green {
+		reg = <14>;
+		active-low;
+		label = "green:wifi5g";
+	};
+
+	led_power_green: power_green {
+		reg = <18>;
+		active-low;
+		label = "green:power";
+		default-state = "on";
+	};
+
+	dsl_green {
+		reg = <20>;
+		active-low;
+		label = "green:dsl";
+	};
+
+	wps_green {
+		reg = <22>;
+		active-low;
+		label = "green:wps";
+	};
+};
+
+&hsspi {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <20000000>;
+		spi-tx-bus-width = <2>;
+		spi-rx-bus-width = <2>;
+		reg = <0>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			cfe at 0 {
+				reg = <0x000000 0x020000>;
+				label = "cfe";
+				read-only;
+			};
+
+			linux at 20000 {
+				reg = <0x020000 0xfa0000>;
+				label = "linux";
+				compatible = "tplink,firmware";
+			};
+
+			nvram at fc0000 {
+				reg = <0xfc0000 0x040000>;
+				label = "nvram";
+			};
+		};
+	};
+};
+
+&pinctrl {
+	pinctrl_leds: leds {
+		function = "led";
+		pins = "gpio1", "gpio8",
+		       "gpio9", "gpio10",
+		       "gpio11", "gpio12",
+		       "gpio14", "gpio18",
+		       "gpio20", "gpio22";
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
diff --git a/target/linux/bcm63xx/image/bcm63xx.mk b/target/linux/bcm63xx/image/bcm63xx.mk
index bbf4da6505..2fe4831ca5 100644
--- a/target/linux/bcm63xx/image/bcm63xx.mk
+++ b/target/linux/bcm63xx/image/bcm63xx.mk
@@ -1219,6 +1219,20 @@ endef
 TARGET_DEVICES += telsey_magic
 
 ### TP-Link ###
+define Device/tplink_archer-vr400-v1
+  $(Device/bcm63xx_tplink)
+  DEVICE_MODEL := Archer VR400
+  DEVICE_VARIANT := v1
+  TPLINK_HWID := 0x491dfa01
+  TPLINK_HWREV := 0x70
+  TPLINK_HWREVADD := 0x0
+  TPLINK_FLASHLAYOUT := 16Mqca
+  CHIP_ID := 63167
+  CFE_BIN_FILE := tplink,archer-vr400-v1/cfe63268.bin
+  DEVICE_PACKAGES := $(USB2_PACKAGES)
+endef
+TARGET_DEVICES += tplink_archer-vr400-v1
+
 define Device/tp-link_td-w8900gb
   $(Device/bcm63xx-legacy)
   DEVICE_VENDOR := TP-Link
diff --git a/target/linux/bcm63xx/patches-5.10/519-board_bcm63268.patch b/target/linux/bcm63xx/patches-5.10/519-board_bcm63268.patch
index 9693b4d3b0..1e49f17839 100644
--- a/target/linux/bcm63xx/patches-5.10/519-board_bcm63268.patch
+++ b/target/linux/bcm63xx/patches-5.10/519-board_bcm63268.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -2697,6 +2697,273 @@ static struct board_info __initdata boar
+@@ -2697,6 +2697,317 @@ static struct board_info __initdata boar
  #endif /* CONFIG_BCM63XX_CPU_6368 */
  
  /*
@@ -227,6 +227,50 @@
 +	},
 +};
 +
++static struct board_info __initdata board_VR400 = {
++	.name = "963167TP",
++	.expected_cpu_id = 0x63268,
++
++	.has_pci = 1,
++	.has_ohci0 = 1,
++	.has_ehci0 = 1,
++	.num_usbh_ports = 1,
++
++	.has_enetsw = 1,
++	.enetsw = {
++		.used_ports = {
++			[0] = {
++				.used = 1,
++				.phy_id = 1,
++				.name = "LAN3",
++			},
++			[1] = {
++				.used = 1,
++				.phy_id = 2,
++				.name = "LAN2",
++			},
++			[2] = {
++				.used = 1,
++				.phy_id = 3,
++				.name = "LAN1",
++			},
++			[3] = {
++				.used = 1,
++				.phy_id = 4,
++				.name = "LAN4/WAN",
++			},
++		},
++	},
++
++	.use_fallback_sprom = 1,
++	.fallback_sprom = {
++		/* BCM4352 not supported */
++		//.type = SPROM_BCM4352,
++		.pci_bus = 1,
++		.pci_dev = 0,
++	},
++};
++
 +static struct board_info __initdata board_vw6339gu = {
 +	.name = "VW6339GU",
 +	.expected_cpu_id = 0x63268,
@@ -274,7 +318,7 @@
   * all boards
   */
  static const struct board_info __initconst *bcm963xx_boards[] = {
-@@ -2801,6 +3068,15 @@ static const struct board_info __initcon
+@@ -2801,6 +3112,16 @@ static const struct board_info __initcon
  	&board_VR3026e,
  	&board_WAP5813n,
  #endif /* CONFIG_BCM63XX_CPU_6368 */
@@ -285,12 +329,13 @@
 +	&board_H500s,
 +	&board_VG8050,
 +	&board_VR3032u,
++	&board_VR400,
 +	&board_vw6339gu,
 +#endif /* CONFIG_BCM63XX_CPU_63268 */
  };
  
  static struct of_device_id const bcm963xx_boards_dt[] = {
-@@ -2918,6 +3194,14 @@ static struct of_device_id const bcm963x
+@@ -2918,6 +3239,15 @@ static struct of_device_id const bcm963x
  	{ .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, },
  #endif /* CONFIG_BCM63XX_CPU_6368 */
  #ifdef CONFIG_BCM63XX_CPU_63268
@@ -302,6 +347,7 @@
 +	{ .compatible = "sercomm,h500-s-lowi", .data = &board_H500s, },
 +	{ .compatible = "sercomm,h500-s-vfes", .data = &board_H500s, },
 +	{ .compatible = "sky,sr102", .data = &board_BSKYB_63168, },
++	{ .compatible = "tplink,archer-vr400-v1", .data = &board_VR400, },
  #endif /* CONFIG_BCM63XX_CPU_63268 */
  #endif /* CONFIG_OF */
  	{ },
diff --git a/target/linux/bcm63xx/patches-5.10/531-board_bcm6348-bt-voyager-2500v-bb.patch b/target/linux/bcm63xx/patches-5.10/531-board_bcm6348-bt-voyager-2500v-bb.patch
index 39728c45e4..b995b87626 100644
--- a/target/linux/bcm63xx/patches-5.10/531-board_bcm6348-bt-voyager-2500v-bb.patch
+++ b/target/linux/bcm63xx/patches-5.10/531-board_bcm6348-bt-voyager-2500v-bb.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -3230,6 +3230,22 @@ void __init board_bcm963xx_init(void)
+@@ -3276,6 +3276,22 @@ void __init board_bcm963xx_init(void)
  		val &= MPI_CSBASE_BASE_MASK;
  	}
  	boot_addr = (u8 *)KSEG1ADDR(val);
diff --git a/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch b/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch
index 9693b4d3b0..1e49f17839 100644
--- a/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch
+++ b/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -2697,6 +2697,273 @@ static struct board_info __initdata boar
+@@ -2697,6 +2697,317 @@ static struct board_info __initdata boar
  #endif /* CONFIG_BCM63XX_CPU_6368 */
  
  /*
@@ -227,6 +227,50 @@
 +	},
 +};
 +
++static struct board_info __initdata board_VR400 = {
++	.name = "963167TP",
++	.expected_cpu_id = 0x63268,
++
++	.has_pci = 1,
++	.has_ohci0 = 1,
++	.has_ehci0 = 1,
++	.num_usbh_ports = 1,
++
++	.has_enetsw = 1,
++	.enetsw = {
++		.used_ports = {
++			[0] = {
++				.used = 1,
++				.phy_id = 1,
++				.name = "LAN3",
++			},
++			[1] = {
++				.used = 1,
++				.phy_id = 2,
++				.name = "LAN2",
++			},
++			[2] = {
++				.used = 1,
++				.phy_id = 3,
++				.name = "LAN1",
++			},
++			[3] = {
++				.used = 1,
++				.phy_id = 4,
++				.name = "LAN4/WAN",
++			},
++		},
++	},
++
++	.use_fallback_sprom = 1,
++	.fallback_sprom = {
++		/* BCM4352 not supported */
++		//.type = SPROM_BCM4352,
++		.pci_bus = 1,
++		.pci_dev = 0,
++	},
++};
++
 +static struct board_info __initdata board_vw6339gu = {
 +	.name = "VW6339GU",
 +	.expected_cpu_id = 0x63268,
@@ -274,7 +318,7 @@
   * all boards
   */
  static const struct board_info __initconst *bcm963xx_boards[] = {
-@@ -2801,6 +3068,15 @@ static const struct board_info __initcon
+@@ -2801,6 +3112,16 @@ static const struct board_info __initcon
  	&board_VR3026e,
  	&board_WAP5813n,
  #endif /* CONFIG_BCM63XX_CPU_6368 */
@@ -285,12 +329,13 @@
 +	&board_H500s,
 +	&board_VG8050,
 +	&board_VR3032u,
++	&board_VR400,
 +	&board_vw6339gu,
 +#endif /* CONFIG_BCM63XX_CPU_63268 */
  };
  
  static struct of_device_id const bcm963xx_boards_dt[] = {
-@@ -2918,6 +3194,14 @@ static struct of_device_id const bcm963x
+@@ -2918,6 +3239,15 @@ static struct of_device_id const bcm963x
  	{ .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, },
  #endif /* CONFIG_BCM63XX_CPU_6368 */
  #ifdef CONFIG_BCM63XX_CPU_63268
@@ -302,6 +347,7 @@
 +	{ .compatible = "sercomm,h500-s-lowi", .data = &board_H500s, },
 +	{ .compatible = "sercomm,h500-s-vfes", .data = &board_H500s, },
 +	{ .compatible = "sky,sr102", .data = &board_BSKYB_63168, },
++	{ .compatible = "tplink,archer-vr400-v1", .data = &board_VR400, },
  #endif /* CONFIG_BCM63XX_CPU_63268 */
  #endif /* CONFIG_OF */
  	{ },
diff --git a/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch b/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch
index 39728c45e4..b995b87626 100644
--- a/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch
+++ b/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -3230,6 +3230,22 @@ void __init board_bcm963xx_init(void)
+@@ -3276,6 +3276,22 @@ void __init board_bcm963xx_init(void)
  		val &= MPI_CSBASE_BASE_MASK;
  	}
  	boot_addr = (u8 *)KSEG1ADDR(val);
-- 
2.38.1







More information about the openwrt-devel mailing list