Port to TP-Link RE200

I'm currently working on a port to the TP-Link RE200. So far, I got serial and pieced together an image, however, the kernel does not seem to boot. It successfully loads using tftpboot and uncompresses, but the only message I get is Starting kernel....

This is the log from U-Boot:

U-Boot 1.1.3 (Mar 29 2016 - 14:17:26)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb4000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
spi_wait_nsec: 29 
spi device id: c8 40 17 c8 40 (4017c840)
find flash: GD25Q64C
============================================ 
Ralink UBoot Version: 4.1.0.0
This UBoot has been rewritten by TPLINK *_*
-------------------------------------------- 
ASIC 7620_MP (Port5<->None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Mar 29 2016  Time:14:17:26
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   6: Load ART data then write to Flash via TFTP.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

You choosed 4

<0x08><0x08><0x08> 0 
raspi_read: from:20028 len:6 

   
4: System Enter Boot Command Line Interface.

U-Boot 1.1.3 (Mar 29 2016 - 14:17:26)
MT7620 # tftpboot

 netboot_common, argc= 1 

 NetTxPacket = 0x83FE5B00 

 KSEG1ADDR(NetTxPacket) = 0xA3FE5B00 

 NetLoop,call eth_halt ! 

 NetLoop,call eth_init ! 
Trying Eth0 (10/100-M)

 Waitting for RX_DMA_BUSY status Start... done


 ETH_STATE_ACTIVE!! 
*** Warning: no boot file name; using 'test.bin'
TFTP from server 192.168.0.10; our IP address is 192.168.0.254
Filename 'test.bin'.

 TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: *<0x08>Got ARP REPLY, set server/gtwy eth addr (00:e0:4c:00:05:7f)
Got it
#################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ############
done
Bytes transferred = 3717307 (38b8bb hex)
NetBootFileXferSize= 0038b8bb
MT7620 # bootm 0x80100000
## Booting image at 80100000 ...
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 00000080) ...
## Giving linux memsize in MB, 64

Starting kernel ...

I suppose that my make files are not completely correct, this is what I have:

define Device/tplink_re200-v1
  MTK_SOC := mt7620a
  DEVICE_VENDOR := TP-Link
  TPLINK_BOARD_ID := RE200-V1
  TPLINK_HWID := 0x0
  TPLINK_HWREV := 0
  KERNEL := $(KERNEL_DTB) | lzma
  KERNEL_INITRAMFS := $(KERNEL_DTB) | lzma | tplink-v1-header -e
  IMAGES+= factory.bin
  TPLINK_HEADER_VERSION := 1
  IMAGE_SIZE := 7808k
  DEVICE_PACKAGES := kmod-mt76x0e
  DEVICE_MODEL := RE200
  DEVICE_VARIANT := v1
  SUPPORTED_DEVICES += re200-v1
endef
TARGET_DEVICES += tplink_re200-v1

Any ideas on how to fix this? Thanks!

1 Like

Check the kernel command args. My guess is that it doesn't have a console that you can see. Many targets are set up to ignore the boot loader args, using those supplied by the DTS/DTB. Though ignored, those from the boot loader can be a good clue as to what working args might be (including console).

1 Like

Thanks, that seems to be right: the original firmware defines console at /dev/ttyS1. While I couldn't get it to work at first try, I now have at least a place to look for.

I'll keep you updated (could take a while), thanks again.

1 Like

OK, I did a quick try: I still can't get any output, no matter what I try. I'm currently building a very minimal dts to no avail (no matter what I put to the bootargs):

/dts-v1/;

#include "mt7620a.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "tplink,re200-v1", "ralink,mt7620a-soc";
	model = "TP-Link RE200 v1";

	chosen {
		bootargs = "console=ttyS0,57600n8";
	};

	pinctrl {
		state_default: pinctrl0 {
			gpio {
			    ralink,group = "mdio", "i2c", "uartf", "wled", "ephy", "spi refclk";
				ralink,function = "gpio";
			};
		};
	};

};


&gpio0 {
    status = "okay";
};

Maybe my boot commands in U-Boot are wrong (see log file in first post)?

1 Like

Got it to boot. My image generation commands were wrong, I compressed the kernel twice via lzma. Now on to fixing things!

3 Likes

To reply once again to myself: I'm now stuck at running it from flash.

What works:

  • Ethernet
  • Both Radios
  • Some LEDs
  • In theory, also the buttons (untested)

I was able to create an image that the bootloader flashed. The kernel also booted from flash, but now it can't find the rootfs. This is where I need some advice:

[    1.054170] m25p80 spi0.0: gd25q64 (8192 Kbytes)
[    1.063443] 4 fixed-partitions partitions found on MTD device spi0.0
[    1.076109] Creating 4 MTD partitions on "spi0.0":
[    1.085685] 0x000000000000-0x000000020000 : "u-boot"
[    1.096572] 0x000000020000-0x0000007e0000 : "firmware"
[    1.156100] 0x0000007e0000-0x0000007f0000 : "userconfig"
[    1.167683] 0x0000007f0000-0x000000800000 : "radio"
[ ... ]
[    1.323149] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.338116] Please append a correct "root=" boot option; here are the available partitions:
[    1.354779] 1f00             128 mtdblock0 
[    1.354785]  (driver?)
[    1.367819] 1f01            7936 mtdblock1 
[    1.367825]  (driver?)
[    1.380849] 1f02              64 mtdblock2 
[    1.380855]  (driver?)
[    1.393888] 1f03              64 mtdblock3 
[    1.393894]  (driver?)
[    1.406915] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.424642] Rebooting in 1 seconds..

The bootloader has no commandline defined nor do I provide a root= option to the dts file. How can I tell it where the rootfs is? Where is it, actually, since there is just the partition "firmware"?

This is my current image generation setting:

define Device/tplink_re200-v1
  MTK_SOC := mt7620a
  DEVICE_VENDOR := TP-Link
  TPLINK_BOARD_ID := RE200-V1
  TPLINK_HWID := 0x02000001
  TPLINK_HWREV := 0x00000001
  KERNEL := $(KERNEL_DTB)
  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v1-header -e -O
  IMAGES+= factory.bin
  IMAGE/sysupgrade.bin := append-rootfs
  IMAGE/factory.bin := append-rootfs | mktplinkfw factory -C EU -c -e -O
  TPLINK_HEADER_VERSION := 1
  IMAGE_SIZE := 7808k
  TPLINK_FLASHLAYOUT := 8Mlzma
  DEVICE_PACKAGES := kmod-mt76x0e
  DEVICE_MODEL := RE200
  KERNEL_ENTRY := 0x8000c310
  KERNEL_LOADADDR := 0x80000000
  DEVICE_VARIANT := v1
  SUPPORTED_DEVICES += re200
endef
TARGET_DEVICES += tplink_re200-v1

When examining the file, it is only 1.6MiB in size. I suspect that the rootfs is not actually appended?

1 Like

Basically, I'm done.
What works:

  • Ethernet
  • Both Radios
  • Power, WiFi and Ethernet LED
  • WPS and Reset buttons
  • Flash (i.e. booting and saving files etc.)

I have found a way (through U-Boot) to flash back to stock, but at the moment you need serial access to flash OpenWrt (via U-Boot). This is very unfortunate, since the case is quite hard to crack open...

My attempts to fool the web interface into flashing a modified OpenWrt image did not succeed. Further, the recover mode present on other TP-Link devices does not seem to be available.

2 Likes

Did I not find it or is there no link to your GitHub repo yet? :wink:

Also is your device really hardware revision 1? If not that would explain why it's not flashing from the Webinterface.

Yes, it's really a v1. Why would that explain why it's not flashing from the web interface?

It's now available at my github: https://github.com/andyboeh/openwrt/tree/tplink_re200v1

1 Like

If the version does not match the hardware version it will be rejected (for obvious reasons), so if you set v1 but really it's a v3 (for example mine is a v3) it will reject it.

1 Like

Ah OK, this is what you meant :slight_smile: I'm not yet sure why the web interface rejects it, though.

I don't know how similar or different v1 and v3 are, since I just have a v1. I suppose the image generation options are different, this is, for now, the only MediaTek-based device supported in OpenWrt that has a TP-Link version 1 header.

1 Like

I've taken a look at a stock RE200v3 image and it seems like there is a header of some kind after the bootloader, however that header is recognized by binwalk incorrectly so it's probably modified somehow.

Anyways, I opened my v3 now (it was glued together in addition to those clips on the side) and I now have access to the bootloader. You simply selected option 2 (Load system code then write to flash via tftp) and provided the OpenWRT image, right? Once my compilation finished I'll try that.....

1 Like

Mine was even welded together, not easy to pry open.
I would give it a go from SDRAM first and check whether it boots at all - for development, I've always used option 1 (load image to SDRAM via TFTP or similar), that worked fine with the -initramfs image.
Once I confirmed that everything was working, I dared to flash :slight_smile:

1 Like

Probably the same stuff I am facing here aswell. I left quite some marks on the device.....

Is there something that can extend the time waiting for the number? So far I was only sucessful with autosend that just sends the desired character as fast as possible to the device, when I try to manually enter it I always miss the right time.

So I've tried to boot up the generated openwrt-ramips-mt7620-tplink_re200-v1-initramfs-kernel.bin but unfortunately it gets stuck:

[    0.000000] Linux version 4.14.158 (root@Computer) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r11695-1bdea1c99f)) #0 Thu Dec 19 09:30:01 2019<\r><\n>
[    0.000000] Board has DDR2<\r><\n>
[    0.000000] Analog PMU set to hw control<\r><\n>
[    0.000000] Digital PMU set to hw control<\r><\n>
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2<\r><\n>
[    0.000000] bootconsole [early0] enabled<\r><\n>
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)<\r><\n>
[    0.000000] MIPS: machine is TP-Link RE200 v1<\r><\n>
[    0.000000] Determined physical RAM map:<\r><\n>
[    0.000000]  memory: 04000000 @ 00000000 (usable)<\r><\n>
[    0.000000] Initrd not found or empty - disabling initrd<\r><\n>
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.<\r><\n>
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes<\r><\n>
[    0.000000] Zone ranges:<\r><\n>
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]<\r><\n>
[    0.000000] Movable zone start for each node<\r><\n>
[    0.000000] Early memory node ranges<\r><\n>
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]<\r><\n>
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]<\r><\n>
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a0 with crng_init=0<\r><\n>
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240<\r><\n>
[    0.000000] Kernel command line: console=ttyS0,57600n8 rootfstype=squashfs,jffs2<\r><\n>
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)<\r><\n>
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)<\r><\n>
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)<\r><\n>
[    0.000000] Writing ErrCtl register=00071327<\r><\n>
[    0.000000] Readback ErrCtl register=00071327<\r><\n>
[    0.000000] Memory: 56440K/65536K available (3918K kernel code, 186K rwdata, 896K rodata, 3120K init, 212K bss, 9096K reserved, 0K cma-reserved)<\r><\n>
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1<\r><\n>
[    0.000000] NR_IRQS: 256<\r><\n>
[    0.000000] CPU Clock: 580MHz<\r><\n>
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns<\r><\n>
[    0.000000] systick: enable autosleep mode<\r><\n>
[    0.000000] systick: running - mult: 214748, shift: 32<\r><\n>
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns<\r><\n>
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns<\r><\n>
[    0.015326] Calibrating delay loop... <\r><\n>
[   14.794031] random: fast init done<\r><\n>
[   14.882133] random: crng init done<\r><\n>

What image did you flash when writing to the flash? I've tried that now aswell but no luck there either....

1 Like

I was able to open mine with barely visible marks by using a vise - I found this technique somewhere else.

Well, you've got a different SoC: MT7628A while my v1 is a MT7620A. You need to generate your own DTS. At least you seem to have got the same header format, it took me quite some time to even get any response from the kernel (see this thread).

It depends on your terminal, I'm using Cutecom on Linux and it only works manually if I set it to no line termination. After entering U-Boot, I set it to 'LF'.

I flashed the -factory image.

1 Like

Ahh good catch, I didnt notice that the SoC is different, I just changed all the SoC references now and moved it to the correct makefile, removed the LED stuff for now, relabeled the radio partition to factory (as a factory label is required somehow) and removed gpio3 but now I am getting

Makefile:201: *** Missing Build/mktplinkfw.  Stop.

When I try to use the v2 stuff that all other mt76x8 uses it won't boot at all, so this is probably the correct one as pulling the initramfs from the build dir at least boots until a certain point.

How did you get all the flash addresses/layout?

1 Like

You can use mktplinkfw -i on the original firmware file (it's in build_dir/host/firmware-utils/bin), this gives you most of the information needed (i.e. kernel entry point, kernel load address etc.). For the mtd layout, I watched the original firmware boot and unified the separate kernel and rootfs partitions to one firmware partition.

For the missing mktplinkfw command, you need to copy the template I used at the top of mt7620a.mk to mt76x8a.mk to fix this issue (I copied and adapted mine from the ar71xx port).

You're lucky that I figured all that out a few days ago :slight_smile:

1 Like

Ahhh, perfect, that gets me quite further in the boot process.

[    0.000000] Linux version 4.14.158 (root@Computer) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r11695-1bdea1c99f)) #0 Thu Dec 19 09:30:01 2019<\r><\n>
[    0.000000] Board has DDR2<\r><\n>
[    0.000000] Analog PMU set to hw control<\r><\n>
[    0.000000] Digital PMU set to hw control<\r><\n>
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2<\r><\n>
[    0.000000] bootconsole [early0] enabled<\r><\n>
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)<\r><\n>
[    0.000000] MIPS: machine is TP-Link RE200 v1<\r><\n>
[    0.000000] Determined physical RAM map:<\r><\n>
[    0.000000]  memory: 04000000 @ 00000000 (usable)<\r><\n>
[    0.000000] Initrd not found or empty - disabling initrd<\r><\n>
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.<\r><\n>
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes<\r><\n>
[    0.000000] Zone ranges:<\r><\n>
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]<\r><\n>
[    0.000000] Movable zone start for each node<\r><\n>
[    0.000000] Early memory node ranges<\r><\n>
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]<\r><\n>
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]<\r><\n>
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a0 with crng_init=0<\r><\n>
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240<\r><\n>
[    0.000000] Kernel command line: console=ttyS0,57600n8 rootfstype=squashfs,jffs2<\r><\n>
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)<\r><\n>
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)<\r><\n>
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)<\r><\n>
[    0.000000] Writing ErrCtl register=00079127<\r><\n>
[    0.000000] Readback ErrCtl register=00079127<\r><\n>
[    0.000000] Memory: 56516K/65536K available (3917K kernel code, 182K rwdata, 896K rodata, 3060K init, 205K bss, 9020K reserved, 0K cma-reserved)<\r><\n>
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1<\r><\n>
[    0.000000] NR_IRQS: 256<\r><\n>
[    0.000000] intc: using register map from devicetree<\r><\n>
[    0.000000] CPU Clock: 580MHz<\r><\n>
[    0.000000] timer_probe: no matching timers found<\r><\n>
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns<\r><\n>
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns<\r><\n>
[    0.015369] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)<\r><\n>
[    0.087589] pid_max: default: 32768 minimum: 301<\r><\n>
[    0.096956] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)<\r><\n>
[    0.109918] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)<\r><\n>
[    0.129601] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns<\r><\n>
[    0.148987] futex hash table entries: 256 (order: -1, 3072 bytes)<\r><\n>
[    0.161126] pinctrl core: initialized pinctrl subsystem<\r><\n>
[    0.172400] NET: Registered protocol family 16<\r><\n>
[    0.183631] rt2880-pinmux pinctrl: invalid group "uartf" for function "gpio"<\r><\n>
[    0.197502] rt2880-pinmux pinctrl: invalid group "ephy" for function "gpio"<\r><\n>
[    0.211214] rt2880-pinmux pinctrl: invalid group "wled" for function "gpio"<\r><\n>
[    0.224973] rt2880-pinmux pinctrl: invalid group "nd_sd" for function "gpio"<\r><\n>
[    0.238906] rt2880-pinmux pinctrl: invalid group "rgmii1" for function "gpio"<\r><\n>
[    0.253010] rt2880-pinmux pinctrl: invalid group "spi refclk" for function "gpio"<\r><\n>
[    0.267804] rt2880-pinmux pinctrl: error claiming hogs: -22<\r><\n>
[    0.278805] rt2880-pinmux pinctrl: could not claim hogs: -22<\r><\n>
[    0.290134] rt2880-pinmux: probe of pinctrl failed with error -22<\r><\n>
[    0.407491] mt7620-pci 10140000.pcie: Port 0 N_FTS = 1b105000<\r><\n>
[    0.568518] PCI host bridge /pcie@10140000 ranges:<\r><\n>
[    0.577865]  MEM 0x0000000020000000..0x000000002fffffff<\r><\n>
[    0.588175]   IO 0x0000000010160000..0x000000001016ffff<\r><\n>
[    0.617317] mt7621_gpio 10000600.gpio: registering 32 gpios<\r><\n>
[    0.628520] mt7621_gpio 10000600.gpio: registering 32 gpios<\r><\n>
[    0.639646] mt7621_gpio 10000600.gpio: registering 32 gpios<\r><\n>
[    0.651438] PCI host bridge to bus 0000:00<\r><\n>
[    0.659401] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]<\r><\n>
[    0.673033] pci_bus 0000:00: root bus resource [io  0xffffffff]<\r><\n>
[    0.684691] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]<\r><\n>
[    0.698107] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]<\r><\n>
[    0.714193] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring<\r><\n>
[    0.731026] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]<\r><\n>
[    0.744017] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]<\r><\n>
[    0.757741] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x201fffff]<\r><\n>
[    0.771157] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]<\r><\n>
[    0.784580] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff]<\r><\n>
[    0.797996] pci 0000:01:00.1: BAR 0: assigned [mem 0x20100000-0x201fffff]<\r><\n>
[    0.811407] pci 0000:00:00.0: PCI bridge to [bus 01]<\r><\n>
[    0.821196] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x201fffff]<\r><\n>
[    0.839778] clocksource: Switched to clocksource MIPS<\r><\n>
[    0.850957] NET: Registered protocol family 2<\r><\n>
[    0.860332] TCP established hash table entries: 1024 (order: 0, 4096 bytes)<\r><\n>
[    0.874035] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)<\r><\n>
[    0.886555] TCP: Hash tables configured (established 1024 bind 1024)<\r><\n>
[    0.899263] UDP hash table entries: 256 (order: 0, 4096 bytes)<\r><\n>
[    0.910735] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)<\r><\n>
[    0.923397] NET: Registered protocol family 1<\r><\n>
[    2.739786] random: fast init done<\r><\n>
[    4.285496] Crashlog allocated RAM at address 0x3f00000<\r><\n>
[    4.297539] workingset: timestamp_bits=14 max_order=14 bucket_order=0<\r><\n>
[    4.316840] squashfs: version 4.0 (2009/01/31) Phillip Lougher<\r><\n>
[    4.328292] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.<\r><\n>
[    4.383580] io scheduler noop registered<\r><\n>
[    4.391257] io scheduler deadline registered (default)<\r><\n>
[    4.402169] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled<\r><\n>
[    4.415517] of_serial 10000c00.uartlite: could not find pctldev for node /pinctrl/uartlite, deferring probe<\r><\n>
[    4.435609] spi-mt7621 10000b00.spi: could not find pctldev for node /pinctrl/spi_pins, deferring probe<\r><\n>
[    4.454665] libphy: Fixed MDIO Bus: probed<\r><\n>
[    4.476137] rt3050-esw 10110000.esw: link changed 0x00<\r><\n>
[    4.487071] mtk_soc_eth 10100000.ethernet: generated random MAC address 8e:7f:a3:ed:15:b6<\r><\n>
[    4.503837] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5<\r><\n>
[    4.521852] NET: Registered protocol family 10<\r><\n>
[    4.534879] Segment Routing with IPv6<\r><\n>
[    4.542145] NET: Registered protocol family 17<\r><\n>
[    4.550875] 8021q: 802.1Q VLAN Support v1.8<\r><\n>
[    4.559860] of_serial 10000c00.uartlite: could not find pctldev for node /pinctrl/uartlite, deferring probe<\r><\n>
[    4.579112] spi-mt7621 10000b00.spi: could not find pctldev for node /pinctrl/spi_pins, deferring probe<\r><\n>
[    4.599119] Warning: unable to open an initial console.<\r><\n>
[    4.626026] Freeing unused kernel memory: 3060K<\r><\n>
[    4.634863] This architecture does not have kernel memory protection.<\r><\n>
[    4.662374] init: Console is alive<\r><\n>
[    4.669191] init: - watchdog -<\r><\n>
[    4.698780] kmodloader: loading kernel modules from /etc/modules-boot.d/*<\r><\n>
[    4.715071] of_serial 10000c00.uartlite: could not find pctldev for node /pinctrl/uartlite, deferring probe<\r><\n>
[    4.734407] spi-mt7621 10000b00.spi: could not find pctldev for node /pinctrl/spi_pins, deferring probe<\r><\n>
[    4.755696] kmodloader: done loading kernel modules from /etc/modules-boot.d/*<\r><\n>
[    4.771572] of_serial 10000c00.uartlite: could not find pctldev for node /pinctrl/uartlite, deferring probe<\r><\n>
[    4.790923] spi-mt7621 10000b00.spi: could not find pctldev for node /pinctrl/spi_pins, deferring probe<\r><\n>
[    4.809990] init: - preinit -<\r><\n>
[    5.001189] rt3050-esw 10110000.esw: link changed 0x00<\r><\n>
[    5.057016] random: procd: uninitialized urandom read (4 bytes read)<\r><\n>
[    7.218066] procd: - early -<\r><\n>
[    7.224653] procd: - watchdog -<\r><\n>
[    7.772446] procd: - watchdog -<\r><\n>
[    7.778891] procd: failed to set stdio: No such device<\r><\n>
[    7.789186] procd: - ubus -<\r><\n>
[    7.802215] random: ubusd: uninitialized urandom read (4 bytes read)<\r><\n>
[    7.845364] random: ubusd: uninitialized urandom read (4 bytes read)<\r><\n>
[    7.858471] random: ubusd: uninitialized urandom read (4 bytes read)<\r><\n>
[    7.872125] procd: - init -<\r><\n>
[    8.371334] kmodloader: loading kernel modules from /etc/modules.d/*<\r><\n>
[    8.415118] ip6_tables: (C) 2000-2006 Netfilter Core Team<\r><\n>
[    8.454006] Loading modules backported from Linux version v5.4-rc8-0-gaf42d3466bdc<\r><\n>
[    8.468943] Backport generated by backports.git v5.4-rc8-1-0-g368e8c51<\r><\n>
[    8.512461] ip_tables: (C) 2000-2006 Netfilter Core Team<\r><\n>
[    8.547952] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)<\r><\n>
[    8.683767] xt_time: kernel timezone is -0000<\r><\n>
[    8.832668] PPP generic driver version 2.4.2<\r><\n>
[    8.850777] NET: Registered protocol family 24<\r><\n>
[    8.881339] mt76x0e 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4<\r><\n>
[    8.893727] mt76x0e 0000:01:00.0: ASIC revision: 76100002<\r><\n>
[    8.930632] mt76x0e 0000:01:00.0: Firmware Version: 0.1.00<\r><\n>
[    8.976723] urngd: v1.0.1 started.<\r><\n>
[    9.161535] rt3050-esw 10110000.esw: link changed 0x10<\r><\n>
[    9.188719] random: crng init done<\r><\n>
[    9.195340] random: 6 urandom warning(s) missed due to ratelimiting<\r><\n>
[    9.239796] mt76x0e 0000:01:00.0: driver does not support default EEPROM<\r><\n>
[    9.253076] mt76x0e: probe of 0000:01:00.0 failed with error -22<\r><\n>
[    9.269672] kmodloader: done loading kernel modules from /etc/modules.d/*<\r><\n>
[   56.634682] br-lan: port 1(eth0) entered blocking state<\r><\n>
[   56.645001] br-lan: port 1(eth0) entered disabled state<\r><\n>
[   56.655563] device eth0 entered promiscuous mode<\r><\n>
[   56.707457] br-lan: port 1(eth0) entered blocking state<\r><\n>
[   56.717744] br-lan: port 1(eth0) entered forwarding state<\r><\n>
[   56.728549] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready<\r><\n>
[   57.620460] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready<\r><\n>

I guess these values in the dts are not quite right:

&wmac {
        ralink,mtd-eeprom = <&factory 0>;
        mtd-mac-address = <&userconfig 0x0160>;
};

&pcie {
        status = "okay";
};

&pcie0 {
        mt76@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                mtd-mac-address = <&userconfig 0x0160>;
                mtd-mac-address-increment = <1>;
        };
};

How did you figure out what these values are supposed to be?

1 Like

It seems that you have to fix the GPIO pinmux definitions first, it can't even find your SPI flash chip (plus, there is a bunch of error messages related to pinmux). Check the state_default entries for pinctrl0, the labels are quite different for the MT7628AN. I also had a look at the datasheet to understand the correspondence between the different functions and the GPIO numbers.

1 Like

After quite some work I now have an image that does at least boot up properly, I still need to take care of the LEDs though, how did you figure out the right GPIOs for that?

2 Likes