Support for Easybox 904 LTE

Ahh @QAuge great that you are here :smiley:

Hmm it should be inside.
raconfig.c = https://pastebin.com/g91LuYVL
change-raconfig.c-for-linux4.19.patch = https://pastebin.com/kiqY8xrL
I try again with an nealy eqal result.

root@OpenWrt:~# ./rt3883 boot
Insmod with MAC1=4c:09:d4:15:10:54 and MAC2=4c:09:d4:15:10:56
[  123.226683] Warnning!! syncmiimac is foreced to 0 in dual concurrent mode.
[  123.232262] RT3883iNIC: 802.11n WLAN MII driver v2.4.0.6 (Feb. 09, 2011)
[  123.239020] eth0.3: Master at 0x0, 00:11:22:33:44:55
[  123.243915] Use default profile path.
[  123.247526] -----> mii_hardware_reset
[  123.261251] -----> mii_hardware_reset
[  123.263480] Update MAC(0)=4c:09:d4:15:10:54
[  123.267697] ============= Init Thread ===================
[  123.275024] RacfgTaskThread pid = 1878
[  123.277918] RacfgBacklogThread pid = 1879
[  123.282906] wl000: Ralink iNIC at 0x0, 4c:09:d4:15:10:54
[  123.291403] Ignored command_type: 1, command_id: 1 
[  123.300785] Update MAC(0)=4c:09:d4:15:10:56
[  123.303521] ============= Init Thread ===================
[  123.344161] RacfgTaskThread pid = 1884
[  123.348401] RacfgBacklogThread pid = 1886
[  123.352608] wl010: Ralink iNIC at 0x0, 4c:09:d4:15:10:56
[  123.391126] iNIC Open wl000
[  123.392612] -----> mii_hardware_reset
[  124.424067] -----> mii_hardware_reset
[  124.426299] Op mode = 1
[  124.428817] ConcurrentObj.CardCount=0
[  124.432428] Read profile[0]
[  124.438096] BssidNum=2
[  124.440678] Read profile[1]
[  124.443469] BssidNum=2
[  124.446050] rlk_inic_mbss_init (pAd->RaCfgObj.BssidNum=2)
[  124.450091] rlk_inic_mbss_init --->
[  124.453589] Register MBSSID IF (wl001)
[  124.458783] register_netdev done
[  124.460662] rlk_inic_mbss_init <---
[  124.464098] ConcurrentObj.CardCount=0 init_flag=0
[  124.468790] Wait for boot done...
[  124.472096] Call RaCfgWaitSyncRsp
[  124.476165] RACFG_CMD_BOOT_NOTIFY
[  124.480886] Firmware path iNIC/RT3883/iNIC_ap.bin
[  124.484244] Profile[0] path iNIC/RT3883/iNIC_ap.dat, read path iNIC/RT3883/iNIC_ap.dat
[  124.492121] EEPROM[0] path iNIC/RT3883/iNIC_e2p.bin, read path iNIC/RT3883/iNIC_e2p.bin
[  124.500122] Profile[1] path iNIC/RT3883/iNIC_ap1.dat, read path iNIC/RT3883/iNIC_ap1.dat
[  124.508218] EEPROM[1] path iNIC/RT3883/iNIC_e2p1.bin, read path iNIC/RT3883/iNIC_e2p1.bin
[  124.516396] Request file: iNIC/RT3883/iNIC_ap.bin
[  124.781375] Request file: iNIC/RT3883/iNIC_ap.dat
[  124.785082] Request file: iNIC/RT3883/iNIC_e2p.bin
[  124.790914] Request file: iNIC/RT3883/iNIC_ap1.dat
[  124.795000] Request file: iNIC/RT3883/iNIC_e2p1.bin
[  124.800735] Upload Profile 1024 bytes from file, 0 from extra...
[  125.454754] RACFG_CMD_BOOT_NOTIFY
> no reaction

It happen somtimes so and so on loading the same module

...
[  693.656243] RACFG_CMD_BOOT_NOTIFY
[  693.660999] Firmware path iNIC/RT3883/iNIC_ap.bin
[  693.664359] Profile[0] path iNIC/RT3883/iNIC_ap.dat, read path iNIC/RT3883/iNIC_ap.dat
[  693.672245] EEPROM[0] path iNIC/RT3883/iNIC_e2p.bin, read path iNIC/RT3883/iNIC_e2p.bin
[  693.680237] Profile[1] path iNIC/RT3883/iNIC_ap1.dat, read path iNIC/RT3883/iNIC_ap1.dat
[  693.688333] EEPROM[1] path iNIC/RT3883/iNIC_e2p1.bin, read path iNIC/RT3883/iNIC_e2p1.bin
[  693.696512] Request file: iNIC/RT3883/iNIC_ap.bin
[  693.962679] Request file: iNIC/RT3883/iNIC_ap.dat
[  693.966381] Request file: iNIC/RT3883/iNIC_e2p.bin
[  693.972313] Request file: iNIC/RT3883/iNIC_ap1.dat
[  693.976380] Request file: iNIC/RT3883/iNIC_e2p1.bin
[  693.981699] Upload Profile 1024 bytes from file, 0 from extra...
[  693.986709] Unhandled kernel unaligned access[#1]:
[  693.991329] CPU: 0 PID: 2065 Comm: RaCfg Task Tainted: G         C        4.19.56 #0
[  693.999064] $ 0   : 00000000 00000001 80736360 00000001
[  694.004284] $ 4   : 074e4b69 8627fbd4 869284a0 00000000
[  694.009507] $ 8   : 00000001 50415053 0a575041 50534b33
[  694.014729] $12   : 3d0a5750 64000000 0000013f 4150534b
[  694.019952] $16   : 00000001 86928644 806dbfe4 80736360
[  694.025174] $20   : 00040000 8627fbd4 074e4b69 00000001
[  694.030396] $24   : 00000000 00000000                  
[  694.035619] $28   : 8627e000 8627fb70 00000000 80096fc4
[  694.040842] Hi    : 00000062
[  694.043715] Lo    : 28f5c418
[  694.046606] epc   : 8054fa80 _raw_spin_lock_irqsave+0x1c/0x64
[  694.052354] ra    : 80096fc4 lock_timer_base+0x6c/0xbc
[  694.057467] Status: 1100ff02	KERNEL EXL 
[  694.061385] Cause : 00800010 (ExcCode 04)
[  694.065387] BadVA : 074e4b69
[  694.068261] PrId  : 00019556 (MIPS 34Kc)
[  694.072175] Modules linked in: rt3883_iNIC iptable_nat ipt_MASQUERADE xt_state xt_nat xt_conntrack xt_REDIRECT xt_FLOWOFFLOAD xt_CT pppoe nf_nat_ipv4 nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack ipt_REJECT xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG pppox ppp_async nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 ltq_deu_vr9 iptable_mangle iptable_filter ip_tables drv_vmmc crc_ccitt drv_dsl_cpe_api drv_mei_cpe nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 pppoatm ppp_generic slhc br2684 atm drv_tapi drv_ifxos fb_ili9341_eb904 fbtft(C) fb_sys_fops backlight sysimgblt sysfillrect syscopyarea fb font dwc2 gpio_button_hotplug
[  694.138950] Process RaCfg Task (pid: 2065, threadinfo=0e2e251a, task=bb73c495, tls=00000000)
[  694.147378] Stack : 00000000 00000001 00000000 8007ea18 00000000 ffffffe5 869284a0 80096fc4
[  694.155733]         86278d00 8627fbfc 867ad380 86135d80 86928644 86135d80 867ddbbc 000181b1
[  694.164089]         86262fa4 80660000 80840000 800979c4 867ad380 86135d80 86278d00 8627fbfc
[  694.172445]         86262fa4 8007f0d4 867ad380 86135d80 867ddbbc 869284a0 86262fa4 80660000
[  694.180801]         80840000 86265fbc 867e3594 00000400 00000000 00000000 00000000 8086a634
[  694.189156]         ...
[  694.191595] Call Trace:
[  694.194042] [<8054fa80>] _raw_spin_lock_irqsave+0x1c/0x64
[  694.199444] [<80096fc4>] lock_timer_base+0x6c/0xbc
[  694.204226] [<800979c4>] mod_timer+0x94/0x1b4
[  694.208601] [<86265fbc>] _append_extra_profile2+0xde4/0x1820 [rt3883_iNIC]
[  694.215456] Code: 32100001  000000c0  24030001 <c0850000> 14a00005  00000000  00600825  e0810000  1020fffa 
[  694.225191] 
[  694.226862] ---[ end trace 2d0f26f69ecd14f7 ]---
[  694.234655] Kernel panic - not syncing: Fatal exception
[  694.240314] Rebooting in 3 seconds..

I littleit play with it (remove some timer stuff) and i thing the problems is somting with the linux timers.
I thing my code are wrong when i look in some other linux kernel code i found stuff that looks like:

timer_setup(&pAd->RaCfgObj.uploadTimer, upload_timeout, 0);

instead off:

timer_setup(&pAd->RaCfgObj.uploadTimer, (void *)&upload_timeout, (uintptr_t)pAd);

but when i write this i get this error:

  CC [M]  /opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/comm/raconfig.o
In file included from ./include/linux/workqueue.h:9:0,
                 from ./include/linux/srcu.h:34,
                 from ./include/linux/notifier.h:16,
                 from ./include/linux/memory_hotplug.h:7,
                 from ./include/linux/mmzone.h:748,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/umh.h:4,
                 from ./include/linux/kmod.h:22,
                 from ./include/linux/module.h:13,
                 from /opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/comm/rlk_inic.h:6,
                 from /opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/comm/raconfig.c:1:
/opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/comm/raconfig.c: In function '_upload_firmware':
./include/linux/timer.h:114:27: error: passing argument 2 of 'init_timer_key' from incompatible pointer type [-Werror=incompatible-pointer-types]
  init_timer_key((_timer), (_fn), (_flags), NULL, NULL)
                           ^
./include/linux/timer.h:130:2: note: in expansion of macro '__init_timer'
  __init_timer((timer), (callback), (flags))
  ^~~~~~~~~~~~
/opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/comm/raconfig.c:1274:3: note: in expansion of macro 'timer_setup'
   timer_setup(&pAd->RaCfgObj.uploadTimer, upload_timeout, 0);
   ^~~~~~~~~~~
./include/linux/timer.h:79:6: note: expected 'void (*)(struct timer_list *)' but argument is of type 'void (*)(uintptr_t) {aka void (*)(long unsigned int)}'
 void init_timer_key(struct timer_list *timer,
      ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [/opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/comm/raconfig.o] Error 1
make[3]: *** [_module_/opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0] Error 2
make[3]: Leaving directory `/opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.19.56'
make[2]: *** [/opt/build/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/ralink_inic-1.0.0/.built] Error 2
make[2]: Leaving directory `/opt/build/openwrt/feeds/eb904_driver/kernel/ralink_inic'
time: package/feeds/eb904_driver/ralink_inic/compile#3.37#1.23#13.51
make[1]: *** [package/feeds/eb904_driver/ralink_inic/compile] Error 2
make[1]: Leaving directory `/opt/build/openwrt'
make: *** [package/ralink_inic/compile] Error 2
 

############################################################
At removing memdev:

I read the post Support for Easybox 904 LTE - #139 by kovz
again and again but i do not really understand it.
Anyway i search in the linked source for MII_PCDU_5_REG but i found only the definition in the linked header file

#define MII_PCDU_5_REG (VR9_SWIP_TOP_BASE_ADDR + (0x41 * 4))

Is MII_PCDU_5_REG the Address 0x1e10b204 And where is it used ?
As i say i found not using in the linked source.

OK but i had have the naiv simple idea to put the devmem write part of the init script at the beginning of the Module.
Without understanding

unsigned int *iMemioaddr_MII_CFG_5 	= (void *)0x1e10b200;
writel(0x4024, iMemioaddr_MII_CFG_5);

But the kernel crash with:

[   25.284262] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   33.773786] CPU 0 Unable to handle kernel paging request at virtual address 1e10b200, epc == 867d5eb8, ra == 867b402c
[   33.783054] Oops[#1]:
[   33.785216] CPU: 0 PID: 1497 Comm: insmod Not tainted 4.14.130 #0
[   33.791303] task: 872a72c0 task.stack: 86674000
[   33.795824] $ 0   : 00000000 00000001 1e10b200 24400000
[   33.801046] $ 4   : 00004024 1e10b200 00000001 86717380
[   33.806268] $ 8   : 00009911 00009910 00000001 00000001
[   33.811491] $12   : 00009910 86ae0400 86ae0400 00000114
[   33.816713] $16   : 80800000 00000000 867b4000 80810000
[   33.821935] $20   : 80810000 00000000 867db408 00000028
[   33.827158] $24   : 00000003 80028214                  
[   33.832380] $28   : 86674000 86675c78 80800000 867b402c
[   33.837603] Hi    : 00000000
[   33.840476] Lo    : 00000000
[   33.843465] epc   : 867d5eb8 crc32+0x568/0xf28 [rt3883_iNIC]
[   33.849085] ra    : 867b402c init_module+0x2c/0xa58 [rt3883_iNIC]
[   33.855098] Status: 1100ff03	KERNEL EXL IE 
[   33.859278] Cause : 0080000c (ExcCode 03)
[   33.863281] BadVA : 1e10b200
[   33.866154] PrId  : 00019556 (MIPS 34Kc)
[   33.870069] Modules linked in: rt3883_iNIC(+) pppoe nf_conntrack_ipv6 iptable_nat ipt_REJECT ipt_MASQUERADE xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_FLOWOFFLOAD xt_CT pppox ppp_async nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_nat nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack ltq_deu_vr9 iptable_mangle iptable_filter ip_tables drv_vmmc crc_ccitt drv_dsl_cpe_api drv_mei_cpe nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 pppoatm ppp_generic slhc br2684 atm drv_tapi drv_ifxos gpio_button_hotplug
[   33.935356] Process insmod (pid: 1497, threadinfo=86674000, task=872a72c0, tls=77f1ceb8)
[   33.943443] Stack : 00000001 00000003 1e10b200 24400000 00004024 1e10b200 86514780 8007cc44
[   33.951798]         87010400 00000000 00000000 001f0041 00000001 86514780 80863220 00000000
[   33.960154]         00000000 00000000 86675cc0 001f0041 80830000 80970000 86717600 80807cc0
[   33.968510]         00000000 80830000 807ca3e8 924e750e 80800000 924e750e 867b4000 80002650
[   33.976866]         00000000 80807cc0 00000800 001f0041 00000001 867a7f00 00000800 867a7f00
[   33.985221]         ...
[   33.987662] Call Trace:
[   33.990179] [<867d5eb8>] crc32+0x568/0xf28 [rt3883_iNIC]
[   33.995569] [<867b402c>] init_module+0x2c/0xa58 [rt3883_iNIC]
[   34.001228] Code: afa2000c  8fa20008  8fa3000c <ac430000> 00000000  27bd0010  03e00008  00000000  00000000 
[   34.010899] 
[   34.012523] ---[ end trace 1c14d1d955584722 ]---
[   34.019871] Kernel panic - not syncing: Fatal exception
[   34.025156] Rebooting in 3 seconds..

ROM VER: 1.1.4

Can it happen that is not allowed what i want ?
Can it happen that a kernel module allowed to write in there own space ?

###################################################################
at SQM crashes:
And not to forget that SQM (tc) not working with the driver:

1 Like