Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4631731pxj; Wed, 12 May 2021 09:38:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZtWTy6YHoS3dqIDKlzIhl2inD3/0jOgh3essDYVHuSVKP58uDsda9FyjKxBZXx6EY1o0w X-Received: by 2002:a4a:dc5:: with SMTP id 188mr28548266oob.80.1620837435507; Wed, 12 May 2021 09:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837435; cv=none; d=google.com; s=arc-20160816; b=i4MdUgR1icam0vn5anO+On6m2rCfD2aeshB7c4cKNeFzFQmPaoOOmdy6qnujateHpX DC/nVqXBPH896UB6JbiRmK4ClzRl08GUh3eVDV5H60tVp+afKG1LZL0yiDIX6j6fVRtb 64ctDuC2RnXoijeFv5ZKW+ezWUtg51MQztNFB9ovGZ8Ds2qjv/JbIVr2tjjTZZx+mO63 fe8gt/C1kGwMhJy4vqoovcAPtp+Bv7zuIWZOInTye0UPVcFEBKxx2PstcslFPrVbpn8V 2lPCN7k/WALPHrFGiq2ULokDR+xXCN4HM2kb1W1Bm6AsETU/OaI1nzO+wJeC4XhQuQsJ fMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=27TuCufcgvzoRrgSg/i56PzAaDOvE60RuQ4PoDJxcwQ=; b=wH21ZmA4Sd4L7p/+YcgD6ZBSQRKfNgOrVysDBmBNNQuiVSYYJ4N3UqyPSOFgH0X4W8 b/lAFXm2T0gBlR0x8xrZtCI39NlsHltFdR1r/tHTh9ABuGJ4y4Bc31Znaq4CFwQ62uC4 mvX9EUJgjtvAubP3SnBNDqNLvNC5L7pZF/IH+Pa7Pig1d7WN/PxSbftdlvr+KEKDjbLy ba/AND+4+pnhQJ7cmPqm5VJkntCvD3v9jqX4yd+zmfWApDKeGAljhiSlZ6Ff8lF2Xb4G pLd207fuVp/OTZISqIpWS5nVydcF68+r1EJV7zSAzWLFZVWIvYNHFrIGpbAHfjdFfD9w 4W4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M3mDqjov; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si403146otp.132.2021.05.12.09.37.02; Wed, 12 May 2021 09:37:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M3mDqjov; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242925AbhELQgJ (ORCPT + 99 others); Wed, 12 May 2021 12:36:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:39906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234432AbhELPoW (ORCPT ); Wed, 12 May 2021 11:44:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBBB861C8E; Wed, 12 May 2021 15:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832959; bh=DZ/XnnmeEQAiNYxiBQXimh04RwnUmfSV/6gyphyJMgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3mDqjoveNLXC9rQixYa78k/jBUINL5wRdkMfmbTDb9R7Yt0BbcygPgQ5Lxcp/v/K W4u/seZi/okD3KFm738qeFA49X84oXzUaEDXc/d7M//8CivTim2b0Eq9uybwoRjrCC 4svDcycsd4gxRy+WlBx9oyCZ0dx1ON3JZWnSfKpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Kochetkov , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 493/530] net: phy: marvell: fix m88e1111_set_downshift Date: Wed, 12 May 2021 16:50:03 +0200 Message-Id: <20210512144835.958855987@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Kochetkov [ Upstream commit e7679c55a7249f1315256cfc672d53e84072e223 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 8e2ef7d67bff..91616182c311 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -861,22 +861,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, -- 2.30.2