From patchwork Thu Apr 22 10:46:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kochetkov X-Patchwork-Id: 12218287 X-Patchwork-Delegate: kuba@kernel.org 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 15DD0C433B4 for ; Thu, 22 Apr 2021 11:14:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC64E6145A for ; Thu, 22 Apr 2021 11:14:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236014AbhDVLOt (ORCPT ); Thu, 22 Apr 2021 07:14:49 -0400 Received: from fallback24.m.smailru.net ([94.100.187.223]:43262 "EHLO fallback24.mail.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235634AbhDVLOs (ORCPT ); Thu, 22 Apr 2021 07:14:48 -0400 X-Greylist: delayed 1726 seconds by postgrey-1.27 at vger.kernel.org; Thu, 22 Apr 2021 07:14:48 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=DT6/s8bWx6dRQ+iAwrdGoXzlyGjYlSDA4ycFx/PkTWI=; b=gAmhVH94kq+sCmX6UNt5LW2wGORRCoEWsg1YnLhriXBj9v0IQQxV1xDX3bSpRZ+5Xx0J3z3ELG0/LZ7IwDu0DVJnkD5CslmgnhDeyrhnRs9JgO7BK/23vb3rzt1v+VhEGYOHDQRl2ggQKoqzLGgfSAwwpSXmuaecc5euN2P4HVo=; Received: from [10.161.117.32] (port=53868 helo=smtp3.mail.ru) by fallback24.m.smailru.net with esmtp (envelope-from ) id 1lZWpq-0000yu-95 for netdev@vger.kernel.org; Thu, 22 Apr 2021 13:45:26 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=DT6/s8bWx6dRQ+iAwrdGoXzlyGjYlSDA4ycFx/PkTWI=; b=JxBlh/lgPrQ/9w0uwy8+Ox2fKtbVLTcaUdr0j6llJ9lsBBJY253YrYCVyR1Qe++Mqz7hNFRp7PWDnYgVnBePvjnzDxOc3kLbn7c7tP5EvVg9x+cxQR0/RHE6sC8WLmOyX2AvrJB2RLLN2CGMVTD4QDrlu9kfI3wnLl82MRKrZ/4=; Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1lZWpm-0000ww-5e; Thu, 22 Apr 2021 13:45:22 +0300 From: Maxim Kochetkov To: netdev@vger.kernel.org Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, f.fainelli@gmail.com, Maxim Kochetkov Subject: [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift Date: Thu, 22 Apr 2021 13:46:43 +0300 Message-Id: <20210422104644.9472-2-fido_max@inbox.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210422104644.9472-1-fido_max@inbox.ru> References: <20210422104644.9472-1-fido_max@inbox.ru> MIME-Version: 1.0 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9DD7F0C977691F2B1E5FF39DF8BC957E24B746F5234D6004C182A05F538085040D00A0D1DAB6F3832B4334DEFBD60714524FAF12F9C51DF36C6D148D8999858FF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7FCFCB92DA8654BB0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063786D6A7D810B9582D8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2B8648DB7A7F4F3000FFCDDABCCF43407BE5E7F44427E1A0ED2E47CDBA5A96583C09775C1D3CA48CFED8438A78DFE0A9E117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658359CC434672EE6371117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF10846442021A9C29BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6F7EC8CC465A83DA33AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735D05AD665AB97B35DC4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831906A50FD69B36923008EF5BE183B7CB3 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C3E7AEEB2EA3DACB398D68DDA0C7E1E9E97C85A34EB8F7D649C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF46906D4753B15FC0699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D341B5517184E88C1BD2369AD379DED1938BEE4E2F0937DBADCA276E4011CE8B8C9F098B238FAAB17891D7E09C32AA3244C51C7476C4D883DEA390E901556702BACA995755A1445935EAD832FF50B3043B1 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojd3ipC3Yuge3Auu2zKhT5Fg== X-Mailru-Sender: 11C2EC085EDE56FA9C10FA2967F5AB24CCAA6BE7B7761317166E5606519823F20F6604896108845BEE9242D420CFEBFD3DDE9B364B0DF2891A624F84B2C74EDA4239CF2AF0A6D4F80DA7A0AF5A3A8387 X-Mras: Ok X-7564579A: B8F34718100C35BD X-77F55803: 6242723A09DB00B44BADD4F5929CCB15E536D9810E242AD3F3B678AD184A8ACF049FFFDB7839CE9E5F41FB687843EBAB06F00E08F85C521E21C237ABC3298BF45C023F79A8AA4BFE X-7FA49CB5: 0D63561A33F958A56523CB669E9E4432734CC897D80F37DBA4D2052C2575E1C58941B15DA834481FA18204E546F3947CEDC5C53491350371F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637DC24B783B16D3BB1389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F790063740BA071C1C7EF6BBD81D268191BDAD3DBD4B6F7A4D31EC0BEA7A3FFF5B025636AAAE862A0553A39223F8577A6DFFEA7C565C1E6824D8037B43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C3E7AEEB2EA3DACB3709DCBF4CC5428C8E238C1E0F2B938C09C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojd3ipC3Yuge3S0MSpsAm/Tw== X-Mailru-MI: 800 X-Mailru-Sender: A5480F10D64C90053DB5E8752E58C64B6107DA3D8362899CD368D2C4C45289A11BE96DBAF4D557C5EE9242D420CFEBFD3DDE9B364B0DF2891A624F84B2C74EDA4239CF2AF0A6D4F80DA7A0AF5A3A8387 X-Mras: Ok Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Changing downshift params without software reset has no effect, so call genphy_soft_reset() after change downshift params. As the datasheet says: Changes to these bits are disruptive to the normal operation therefore, any changes to these registers must be followed by software reset to take effect. Fixes: 911af5e149bb ("net: phy: marvell: fix downshift function naming") Signed-off-by: Maxim Kochetkov Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index e2b2b20c0dc5..5fd5f4986644 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1036,22 +1036,28 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data) static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt) { - int val; + int val, err; if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX) return -E2BIG; - if (!cnt) - return phy_clear_bits(phydev, MII_M1011_PHY_SCR, - MII_M1011_PHY_SCR_DOWNSHIFT_EN); + if (!cnt) { + err = phy_clear_bits(phydev, MII_M1011_PHY_SCR, + MII_M1011_PHY_SCR_DOWNSHIFT_EN); + } else { + val = MII_M1011_PHY_SCR_DOWNSHIFT_EN; + val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1); - val = MII_M1011_PHY_SCR_DOWNSHIFT_EN; - val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1); + err = phy_modify(phydev, MII_M1011_PHY_SCR, + MII_M1011_PHY_SCR_DOWNSHIFT_EN | + MII_M1011_PHY_SCR_DOWNSHIFT_MASK, + val); + } - return phy_modify(phydev, MII_M1011_PHY_SCR, - MII_M1011_PHY_SCR_DOWNSHIFT_EN | - MII_M1011_PHY_SCR_DOWNSHIFT_MASK, - val); + if (err < 0) + return err; + + return genphy_soft_reset(phydev); } static int m88e1011_get_tunable(struct phy_device *phydev, From patchwork Thu Apr 22 10:46:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kochetkov X-Patchwork-Id: 12218293 X-Patchwork-Delegate: kuba@kernel.org 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 9A07CC433B4 for ; Thu, 22 Apr 2021 11:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59E7D61406 for ; Thu, 22 Apr 2021 11:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236040AbhDVLVz (ORCPT ); Thu, 22 Apr 2021 07:21:55 -0400 Received: from fallback22.m.smailru.net ([94.100.176.132]:48492 "EHLO fallback22.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235882AbhDVLVy (ORCPT ); Thu, 22 Apr 2021 07:21:54 -0400 X-Greylist: delayed 2151 seconds by postgrey-1.27 at vger.kernel.org; Thu, 22 Apr 2021 07:21:53 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=mzPEIVGg4pAmX+hu6DFe/xtS4mul7PUbnYXjVimxWyE=; b=TTvYdB5JnxqCdSGwJ4mjxgmZmlXJlxiTwmNllBvlTZRFC9CaIviojlX+pfL3DbgW+cr6g77ZHriEQLnNz+PQesoTNy6eo5vl5yj9/gC6pCfozaVEexwkd0sDkqC8UKsdpNRqRudgtJHTp3px9ZoY4a4kx/5VZFWe4h8KM1qbIM8=; Received: from [10.161.117.32] (port=47942 helo=smtp3.mail.ru) by fallback22.m.smailru.net with esmtp (envelope-from ) id 1lZWpq-0005zm-Om for netdev@vger.kernel.org; Thu, 22 Apr 2021 13:45:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=mzPEIVGg4pAmX+hu6DFe/xtS4mul7PUbnYXjVimxWyE=; b=oQOpNb9mX/7WrT22UviJ+n66c+7lLXb9dzn1QzgRf6LghXst5jueSD6XVwE1lOMaEBSXXQp1Uyu0jvFr+jeZZ/OtMYOg5NFw3axtOnMEcmTq927ZZGMoJ2ogLKMqKK4+J9frt/pkDvnsnCcQvSFimiHEqH1vuTSQvExjncswcKw=; Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1lZWpn-0000ww-1d; Thu, 22 Apr 2021 13:45:23 +0300 From: Maxim Kochetkov To: netdev@vger.kernel.org Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, f.fainelli@gmail.com, Maxim Kochetkov Subject: [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift Date: Thu, 22 Apr 2021 13:46:44 +0300 Message-Id: <20210422104644.9472-3-fido_max@inbox.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210422104644.9472-1-fido_max@inbox.ru> References: <20210422104644.9472-1-fido_max@inbox.ru> MIME-Version: 1.0 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9DD7F0C977691F2B1E5FF39DF8BC957E24B746F5234D6004C182A05F5380850402F2A7E56AB5F8DDFD8462E71622F5C19F31A87DEFC60094CBD3B719FE5D5640A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C6068CE86C2B75F5EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637329F9579A0E72DCC8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B21DDDE7573B2463322803994895D47BE979373A8315E4CF65D2E47CDBA5A96583C09775C1D3CA48CF17B107DEF921CE79117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7494AAEFF9D85BA3DD32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C021F5160717EECE6CCD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831906A50FD69B36923B24383D33A8A987E X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C3E7AEEB2EA3DACB38494A9F188F785D150B539352C4134069C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF46906D4753B15FC0699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3468964757141B82E0CB64017E9DD7B00B870662A3D8F094F9EEB14A8953F0AC9E57206CBF9D28EAA51D7E09C32AA3244C8D31004AF247107B02573F6A41889BB7D9ADFF0C0BDB8D1FAD832FF50B3043B1 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojd3ipC3Yuge3w9tnHBcT4Fw== X-Mailru-Sender: 11C2EC085EDE56FA9C10FA2967F5AB24FF0E9E4A50476AF5166E5606519823F2CBED7222F07C268EEE9242D420CFEBFD3DDE9B364B0DF2891A624F84B2C74EDA4239CF2AF0A6D4F80DA7A0AF5A3A8387 X-Mras: Ok X-7564579A: 646B95376F6C166E X-77F55803: 6242723A09DB00B44BADD4F5929CCB15E536D9810E242AD34A4A4DAE34B9811F049FFFDB7839CE9E5F41FB687843EBABC87C54600BE446EAE5111D6A2C269B5F420BA7EA0E445CEE X-7FA49CB5: 0D63561A33F958A56523CB669E9E4432BE09D7CF1775943F66C8AC0F504746A68941B15DA834481FA18204E546F3947CEDC5C53491350371F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637DC24B783B16D3BB1389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F790063740BA071C1C7EF6BBD81D268191BDAD3DBD4B6F7A4D31EC0BEA7A3FFF5B025636AAAE862A0553A39223F8577A6DFFEA7C565C1E6824D8037B43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C3E7AEEB2EA3DACB37AA83F8EDA6DD3EE9DC7B1F20CB95BFC9C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojd3ipC3Yuge3vyNG3E5hvsw== X-Mailru-MI: 800 X-Mailru-Sender: A5480F10D64C90053DB5E8752E58C64B6107DA3D8362899C82189DEDF2630B47174BD9EFAF5FAE7EEE9242D420CFEBFD3DDE9B364B0DF2891A624F84B2C74EDA4239CF2AF0A6D4F80DA7A0AF5A3A8387 X-Mras: Ok Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Changing downshift params without software reset has no effect, so call genphy_soft_reset() after change downshift params. As the datasheet says: Changes to these bits are disruptive to the normal operation therefore, any changes to these registers must be followed by software reset to take effect. Fixes: 5c6bc5199b5d ("net: phy: marvell: add downshift support for M88E1111") Signed-off-by: Maxim Kochetkov Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 5fd5f4986644..a61fde7013bd 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -978,22 +978,28 @@ static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data) static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt) { - int val; + int val, err; if (cnt > MII_M1111_PHY_EXT_CR_DOWNSHIFT_MAX) return -E2BIG; - if (!cnt) - return phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR, - MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN); + if (!cnt) { + err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR, + MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN); + } else { + val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN; + val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1); - val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN; - val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1); + err = phy_modify(phydev, MII_M1111_PHY_EXT_CR, + MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN | + MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, + val); + } - return phy_modify(phydev, MII_M1111_PHY_EXT_CR, - MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN | - MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, - val); + if (err < 0) + return err; + + return genphy_soft_reset(phydev); } static int m88e1111_get_tunable(struct phy_device *phydev,