Questions on EN7512 SoC porting from linux2.6

The Mediatek EN7512 source code I've found is for linux 2.6. I've made a diff of arch/mips against plain linux2.6 and then applied the patch to linux4.9 (and 3.9) just to see how many "rejects" there will be. You can find the rejects here: https://bitbucket.org/vzdor/en7512/src/master/linux-4.9.99-apply.rej
It is 600 lines of rejected diff.

The plan is to apply the minimal patch to linux 4.9, buildroot and see what works. There is support for Mediatek SoC ethernet in linux4.9, may be this driver will work with this SoC (if arch/mips is ported)? There is source code of the 7512 ethernet driver for the bootloader, may be this can be used as reference. May be modern linux Mediatek-USB will work, without porting USB code.

I've also added diffs to the repository: https://bitbucket.org/vzdor/en7512/src/master/

Questions

If the patch will apply it does not mean the device will work. May be someone already did this and stopped? Or may be someone is working on this?

I'm a newb, have not done any linux driver programming nor MIPS programming. I can, may be fix obvious changes, but for example, there is no SMTC (https://www.linux-mips.org/wiki/34K) in linux4.9, but this was used in 2.6. I can't imagine the work required. May be someone knowledgeable could review mips.files, mips.diff and rejects file and give some suggestions or conclusion.

2 Likes

Question is why exactly are you eyeing that thing? Are you hoping to get the DSL part working? As that seems highly unlikely due to its completely proprietary nature...

Only ethernet and hopefully WiFi and USB. I do not need DSL.

I think STMC is optional by how it was dropped from linux: https://marc.info/?l=linux-mips&m=139695479229352&w=4
So I will try to delete any STMC changes.

Some code is easy to rollback since

  1. the symbols not used anywhere with the code
  2. the code is related to Ralink and if linux4 supports Ralink, then I can drop this code
  3. some code for error reporting, like in case of NMI, the Mediatek changes to arch/mips/kernel/traps.c, although I'm not sure.

What works: booting and UART console. So I can boot ramfs and run some commands.

I'm stuck with ethernet driver. The source code of the driver is in eth.c of the repository.

There is QDMA_DMA_DSCP_T structure: done, pkt_addr and a few more fields. You make an array of these at some DMA accessible memory and set QDMA_CSR_TX_DSCP_BASE. To send a message, you assign pkt_addr and set QDMA_CSR_TX_CPU_IDX. If OK, done will be set to 1. But this only works 6 times. I do not know why and how to get out of this state.

There is QDMA_HWFWD_DMA_DSCP_T and status register, QDMA_CSR_DBG_LMGR_STATUS. When a packet is being sent, this object changes. After 6 packets, the status register begin to decrease.

Registers: https://bitbucket.org/vzdor/en7512/src/master/bootloader-en7512-net-src/7512_eth.h

I've got a similiar router with the EN7512 CPU, probably. So it does need some work for openwrt? I also got GPL source code for it from TP-LINK, if it would help in any way. Here is my topic: