OpenWrt support for Zyxel PMG5617GA, first GPON support !?

The man from the next topic has advanced a bit on this issue. In his repository, he was building a working kernel version 5.9.9.

README.md

Bootloader

Bootloader sources: mtk/bootrom.

Emacs modes for hiding {} blocks (hs-minor-mode), for hiding ifdefs (hide-ifdef-mode), will be helpfull. The sources include SPI and NAND code, 7512 ethernet code, even leds (light diods) IO configs.

Bootloader may support jump addr command. The command will call function (jump to) at addr. tftp will save file to TFTP_BUF_BASE: 0x80020000 addr. (net/tftpput.c).

$ nm output/build/linux-custom/vmlinux | grep kernel_en 80020000 T __kernel_entry 802c48c8 T kernel_entry

__kernel_entry will jump to kernel_entry. kernel_entry is linux entry point. __kernel_entry is defined in arch/mips/kernel/head.S under #if CONFIG_BOOT_RAW. Selecting TC3262 CPU will "select" this option.

vmlinux includes ELF header. arch/mips/boot/vmlinux.bin is vmlinux with ELF header removed (by objcopy) and can be used with jump command.

When vmblinux.bin is uploaded, tftp will not write the file to flash and will complain that file name is invalid, but that is OK and jump 80020000 command can be called.

Did not test this yet:

flash dst src len command will call flash_write(dst, len, &retlen, (const unsigned char *) (src)) src should be set to TFT_BUF_BASE. dst.. go figure.

On power-up, bootloader calls boot_kernel (init/main.c) which loads image, performs tests and jumps to loaded kernel memory address. First, the trx_header (mtk/tools/trx/trx.h) struct len, magic, crc32 will be read from flash and compared. trx_header address: flash_base + flash_tclinux_start. The variables set in flash/flashhal.c, in *_init functions. 0x0 + 0x40000 * 2 if IS_NANDFLASH and TCSUPPORT_BB_NAND, flash command dst will be 0x80000.

1 Like

Update: After a bit of printf() debugging, I was able to nail down my problem to the fact that the kernel was crashing early because it was fishing around in memory looking for uboot kernel args.

Current status (littered with prom_printf()):

bldr> jump 80002000                                                                                                                                                                                         
Jump to 80002000                                                                                                                                                                                            
UART ONLINE                                                                                                                                                                                                 
TC_AHB                                                                                                                                                                                                      
TC_USB                                                                                                                                                                                                      
TC_DMT                                                                                                                                                                                                      
TC_PCM                                                                                                                                                                                                      
TC_FE                                                                                                                                                                                                       
GOT MEM TYPE DDR3                                                                                                                                                                                           
INITIAL RESERVED MEM                                                                                                                                                                                        
NORMAL MEM                                                                                                                                                                                                  
HWQ                                                                                                                                                                                                         
HIGHMEM                                                                                                                                                                                                     
RAM                                                                                                                                                                                                         
DMA                                                                                                                                                                                                         
SMP_OPSOK                                                                                                                                                                                                   
COMPLETE                                                                                                                                                                                                    
PROM_INIT                                                                                                                                                                                                   
EARLY_FDC_CONSOLE  
[    0.000000] Linux version 4.9-ndm-5 (user@ee055d46035a) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r8077-7cbbab7246) ) #15 SMP Wed Mar 22 12:02:56 UTC 2023                                                   
[    0.000000] ISPRAM0: PA=00220000,Size=00010000,enabled                                                                                                                                                   
[    0.000000] First printk                                                                                                                                                                                 
[    0.000000] EcoNet SoC: RAM: DDR3 512 MB                                                                                                                                                                 
[    0.000000] CPU/SYS frequency: 900/225 MHz                                                                                                                                                               
[    0.000000] bootconsole [early0] enabled                                                                                                                                                                 
EARLY_PRINTK                                                                                                                                                                                                
[    0.000000] CPU0 revision is: 00019558 (MIPS 34Kc)                                                                                                                                                       
CPU_REPORT                                                                                                                                                                                                  
[    0.000000] Determined physical RAM map:                                                                                                                                                                 
[    0.000000]  memory: 00020000 @ 00000000 (reserved)                                                                                                                                                      
[    0.000000]  memory: 1bbe0000 @ 00020000 (usable)                                                                                                                                                        
[    0.000000]  memory: 00400000 @ 1bc00000 (reserved)                                                                                                                                                      
[    0.000000] Wasting 1024 bytes for tracking 32 unused pages                                                                                                                                              
[    0.000000] Detected 1 available secondary CPU(s)                                                                                                                                                        
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.                                                                                                                              
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes                                                                                                                       
[    0.000000] Zone ranges:                                                                                                                                                                                 
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000001bbfffff]                                                                                                                                       
[    0.000000] Movable zone start for each node                                                                                                                                                             
[    0.000000] Early memory node ranges                                                                                                                                                                     
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bbfffff]                                                                                                                                      
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001bbfffff]                                                                                                                             
[    0.000000] percpu: Embedded 11 pages/cpu s16272 r8192 d20592 u45056                                                                                                                                     
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 112776                                                                                                                  
[    0.000000] Kernel command line: console=ttyS0,115200n8 es=1                                                                                                                                             
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)                                                                                                                                          
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)                                                                                                                              
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)                                                                                                                               
[    0.000000] Writing ErrCtl register=00067c7e                                                                                                                                                             
[    0.000000] Readback ErrCtl register=00067c7e                                                                                                                                                            
[    0.000000] NMI base is 813fc200                                                                                                                                                                         
[    0.000000] Memory: 447416K/454656K available (2200K kernel code, 105K rwdata, 468K rodata, 156K init, 223K bss, 7240K reserved, 0K cma-reserved)                                                        
[    0.000000] Hierarchical RCU implementation.                                                                                                                                                             
[    0.000000]  Build-time adjustment of leaf fanout to 32.                                                                                                                                                 
[    0.000000] NR_IRQS:41                                                                                                                                                                                   
[    0.000000] hpt: using 200.000 MHz high precision timer                                                                                                                                                  
[    0.000000] clocksource: hpt: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns                                                                                                        
[    0.000007] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns                                                                                                                    
[    0.008003] console [ttyS0] enabled                                                                                                                                                                      
[    0.008003] console [ttyS0] enabled                                                                                                                                                                      
[    0.014795] bootconsole [early0] disabled                                                                                                                                                                
[    0.014795] bootconsole [early0] disabled  
[    0.022789] Calibrating delay loop... 599.04 BogoMIPS (lpj=1198080)                                                                                                                                      
[    0.053322] pid_max: default: 32768 minimum: 301                                                                                                                                                         
[    0.058074] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)                                                                                                                                  
[    0.064533] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)                                                                                                                             
[    0.072597] Config7: 0x80080500                                                                                                                                                                          
[    0.078036] ISPRAM0: PA=00220000,Size=00010000,enabled                                                                                                                                                   
[    0.078861] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.                                                                                                                              
[    0.078867] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes                                                                                                                       
[    0.078952] CPU1 revision is: 00019558 (MIPS 34Kc)                                                                                                                                                       
[    0.132502] Synchronize counters for CPU 1: done.                                                                                                                                                        
[    0.137188] Brought up 2 CPUs                                                                                                                                                                            
[    0.140051] CPU1: update max cpu_capacity 1024                                                                                                                                                           
[    0.144550] CPU1: update max cpu_capacity 1024                                                                                                                                                           
[    0.145912] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns                                                                                              
[    0.145929] futex hash table entries: 512 (order: 2, 16384 bytes)
[    0.551900] PCI host bridge to bus 0000:00
[    0.556012] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.562781] pci_bus 0000:00: root bus resource [io  0x1f600000-0x1f60ffff]
[    0.569610] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.576364] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.586492] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.594486] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.605235] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.611911] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff]
[    0.618696] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.623643] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.630464] pci 0000:00:01.0: PCI bridge to [bus 02]
[    0.635645] clocksource: Switched to clocksource hpt
[    0.645030] workingset: timestamp_bits=29 max_order=17 bucket_order=0
[    0.651668] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.658504] io scheduler noop registered (default)
[    0.663523] PCI: Enabling device 0000:00:00.0 (0000 -> 0002)
[    0.672304] tc3162_uart: UART driver for EN751x SoC, buffer size is 4096 bytes
[    0.679715] ttyS0 at I/O 0xbfbf0003 (irq = 1, base_baud = 7200) is a TC3162
[    0.680211] ndmpart: registering the NDM partition parser...
[    0.680238] EcoNET SPI NAND driver init
[    0.680269] Set SPI Clock to 50 Mhz
[    0.680299] Using Flash ECC
[    0.680313] Detected SPI NAND Flash: TC58CVG1S3H, Flash Size: 256 MB
[    0.680606] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xcb
[    0.680616] nand: Toshiba TC58CVG1S3H
[    0.680629] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.745041] BMT pool size: 163
[    0.746851] BBT found, bad block count: 3
[    0.746862] BBT bad block:  
[7 4365] Kerne] BBTib - blt sync536:
                                    VFS: 0n74688to moBT  ro tloc :n un7
[ - lock(6,41] [    0.762564] Machine restart...

This seems like it will be quite a bit easier to debug now.

Update: Got a clean boot

BGA IC                                                                                                
Xtal:1                                                                                                
DDR3 init.                                                                                            
DRAMC init done.                                                                                      
Calculate size.                                                                                       
DRAM size=512MB(supported max size)                                                                   
Set new TRFC.                                                                                         
ddr-1066                                                                                              
                                                                                                      
7512DRAMC V1.2.2 (0)                                                                                  
                                                                                                      
                                                                                                      
EN751221 at Tue Nov 7 20:42:52 CST 2017 version 1.1 free bootbase                
                                                                                                      
Memory size 512MB                                                                                     
                                                                                                      
Set SPI Clock to 25 Mhz                                                                               
spi_nand_probe: mfr_id=0x98, dev_id=0xcb                                                              
Using Flash ECC.                                                                                      
Detected SPI NAND Flash : _SPI_NAND_DEVICE_ID_TC58CVG1S3H, Flash Size=0x10000000                      
bmt pool size: 163                                                                                    
BMT & BBT Init Success                                                                                                                                                                                      
                                                                                                      
Press any key in 3 secs to enter boot command mode.              
.......................                                                                               
UserName: telecomadmin                                                                                
Password: ********                                                                                    
                                                                                                      
bldr> xmdm 80002000 786630                                                                            
CCCC                                                                                                  
*** file: /root/pkt_access/openwrt/linux.bin
$ lsx -vv /root/pkt_access/openwrt/linux.bin                                                          
Sending /root/pkt_access/openwrt/linux.bin, 61644 blocks: Give your local XMODEM receive command now.
Bytes Sent:7890560   BPS:7989                                          
                                                                                                      
Transfer complete                                                                                     
                                                                                                      
*** exit status: 0 ***                                                                                
ived len=786680                                                                                       
bldr> jump 80002000                                                                                   
Jump to 80002000                                                                                      
[    0.000000] Linux version 4.9-ndm-5 (user@5247154d066c) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r8077-7cbbab7246) ) #0 SMP Wed Nov 11 20:09:58 2020
[    0.000000] ISPRAM0: PA=00350000,Size=00010000,enabled                                             
[    0.000000] EcoNet SoC: RAM: DDR3 512 MB                                                           
[    0.000000] CPU/SYS frequency: 900/225 MHz                                                                                                                                                               
[    0.000000] bootconsole [early0] enabled                                                           
[    0.000000] CPU0 revision is: 00019558 (MIPS 34Kc)                                                 
[    0.000000] Determined physical RAM map:      
[    0.000000]  memory: 00020000 @ 00000000 (reserved)                       
[    0.000000]  memory: 1bbe0000 @ 00020000 (usable)                         
[    0.000000]  memory: 00400000 @ 1bc00000 (reserved) 
[    0.000000]  memory: 1bbe0000 @ 00020000 (usable)                                                                                                                                               [100/412]
[    0.000000]  memory: 00400000 @ 1bc00000 (reserved)                      
[    0.000000] Wasting 1024 bytes for tracking 32 unused pages                           
[    0.000000] Initrd not found or empty - disabling initrd                               
[    0.000000] Detected 1 available secondary CPU(s)                                      
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:                                                                           
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000001bbfffff]   
[    0.000000] Movable zone start for each node                                                       
[    0.000000] Early memory node ranges                                                               
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bbfffff]           
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001bbfffff]
[    0.000000] percpu: Embedded 12 pages/cpu s17968 r8192 d22992 u49152          
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 112776
[    0.000000] Kernel command line: console=ttyS0,115200                                              
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)       
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)  
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Writing ErrCtl register=00067c6c                                                       
[    0.000000] Readback ErrCtl register=00067c6c                                                      
[    0.000000] NMI base is 813fc200                                                                   
[    0.000000] Memory: 442588K/454656K available (3448K kernel code, 144K rwdata, 664K rodata, 3472K init, 243K bss, 12068K reserved, 0K cma-reserved)
[    0.000000] Hierarchical RCU implementation.                                                       
[    0.000000]  Build-time adjustment of leaf fanout to 32.      
[    0.000000] NR_IRQS:41                                                                             
[    0.000000] hpt: using 200.000 MHz high precision timer             
[    0.000000] clocksource: hpt: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000007] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.008002] console [ttyS0] enabled                                                                
[    0.008002] console [ttyS0] enabled                                                                
[    0.014795] bootconsole [early0] disabled
[    0.014795] bootconsole [early0] disabled                                                          
[    0.022791] Calibrating delay loop... 599.04 BogoMIPS (lpj=1198080)
[    0.053324] pid_max: default: 32768 minimum: 301                    
[    0.058067] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.064535] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.075290] ISPRAM0: PA=00350000,Size=00010000,enabled                            
[    0.076140] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.076147] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.076231] CPU1 revision is: 00019558 (MIPS 34Kc)                                                 
[    0.132050] Synchronize counters for CPU 1: done.                                                  
[    0.136839] Brought up 2 CPUs              
[    0.139727] CPU1: update max cpu_capacity 589                                                      
[    0.144090] CPU1: update max cpu_capacity 589                                                      
[    0.145303] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.145320] futex hash table entries: 512 (order: 2, 16384 bytes)
[    0.164595] NET: Registered protocol family 16                                                     
[    0.567802] PCI host bridge to bus 0000:00    
[    0.571849] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.578739] pci_bus 0000:00: root bus resource [io  0x1f600000-0x1f60ffff]
[    0.585472] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.578739] pci_bus 0000:00: root bus resource [io  0x1f600000-0x1f60ffff]                                                                                                                       [50/412]
[    0.585472] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.592238] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.602306] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.610299] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.622617] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.629289] pci 0000:00:01.0: BAR 8: assigned [mem 0x20100000-0x202fffff]
[    0.636027] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff]
[    0.642835] pci 0000:00:00.0: PCI bridge to [bus 01]                 
[    0.647784] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.654613] pci 0000:02:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff 64bit]
[    0.661907] pci 0000:02:00.0: BAR 6: assigned [mem 0x20200000-0x2020ffff pref]
[    0.669031] pci 0000:00:01.0: PCI bridge to [bus 02]                     
[    0.674001] pci 0000:00:01.0:   bridge window [mem 0x20100000-0x202fffff]     
[    0.681969] clocksource: Switched to clocksource hpt
[    0.688429] NET: Registered protocol family 2                                                      
[    0.692898] IP idents hash table entries: 8192 (order: 4, 65536 bytes)
[    0.700252] TCP established hash table entries: 16384 (order: 4, 65536 bytes)
[    0.707536] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)  
[    0.714525] TCP: Hash tables configured (established 16384 bind 16384)
[    0.721057] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.726786] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes) 
[    0.733266] NET: Registered protocol family 1                                                      
[    0.812038] workingset: timestamp_bits=29 max_order=17 bucket_order=0
[    0.818598] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.826354] io scheduler noop registered (default)
[    0.831391] PCI: Enabling device 0000:00:00.0 (0000 -> 0002)        
[    0.838901] PCI: Enabling device 0000:00:01.0 (0000 -> 0002)
[    0.846744] tc3162_uart: UART driver for EN751x SoC, buffer size is 4096 bytes
[    0.854130] ttyS0 at I/O 0xbfbf0003 (irq = 1, base_baud = 7200) is a TC3162
[    0.854592] ndmpart: registering the NDM partition parser...             
[    0.854620] EcoNET SPI NAND driver init
[    0.854645] Set SPI Clock to 50 Mhz                                                                
[    0.854673] Using Flash ECC
[    0.854685] Detected SPI NAND Flash: TC58CVG1S3H, Flash Size: 256 MB
[    0.854976] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xcb
[    0.854983] nand: Toshiba TC58CVG1S3H
[    0.854994] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.919424] BMT pool size: 163               
[    0.921233] BBT found, bad block count: 3      
[    0.921242] BBT bad block: 3                                                                       
[    0.921249] BBT bad block: 1536                                                                    
[    0.921256] BBT bad block: 1537            
[    0.921314] BMT & BBT init success                                                                 
[    0.926674] ndmpart: di: unknown magic 0x55424923
[    0.926689] mtd: failed to find partitions; one or more parsers reports errors (-22)
[    0.927694] tun: Universal TUN/TAP device driver, 1.6
[    0.927717] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    0.927788] PPP generic driver version 2.4.2  
[    0.927934] PPP MPPE Compression module registered
[    0.927948] NET: Registered protocol family 24 
[    0.927974] PPTP driver version 0.8.5
[    0.927948] NET: Registered protocol family 24
[    0.927974] PPTP driver version 0.8.5
[    0.929555] nf_conntrack version 0.5.0 (56320 buckets, 112640 max)
[    0.929993] gre: GRE over IPv4 demultiplexor driver
[    0.930117] NET: Registered protocol family 10
[    0.931277] NET: Registered protocol family 17
[    0.931311] 8021q: 802.1Q VLAN Support v1.8
[    0.946350] Freeing unused kernel memory: 3472K
[    0.946374] This architecture does not have kernel memory protection.
[    0.946382] RNG reseed started
[    0.946425] cannot get MTD device Config: -19
[    0.958088] init: Console is alive
[    0.972789] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    0.973142] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    0.979246] init: - preinit -
[    1.060623] random: jshn: uninitialized urandom read (4 bytes read)
[    1.081849] random: jshn: uninitialized urandom read (4 bytes read)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    4.189751] procd: - early -
[    4.740799] procd: - ubus -
[    4.747511] random: ubusd: uninitialized urandom read (4 bytes read)
[    4.790943] random: ubusd: uninitialized urandom read (4 bytes read)
[    4.791428] random: ubusd: uninitialized urandom read (4 bytes read)
[    4.792290] procd: - init -
Please press Enter to activate this console.
[    4.924298] kmodloader: loading kernel modules from /etc/modules.d/*
[    4.927875] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    4.938230] ip_tables: (C) 2000-2006 Netfilter Core Team
[    4.975870] xt_time: kernel timezone is -0000
[    4.981559] kmodloader: done loading kernel modules from /etc/modules.d/*
[    6.139263] random: fast init done
[    9.034952] IPv6: ADDRCONF(NETDEV_UP): lo: link is not ready



BusyBox v1.28.4 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 18.06.9, r8077-7cbbab7246
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# 

:muscle:

Notes:

  1. [ 0.000000] ISPRAM0: PA=00350000,Size=00010000,enabled - the 2.6 kernel says this should be 32k not 64k and this kernel has it hard coded to 64k. I don't know anything about ISPRAM or whether this means there will be zero space for CONFIG_TC3162_DMEM, or if it will map addresses off the chip and eventually crash, or if it just doesn't matter and it's better to do it this way.
  2. [ 0.136839] Brought up 2 CPUs - the 2.6 kernel brings up 4 "virtual" CPUs, unclear which is better
  3. [ 0.926689] mtd: failed to find partitions; one or more parsers reports errors (-22) - this needs fixing so that we can load the squashfs and not rely on initramfs
  4. [ 0.946425] cannot get MTD device Config: -19 - random number generator, low priority

TODO:

  1. Probably ethernet, the driver is in the kernel tree so this should be relatively low hanging fruit
  2. Figure out the MTD situation
  3. Wifi drivers
  4. USB (this is another case where the EN7512 differs from the EN7526 and so the kernel is initializing the USB incorrectly)
  5. Check if EPON drivers exist in this kernel (I'm not sure - didn't check)
  6. Port the prom and all of the working drivers to stock openwrt kernel-5.15 and stop using this divergent 4.9
  7. Build a trx "tclinux.bin" file so I can flash to the chip
  8. Propose patches to OpenWRT

But this weekend I will push my hacky openwrt tree to github and write some instructions for anyone who wants to follow along.

Awesome job dude. I guess you've loaded the image in RAM and not flash it in NAND yet. Also, did you fiddled with the core .c files and/or any kernel patches to make it boot?
I was going to suggest creating a repo on Github and come up with commits so we can work along. But not this weekend for me as i have work (ironically for an ISP).

I guess you've loaded the image in RAM and not flash it in NAND yet <-- yup, that way I could:

  1. Reduce any risk of bricking
  2. Not have to futz around with the TRX header and custom image compression logic
  3. I'm updating the kernel every boot anyway, so might as well just push it into memory rather than writing it

fiddled with the core .c files and/or any kernel patches to make it boot? <-- The only file I modified was tc3262/Platform to change 0xffffffff80020000 to 0xffffffff80002000 which is the default load address for the EN7526. That said, I'm not convinced that its even necessary for now when I'm manually loading and jumping. What I did patch rather extensively was the config.

And now some bad news: The Ethernet module is a big ugly blob of code which is not present in any of keenetic's public codebases. Keenetic probably has the source but I think it has some scary anti-GPL "do not share this" warnings on it, as does the Linux2.6 one.

So what's probably the next step on this is to just port everything we have into 5.15 and then we can copy that big ugly Ethernet module into an openwrt kmod and see what horrors await us when we try to port a driver from 2.6 to 5.15

Update: I have published what I did on github.

I'm not going to pursue this kernel too much more, anything that would land into OpenWRT is going to be based on 5.15 so my next plans are to port over the core support files to 5.15 and then get a new branch going which is branched off of master with a (patched) mainline kernel.

The good news is that the wireless chips are connected over plain old PCIe, so getting these to work should be a piece of cake. The harder project will be migrating the ethernet driver. Then we have XPON which will be similar to ethernet, and USB which I have not seriously investigated.

I think the MTD partitions will come up as soon as we just write a devicetree file.

01:00.0 Network controller: MEDIATEK Corp. Device 7603                                                
        Subsystem: MEDIATEK Corp. Device 7603
        Flags: fast devsel, IRQ 255
        Memory at 20000000 (32-bit, non-prefetchable) [disabled] [size=1M]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Device Serial Number 00-00-00-00-00-00-00-00
        Capabilities: [150] Latency Tolerance Reporting

02:00.0 Network controller: MEDIATEK Corp. MT7662E 802.11ac PCI Express Wireless Network Adapter
        Subsystem: MEDIATEK Corp. MT7662E 802.11ac PCI Express Wireless Network Adapter
        Flags: fast devsel, IRQ 255
        Memory at 20100000 (64-bit, non-prefetchable) [disabled] [size=1M]
        [virtual] Expansion ROM at 20200000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 00 
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Device Serial Number 00-00-00-00-00-00-00-00
        Capabilities: [158] Latency Tolerance Reporting
        Capabilities: [160] L1 PM Substates
2 Likes

I found ethernet drivers but they turned out to be only for the bootloader. The 5 GHz processor(QT3840BC + QT2518B) on Sercomm FG824CD with its own linux does not use the pci bus, it is connected via the ethernet interface.

Hi, we search manufacture ONU (for now we manufacture only bridge + router with openwrt, with CLI acess to bridge GPON informations, this combination is very very better to high en product and allow update the router). But we will open the design when the development will be covered.
I use the base RTL9603C due to temperature problem of RTL9602C, it's not FPGA (more easy to manufacture). I have the firmware, the file into the firmware, the SDK, the C decompiled source of GPON driver and user space. Then I'm progressing.

Doesn't really help us since we currently work on an Econet/Mediatek platform and not Realtek. However you are welcome to drop your files here and might pick up once this project is complete.

Update: Got to the point of init being run with Linux 5.15 (no shell yet, it hangs).

BGA IC
Xtal:1
DDR3 init.
DRAMC init done.
Calculate size.
DRAM size=512MB(supported max size)
Set new TRFC.
ddr-1066

7512DRAMC V1.2.2 (0)


EN751221 at Tue Nov 7 20:42:52 CST 2017 version 1.1 free bootbase

Memory size 512MB

Set SPI Clock to 25 Mhz
spi_nand_probe: mfr_id=0x98, dev_id=0xcb
Using Flash ECC.
Detected SPI NAND Flash : _SPI_NAND_DEVICE_ID_TC58CVG1S3H, Flash Size=0x10000000
bmt pool size: 163
BMT & BBT Init Success

Press any key in 3 secs to enter boot command mode.
........
UserName: telecomadmin
Password: ********

bldr> xmdm 80020000 9731d0
C
*** file: /root/pkt_access/openwrt-new/build_dir/target-mips_mips32_musl/linux-tc3262_en7526/vmlinux-initramfs
$ lsx -vv /root/pkt_access/openwrt-new/build_dir/target-mips_mips32_musl/linux-tc3262_en7526/vmlinux-initramfs
Sending /root/pkt_access/openwrt-new/build_dir/target-mips_mips32_musl/linux-tc3262_en7526/vmlinux-initramfs, 77411 blocks: Give your local XMODEM receive command now.
Bytes Sent:9908736   BPS:7993

Transfer complete

*** exit status: 0 ***

bldr> jump 80020000
Jump to 80020000
UART ACTIVE!
[    0.000000] Linux version 5.15.104 (user@880657a2a7b5) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 12.2.0 r22401+2-3e91feee93) 12.2.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Sun Apr 2 15:04:14 2023
[    0.000000] ISPRAM0: PA=1c000000,Size=00010000,enabled
[    0.000000] EcoNet SoC: RAM: DDR3 512 MB
[    0.000000] CPU/SYS frequency: 900/225 MHz
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019558 (MIPS 34Kc)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Detected 1 available secondary CPU(s)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001bffffff]                                                                                                                    [50/1801]
[    0.000000] percpu: Embedded 11 pages/cpu s12752 r8192 d24112 u45056
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Writing ErrCtl register=00067c60
[    0.000000] Readback ErrCtl register=00067c60
[    0.000000] NMI base is 8000c200
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 440176K/458752K available (5496K kernel code, 544K rwdata, 1008K rodata, 2672K init, 208K bss, 18576K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 41
[    0.000000] hpt: using 200.000 MHz high precision timer
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at kernel/irq/manage.c:1785 __setup_irq+0x7c4/0x834
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.104 #0
[    0.000000] Stack : 87fd0000 8009d740 00000000 00000004 00000000 00000000 8067dd64 809a0000
[    0.000000]         80680000 806036b0 80686fc8 80686ae3 00000000 11000300 8067dd10 00000000
[    0.000000]         00000000 00000000 806036b0 8067dbb0 ffffefff 00000000 00000000 ffffffea
[    0.000000]         00000026 8067dbbc 00000026 8068c8b0 806036b0 00000000 00000000 800a2980
[    0.000000]         00000009 8068246c 80682440 87fd931c 00000018 00000030 8801e81c 8801e81c
[    0.000000]         ...
[    0.000000] Call Trace:
[    0.000000] [<80027fc8>] show_stack+0x28/0xf0
[    0.000000] [<80332188>] dump_stack_lvl+0x60/0x80
[    0.000000] [<80048e44>] __warn+0x9c/0x124
[    0.000000] [<80048f28>] warn_slowpath_fmt+0x5c/0xac
[    0.000000] [<800a2980>] __setup_irq+0x7c4/0x834
[    0.000000] [<800a2f08>] setup_percpu_irq+0x60/0xc0
[    0.000000] [<80021660>] r4k_clockevent_init+0x120/0x184
[    0.000000] [<80708650>] time_init+0x18/0x88
[    0.000000] [<80704ca4>] start_kernel+0x538/0x764
[    0.000000]
[    0.000000] ---[ end trace cecfc7ec853a6908 ]---
[    0.000000] clocksource: hpt: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000002] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.007936] Calibrating delay loop... 599.04 BogoMIPS (lpj=1198080)
[    0.042018] pid_max: default: 32768 minimum: 301
[    0.046846] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.054026] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.064933] rcu: Hierarchical SRCU implementation.
[    0.070080] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.078049] smp: Bringing up secondary CPUs ...
[    0.083457] ISPRAM0: PA=1c000000,Size=00010000,enabled
[    0.083503] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.083512] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.083614] CPU1 revision is: 00019558 (MIPS 34Kc)
[    0.114645] Synchronize counters for CPU 1: done.
[    0.143730] smp: Brought up 1 node, 2 CPUs
[    0.149280] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.158928] futex hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.166852] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.187221] clocksource: Switched to clocksource hpt
[    0.193040] NET: Registered PF_INET protocol family
[    0.198139] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.206383] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.214667] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.222368] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.230139] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.237291] TCP: Hash tables configured (established 4096 bind 4096)
[    0.243697] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.250163] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.257455] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.272141] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    0.285034] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.290785] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.303786] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.313728] NET: Registered PF_INET6 protocol family
[    0.321690] Segment Routing with IPv6
[    0.325415] In-situ OAM (IOAM) with IPv6
[    0.329425] NET: Registered PF_PACKET protocol family
[    0.334558] 8021q: 802.1Q VLAN Support v1.8
[    1.969718] Warning: unable to open an initial console.
[    1.983527] Freeing unused kernel image (initmem) memory: 2672K
[    1.989370] This architecture does not have kernel memory protection.
[    1.995810] Run /init as init process
[    2.428592] init: Console is alive
[    2.453023] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.462865] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.480520] init: - preinit -
[    2.703905] random: jshn: uninitialized urandom read (4 bytes read)
[    2.730193] random: jshn: uninitialized urandom read (4 bytes read)
[    4.900246] procd: - early -
[    5.430811] procd: failed to set stdio: No such device
[    5.436643] procd: - ubus -
[    5.449221] random: ubusd: uninitialized urandom read (4 bytes read)
[    5.490063] random: ubusd: uninitialized urandom read (4 bytes read)
[    5.496875] random: ubusd: uninitialized urandom read (4 bytes read)
[    5.506867] procd: - init -
[    6.091325] kmodloader: loading kernel modules from /etc/modules.d/*
[    6.217692] PPP generic driver version 2.4.2
[    6.226851] NET: Registered PF_PPPOX protocol family
[    6.247140] kmodloader: done loading kernel modules from /etc/modules.d/*
[    6.270633] urngd: v1.0.2 started.
[    6.448149] random: crng init done
[    6.451457] random: 21 urandom warning(s) missed due to ratelimiting

Major issues to address:

  1. Boot process hangs at this point, likely related to:
  • Warning: unable to open an initial console.
  • procd: failed to set stdio: No such device
  1. During setup of the timesource, this warning is being triggered.

And one curiosity: [ 0.083457] ISPRAM0: PA=1c000000,Size=00010000,enabled - I did not port any of the IMEM support code, this is generic Linux code doing this.

And in case anyone wants to follow along: https://github.com/cjdelisle/openwrt/tree/feature-tc3262-support

3 Likes

Sorry I haven't been paying much attention to this project, I've been caught up dealing with a PCI bug on an MT7621.

But I did go through the various header files and drew up a bit of a memory map for the EN7526.

I'll be able to get back to this when I manage to solve my PCI issue.

1 Like

We're back again.

bldr> j 80020000                                                                                                                                                                                            
Jump to 80020000                                                                                                                                                                                            
UART ACTIVE!                                                                                                                                                                                                
[    0.000000] Linux version 5.15.104 (ilyas@gsnoff-probook) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 12.2.0 r22403-711755c195) 12.2.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Tue May 23 22:03:13 2023      
[    0.000000] ISPRAM0: PA=1c000000,Size=00010000,enabled                                                                                                                                                   
[    0.000000] EcoNet SoC: RAM: DDR3 512 MB                                                                                                                                                                 
[    0.000000] CPU/SYS frequency: 900/225 MHz                                                                                                                                                               
[    0.000000] printk: bootconsole [early0] enabled                                                                                                                                                         
[    0.000000] CPU0 revision is: 00019558 (MIPS 34Kc)                                                                                                                                                       
[    0.000000] Initrd not found or empty - disabling initrd                                                                                                                                                 
[    0.000000] Detected 1 available secondary CPU(s)                                                                                                                                                        
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.                                                                                                                              
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes                                                                                                                       
[    0.000000] Zone ranges:                                                                                                                                                                                 
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000001bffffff]                                                                                                                                       
[    0.000000] Movable zone start for each node                                                                                                                                                             
[    0.000000] Early memory node ranges                                                                                                                                                                     
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bffffff]                                                                                                                                      
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001bffffff]                                                                                                                             
[    0.000000] percpu: Embedded 11 pages/cpu s12752 r8192 d24112 u45056                                                                                                                                     
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680                                                                                                                                
[    0.000000] Kernel command line: console=ttyS0,115200                                                                                                                                                    
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)                                                                                                                      
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)                                                                                                                       
[    0.000000] Writing ErrCtl register=00067c70                                                                                                                                                             
[    0.000000] Readback ErrCtl register=00067c70                                                                                                                                                            
[    0.000000] NMI base is 8000c200                                                                                                                                                                         
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off                                                                                                                                      
[    0.000000] Memory: 439520K/458752K available (5693K kernel code, 556K rwdata, 1072K rodata, 2908K init, 355K bss, 19232K reserved, 0K cma-reserved)                                                     
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1                                                                                                                                   
[    0.000000] rcu: Hierarchical RCU implementation.                                                                                                                                                        
[    0.000000]  Tracing variant of Tasks RCU enabled.                                                                                                                                                       
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.                                                                                                                       
[    0.000000] NR_IRQS: 41                                                                                                                                                                                  
[    0.000000] hpt: using 200.000 MHz high precision timer                                                                                                                                                  
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at kernel/irq/manage.c:1785 __setup_irq+0x7c4/0x834                                                                                                                   
[    0.000000] Modules linked in:                                                                                                                                                                           
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.104 #0                                                                                                                                        
[    0.000000] Stack : 87fd0000 8009e2d8 00000000 00000004 00000000 00000000 806bfd64 80a20000                                                                                                              
[    0.000000]         806d0000 80639f10 806c8fc8 806c8ae3 00000000 11000300 806bfd10 00000000                                                                                                              
[    0.000000]         00000000 00000000 80639f10 806bfbb0 ffffefff 00000000 00000000 ffffffea                                                                                                              
[    0.000000]         00000026 806bfbbc 00000026 806ce950 80639f10 00000000 00000000 800a3518                                                                                                              
[    0.000000]         00000009 806c446c 806c4440 87fd931c 00000018 00000030 8801e81c 8801e81c                                                                                                              
[    0.000000]         ...                                                                                                                                                                                  
[    0.000000] Call Trace:                                                                                                                                                                                  
[    0.000000] [<800288c8>] show_stack+0x28/0xf0                                                                                                                                                            
[    0.000000] [<803335f8>] dump_stack_lvl+0x60/0x80                                                  
[    0.000000] [<80049744>] __warn+0x9c/0x124      
[    0.000000] [<80049828>] warn_slowpath_fmt+0x5c/0xac                                               
[    0.000000] [<800a3518>] __setup_irq+0x7c4/0x834                                                   
[    0.000000] [<800a3aa0>] setup_percpu_irq+0x60/0xc0                                                
[    0.000000] [<80021660>] r4k_clockevent_init+0x120/0x184                                           
[    0.000000] [<8074d8e4>] time_init+0x18/0x88    
[    0.000000] [<80749ca4>] start_kernel+0x538/0x764                                                  
[    0.000000]                                     
[    0.000000] ---[ end trace a648712241af2e81 ]---                                                   
[    0.000000] clocksource: hpt: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns                                                                                                        
[    0.000002] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns              
[    0.007911] printk: console [ttyS0] enabled     
[    0.007911] printk: console [ttyS0] enabled     
[    0.016146] printk: bootconsole [early0] disabled                                                  
[    0.016146] printk: bootconsole [early0] disabled                                                  
[    0.025542] Calibrating delay loop... 599.04 BogoMIPS (lpj=1198080)                                
[    0.059641] pid_max: default: 32768 minimum: 301                                                   
[    0.064471] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)                    
[    0.071656] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)               
[    0.082478] rcu: Hierarchical SRCU implementation.                                                 
[    0.087606] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build                
[    0.095572] smp: Bringing up secondary CPUs ...                                                    
[    0.100933] ISPRAM0: PA=1c000000,Size=00010000,enabled                                             
[    0.100978] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.                        
[    0.100988] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes                 
[    0.101091] CPU1 revision is: 00019558 (MIPS 34Kc)                                                 
[    0.132171] Synchronize counters for CPU 1: done.                                                  
[    0.161248] smp: Brought up 1 node, 2 CPUs      
[    0.166783] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns                                                                                              
[    0.176426] futex hash table entries: 512 (order: 2, 16384 bytes, linear)                          
[    0.184346] NET: Registered PF_NETLINK/PF_ROUTE protocol family                                    
[    0.571844] PCI host bridge to bus 0000:00
[    0.575900] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]                         
[    0.582665] pci_bus 0000:00: root bus resource [io  0x1f600000-0x1f60ffff]                         
[    0.589525] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]             
[    0.597610] pci 0000:00:00.0: [14c3:0810] type 01 class 0x060400                                   
[    0.604812] pci 0000:00:01.0: [14c3:0811] type 01 class 0x060400                                   
[    0.611894] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring            
[    0.619870] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring            
[    0.628370] pci 0000:01:00.0: [14c3:7603] type 00 class 0x028000                                   
[    0.634396] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff]                                
[    0.641357] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold                                  
[    0.647739] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01                            
[    0.654839] pci 0000:02:00.0: [14c3:7662] type 00 class 0x028000                                   
[    0.660900] pci 0000:02:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]                          
[    0.667824] pci 0000:02:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]                           
[    0.674928] pci 0000:02:00.0: PME# supported from D0 D3hot D3cold                                  
[    0.681320] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02                            
[    0.687867] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 02                            
[    0.694429] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]                          
[    0.701183] pci 0000:00:01.0: BAR 8: assigned [mem 0x20100000-0x202fffff]                          
[    0.707955] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff]                          
[    0.714739] pci 0000:00:00.0: PCI bridge to [bus 01]                                               
[    0.719712] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]                          
[    0.726512] pci 0000:02:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff 64bit]                    
[    0.733835] pci 0000:02:00.0: BAR 6: assigned [mem 0x20200000-0x2020ffff pref]                     
[    0.740935] pci 0000:00:01.0: PCI bridge to [bus 02]                                               
[    0.745913] pci 0000:00:01.0:   bridge window [mem 0x20100000-0x202fffff]                          
[    0.752969] clocksource: Switched to clocksource hpt                                               
[    0.758789] NET: Registered PF_INET protocol family                                                
[    0.763877] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)                     
[    0.772146] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)        
[    0.780432] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)               
[    0.788133] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)               
[    0.795905] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)                      
[    0.803044] TCP: Hash tables configured (established 4096 bind 4096)                               
[    0.809458] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)                             
[    0.815923] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)                        
[    0.823216] NET: Registered PF_UNIX/PF_LOCAL protocol family                                       
[    0.828927] PCI: CLS 0 bytes, default 32        
[    0.837849] workingset: timestamp_bits=14 max_order=17 bucket_order=3                              
[    0.850633] squashfs: version 4.0 (2009/01/31) Phillip Lougher                                     
[    0.856381] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.                                                                                              
[    0.870885] tc3162_uart: UART driver for EN751x SoC, buffer size is 4096 bytes                     
[    0.878615] ttyS0 at I/O 0xbfbf0003 (irq = 1, base_baud = 7200) is a TC3162                        
[    0.886578] EcoNET SPI NAND driver init         
[    0.886667] Set SPI Clock to 50 Mhz
[    0.886703] Using Flash ECC                     
[    0.886718] Detected SPI NAND Flash: TC58CVG1S3H, Flash Size: 256 MB                               
[    0.887096] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xcb                               
[    0.887116] nand: Toshiba TC58CVG1S3H           
[    0.887130] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64                 
[    0.949871] BMT pool size: 163                  
[    0.951698] BBT found, bad block count: 3       
[    0.951709] BBT bad block: 3                    
[    0.951717] BBT bad block: 1536                 
[    0.951726] BBT bad block: 1537                 
[    0.951778] BMT & BBT init success              
[    2.779508] NET: Registered PF_INET6 protocol family                                               
[    2.781990] Segment Routing with IPv6           
[    2.782105] In-situ OAM (IOAM) with IPv6        
[    2.782218] NET: Registered PF_PACKET protocol family                                              
[    2.782343] 8021q: 802.1Q VLAN Support v1.8     
[    2.795121] Freeing unused kernel image (initmem) memory: 2908K                                    
[    2.795172] This architecture does not have kernel memory protection.                              
[    2.795196] Run /init as init process           
[    3.263918] init: Console is alive              
[    3.290954] kmodloader: loading kernel modules from /etc/modules-boot.d/*                          
[    3.294854] kmodloader: done loading kernel modules from /etc/modules-boot.d/*                     
[    3.296614] init: - preinit -                   
[    3.522749] random: jshn: uninitialized urandom read (4 bytes read)                                
[    3.543376] random: jshn: uninitialized urandom read (4 bytes read)                                
Press the [f] key and hit [enter] to enter failsafe mode                                              
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level                          
[    5.704294] procd: - early -                    
[    6.241202] procd: - ubus -                     
[    6.251436] random: ubusd: uninitialized urandom read (4 bytes read)                               
[    6.291969] random: ubusd: uninitialized urandom read (4 bytes read)                               
[    6.292687] random: ubusd: uninitialized urandom read (4 bytes read)                               
[    6.296913] procd: - init -                     
Please press Enter to activate this console.       
[    6.881103] kmodloader: loading kernel modules from /etc/modules.d/*                               
[    7.038711] urngd: v1.0.2 started.              
[    7.183087] Loading modules backported from Linux version v6.1-rc8-0-g76dcd734eca2                 
[    7.183184] Backport generated by backports.git v5.15.81-1-41-g02e352527db5                        
[    7.275871] pci 0000:00:00.0: enabling device (0000 -> 0002)                                       
[    7.277225] mt7603e 0000:01:00.0: enabling device (0000 -> 0002)                                   
[    7.277599] mt7603e 0000:01:00.0: ASIC revision: 76030010                                          
[    7.279005] mt7603e 0000:01:00.0: Invalid MAC address, using random address 62:9f:b7:50:9a:5a                                                                                                            
[    7.314458] random: crng init done              
[    7.314513] random: 22 urandom warning(s) missed due to ratelimiting                               
[    8.299162] mt7603e 0000:01:00.0: Firmware Version: ap_pcie                                        
[    8.299225] mt7603e 0000:01:00.0: Build Time: 20160107100755                                       
[    8.336976] mt7603e 0000:01:00.0: firmware init done
[    8.519554] pci 0000:00:01.0: enabling device (0000 -> 0002)                                       
[    8.521002] mt76x2e 0000:02:00.0: enabling device (0000 -> 0002)                                   
[    8.521343] mt76x2e 0000:02:00.0: ASIC revision: 76120044                                          
[    9.160987] mt76x2e 0000:02:00.0: Invalid MAC address, using random address e6:12:47:26:da:8d                                                                                                            
[    9.171238] mt76x2e 0000:02:00.0: ROM patch build: 20141115060606a                                 
[    9.175330] mt76x2e 0000:02:00.0: Firmware Version: 0.0.00                                         
[    9.175379] mt76x2e 0000:02:00.0: Build: 1      
[    9.175393] mt76x2e 0000:02:00.0: Build Time: 201607111443____                                     
[    9.596962] mt76x2e 0000:02:00.0: Firmware failed to start                                         
[    9.597110] mt76x2e: probe of 0000:02:00.0 failed with error -145                                  
[    9.656096] PPP generic driver version 2.4.2    
[    9.657609] NET: Registered PF_PPPOX protocol family                                               
[    9.665361] kmodloader: done loading kernel modules from /etc/modules.d/*                          



BusyBox v1.36.0 (2023-04-02 15:04:14 UTC) built-in shell (ash)                                        

  _______                     ________        __                                                      
 |       |.-----.-----.-----.|  |  |  |.----.|  |_                                                    
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|                                                   
 |_______||   __|_____|__|__||________||__|  |____|                                                   
          |__| W I R E L E S S   F R E E D O M     
 -----------------------------------------------------                                                
 OpenWrt SNAPSHOT, r22404+2-69d4060b66             
 -----------------------------------------------------                                                
=== WARNING! =====================================                                                    
There is no root password defined on this device!                                                     
Use the "passwd" command to set up a new password                                                     
in order to prevent unauthorized SSH logins.       
--------------------------------------------------                                                    
root@OpenWrt:/#

I'm working on this with my colleague Ilyas Gasanov and the most recent updates are right now in his github: https://github.com/gsnoff/openwrt-tc3262/tree/feature-tc3262-support

Current status:

  • Serial port works (clearly)
  • PCI apparently works
  • SPI NAND - seems working but we have not yet fed it the partition table
  • mt7603e seems to work - was able to scan APs
  • mt76x2e not loading firmware: We have not yet tried feeding it the EEPROM so this is potentially a non-issue

Next steps:

  • Get flash partitions working (just with kernel command line for now)
  • Try to get wifi fully working (test with EEPROM)
  • Create a tclinux.bin file and flash it to disk so we don't need to siphon the kernel through xmodem each time
  • Investigate porting of ethernet driver
2 Likes

Cool. Someone suggested the Ethernet driver might be here:

Anything of interest here?:

or here:

or my published repo at the top of the page?

@alexceltare2 first of all congratulations for the great work and effort so far! Keep the momentum please!

Quick question: Does the success of this project to support PMG5617GA unlock the potential to support VMG8623-T50B (or its variations) too down the line? The chip appears to be very similar. It is the EN7516GT.

If the chipset uses the same core (EN751221/TC3162) then it should be relatively easy to port it over.

Thanks for great work. Any progress now?

Quite slow on my part ATM. Been held back by some personal stuff I have to sort out first.

It seems someone was having a go at a similar platform and hitting the same ethernet driver snag for openwrt:
https://patchwork.ozlabs.org/project/openwrt/patch/20220726064601.697889-1-daniel@dd-wrt.com/

Is there a realistic way out of this? I was looking at the OEM serial output in the wiki page and it seems that we are dealing with a MT7530 switch which seem to be supported in the mainline.

@alexceltare2 I see that you've managed to unlock the bootloader with the ATEN and ATSE commands. I have a different Zyxel router, DX5401, which uses longer unlock codes, similar to the ones here: https://github.com/chear/SWNote/blob/master/ZyXEL.md (thanks @cjd for sharing). Can anyone help me unlock the bootloader for my Zyxel router using this method? Thanks in advance!

Is this project still ongoing?