From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E28D2C432C0 for ; Mon, 2 Dec 2019 13:46:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4BD92053B for ; Mon, 2 Dec 2019 13:46:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Ffw0mhWV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727533AbfLBNqP (ORCPT ); Mon, 2 Dec 2019 08:46:15 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:33824 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727490AbfLBNqP (ORCPT ); Mon, 2 Dec 2019 08:46:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=s7PmRgS34bnx+DHAnO+vmv7OQpjXwYwCkPaJH2/QmvI=; b=Ffw0mhWVburOJV3CZDBrSqr8bH i+nLcw/iEa0xVKWwL/riSDHiT2ncvWqNFPyE90i8bY6ZLBztclpNOSzrycw95xwnHEkq3yAEzqKsj O0PAFEKRKBd5N7TJ9/jh6cnD0IK87FUim01punsVzhStK+Enxwye/yYBRAE+BN1WCafs=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1ibm1e-0000Vs-T6; Mon, 02 Dec 2019 14:46:06 +0100 Date: Mon, 2 Dec 2019 14:46:06 +0100 From: Andrew Lunn To: Sam Lewis Cc: steve.glendinning@shawell.net, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org Subject: Re: PROBLEM: smsc95xx loses config on link down/up Message-ID: <20191202134606.GA1234@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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