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,