Adding OpenWrt support for Xiaomi AX3600 (Part 1)

The edma driver is too much hacky to be proposed upstream ?

Anyway I think we can agree that to have some progress here the first step would be to try in every way possible to remove the ssdk driver

Yes, because they made their own HAL that they share with EDMA, Synpopsis and some other based drivers

1 Like

Ok, I edited the kernel header file to include <linux/sched.h> actually got the thing compiled.
However, there are some warnings and I trying to debug the stupid MODULE_LICENSE error?
Like, how can you have a error related to that:

In file included from /home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.35/include/linux/module.h:21,
                 from /home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.35/include/linux/phy.h:22,
                 from /home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/include/init/ssdk_dts.h:26,
                 from ssdk_init.c:24:
ssdk_init.c: At top level:
/home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.35/include/linux/module.h:181:39: error: expected ',' or ';' before 'KBUILD_MODFILE'
 #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
                                       ^~~~~~~~~~~~~~
/home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.35/include/linux/moduleparam.h:36:47: note: in definition of macro '__MODULE_INFO'
   = __MODULE_INFO_PREFIX __stringify(tag) "=" info
                                               ^~~~
/home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.35/include/linux/module.h:181:21: note: in expansion of macro 'MODULE_INFO'
 #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
                     ^~~~~~~~~~~
/home/robimarko/Building/AX3600/AX3600-5.10/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.35/include/linux/module.h:228:34: note: in expansion of macro 'MODULE_FILE'
 #define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license, _license)
                                  ^~~~~~~~~~~
ssdk_init.c:3691:1: note: in expansion of macro 'MODULE_LICENSE'
 MODULE_LICENSE("Dual BSD/GPL");
1 Like

Maybe stupid suggestion, but could it be related to your error? https://stackoverflow.com/questions/50005865/kernel-demo-build-error/50297665

1 Like

Nothing stupid, it points to having to terminate with semicolons, but you can see that its already terminated.

1 Like

I could be wrong but i remember at times to had a problem with the license... did you check my patch in my repo about ssdk?

I am looking, I can see that you had issues with uaccess and solved that by including a the generic one.
But nothing for the license.

Anyway, by commenting the license out and including <linux/sched.h> in the kernel SSDK compiles, NSS-DP was really easy to add get to compile.

Added DT nodes, but there are tons of clocks and resets missing so working on adding those.

2 Likes

Yep that was my fix... I probably never added to my repo as it wasn't that clean...

Finally battled with the clocks and conflicts to get them added, however a nasty surprise:

[    5.635032] Disabling lock debugging due to kernel taint
[    5.649716] qca_ssdk: Unknown symbol phy_gbit_features (err -2)
[    5.649766] qca_ssdk: Unknown symbol clk_unprepare (err -2)
[    5.654489] qca_ssdk: Unknown symbol gpio_free (err -2)
[    5.656347] random: crng init done
[    5.660003] qca_ssdk: please compile with -fno-common
[    5.660014] qca_ssdk: Unknown symbol of_property_read_string (err -2)
[    5.660040] qca_ssdk: Unknown symbol blocking_notifier_chain_unregister (err -2)
[    5.665210] random: 4 urandom warning(s) missed due to ratelimiting
[    5.668698] qca_ssdk: Unknown symbol clk_disable (err -2)
[    5.693689] qca_ssdk: Unknown symbol phy_basic_features (err -2)
[    5.699240] qca_ssdk: please compile with -fno-common
[    5.705321] qca_ssdk: Unknown symbol of_property_read_variable_u8_array (err -2)
[    5.710276] qca_ssdk: Unknown symbol kobject_create_and_add (err -2)
[    5.717742] qca_ssdk: Unknown symbol driver_find (err -2)
[    5.724073] qca_ssdk: Unknown symbol gpio_request (err -2)
[    5.729373] qca_ssdk: Unknown symbol blocking_notifier_chain_register (err -2)
[    5.734755] qca_ssdk: Unknown symbol clk_get_rate (err -2)
[    5.741956] qca_ssdk: please compile with -fno-common
[    5.747438] qca_ssdk: Unknown symbol clk_set_rate (err -2)
[    5.752545] qca_ssdk: Unknown symbol gpiod_set_raw_value (err -2)
[    5.757931] qca_ssdk: Unknown symbol system_long_wq (err -2)
[    5.764086] qca_ssdk: please compile with -fno-common
[    5.769816] qca_ssdk: Unknown symbol gpio_to_desc (err -2)
[    5.774777] qca_ssdk: Unknown symbol gpio_request_one (err -2)
[    5.780151] qca_ssdk: Unknown symbol clk_register (err -2)
[    5.785976] qca_ssdk: Unknown symbol reset_control_put (err -2)
[    5.791444] qca_ssdk: Unknown symbol gpiod_to_irq (err -2)
[    5.797268] qca_ssdk: Unknown symbol of_get_named_gpio_flags (err -2)
[    5.802809] qca_ssdk: Unknown symbol reset_control_deassert (err -2)
[    5.809324] qca_ssdk: Unknown symbol platform_driver_unregister (err -2)
[    5.815752] qca_ssdk: Unknown symbol __platform_driver_register (err -2)
[    5.822425] qca_ssdk: Unknown symbol of_property_read_variable_u32_array (err -2)
[    5.829124] qca_ssdk: Unknown symbol blocking_notifier_call_chain (err -2)
[    5.836498] qca_ssdk: Unknown symbol sysfs_create_file_ns (err -2)
[    5.843255] qca_ssdk: Unknown symbol clk_set_parent (err -2)
[    5.849416] qca_ssdk: please compile with -fno-common
[    5.855249] qca_ssdk: Unknown symbol __of_reset_control_get (err -2)
[    5.860185] qca_ssdk: Unknown symbol of_platform_populate (err -2)
[    5.866611] qca_ssdk: please compile with -fno-common
[    5.872606] qca_ssdk: Unknown symbol clk_enable (err -2)
[    5.877717] qca_ssdk: Unknown symbol gpiod_set_debounce (err -2)
[    5.883102] qca_ssdk: Unknown symbol sysfs_remove_file_ns (err -2)
[    5.889093] qca_ssdk: Unknown symbol reset_control_assert (err -2)
[    5.895085] qca_ssdk: Unknown symbol gpiod_direction_output_raw (err -2)
[    5.901245] qca_ssdk: Unknown symbol clk_prepare (err -2)
[    5.946097] Loading modules backported from Linux version v5.10.34-0-g0aa66717f684
[    5.946135] Backport generated by backports.git v5.10.34-1-0-g7b5533e1
[    5.961510] xt_time: kernel timezone is -0000
[    5.998418] PPP generic driver version 2.4.2
[    5.999364] NET: Registered protocol family 24
[    6.045175] qca_ssdk: Unknown symbol phy_gbit_features (err -2)
[    6.045252] qca_ssdk: Unknown symbol clk_unprepare (err -2)
[    6.049977] qca_ssdk: Unknown symbol gpio_free (err -2)
[    6.055465] qca_ssdk: please compile with -fno-common
[    6.060700] qca_ssdk: Unknown symbol of_property_read_string (err -2)
[    6.065928] qca_ssdk: Unknown symbol blocking_notifier_chain_unregister (err -2)
[    6.072346] qca_ssdk: Unknown symbol clk_disable (err -2)
[    6.079797] qca_ssdk: Unknown symbol phy_basic_features (err -2)
[    6.085065] qca_ssdk: please compile with -fno-common
[    6.091165] qca_ssdk: Unknown symbol of_property_read_variable_u8_array (err -2)
[    6.096135] qca_ssdk: Unknown symbol kobject_create_and_add (err -2)
[    6.103589] qca_ssdk: Unknown symbol driver_find (err -2)
[    6.109920] qca_ssdk: Unknown symbol gpio_request (err -2)
[    6.115221] qca_ssdk: Unknown symbol blocking_notifier_chain_register (err -2)
[    6.120601] qca_ssdk: Unknown symbol clk_get_rate (err -2)
[    6.127772] qca_ssdk: please compile with -fno-common
[    6.133284] qca_ssdk: Unknown symbol clk_set_rate (err -2)
[    6.138390] qca_ssdk: Unknown symbol gpiod_set_raw_value (err -2)
[    6.143779] qca_ssdk: Unknown symbol system_long_wq (err -2)
[    6.149912] qca_ssdk: please compile with -fno-common
[    6.155662] qca_ssdk: Unknown symbol gpio_to_desc (err -2)
[    6.160626] qca_ssdk: Unknown symbol gpio_request_one (err -2)
[    6.165999] qca_ssdk: Unknown symbol clk_register (err -2)
[    6.171824] qca_ssdk: Unknown symbol reset_control_put (err -2)
[    6.177292] qca_ssdk: Unknown symbol gpiod_to_irq (err -2)
[    6.183103] qca_ssdk: Unknown symbol of_get_named_gpio_flags (err -2)
[    6.188653] qca_ssdk: Unknown symbol reset_control_deassert (err -2)
[    6.195170] qca_ssdk: Unknown symbol platform_driver_unregister (err -2)
[    6.201599] qca_ssdk: Unknown symbol __platform_driver_register (err -2)
[    6.208270] qca_ssdk: Unknown symbol of_property_read_variable_u32_array (err -2)
[    6.214969] qca_ssdk: Unknown symbol blocking_notifier_call_chain (err -2)
[    6.222351] qca_ssdk: Unknown symbol sysfs_create_file_ns (err -2)
[    6.229103] qca_ssdk: Unknown symbol clk_set_parent (err -2)
[    6.235241] qca_ssdk: please compile with -fno-common
[    6.241094] qca_ssdk: Unknown symbol __of_reset_control_get (err -2)
[    6.246029] qca_ssdk: Unknown symbol of_platform_populate (err -2)
[    6.252430] qca_ssdk: please compile with -fno-common
[    6.258452] qca_ssdk: Unknown symbol clk_enable (err -2)
[    6.263564] qca_ssdk: Unknown symbol gpiod_set_debounce (err -2)
[    6.268948] qca_ssdk: Unknown symbol sysfs_remove_file_ns (err -2)
[    6.274937] qca_ssdk: Unknown symbol reset_control_assert (err -2)
[    6.280932] qca_ssdk: Unknown symbol gpiod_direction_output_raw (err -2)
[    6.287091] qca_ssdk: Unknown symbol clk_prepare (err -2)
[    6.330757] kmodloader: 2 modules could not be probed
[    6.330858] kmodloader: dependency not loaded qca-ssdk
[    6.334845] kmodloader: - qca-nss-dp - 1
[    6.339866] kmodloader: - qca-ssdk - 0
1 Like

you need to have a license or ANY GPL symbol can't be used

declare a plain GPL license for ssdk

(if notice the kernel should be now tainted as proprietary module are now used)

1 Like

How when MODULE_LICENSE throws an error?
Also, -fno-common is defined in the gcc arguments, but it looks like OpenWrt is stripping that.

1 Like

sorry i'm stupid... anyway i'm cloning your report and i'm trying to fix the license problem...

Thanks, hopefully this time around we can get this router usable.

Added -fno-common to CFLAGS and this time it got applied.

3 Likes

//offtopic - following this topic just to see if it makes sense to get this router, however the last couple of messages brings a huge smile on my face as you can see a real development effort. Thanks guys, I might be a front-end dev, but I appreciate it.

3 Likes

having some fun trying to build this for ipq806x hoping it's not impossible to do...

1 Like

I am sure its possible, this license error makes no sense at all.

1 Like

Wait, what?
I saw that all of the flags from config file were not being applied by the SSDK at all.
Simply copied them over as EXTRA_CFLAGS and now there are not warnings on anything and ti compiles just fine.

It will load the modules fine, no errors even.
Clock setting suceeds, but it does not register any ports.

[    5.648090] ssdk_switch_device_num_init[1159]:INFO:ess-switch dts node number: 1
[    5.648206] ssdk_dt_get_switch_node[970]:INFO:ess-switch DT exist!
[    5.651913] random: crng init done
[    5.654570] ssdk_dt_parse_access_mode[856]:INFO:switch_access_mode: local bus
[    5.660558] random: 4 urandom warning(s) missed due to ratelimiting
[    5.663937] ssdk_dt_parse_access_mode[869]:INFO:switchreg_base_addr: 0x3a000000
[    5.663944] ssdk_dt_parse_access_mode[870]:INFO:switchreg_size: 0x1000000
[    5.684511] ssdk_dt_parse_mac_mode[295]:INFO:mac mode = 0x0
[    5.691451] ssdk_dt_parse_mac_mode[304]:INFO:mac mode1 = 0xff
[    5.696835] ssdk_dt_parse_mac_mode[313]:INFO:mac mode2 = 0xff
[    5.702810] ssdk_dt_parse_uniphy[332]:INFO:ess-uniphy DT exist!
[    5.708644] ssdk_dt_parse_intf_mac[801]:INFO:dp1 MAC 88:c3:97:c3:a8:33
[    5.714243] ssdk_dt_parse_intf_mac[801]:INFO:dp2 MAC 88:c3:97:16:5d:9f
[    5.720849] ssdk_dt_parse_intf_mac[801]:INFO:dp3 MAC 88:c3:97:c3:a8:33
[    5.727350] ssdk_dt_parse_intf_mac[801]:INFO:dp4 MAC 88:c3:97:c3:a8:33
[    5.733861] ssdk_dt_parse_intf_mac[801]:INFO:dp5 MAC 88:c3:97:c3:a8:33
[    5.740383] ssdk_plat_init start
[    5.793428] ssdk_gcc_clock_init[1033]:INFO:SSDK gcc clock init successfully!
[    5.794553] HPPE initializing...
[    5.799861] malibu_phy_api_ops_init[2848]:INFO:qca probe malibu phy driver succeeded!
[    5.809015] regi_init[3567]:INFO:Initializing HPPE!!
[    6.031528] ssdk_ppe_reset_init[1265]:INFO:ppe reset successfully!
[    6.034941] qca_hppe_tdm_hw_init[684]:INFO:tdm setup num=96
[    6.036941] qca_hppe_portctrl_hw_init[110]:INFO:Hawkeye PPE port initializing
[    6.257716] ssdk_switch_register[1718]:INFO:Chip version 0x1500
[    6.257752] qca_link_polling_select[1315]:INFO:link-polling-required node does not exist
[    6.262448] ssdk_switch_register[1744]:INFO:polling is selected
[    6.270778] regi_init[3571]:INFO:Initializing HPPE Done!!
[    6.276505] regi_init[3631]:INFO:qca-ssdk module init succeeded

NSS-DP is not triggering at all, like its not probing at all.
This is kind of driving me nuts.

2 Likes

some problem in the dts?

Should not be, copied it over from 5.4 QCA tree.
NSS-DP simply triggers of qcom,nss-dp and EDMA has its own compatible.

1 Like

i also compared them with mine and they are identical... random error in the nss dp probe?