[PATCH v2] net: mtk_sgmii: implement mtk_pcs_ops
Bjørn Mork
bjorn at mork.no
Mon Jan 16 10:59:50 PST 2023
"Russell King (Oracle)" <linux at armlinux.org.uk> writes:
> On Mon, Jan 16, 2023 at 07:30:27PM +0100, Bjørn Mork wrote:
>> "Russell King (Oracle)" <linux at armlinux.org.uk> writes:
>>
>> > That all looks fine. However, I'm running out of ideas.
>>
>> Thanks a lot for the effort in any case. It's comforting that even the
>> top experts can't figure out this one :-)
>>
>>
>> > What we seem to have is:
>> >
>> > PHY:
>> > VSPEC1_SGMII_CTRL = 0x34da
>> > VSPEC1_SGMII_STAT = 0x000e
>> >
>> > The PHY is programmed to exchange SGMII with the host PCS, and it
>> > says that it hasn't completed that exchange (bit 5 of STAT).
>> >
>> > The Mediatek PCS says:
>> > BMCR = 0x1140 AN enabled
>> > BMSR = 0x0008 AN capable
>> > ADVERTISE = 0x0001 SGMII response (bit 14 is clear, hardware is
>> > supposed to manage that bit)
>> > LPA = 0x0000 SGMII received control word (nothing)
>> > SGMII_MODE = 0x011b SGMII mode, duplex AN, 1000M, Full duplex,
>> > Remote fault disable
>> >
>> > which all looks like it should work - but it isn't.
>> >
>> > One last thing I can think of trying at the moment would be writing
>> > the VSPEC1_SGMII_CTRL with 0x36da, setting bit 9 which allegedly
>> > restarts the SGMII exchange. There's some comments in the PHY driver
>> > that this may be needed - maybe it's necessary once the MAC's PCS
>> > has been switched to SGMII mode.
>>
>>
>> Tried that now. Didn't change anything. And still no packets.
>>
>> root at OpenWrt:/# mdio mdio-bus 6:30 raw 8
>> 0x34da
>> root at OpenWrt:/# mdio mdio-bus 6:30 raw 9
>> 0x000e
>> root at OpenWrt:/# mdio mdio-bus 6:30 raw 8 0x36da
>> root at OpenWrt:/# mdio mdio-bus 6:30 raw 8
>> 0x34da
>> root at OpenWrt:/# mdio mdio-bus 6:30 raw 9
>> 0x000e
>
> If bit 9 is indeed the restart-an bit, it will be self-clearing, so
> I wouldn't expect a read back of it to change to 0x36da.
>
> I guess next thing to try is clearing and setting the AN enable bit,
> bit 12, so please try this:
>
> mdio mdio-bus 6:30 raw 8 0x24da
> mdio mdio-bus 6:30 raw 8 0x36da
> mdio mdio-bus 6:30 raw 9
>
> If that doesn't work, then let's try something a bit harder:
>
> mdio mdio-bus 6:30 raw 8 0xb4da
> mdio mdio-bus 6:30 raw 9
>
> Please let me know the results from those.
OK, back to the original dts with phy-mode = "2500base-x", with peer set
to 1G. Still no success:
root at OpenWrt:/# mdio mdio-bus 6:30 raw 8
0x34da
root at OpenWrt:/# mdio mdio-bus 6:30 raw 9
0x000e
root at OpenWrt:/# mdio mdio-bus 6:30 raw 8 0x24da
root at OpenWrt:/# mdio mdio-bus 6:30 raw 8 0x36da
root at OpenWrt:/# mdio mdio-bus 6:30 raw 9
0x000e
root at OpenWrt:/# mdio mdio-bus 6:30 raw 8 0xb4da
root at OpenWrt:/# mdio mdio-bus 6:30 raw 9
0x000e
Bjørn
More information about the Linux-mediatek
mailing list