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

ramips: add initial support for TP-LINK TL-WR840N v4 #974

Closed
wants to merge 1 commit into
base: master
from
Jump to file or symbol
Failed to load files and symbols.
+169 −0
Diff settings

Always

Just for now

@@ -323,6 +323,11 @@ tiny-ac)
set_wifi_led "$board:orange:wifi"
set_usb_led "$board:green:usb"
;;
tl-wr840n-v4)
set_wifi_led "$board:green:wireless"
ucidef_set_led_switch "lan" "lan" "$board:green:lan" "switch0" "0x1e"
ucidef_set_led_switch "wan" "wan" "$board:green:wan" "switch0" "0x01"
;;
vocore)
ucidef_set_led_netdev "eth" "ETH" "$board:orange:eth" "eth0"
set_wifi_led "$board:green:status"
@@ -151,6 +151,7 @@ ramips_setup_interfaces()
mzk-wdpr|\
rb750gr3|\
rt-n14u|\
tl-wr840n-v4|\
ubnt-erx|\
ur-326n4g|\
wrtnode|\
@@ -35,6 +35,7 @@ get_status_led() {
nbg-419n2|\
pwh2004|\
r6220|\
tl-wr840n-v4|\
vr500|\
wnce2001|\
wndr3700v5|\
@@ -478,6 +478,9 @@ ramips_board_detect() {
*"Timecloud")
name="timecloud"
;;
"TP-LINK TL-WR840N v4")
name="tl-wr840n-v4"
;;
*"UBNT-ERX")
name="ubnt-erx"
;;
@@ -135,6 +135,7 @@ platform_check_image() {
tew-714tru|\
timecloud|\
tiny-ac|\
tl-wr840n-v4|\
ur-326n4g|\
ur-336un|\
v22rw-2x2|\
@@ -0,0 +1,141 @@
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7628an.dtsi"
/ {
compatible = "tplink,tl-wr840n-v4", "mediatek,mt7628an-soc";
model = "TP-LINK TL-WR840N v4";
chosen {
bootargs = "console=ttyS0,115200";
};
memory@0 {
device_type = "memory";
reg = <0x0 0x4000000>;
};
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;
reset {
label = "reset";
gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
gpio-leds {
compatible = "gpio-leds";
power {
label = "tl-wr840n-v4:green:power";
gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
};
wireless {
label = "tl-wr840n-v4:green:wireless";
gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
};
ethernet {
label = "tl-wr840n-v4:green:lan";
gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
};
internet {
label = "tl-wr840n-v4:green:wan";
gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
};
wps {
label = "tl-wr840n-v4:green:wps";
gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
};
};
};
&pinctrl {
state_default: pinctrl0 {
gpio {
ralink,group = "i2c", "i2s", "uart1", "uart2", "p0led_an", "p2led_an" ;
ralink,function = "gpio";
};
};
};
&spi0 {
status = "okay";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
m25p,chunked-io = <32>;
partition@0 {
label = "boot";
reg = <0x0 0x20000>;
read-only;
};
partition@20000 {
label = "firmware";
reg = <0x20000 0x7a0000>;
};
partition@7c0000 {
label = "config";
reg = <0x7c0000 0x10000>;
read-only;
};
factory: partition@07d0000 {
label = "romfile";
reg = <0x7d0000 0x10000>;
read-only;
};
partition@07e0000 {
label = "rom";
reg = <0x7e0000 0x10000>;
read-only;
};
partition@07f0000 {
label = "radio";
reg = <0x7f0000 0x10000>;
read-only;
};
};
};
&usbphy {
status = "disabled";
};
&ehci {
status = "disabled";
};
&ohci {
status = "disabled";
};
&wmac {
status = "okay";
mtd-mac-address = <&factory 0xf100>;

This comment has been minimized.

@worm202

worm202 May 15, 2017

I'm trying to investigate poor wireless performance, which was described by @sanitariu
The thing I noticed here is that the EEPROM address was not defined, so it uses default value from mt7628an.dtsi, which is wrong for this hardware:
mediatek,mtd-eeprom = <&factory 0x0000>;
Real EEPROM is located in radio partition, so we must declare this:

&spi0 {
...
	m25p80@0 {
...
		radio: partition@07f0000 {
...
&wmac {
...
	mediatek,mtd-eeprom = <&radio 0x0000>;
};

But performance is still bad though.

@worm202

worm202 May 15, 2017

I'm trying to investigate poor wireless performance, which was described by @sanitariu
The thing I noticed here is that the EEPROM address was not defined, so it uses default value from mt7628an.dtsi, which is wrong for this hardware:
mediatek,mtd-eeprom = <&factory 0x0000>;
Real EEPROM is located in radio partition, so we must declare this:

&spi0 {
...
	m25p80@0 {
...
		radio: partition@07f0000 {
...
&wmac {
...
	mediatek,mtd-eeprom = <&radio 0x0000>;
};

But performance is still bad though.

This comment has been minimized.

@sanitariu

sanitariu May 19, 2017

Did you make some patch for the correct eeprom ?

@sanitariu

sanitariu May 19, 2017

Did you make some patch for the correct eeprom ?

This comment has been minimized.

@Lipton2kirov
@Lipton2kirov
};
&ethernet {
mtd-mac-address = <&factory 0xf100>;
mediatek,portmap = "llllw";
};
@@ -2,6 +2,10 @@
# MT7628 Profiles
#
define Build/prepend-to
dd bs=1 seek=$(1) if=$@ of=$@.new && mv $@.new $@
endef
define Device/mt7628
DTS := MT7628
BLOCKSIZE := 64k
@@ -26,6 +30,17 @@ define Device/miwifi-nano
endef
TARGET_DEVICES += miwifi-nano
define Device/tl-wr840n-v4
DTS := TL-WR840NV4
IMAGE_SIZE := 7808k
DEVICE_TITLE := TP-Link TL-WR840N v4
DEVICE_PACKAGES :=
KERNEL := $(KERNEL_DTB) | prepend-to 448 | uImage lzma

This comment has been minimized.

@mkresin

mkresin Mar 23, 2017

Contributor

please use the existing pad-extra instead of your custom prepend-to.

pad-extra 448 | $(KERNEL_DTB) | uImage lzma
@mkresin

mkresin Mar 23, 2017

Contributor

please use the existing pad-extra instead of your custom prepend-to.

pad-extra 448 | $(KERNEL_DTB) | uImage lzma

This comment has been minimized.

@svobodavac

svobodavac Mar 24, 2017

Contributor

I'm afraid it's not possible.
KERNEL_DTB = kernel-bin | patch-dtb | lzma
Calling pad-extra before making KERNEL_DTB causes, that all leading zeroes crated by pad-extra are subject of lzma a will be comprimed:(
I can't find better/simpler solution.

@svobodavac

svobodavac Mar 24, 2017

Contributor

I'm afraid it's not possible.
KERNEL_DTB = kernel-bin | patch-dtb | lzma
Calling pad-extra before making KERNEL_DTB causes, that all leading zeroes crated by pad-extra are subject of lzma a will be comprimed:(
I can't find better/simpler solution.

IMAGES += factory.bin
IMAGE/factory.bin := pad-extra 131072 | $$(sysupgrade_bin)
endef
TARGET_DEVICES += tl-wr840n-v4
define Device/vocore2
DTS := VOCORE2
IMAGE_SIZE := $(ralink_default_fw_size_16M)
@@ -192,6 +192,7 @@ CONFIG_SPI_MT7621=y
# CONFIG_SPI_RT2880 is not set
CONFIG_SRCU=y
CONFIG_SWCONFIG=y
CONFIG_SWCONFIG_LEDS=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
@@ -195,6 +195,7 @@ CONFIG_SPI_MT7621=y
# CONFIG_SPI_RT2880 is not set
CONFIG_SRCU=y
CONFIG_SWCONFIG=y
CONFIG_SWCONFIG_LEDS=y
CONFIG_SWPHY=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
ProTip! Use n and p to navigate between commits in a pull request.