Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4630698pxj; Wed, 12 May 2021 09:37:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRCG2kqh1xHiyVi6uhBtMPoztUBnjbnVN5ALEPRqNtDNvppjNk0d6wuEeX/HykjCXJA8li X-Received: by 2002:a05:6830:17cb:: with SMTP id p11mr32899064ota.283.1620837427964; Wed, 12 May 2021 09:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837427; cv=none; d=google.com; s=arc-20160816; b=MNkd0yWAIIX1eNz/QHcyXXbgw6ac0CN6hMwWbm96X6a+FOCmxBDWE8sV8M20cYlbHh deCZcOqTSdGLql/wONGdPoMBl8JGZmAoXJFCVal3o4PVd61xONjXh6cAQdwgT+Riz6pA KKwSt1ptMH2bYA468GToPt6cZrM/m4GNJRjsst0fx/pBXVoamjjt0y7h+u3SaGdvQmmD 1s+zlZan22woHPhJd0V9OT4qwn8vD3z6kYXV7mdg+e41WbHHKqkYEz7sNonNGvBs5E8N fylsTFgyDyyLGHVZxCynry96/bWZlQV++7C9JJRQX7EBvpAeRD13Ht3f8qLVM6Py9T9F M4+g== 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=uJWbg6bhvk+xlQwOek10oIM4eDqHqtEb6HkLVGEXELA=; b=knvZj2dE1cRmcnwaq1mmBr8bW2S/zDDagMFTkYserSk5SsCF5c7mrP5hJWrMAN0ZTm 4MS4/NB3zdKoI0WYtFhfhyAo7r/6e45lrVxYs9dxxFu5AvlB/zK98Gepvft5qp6NtMbH gi2v4g9CsLJVxjxgyW/XVLzBHu4UrtV0tQWcUqTCtaM9tKVcgXRTsJ5BOefLt6JTTCU7 r19QEA3DnAD1aNTxmw3YiyZOBPPGyxHZ8UN3BNn2pz4C/1bhNNwm79rJee8IOoeF24fb jTpJX9flSTHHuRKyEaMfzXuyCFuNCI8cMNPAfcKR3BHsW9z+5ybOs2dNP9smZTkw5arm tsxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KYbOxCs/"; 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 s26si410682otr.238.2021.05.12.09.36.53; Wed, 12 May 2021 09:37:07 -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="KYbOxCs/"; 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 S242908AbhELQgG (ORCPT + 99 others); Wed, 12 May 2021 12:36:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:43610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234268AbhELPoK (ORCPT ); Wed, 12 May 2021 11:44:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 725C861C8F; Wed, 12 May 2021 15:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832957; bh=qlfw+mrd44xq9zaEMAvfAROavH2v4waC04HPLa8lgpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYbOxCs/iVziTK1zgcn37OAAiEKs/XTvWl0F2D+mmYrrbQQ3ytrkTBLvNcwzf2zDO jWOuz75auyhGUaXWIbV9VqHObWiD1pvinyXSJzcEJmOPiDJWVaMf77YMJrWwfQooyr yV+MGWT0ot5KcMGhriLkjLkzKlK3hZf4T5DBDiSc= 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 492/530] net: phy: marvell: fix m88e1011_set_downshift Date: Wed, 12 May 2021 16:50:02 +0200 Message-Id: <20210512144835.925002786@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 990875b299b8612aeb85cb2e2751796f1add65ff ] 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 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 823a89354466..8e2ef7d67bff 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -919,22 +919,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, -- 2.30.2