Porting the EN75xx platform - code style questions.
Caleb James DeLisle
cjd at cjdns.fr
Mon Jan 20 05:41:15 PST 2025
Hello folks,
I'm back to my old time-waster, trying to port to an EN7526.
I'd like some advice on what is the "best" way to code this so that it's easily merged, and not
excluded from upstreaming for quality reasons.
First question: I'm planning on pretty much rewriting everything from scratch, so I'd like to know
what is the Gold Standard of MIPS platforms that I should be emulating. I'm currently trying to
pattern off of the ralink platform in linux upstream, but I don't know if what I'm copying is the best.
Second question: What's the appropriate balance between hard-coding the system type, and trying to
detect and roll with whatever you have?
At one extreme, I could make the build be for one SoC only, e.g. EN7526G, and make it panic if it
boots on anything else (even like an EN7526C which would probably boot ok). At the other extreme, I
could make the code use runtime detection only and let the user choose from a menu of SoCs and have
them mutually exclude if they have major differences like byte order.
The 2nd direction makes a lot of sense to me because I can make it so you can select Generic and
you'll get an OS which tries really hard to boot on whatever you put it on, but if you select a
specific processor then some function like `static inline bool en75_soc_is(enum en75_soc_type t)`
will be constant folded, so dead code elimination will clean up any if block that references an
another SoC.
The problem is device trees. These boards use an old trx loader so FIT is out of the question, but
what I could do is append multiple DTs and have plat_mem_setup() just walk them like a linked list
looking for the index of the identified SoC, but I wanted to ask for opinions first before doing
something "smart" that might just lead to code nobody wants to go near.
Third question: Anybody going to be at FOSDEM?
Thanks,
Caleb
More information about the openwrt-devel
mailing list