How to set senao-header for letting update from factory FW

I am developing a snapshot for Sitecom WLR-4100 v1002 based on Mediatek MT7620A.
The firmware is correctly flashed using UART consolle + TFTP.
When I try to flash from factory firmware (*.dlf file) I get the following message:

ERROR: header check error, please check your firmware.

I did the same experiments as WLR-6000, but I was unable to identify the device name to be set in OpenWRT for *.dlf.

You need to specify the correct "Vendor ID" and "Product ID", "Firmware Type" of mksenaofw for your device.

stock firmware v3.1 (WLR-4100v1001-firmware-v31.dlf):

        00010203 04050607 08090A0B 0C0D0E0F  0123456789ABCDEF
000000  00000000 00000222 0000004A 31323300  ......."...J123.
000010  00000000 00000000 00000000 00000002  ................
000020  003E3015 00000000 13BFF020 E026B475  .>0........ .&.u
000030  FD19C462 5B186B7B F4BF0408 08F3ECBF  ...b[.k{........
000040  B9A10408 BDFC0540 24431940 F43F1940  .......@$C.@.?.@
000050  08F3ECBF 35FD0540 0000050F 12345678  ....5..@.....4Vx

0x4 - 0x7: Vendor ID
0x8 - 0xB: Product ID
0x1C - 0x1F: Firmware Type

ref:

I executed hexdump for WLR-4100 V1 001, but I got something different:

$ hexdump WLR-4100v1001-firmware-v31.dlf -n 48
0000000 0000 0000 0000 2202 0000 4a00 3231 0033
0000010 0000 0000 0000 0000 0000 0000 0000 0200
0000020 3e00 1530 0000 0000 bf13 20f0 26e0 75b4

I suppose:
Vendor ID: 0x00002202
Product ID: 0x00004A00
Firmware Type: 0x00000200
Actually mine is WLR-4100 V1 002 having different HW:

$ hexdump WLR-4100v1002-V1-4-1-24.dlf -n 48
0000000 0000 0000 0000 2202 0000 4a10 3231 0033
0000010 0000 0000 0000 0000 0000 0000 0000 0200
0000020 5000 2000 0000 0000 870a dad5 0ef4 7229

I suppose:
Vendor ID: 0x00002202
Product ID: 0x00004A10
Firmware Type: 0x00000200

Do we have some kind Indians make fan of me?

It is due to the difference of endianness (big or little).
The values of senao header should be filled in big endianness.

Can you try following command?
hexdump -n 80 -C WLR-4100v1001-firmware-v31.dlf

result in my environment:

$ hexdump -n 80 -C WLR-4100v1001-firmware-v31.dlf
00000000  00 00 00 00 00 00 02 22  00 00 00 4a 31 32 33 00  |......."...J123.|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 02  |................|
00000020  00 3e 30 15 00 00 00 00  13 bf f0 20 e0 26 b4 75  |.>0........ .&.u|
00000030  fd 19 c4 62 5b 18 6b 7b  f4 bf 04 08 08 f3 ec bf  |...b[.k{........|
00000040  b9 a1 04 08 bd fc 05 40  24 43 19 40 f4 3f 19 40  |.......@$C.@.?.@|
00000050
2 Likes

OK I aligned my FW:

define Device/wlr-4100v1002
  DTS := WLR-4100v1002
  $(Device/dsa-migration)
  BLOCKSIZE := 4k
  IMAGE_SIZE := 7244k
  IMAGES += factory.dlf
  IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
	senao-header -r 0x0222 -p 0x104A -t 2
  DEVICE_TITLE := Sitecom WLR-4100 v1 002
  DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
endef
TARGET_DEVICES += wlr-4100v1002

Leading to this *.dlf (senao-header -r 0x0222 -p 0x104A -t 2)

$ hexdump openwrt-ramips-mt7620-wlr-4100v1002-squashfs-factory.dlf -n 48 -C
00000000  00 00 00 00 00 00 02 22  00 00 10 4a 31 32 33 00  |......."...J123.|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 02  |................|
00000020  00 39 80 04 00 00 00 00  26 f8 99 40 0b 79 6e fa  |.9......&..@.yn.|

to the Sitecom:

$ hexdump -n 48 -C WLR-4100v1002-V1-4-1-24.dlf
00000000  00 00 00 00 00 00 02 22  00 00 10 4a 31 32 33 00  |......."...J123.|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 02  |................|
00000020  00 50 00 20 00 00 00 00  0a 87 d5 da f4 0e 29 72  |.P. ..........)r|
1 Like

Wooow, it works!!! Now I can jump from factory to OpenWRT firmware and viceversa without the need of UART. Then I can close the device case.
In summary:
Vendor ID: 0x00000222 (senao-header -r 0x0222 -p 0x104A -t 2)
Product ID: 0x0000104A (senao-header -r 0x0222 -p 0x104A -t 2)
Firmware Type: 0x00000002 (senao-header -r 0x0222 -p 0x104A -t 2)

2 Likes

Just a sidenote

I have seen Senao vendor ID and product ID clearly printed from the u-boot environment

if you set up the uboot-envtools config for this board using the command
fw_printenv

otherwise a normal printenv in the UART u-boot console

in some cases, It may seem that the console cannot be accessed (no option listed),
but it can be accessible despite the ability to do so not being printed to the user

When I was working on ESR600H, boot log only showed 1 option and had 0 bootdelay
however if I held the "4" key while powering the board, I got serial console, like other similar u-boot builds on similar boards

Sure, it is a boot menu unlisted option 4:
4: System Enter Boot Command Line Interface.
then

MT7620 # printenv
bootcmd=tftp
bootdelay=1
baddrate=115200
ethaddr="xx:xx:xx:xx:xx:xx"
ipaddr=192.168.99.9
serverip=192.168.99.8
sn=xxxxxxxxx
hw_ver=1.0.0
hw_id=0222104A
pro_id=000
country=000
domain=1
op_mode=0
wanaddr=xx:xx:xx:xx:xx:xx
wlanaddr=xx:xx:xx:xx:xx:xx
iNICaddr=xx:xx:xx:xx:xx:xx
eth_en=0
snextra=*********
bootfile=uImageWLR-5100v1002
uboot_ver=1.0.0.1
sku_table=0
language_code=uk
stdin=serial
stdout=serial
stderr=serial
Environment size: 429/4092 bytes 

MT7620 # version
U-Boot 1.1.3 (May 23 2013 - 14:40:54) `

Sitecom WLR-4100 v1 002 is very similar to ESR600. Initially I found the same issue of 2 out of 4 LANs working. Now I fixed it. I am confident that the same solution works for ESR600.
I would like to submit a patch for adding WLR4100 in the project, but I never did something like that before.

1 Like

yeah this is it

Make sure that adding the board is done with only 1 commit
if you have another change that fixes LAN for both this board and ESR600 then it should be a separate commit, 2 commits total

if you need more help open a new topic

Here's the completed hardware id for senao oem device

/*****************************************************************************
;
;    The formation of HW ID contained the items below:
;        reserved : 1 byte
;        type     : 1 byte
;        company  : 2 byte
;        id       : 4 byte
;
;    Rules:
;        reserved : 0
;
;        type     : 0. NO_BRAND
;                   1. OBM 
;                   2. ODM 
;                   3. OEM
;                   4. EMS (id field: no meaning, it's just an index)
;                   5. Software provider
;
;        company  : 0. NO_BRAND
;                   1. EnGenius
;                   2. Sitecom
;                   3. Hamlet
;                   4. Rosewill
;                   5. Corega
;                   6. Amper
;                   7. ZyXEL
;                   8. NetComm
;                   9. MSI
;                   A. I-O Data
;                   B. ST&T
;                   C. TRENDnet
;                   D. ALLNET
;                   E. ATI
;                   F. ENCORE
;                  10. HIFULL 
;                  11. NGN
;                  12. ALCON
;                  13. LevelOne
;                  14. Ziggo
;                  15. PCI
;                  16. Pakedge
;                  17. Atlantis
;                  18. D-Link
;                  19. QTEL
;                  1A. Belkin
;                  1B. Nilox
;                  1C. LG-ERICSSON
;		   		   1D. Axtel
;   			   22. Sitecom new model name from 2011
;   			   23. FXC
;   			   24. ALLNET
;   			   25. CWD
;				   26. Sitecom new model name from 2014
;				   27. Hit
;				   28. Torch
;                  29. WinMate
;                  2A. LanYo
;                  2B. Emplus
;                  2C. Planet
;                  2D. Fujitsu
;                  DD. DD-WRT
;
;        id       : 0. NO_BRAND
;                   1. 9750
;                   2. 9750A
;                   3. 9750G
;                   4. ECB9500
;                   5. 9750B (32MB RAM)
;                   6. EOR (Dual-radio)
;                   7. 9752 (32MB RAM, 4MB Flash)
;                   8. 9753 (16MB RAM, 4MB Flash)
;                   9. 7750
;                   A. 7850 (Atheros 11n AP94/96 platform)
;                   B. 3670
;                   C. 9752A
;                   D. 6650 (3G Router - 3050)  (16MB RAM, 4MB Flash)
;                   E. 6670 (3G Router - 3052)  (32MB RAM, 4MB Flash)
;                   F. 6670A (3G Router - 3052)	(16MB RAM, 4MB Flash)
;                  10. 6650A (3G Router - 3050) (32MB RAM, 8MB Flash)
;                  11. 9850 (32MB RAM, 4MB Flash)
;                  12. 9300 (ECB9300, RT3050 ) (32MB RAM, 4MB Flash)
;                  13. 5670 (EOC5670, Ralink RT2880+Atheros AR5413) (32MB RAM, 8MB Flash)
;                  14. 9550 (EAP9550, 3052) (32MB RAM, 4MB Flash)
;                  15. 9320 (ECB9320, 3052) (32MB RAM, 4MB Flash)
;                  16. 9752B (16MB RAM, 4MB Flash)
;                  17. ETR9350 (Travel Router) (3G Router - 3052)  (32MB RAM, 4MB Flash)
;                  18. ERB9250 (3052, AP-REPEATER,CB,CR)(32MB RAM, 4MB Flash)
;                  19. ESR-9753CR (9753+CB+CR)(32MB RAM, 4MB Flash)
;                  1A. 9752 (32MB RAM, 4MB Flash, Internal Power)
;                  1B. 3G8WV (2*16MB RAM, 8MB Flash, Netcomm Hardware Design)
;                  1C. ECB7510 (Atheros 11n AR7161)(2*32MB RAM, 8MB Flash)
;                  1D. 9752 (32MB RAM, 4MB Flash, Special promotion 1)
;                  1E. 6650A (XGP Router - 3050) (32MB RAM, 8MB Flash)
;                  1F. ERB9250A (3052, AP-REPEATER,CB,CR,TR069)(32MB RAM, 8MB Flash)
;                  20. 9850A (2*16MB RAM, 8MB Flash)
;                  21. ETR9330 (Travel Router, no USB)
;                  22. ETR9360 (Travel Router, Battery)
;                  23. ESR1221NH (RTL8196X+8192XX, 1T1R)
;                  24. ESR9221 (RTL8196X+8192XX, 2T2R)
;                  25. 7750AP
;                  26. ESR9752-AP with No Router function (4MB/32MB AP,CB,Repeater)
;                  27. ESR9752-CB with No Router function (4MB/32MB AP,CB,Repeater)
;                  28. ESR9752-VPN (8MB/32MB)
;                  29. ETR9350-8M (Travel Router) (3G Router - 3052)  (32MB RAM, 8MB Flash)
;                  2A. WN-G300DR (16MB RAM, 4MB Flash, 2X2, 1 WAN, 3 LAN, 1 USB)
;                  2B. WN-G150R (16MB RAM, 4MB Flash, 1X1, 1 WAN, 3 LAN)
;                  2C. ESR-AR7100 (Atheros 11n AR7161)(2*32MB RAM, 8MB Flash)
;                  2D. ESR-7760 (7750 + RTL8367M)(2*16MB RAM, 4MB Flash in 3052; 16MB,2MB Flash in 2880)
;                  2E. WN-G300DGR (16*2MB RAM, 4MB Flash, 2X2, 1 WAN, 3 LAN, 1 USB)
;                  2F. WAA (6670 4M Flash 32M RAM, 1 LAN Cmedia Audio chipset )
;                  2F. RT3052 iNIC for ESR7760
;                  30. D-Link DIR-615H1 (RT3352 platform, 32MB RAM, 4MB Flash)
;                  31. ESR1221N (RTL8196X+8188CE, 1T1R)
;                  32. ESR1221N2 (RTL8196X+8192CE, 2T2R)
;                  33. ESR9860  (RTL8198+8192C+8192DE, Dual Concurrent Gigabit Router 2T2R)
;                  34. 
;                  35. WLR-4001  (RTL8198+8192CE, 2T2R)
;                  36. ESR1221AN  (AR7240+AR9280, 5G high power)
;                  37. ESR9850-VPN  (8MB/32MB)
;                  38. EVR100  (8MB/32MB)
;                  39. D-Link DIR-615H1-TN (RT3352 platform, 32MB RAM, 4MB Flash, AP Mode)
;   			   3A. ERB9260 (Travel Router, no USB)
;   			   3B. ESR1221N-BRZ
;				   3C. ESR150H (RTL8196C+8188CE, 1T1R High power, 4M/32M, 1WAN, 4LAN)
;				   3D. ESR300H (RTL8196C+8192CE, 2T2R High power, 4M/32M, 1WAN, 4LAN)
;                  3E. EAP150 (RTL8196C+8188CE, 1T1R High power, 4M/32M, 1 ethernet port)
;   			   3F. EAP300 (RTL8196C+8192CE, 2T2R High power, 4M/32M,1 ethernet port)
;   			   40. ESR1221NH-EXT (RTL8196C+8188CE, 1T1R High power, 4M/32M, with SMA connector)
;   			   41. RT_3883+5392 (RT3883+RT5392, 8M/32M)
;                  42. ECB150 (RTL8196C+8188CE, 1T1R High power, 4M/32M, 1 ethernet port)
;   			   43. ECB300 (RTL8196C+8192CE, 2T2R High power, 4M/32M,1 ethernet port)
;   			   44. RT_3662+5392 (RT3662+RT5392, 8M/32M)
;                  45. WHG-NAPG/AL (Atheros 11n AR7161)(2*32MB RAM, 16MB Flash)
;                  46. RT3662+RTL8370M (1WAN 7LAN VPN router,64MB DDR, 8MB flash)
;                  47. AR9342+AR8327N (Atheros 11n Soc,WASP 2T2R, Giga Switch with HNAT, 32MB DDR1, 8MB flash)
;   			   48. AR9341 (Atheros 11n Soc,WASP 2T2R, internal 10/100 Switch, 32MB DDR1, 8MB flash)
;   			   49. AR9341 (Atheros 11n Soc,WASP 2T3R, internal 10/100 Switch, 32MB DDR1, 8MB flash)
;   			   4A. ESR9850V2 (RT3352 + RTL8367RB, 32MB RAM, 8MB Flash, 2T2R)
;                  4B. ERB150H (RTL8196C+8188CE, 1T1R High power, 4M/32M, 4LAN)
;   			   4C. ERB300H (RTL8196C+8192CE, 2T2R High power, 4M/32M, 4LAN)
;   			   4D. AR9331 (Atheros 11n Soc,Hornet 1T1R, internal 10/100 Switch, 32MB DDR1, 4MB flash)
;   			   4E. ESR900 (Atheros Scorpion 3T3R product GE, AR9558+AR9580+AR8327N, 16M/128M)
;   			   4F.
;				   50. ESR1221N2_4M_32(RTL8196X+8192CE, 1T1R, 32M RAM, 4M Flash)
;   			   51. ESR1221N2_4M_32(RTL8196X+8192CE, 2T2R, 32M RAM, 4M Flash)
;                  52. ESR350H (RT3352+RTL8367RB, 2T2R, 32M RAM, 8M Flash)
;                  53. WLR-5100(AR9342+AR8327N)
;                  54. WLR-6100(AR8327+RT6855A, 64M RAM, 8M Flash, 3*3 Dual Radio Giga Router)
;   			   55. EPA3520(AR9344+AR7420)
;   			   56. AR9342+QCA8337N+QCA9882 (Atheros 11n Soc,WASP 2T2R, QCA Giga Switch, QCA 5G 802.11AC, 64MB DDR1, 8MB flash)
;                  57. ESR600 (MT7620A+RT5592, GE 1W4L, 64M RAM, 8M Flash)
;                  58. ESR350 (MT7620A, GE 1W4L, 64M RAM, 8M Flash)
;                  59. ESR300 (MT7620N, FE 1W4L, 64M RAM, 8M Flash)
;                  5A. ETA1305 (MT7620N, GE 1W4L, 32M RAM, 4M Flash)
;   			   5B. ETA3305 (MT7620N, GE 1W4L + MII PLC module, 32M RAM, 4M Flash)
;                  5C. NBG6716 (QCA9558+QCA8337N+QCA9880, 16M Flash, 256M RAM)
;                  60.  WN-AC1600DGR_SCO (QCA9558 2.4G 2T2R, QCA9580 5G 802.11AC 3T3R, , 64MB DDR2, 16MB flash)
;                  61. ESR1200 (AR9557 + AR8337N + QCA9882+16M flash+256M RAM)
;                  62. ESR1750 (AR9558 + AR8337N + QCA9880+16M flash+256M RAM)
;                  63. ERB300 (MT7620N ,8M flash , 64 RAM)
;                  64. ERB600 (MT7620A ,RT5592 ,8M flash ,64 RAM)
;   			   65. EDS1130 (GM8126 + MT7601U + HM1375 + Light-sensor(CG5122LC), IP Camera, 128M RAM, 256M NAND Flash)
;                  66. ESR1300 (AR9558 + AR8337N + QCA9882+16M flash+256M RAM)
;                  67. ESR1600 (AR9557 + AR8337N + QCA9880+16M flash+256M RAM)
;                  68. ESR1221N2V2 (MT7620N, FE 1W4L, 32M RAM, 4M Flash)
;   			   69. ESR9850V3 (MT7620A, GE 1W4L, 32M RAM, 8M Flash)
;   			   6A. EPG600 (MT7620A+RT5592, GE 1W4L, 64M RAM, 16M Flash)
;   			   6B. KEN (GM8126 + RTL8189ES + HM1375 + Light-sensor(CG5122LC) + No Ethernet port, IP Camera, 128M RAM, 256M NAND Flash)
;   			   6C. RYU (GM8126 + RTL8189ES + HM1375 + Light-sensor(CG5122LC), IP Camera, 128M RAM, 256M NAND Flash)
;                  6D. ECB1750 (AR9558 + AR8035 + QCA9880+16M flash+128M RAM)
;                  6E. NBG6616 (QCA9557+QCA8337N+QCA9882, 16M Flash, 128M RAM)
;                  6F. EAP100 (base on EAP300)
;				   70, ESR900v2
;				   71, EPG5000 (ESR1750 High power)
;   			   72, RE-1 (AR9558+QCA8337N+EJ168; 64M+64M RAM + 16M flash; Ethernet Router)
;   			   73. EDS5131 (GM8126 + MT7601U + HM1375 + RTC + Light-sensor(CM3232) + RTC(ISL1208) + No SDIO, IP Camera, 128M RAM, 256M NAND Flash)
;   			   74. RE-2 (AR9558+QCA8337N+EJ168; 128M+128M RAM + 16M flash; Ethernet Router)
;   			   75. EDS6131 (GM8126 + MT7601U + HM1375 + Light-sensor(CG5122LC), IP Camera, 128 RAM, 256M NAND Flash)
;   			   76. WX-1 (AR9558 + AR8035 + QCA9880+16M flash+128M RAM)
;				   77. WLR9100 (IPQ8064 + QCA8337 + QCA9880 + 32M SPI/256 nand flash + 256M RAM)
;                  78. EWS500AP
;                  79. ENS620EXT (IPQ40xx SoC, Dual Radio Outdoor AP, 2T2R, 400Mbps + 867Mbps)
;                  7A. EWS510AP
;                  7B. EWS370AP (AP indoor internal ant)
;                  7C. EWS371AP (AP indoor external ant)
;                  7D. EWS870AP (AP outdoor internal ant)
;                  7E. EWS871AP (AP outdoor external ant)
;		   A0. ENH1750EXT (Outdoor models, QCA955X + AR988X, Two ports with single phy, AR8033 + AR8035)
;                  80. EWS360AP
;                  81. HUDDLE (QCA9558 + QCA9880 + AR8033 + AR8035, 32M FLASH, 128MB RAM)
;                  82. Triband(EWS380AP) (IPQ4019+QCA9882+AR8072, 4MB SPI+128MB NAND, 256MB RAM)
;                  83. EMR3000 (QCA9557 + QCA9882 + AR8033 + AR8035, 32M FLASH, 128MB RAM)
;                  84. EWS300AP
;                  85. EWS660AP (QCA9558 + QCA9880 + AR8033 + AR8035, 16M FLASH, 128MB RAM, 3*3ac)
;                  86. EWS650AP (QCA9558 + QCA9880 + AR8033 + AR8035, 16M FLASH, 128MB RAM, 2*2ac)
;                  87. EWS860AP (QCA9558 + QCA9880 + AR8033 + AR8035, 16M FLASH, 128MB RAM, 3*3ac)
;                  88. EWS350AP (QCA9558 + QCA9880, 16M FLASH, 128MB RAM, 2*2ac)
;   			   89. EWS320AP (QCA9558 + QCA9880, 16M FLASH, 128MB RAM, 3*3)
;   			   8A. EWS550AP (IPQ4019+AR8075, 32MB SPI+256MB NAND, 256MB RAM)
;                  8B. EAP2200 (IPQ4019+QCA9882+AR8072, 4MB SPI+128MB NAND, 256MB RAM)
;                  8C. EMR5000 (IPQ4019+QCA9882+AR8072, 4MB SPI+128MB NAND, 256MB RAM)
;                  90. ENS610EXT     (IPQ40xx SoC, Dual Radio Outdoor AP, 2T2R, 400Mbps + 867Mbps)
;                  91. ENS500-AC     (IPQ40xx SoC, Outdoor CPE, 2T2R, 867Mbps)
;                  92. ENS500EXT-AC  (IPQ40xx SoC, Outdoor AP, 2T2R, 867Mbps)
;                  93. EnStation5-AC (IPQ40xx SoC, Outdoor CPE, 2T2R, 867Mbps)
;                  94. EAP1300       (IPQ40xx SoC, Indoor AP, 2T2R, 400Mbps + 867Mbps)
;                  95. EAP1300EXT    (IPQ40xx SoC, Indoor AP, 2T2R, 400Mbps + 867Mbps)
;                  96. EWS355AP      (IPQ40xx SoC, Indoor AP, 2T2R, 400Mbps + 867Mbps)
;                  97. EWS330AP      (IPQ4018+QCA8072, 32MB SPI, 256MB RAM)
;                  98. EAP1250       (IPQ4018+QCA8072, 32MB SPI, 256MB RAM)
;                  99. ENS202EXTv2   (QCA953X, 32MB SPI, 64MB RAM)
;                  9A. ENS202v2      (QCA953X, 32MB SPI, 64MB RAM)
;                  9B. ENH202v3      (QCA953X, 32MB SPI, 64MB RAM)
;                  9C. EMD1          (IPQ4018+QCA8072, 32MB SPI, 256MB RAM)
;                  9D. EAP1300       (IPQ40xx SoC, Indoor AP, 2T2R, 400Mbps + 867Mbps), replace 94(for new software)
;                  9E. EAP1300EXT    (IPQ40xx SoC, Indoor AP, 2T2R, 400Mbps + 867Mbps), replace 95(for new software)
;                  A5. ENH1300EXT    (IPQ4019+QCA9889+AR8035, Outdoor AP, 2T2R, 400Mbps+867Mbps, 8MB SPI, 256MB NAND, 256MB RAM), 3rd Radio for scanning radio
;                 900. IP8K+AR9381+AR9380+AR8327 (Ubicom IP8K 3*3 Dual Radio Giga Switch, 128MB DDR3 *2, 16MB flash)
;
;    Example:
;        1. EnGenius
;           ESR-9750     01010001
;           ESR-9750A    01010002
;           ESR-9750G    01010003
;
;        2. Sitecom
;           NSR-9750     02020001
;           NSR-9750A    02020002
;           NSR-9750G    02020003
;
;*****************************************************************************/

1 Like

are you also going to make a commit to fix ESR600 ethernet?

If you need help with git and making a PR just ask us whatever you need

otherwise, you can share the fix and I can make a PR for you and signoff with your name and email

I am not the author, finally I just tested:

a solution identified by @nbriggs:

it is a matter of moving a bracket for skipping the global page 0 and 2 setup in case of mediatek,mdio-mode in openwrt/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c:

		/* turn on all PHYs */
		for (i = 0; i <= 4; i++) {
			val = _mt7620_mii_read(gsw, gsw->ephy_base + i, 0);
			val &= ~BIT(11);
			_mt7620_mii_write(gsw, gsw->ephy_base + i, 0, val);
		}
	//} the following steps has to be skipped in WLR-4100 and LR25G001

		/* global page 0 */
		_mt7620_mii_write(gsw, gsw->ephy_base + 1, 31, 0x8000);
		_mt7620_mii_write(gsw, gsw->ephy_base + 0, 30, 0xa000);
		_mt7620_mii_write(gsw, gsw->ephy_base + 1, 30, 0xa000);
		_mt7620_mii_write(gsw, gsw->ephy_base + 2, 30, 0xa000);
		_mt7620_mii_write(gsw, gsw->ephy_base + 3, 30, 0xa000);

		_mt7620_mii_write(gsw, gsw->ephy_base + 0, 4, 0x05e1);
		_mt7620_mii_write(gsw, gsw->ephy_base + 1, 4, 0x05e1);
		_mt7620_mii_write(gsw, gsw->ephy_base + 2, 4, 0x05e1);
		_mt7620_mii_write(gsw, gsw->ephy_base + 3, 4, 0x05e1);

		/* global page 2 */
		_mt7620_mii_write(gsw, gsw->ephy_base + 1, 31, 0xa000);
		_mt7620_mii_write(gsw, gsw->ephy_base + 0, 16, 0x1111);
		_mt7620_mii_write(gsw, gsw->ephy_base + 1, 16, 0x1010);
		_mt7620_mii_write(gsw, gsw->ephy_base + 2, 16, 0x1515);
		_mt7620_mii_write(gsw, gsw->ephy_base + 3, 16, 0x0f0f);
	}      //this let all the 5 Ethernet AR8x27 interfaces to work.

	/* CPU Port6 Force Link 1G, FC ON */
	mtk_switch_w32(gsw, 0x5e33b, GSW_REG_PORT_PMCR(6));

The fix works for WLR-4100 (I tested in 19.07.03) and Lava LR25G001 as stated by @nbriggs. It is supposed to work for ESR600 as well.
I do not exclude that it works just because we leave the boot setting (for TFTP).
Nevertheless, I noticed mediatek,mdio-mode is just for WLR-4100, LR25G001 and ESR600 therefore this modification should not impact others MT7620A routers.
I am not familiar with open source development, I am dealing with my first PR for adding my router:

@mpratt14 feel free to make the PR (3 out of 5 Ethernet ports) in your name.

1 Like

@mpratt14 don't forget the:

&gsw {
	mediatek,port4 = "gmac";
};

in mt7620a_engenius_esr600.dts which prevents the extra Phy4 setting (see gsw_mt7620.c).
Actually it is supposed to be added in mt7620a_lava_lr-25g001.dts as well.

1 Like

thanks for the info, I will be working on adding a similar board soon as well. there might be an easier way to achieve this in DTS, then I can pass this fix to the others already added.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.