Subject: Re: PROBLEM: smsc95xx loses config on link down/up

From: Andrew Lunn <[email-masked]>
Date: Mon, 2 Dec 2019 14:46:06 +0100

On Thu, Nov 28, 2019 at 06:19:14PM +1100, Sam Lewis wrote:
> I'm using a LAN9514 chip in my embedded Linux device and have noticed
> that changing Ethernet configuration (with ethtool for example) does
> not persist after putting the link up.

Hi Sam

Did you ever get a reply to this?

> I've hacked through the driver code (without really knowing what I'm
> doing, just adding various print statements) and I think this happens
> because setting a link up causes the `smsc95xx_reset` function to be
> called which seems to clear all configuration through:
> 
> 1) Doing a PHY reset (with `smsc95xx_write_reg(dev, PM_CTRL, PM_CTL_PHY_RST_)`)
> 2) Doing (another?) PHY reset (with `smsc95xx_mdio_write(dev->net,
> dev->mii.phy_id, MII_BMCR, BMCR_RESET)`)

In general, BMCR_RESET does not clear configuration registers such as
auto-neg etc. It generally just gives the PHY a kick to restart itself
using the configuration as set. So i would initially point a finger at
PM_CTL_PHY_RST_.

Is there a full datasheet somewhere?

You might want to think about using PM_CTL_PHY_RST_ once during probe,
and only BMCR_RESET in open.

    Andrew