RE: [PATCH v2 2/2] net: ethernet: Add driver for Sunplus SP7021

From: Wells Lu 呂芳騰
Date: Fri Nov 26 2021 - 11:15:02 EST


Hi Andrew,


From data provided by ASIC engineer, MAC of SP7021 only
reads the 4 registers of PHY:
0: Control register
1: Status register
4: Auto-negotiation advertisement register
5: Auto-negotiation link partner ability register

It does not read any other registers of PHY.


Best regards,
Wells Lu


> > Hi Andrew,
> >
> > I set phy-id registers to 30 and 31 and found the read-back values of
> > mdio read commands from CPU are all 0x0000.
> >
> > I consulted with an ASIC engineer. She confirmed that if phy-id of a
> > mdio command from CPU does not match any phy-id registers, the mdio
> > command will not be sent out.
> >
> > She explained if phy-id of a mdio command does not match any phy-id
> > registers (represent addresses of external PHYs), why MAC needs to
> > send a command to non-existing PHY?
>
> Reads or writes on a real PHY which Linux is driving can have side effects. There is a
> link statue register which latches. Read it once, you get the last status, read it again,
> you get the current status. If the MAC hardware is reading this register as well a Linux,
> bad things will happen. A read on the interrupt status register often clears the interrupts.
> So Linux will not see the interrupts.
>
> So you need to make sure you hardware is not touching a PHY which Linux uses. Which is
> why i suggested using MDIO bus address 31, which generally does not have a PHY at that
> address.
>
> Andrew