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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 B5728C43381 for ; Wed, 20 Mar 2019 05:17:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F89F2175B for ; Wed, 20 Mar 2019 05:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbfCTFRN (ORCPT ); Wed, 20 Mar 2019 01:17:13 -0400 Received: from anchovy3.45ru.net.au ([203.30.46.155]:59956 "EHLO anchovy3.45ru.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfCTFRM (ORCPT ); Wed, 20 Mar 2019 01:17:12 -0400 Received: (qmail 30459 invoked by uid 5089); 20 Mar 2019 05:17:10 -0000 Received: by simscan 1.2.0 ppid: 30334, pid: 30335, t: 0.0460s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.122?) (preid@electromag.com.au@203.59.235.95) by anchovy2.45ru.net.au with ESMTPA; 20 Mar 2019 05:17:09 -0000 Subject: Re: regression from: net: phy: marvell: Avoid unnecessary soft reset To: Florian Fainelli , liweihang , "netdev@vger.kernel.org" Cc: Andrew Lunn , "David S. Miller" , "dongsheng.wang@hxt-semitech.com" , "cphealy@gmail.com" , "clemens.gruber@pqgruber.com" , "hkallweit1@gmail.com" , "nbd@nbd.name" , "harini.katakam@xilinx.com" References: <20180925182846.30042-1-f.fainelli@gmail.com> <20180925182846.30042-3-f.fainelli@gmail.com> <5ddf46b1-1959-832d-c6a5-86d8f93dc409@electromag.com.au> <7338bda7-541a-ed20-0afa-f5840c8fd131@gmail.com> <36fe3206-763d-41f8-bb9e-fa3067d78f2f@electromag.com.au> <5e258872-34cf-f82f-bcbc-539a74ba8561@gmail.com> From: Phil Reid Message-ID: Date: Wed, 20 Mar 2019 13:16:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <5e258872-34cf-f82f-bcbc-539a74ba8561@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 20/03/2019 11:37 am, Florian Fainelli wrote: > > > On 3/19/2019 7:34 PM, liweihang wrote: >> Hi all, >> >> I've met a similar issue and sent an email to discuss about it before: >> Question about setting speed and duplex failed after auto-negotiation disabled on marvell phy >> >> d6ab93364734 net: phy: marvell: Avoid unnecessary soft reset >> I reverted this patch and the auto-negotiation works ok. >> >> Florian, could you please read my previous email and give me some advice? > > If you can copy the patch author on that email the next time that will > help expedite things. > > So the problem seems to come from the fact that unless the BCMR_RESET > bit is written, then m88e1121_config_aneg_rgmii_delays() has no effect, > does that sound like what you are observing? > > Does the following work for you (Phil and yourself)? > > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c > index 3ccba37bd6dd..6a1ea4c2042a 100644 > --- a/drivers/net/phy/marvell.c > +++ b/drivers/net/phy/marvell.c > @@ -448,6 +448,10 @@ static int m88e1121_config_aneg(struct phy_device > *phydev) > err = m88e1121_config_aneg_rgmii_delays(phydev); > if (err < 0) > return err; > + > + err = genphy_soft_reset(phydev); > + if (err < 0) > + return err; > } > > err = marvell_set_polarity(phydev, phydev->mdix_ctrl); > G'day Florian, Nope that didn't work for me. But based on that patch and liweihang email I found the following works for me: diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 46c8672..de71aef 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1827,7 +1827,13 @@ int genphy_soft_reset(struct phy_device *phydev) { int ret; - ret = phy_write(phydev, MII_BMCR, BMCR_RESET); + phydev_err(phydev, "genphy_soft_reset"); + + ret = phy_read(phydev, MII_BMCR); + if (ret < 0) + return ret; + + ret = phy_write(phydev, MII_BMCR, ret | BMCR_RESET); if (ret < 0) return ret; -- Regards Phil