RTL960x icon indicating copy to clipboard operation
RTL960x copied to clipboard

HSGMII firmware

Open stich86 opened this issue 3 years ago • 391 comments

Hi @Anime4000

I saw you post on lowyat.net about TWCGPON657 that should support HSGMII on LAN side (2.5Gbit/a). Looks like that also HiSense LTE3415 reports this protocol on the data sheet. Chipset is still RTL9601C.

Do you have any info about that firmware? Here in Italy we are struggling with the various LantiQ sticks (at the moment the only one that support 2.5 also on line side) but for particulars FTTH provider we cannot achieve full speed compared to external ONT

Thanks in advance

stich86 avatar Feb 26 '22 23:02 stich86

Firmware for TWCGPON657 is there in Firmware folder, I not sure Firmware is interchangeable, however I haven't tried 2.5GbE since I don't have 2.5GbE capable SFP+ Router

Anime4000 avatar Feb 27 '22 07:02 Anime4000

TWCGPON657

So we cannot use TWCGPON657 firmware on V2801F?

TWCGPON657 isn't available everywhere :(

stich86 avatar Feb 27 '22 08:02 stich86

Yes, I have tried it, the PON laser didn't give any reading.

need someone reverse engineering rtl driver to support 2.5GbE

Anime4000 avatar Feb 27 '22 11:02 Anime4000

Yes, I have tried it, the PON laser didn't give any reading.

need someone reverse engineering rtl driver to support 2.5GbE

Do you have the TWGPON? Can be interesting to get an "nv getenv". Looks like that on the V2801F's kernel there are references to HiSGMII may be we just need to enable a flag on the uBoot or XML

stich86 avatar Feb 27 '22 11:02 stich86

Yes, I have tried it, the PON laser didn't give any reading. need someone reverse engineering rtl driver to support 2.5GbE

Do you have the TWGPON? Can be interesting to get an "nv getenv". Looks like that on the V2801F's kernel there are references to HiSGMII may be we just need to enable a flag on the uBoot or XML

currently I use TWCGPON657 with V2801F firmware..

here my nv getenv

# nv getenv
Valid environment: 2
b0=setenv bootargs ${bootargs_base} ${mtdparts0} ${rst2dfl_flg}; bootm ${img0_kernel}
b1=setenv bootargs ${bootargs_base} ${mtdparts1} ${rst2dfl_flg}; bootm ${img1_kernel}
baudrate=115200
boot_by_commit=if itest.s ${sw_commit} == 0;then run set_act0;run b0;else run set_act1;run b1;fi
boot_by_tryactive=if itest.s ${sw_tryactive} == 0;then setenv sw_tryactive 2;setenv sw_active 0;saveenv;run en_wdt;run b0;else setenv sw_tryactive 2;setenv sw_active 1;saveenv;run en_wdt;run b1;fi
bootargs=console=ttyS0,115200 mtdparts=rtk_spi_nor_mtd:256K(boot),8K(env),8K(env2),240K(config),3M(k0)ro,4864K(r0)ro,3M(k1),4864K(r1),4K@0ro,4K@0ro,4K@0ro,4K@0ro,3M@512K(linux),4864K@3584K(rootfs) root=31:5
bootargs_base=console=ttyS0,115200
bootcmd=if itest.s ${sw_tryactive} == 2; then run boot_by_commit;else run boot_by_tryactive;fi
bootdelay=5
en_wdt=mw b8003268 e7c00000
erase_cfgfs=sf erase ${fl_cfgfs} +${fl_cfgfs_sz}
erase_env=sf erase ${fl_env} +${fl_env_sz};sf erase ${fl_env2} +${fl_env_sz}
ethact=LUNA GMAC
ethaddr=00:E0:4C:00:00:00
filesize=354800
fl_boot_sz=40000
fl_cfgfs=44000
fl_cfgfs_sz=3c000
fl_env=40000
fl_env2=42000
fl_env_sz=2000
fl_kernel1=80000
fl_kernel1_sz=300000
fl_kernel2=840000
fl_kernel2_sz=300000
fl_rootfs1=380000
fl_rootfs1_sz=4c0000
fl_rootfs2=b40000
fl_rootfs2_sz=4c0000
ftfp_base=80000000
fx1000_init=mw bb000084 00000048
img0_kernel=94080000
img1_kernel=94840000
ipaddr=192.168.1.3
mtdparts0=mtdparts=rtk_spi_nor_mtd:256K(boot),8K(env),8K(env2),240K(config),3M(k0)ro,4864K(r0)ro,3M(k1),4864K(r1),4K@0ro,4K@0ro,4K@0ro,4K@0ro,3M@512K(linux),4864K@3584K(rootfs) root=31:5
mtdparts1=mtdparts=rtk_spi_nor_mtd:256K(boot),8K(env),8K(env2),240K(config),3M(k0),4864K(r0),3M(k1)ro,4864K(r1)ro,4K@0ro,4K@0ro,4K@0ro,4K@0ro,3M@8448K(linux),4864K@11520K(rootfs) root=31:7
netmask=255.255.255.0
serverip=192.168.1.7
set_act0=if itest.s ${sw_active} != 0;then setenv sw_active 0;saveenv;fi
set_act1=if itest.s ${sw_active} != 1;then setenv sw_active 1;saveenv;fi
sgmii_init=mw bb000084 00000044
stderr=serial
stdin=serial
stdout=serial
sw_active=0
sw_commit=0
sw_crc0=4f036fd6
sw_crc1=4f036fd6
sw_tryactive=2
sw_valid0=1
sw_valid1=1
sw_version0=V1.9.0-201104
sw_version1=V1.9.0-201104
upb=tftp ${ftfp_base} plr.img && crc32 ${fileaddr} ${filesize} && sf erase 0 +${fl_boot_sz} && sf write ${fileaddr} 0 ${filesize}
upk=tftp ${ftfp_base} uImage && crc32 ${fileaddr} ${filesize} && sf erase ${fl_kernel1} +${fl_kernel1_sz} && sf write ${fileaddr} ${fl_kernel1} ${filesize}
upk1=tftp ${ftfp_base} uImage && crc32 ${fileaddr} ${filesize} && sf erase ${fl_kernel2} +${fl_kernel2_sz} && sf write ${fileaddr} ${fl_kernel2} ${filesize}
upr=tftp ${ftfp_base} rootfs && crc32 ${fileaddr} ${filesize} && sf erase ${fl_rootfs1} +${fl_rootfs1_sz} && sf write ${fileaddr} ${fl_rootfs1} ${filesize}
upr1=tftp ${ftfp_base} rootfs && crc32 ${fileaddr} ${filesize} && sf erase ${fl_rootfs2} +${fl_rootfs2_sz} && sf write ${fileaddr} ${fl_rootfs2} ${filesize}
upt=tftp 80000000 img.tar && upimgtar ${fileaddr} ${filesize}
upv=tftp 80000000 vm.img;upvmimg ${fileaddr}
yu=loady 80000000 && cp.b 80000000 81000000 ${filesize} && cmp.b 80000000 81000000 ${filesize} && sf erase 0 ${filesize} && sf write 80000000 0 ${filesize}

Anime4000 avatar Feb 27 '22 14:02 Anime4000

Thanks!

So can I flash TWGCP FW on V2801F as second image? I want to check if it can links at 2.5GbE

Because we are using uBoot it's easy to rollback using serial. Do you know if v2801f has UART exposed on SFP side?

Thanks again

stich86 avatar Feb 27 '22 14:02 stich86

You can flash V2801F with TWCGPON657 firmware, you need tweak it to make PON Laser working which is I dont know yet...

There 3 different version C00R657V00B13 I not sure which one is 2.5GbE

C00R657V00B13_20191024.tar
C00R657V00B13_20191205.tar
B13_20200507.tar

You try all 3 and tell me which one support 2.5GbE, and check nv getenv especially sgmii_init= value

I have TWCGPON657 and V2801F stick, both stick are not expose UART on SFP even UART pin

Anime4000 avatar Feb 27 '22 14:02 Anime4000

Which tweak is needed? Just use these tar file on the WebUI update?

Thx

stich86 avatar Feb 27 '22 14:02 stich86

just flash it as usual, if not working, you need downgrade V2801F firmware first

Anime4000 avatar Feb 27 '22 14:02 Anime4000

just flash it as usual, if not working, you need downgrade V2801F firmware first

Currently I'm using the latest firmware found here on your repo on my V2801F. I'll try it tonight an report back the findings ;)

stich86 avatar Feb 27 '22 14:02 stich86

great...

if you plan to flash back V2801F firmware, set flash set PON_MODE 3 to prevent V2801F auto restart, because TWCGPON657 did not have VS_AUTH_KEY

flash set PON_MODE 3 in V2801F behavior is different, you need disconnect fiber then can get back telnet

Anime4000 avatar Feb 27 '22 16:02 Anime4000

good and bad news...

good news: I was able to flash both 2019 and 2020 B13/B15 files on my V2801F. On first attempt i catch into /proc/kmsg this log:

<4>change mode to 5(HiSGMII MAC)

so looks like that the TWCGPON657 acts in a different way. also a "nv getenv" doesn't reports any difference between the two firmware. On the login page I was able to read the TX Power of laser, but not able to test with fiber attached.

Now the bad news

After some test I cannot logon anymore on the firmware :( i've tried all password but nothing to do, so i'm out and cannot access by telnet or web.

Do you know if there are a default credential that I can try?

thanks in advance

EDIT: i was able to login again with "system" password. I've tried also to attach the fiber and the stick cannot go ahead of O3 status.

Now my major problem is to fix the EEPROM. Looks like that the stick with the firmware from TWCGPON657 doesn't expose anything on that, and it cannot be enabled on my MacchiatoBIN to check if the link goes at 2500Base-SX

Any hits how to fix the EEPROM?

stich86 avatar Feb 27 '22 19:02 stich86

a little update:

the code into kernel

<4>change mode to 5(HiSGMII MAC)

it's called when parameter LAN_SDS_MODE is set to 5. Switch it to 1 reports <4>change mode to 1(Fiber 1G)

Now I cannot test it on my MacchiatoBIN because the eeprom is empty and Linux doesn't initialize the SFP port

@Anime4000 can you send me a cat /proc/kmsg of your TWCGPON657 with V2801F and LAN_SDS_MODE set to 5?

Thanks in advance

stich86 avatar Feb 27 '22 20:02 stich86

BusyBox v1.12.4 (2020-10-26 08:35:57 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

# flash get LAN_SDS_MODE
LAN_SDS_MODE=2

That default value for my LAN_SDS_MODE

then I set LAN_SDS_MODE to 5 and do cat /proc/kmsg prints noting

then I flash get LAN_SDS_MODE also prints noting and stuck, I need CTRL+C

it seem V2801F firmware are not build to support 2.5GbE

can you try possible value for LAN_SDS_MODE ?

Value Speed /proc/kmsg
1 1GbE <4>change mode to 1(Fiber 1G)
2 same like 1 with full bridge ??
3
4
5 2.5GbE <4>change mode to 5(HiSGMII MAC)

I've tried also to attach the fiber and the stick cannot go ahead of O3 status.

you got RX reading?

Anime4000 avatar Feb 27 '22 20:02 Anime4000

Regarding laser reading, this is my current situation:

image

I've tried LAN_SDS_MODE to 2-3-4 and there are all the reports on kmsg

<4>change mode to 2(SGMII PHY) <4>change mode to 3(SGMII MAC) <4>change mode to 4(HiSGMII PHY)

Now my main problem is the eeprom reading to test if the 2.5GbE it's working.. Your TWCGPON with V2801F reports valid eeprom?

Thanks

stich86 avatar Feb 27 '22 21:02 stich86

I use EdgeRouter 12 can read EEPROM like this: image

Ubiquiti use this kernel patch to allow reading RTL9601C1 EEPROM emulator, yes, RTL9601C1 didn't have EEPROM, it just emulating it.

for Mikrotik, I not sure, I need but the device to fully test.

what OS you using inside MacchiatoBIN?

Anime4000 avatar Feb 27 '22 21:02 Anime4000

I use EdgeRouter 12 can read EEPROM like this:

image

Ubiquiti use this kernel patch to allow reading RTL9601C1 EEPROM emulator, yes, RTL9601C1 didn't have EEPROM, it just emulating it.

for Mikrotik, I not sure, I need but the device to fully test.

what OS you using inside MacchiatoBIN?

On MCBIN I'm using OpenWRT snapshot. Before flashing TWCGPON firmware on V2801F, the stick was correctly recognized and the patch you have linked was working. Now the kernel Linux (and also my Ubiquiti switch) didn't recognize any info from the SFP.

It's strage because I'm assuming that the EEPROM should be generated by the OS (may be configd daemon?)..

Do you know if the stock can still be bought somewhere?

stich86 avatar Feb 27 '22 22:02 stich86

image

there is 2 option I can think of,

  1. modify TWCGPON657 firmware with squashfs-tools and qemu-user-static you can copy configd from V2801F to TWCGPON657

  2. try DFP-34X-2C2 firmware

I bought TWCGPON657 here

need to login, use google chrome to translate page without proxy/iframe

I notice LAN_SDS_MODE have PHY (Layer 1) and MAC (Layer 2), have you try 2 or 4 (PHY) if made a different ?

Anime4000 avatar Feb 27 '22 22:02 Anime4000

image

there is 2 option I can think of,

  1. modify TWCGPON657 firmware with squashfs-tools and qemu-user-static you can copy configd from V2801F to TWCGPON657

  2. try DFP-34X-2C2 firmware

I bought TWCGPON657 here

need to login, use google chrome to translate page without proxy/iframe

I notice LAN_SDS_MODE have PHY (Layer 1) and MAC (Layer 2), have you try 2 or 4 (PHY) if made a different ?

As I've said until I have problems with the eeprom the OpenWrt on my MCBIN doesn't initialize the SFP port :(

Regarding DFP-34X-2C2 firmware, is it working on V2801F?

stich86 avatar Feb 27 '22 22:02 stich86

As I've said until I have problems with the eeprom the OpenWrt on my MCBIN doesn't initialize the SFP port :(

Sorry, this mean SFP has no connection? ~ 6 am here I haven't sleep 🤣

Regarding DFP-34X-2C2 firmware, is it working on V2801F?

This one I not tried yet, because my V2801F has been dead for 1 year because invalid VS_AUTH_KEY, my plan to read NAND flash and modify it

Anime4000 avatar Feb 27 '22 22:02 Anime4000

The problem is that on Linux kernel SFP needs to pass various steps, in my case the SFP_MOD_PROBE that check the EEPROM doesn't pass validation and so the cage is not enabled. Unifi switch is less restrictive but it's only 1Gbit/s device so I cannot test [email protected]

I don't understand one thing: if I revert back to the V2810F firmware what's are the correct step to follow and avoid boot loop?

Thanks

stich86 avatar Feb 27 '22 22:02 stich86

I see

to revert back V2801F firmware, do this:

  • Downgrade TWCGPON657 firmware to B13
  • flash set PON_MODE 3
  • Upgrade V2801F firmware latest
  • After updated, flash set VS_AUTH_KEY

doing PON_MODE 3 will put stick in Fiber Ethernet mode, disconnect fiber until updated VS_AUTH_KEY

Anime4000 avatar Feb 28 '22 04:02 Anime4000

ok so PON_MODE 3 avoid auto-reboot right?

Today i'll try to force a link (with clean up sfp.c on kernel) to see if the stick can negotiate at 2500

stich86 avatar Feb 28 '22 07:02 stich86

@Anime4000 are you able to dump the flash using SOP8 clip? I want to make a dump with currently working stick, because if something goes wrong I can rollback to a working stick

Thanks in advance

stich86 avatar Feb 28 '22 15:02 stich86

ok so PON_MODE 3 avoid auto-reboot right?

Today i'll try to force a link (with clean up sfp.c on kernel) to see if the stick can negotiate at 2500

about this test, it went bad :( i think that EEPROM should be populated in the right way, otherwise the PHY media cannot be activated.. so next step after possibility to flash the NAND i'll try to create an hybrid firmware as suggested: uImage from TWCGPON and rootfs from V2801F

stich86 avatar Feb 28 '22 18:02 stich86

@Anime4000

May be i've found where the parameter LAN_SDS_MODE is readed and configured

the file that change the behaviour is runlansds.sh

on the V2810F this is the code:

#!/bin/sh

echo 1 > proc/lan_sds/lan_sds_cfg
echo 1 > proc/lan_sds/sfp_app
sfpapp &

while TWCGPON657 is parsing the mode from XML file and set it based on the value on it:

#!/bin/sh

lan_sds_mode=`flash get LAN_SDS_MODE | sed 's/LAN_SDS_MODE=//g'`
echo $lan_sds_mode > proc/lan_sds/lan_sds_cfg
echo 1 > proc/lan_sds/sfp_app
sfpapp &

So I think that V2801F with modded files and new rootfs can change this behaviour.

Now i've to flash back my stick and try..

stich86 avatar Feb 28 '22 20:02 stich86

Nice finding... 👍

I also manage to update qemu script https://github.com/Anime4000/RTL9601C1/tree/main/Tools/emulator

making thing easier!

I notice /bin/sfpapp didn't exist in TWCGPON657 firmware

Anime4000 avatar Mar 01 '22 02:03 Anime4000

Little update:

this morning i've repacked the V2801F firmware changing the file runlansds.sh LAN_SDS_MODE was set to 2. Now the stick is up (ethernet link) but I cannot access it anymore..

So i've only two way to restore:

  1. dump the flash and change the active image on the mtd1/mtd2 partition
  2. try to find the UART TX/RX on the RTL9601CI to see what's going on

If I have any news i'll update this thread

stich86 avatar Mar 01 '22 13:03 stich86

I have tried with my own stick echo 5 > proc/lan_sds/lan_sds_cfg

yes, it make stick stuck, it seem V2801F not build 2.5GbE in mind, I also notice TWCGPON657 firmware missing /bin/sfpapp

Anime4000 avatar Mar 01 '22 14:03 Anime4000

I have tried with my own stick echo 5 > proc/lan_sds/lan_sds_cfg

yes, it make stick stuck, it seem V2801F not build 2.5GbE in mind, I also notice TWCGPON657 firmware missing /bin/sfpapp

yes.. i've tried before flash the stick thinking that needs to be change on boot :( have you tried to flash firmware of DFP-34X-2C2 on V2801F? looks like this stick read the LAN_SDS_MODE and also the file runlansds.sh is correct

I suggest to change the documentations, at the moment V2810F with stock firmware doesn't support anything than 1 has LAN_SDS_MODE

stich86 avatar Mar 01 '22 15:03 stich86