On 11/02/2026 21:24, Benjamin Larsson wrote:
Hi.
On 11/02/2026 14:00, Caleb James DeLisle wrote:
Then question is: If we implement a pass-through switch, is that a
different driver? I guess it doesn't register as DSA. What is it in
the DT? Do we still reset it and tune TRGMII? Would need to copy:
mt7530_setup_port6, mt7530_setup_port5, all of the MDIO bus stuff
(mt7531_ind_c22_phy_read, mt7531_ind_c22_phy_write), and some of
mt7530_setup.
Not sure about the TRGMII part, there I would say copy the vendor
driver logic that has been stable enough for shipping devices. But a
driver for the MMIO switch is needed because of the mdio interface.
Problem is, vendor code is (as usual) some of the most hideous crap
imaginable. But as far as phy tuning, I'm planning on at least punching
in all of the values and not skipping anything. However there's a lot of
code for finding those values and I think I'd rather just get them from
the vendor OS and write them directly.
Question: I have a bunch of this crap:
phy_write_mmd(phy, MDIO_MMD_VEND2, 0x0417, 0x7775);
phy_write_mmd(phy, MDIO_MMD_VEND2, 0x027b, 0x1157);
phy_write_mmd(phy, MDIO_MMD_VEND2, 0x0044, 0x0040);
phy_write_mmd(phy, MDIO_MMD_VEND1, 0x0045, 0x0404);
phy_write_mmd(phy, MDIO_MMD_VEND1, 0x0046, 0x0404);
... more magic values, all undocumented
In vendor code, some of them are hardcoded, some select per-SoC, and
some are auto-detected.
These phys identify as a standard 03a2:9412, so I can think of 3
possible ways to fix this:
1. Keep the crap in mt7530.c where it is
2. Make mtk-ge.c able to read parameters from the DT, and write
something like this:
mediatek,phy-params = <0x1f 0x0417 0x7775
0x1f 0x027b 0x1157
0x1f 0x0044 0x0040
0x1e 0x0045 0x0404
0x1e 0x0046 0x0404>;
3. Create an DT entry for each one, like:
mediatek,undocumented-1f-0417 = 0x7775;
mediatek,undocumented-1f-027b = 0x1157;
and so on...
1 is probably least likely to draw attention, but it may need an
occasional update to support a different SoC.
2 is probably most likely to draw attention - I see almost nothing like
that in the kernel currently.
3 creates a bunch of DT symbols which are afterwords more or less
impossible to ever delete
Is there a #4 ?
Daniel, your advice would be appreciated since your name is on the MTK
phy code so I gather you'll be reviewing.
Thanks,
Caleb
Maybe different compatible strings for mcm-host mode that only setups
up the pass-through and mdio? Then the actually used MCM switch should
look like the mt7621 dts.
MvH
Benjamin Larsson
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel