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

From: Wells Lu 呂芳騰
Date: Thu Nov 25 2021 - 22:58:48 EST


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?


Best regards,

Wells Lu
呂芳騰

智能運算專案/Smart Computing Program
家庭平台事業群/Home Entertainment Business Unit
凌陽科技/Sunplus Technology Co., Ltd.
地址:300新竹科學園區創新一路19號
19, Innovation 1st Road,
Science-based Industrial Park
Hsin-Chu, Taiwan 300
TEL:886-3-5786005 ext. 2580

> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Thursday, November 25, 2021 11:21 PM
> To: Wells Lu 呂芳騰 <wells.lu@xxxxxxxxxxx>
> Cc: Wells Lu <wellslutw@xxxxxxxxx>; davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx;
> robh+dt@xxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; p.zabel@xxxxxxxxxxxxxx; Vincent Shih 施錕鴻
> <vincent.shih@xxxxxxxxxxx>
> Subject: Re: [PATCH v2 2/2] net: ethernet: Add driver for Sunplus SP7021
>
> > Due to hardware design, we still need to set PHY address, because MDIO
> > controller of SP7021 only sends out MDIO commands with the same
> > address listed in PHY address registers. The function below needs to
> > be kept.
>
> I suggest you actually set it to some other address. One of the good/bad things about MDIO
> is you have no idea if the device is there. A read to a device which does not exist just
> returns 0xffff, not an error. So i would set the address of 0x1f. I've never seen a PHY
> actually use that address.
>
> Andrew