Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3800541pxb; Mon, 4 Oct 2021 09:52:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmtfQxsmZXhez7fmCoab3Dr5zjEeM1i5pAs5mWXVdDX5WKuwcoqdOyu/y1m7oGBBLvtm6r X-Received: by 2002:a17:902:b48d:b0:13e:8e7e:24d8 with SMTP id y13-20020a170902b48d00b0013e8e7e24d8mr634011plr.55.1633366362896; Mon, 04 Oct 2021 09:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633366362; cv=none; d=google.com; s=arc-20160816; b=XI2z0lCn1hrLAcZ/AhmPgmPnNK3mBNTxMFT7qp/sVil3PCKXOUBQOjAhKyqdn8Oejf GtKmAvSMvMg5B1PNkccXK+dr0ES/X6F4+xE2q6K1dfG/Sam1UPlCXn1gAtvkKCIzMHk6 I/6UfTOnUILZGgk0tBSXR5P3+jb9WyHzQqFUXci99mXlWy0dnCMEvc0kzAPc923EZD+C nMTlgW5KKfVu/DYKq91/GzOH63+ZSmL82r3h4E3aCdrGLMMJ1gBCzbuF4MKsbCMgdea5 iY9Ry+ejlGuC+mb/7MUhpIczJaV+qI2x5JdT0UQm4p+wWeasjSmcUl/J7QY6LkklSZxI cZEg== 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=9+p/dVY3p/nUj2ExsJyqcDUjKl5FZeyvK9tsI0s5/9A=; b=FV4ZJxjv8aGtMj2pxEtIX4TJrgYrs4rGuMpqLoSdbb6SCfiQvUb3I56NzDDO1lOPMC JpI0R7fNYe/F9jHNhsc1XSTvLE80otrqPYq7r5eroGJrSYInL/pi3gImRqs4U2Bc7wS5 lXQ7mpItiIvwzTNleWa9fKOvGpf07+qSNACxYR0I0K/tdcCMoZNczVbDy6fzHl2ccud+ IuUyCiMualjF593M//yQBd0YTBDypHWjDOpWaPmPeItUtyUoWiuz+plW1xv0JJQ8rm5k XQ361sQa8ePoLlNHWGWYqykYoeLFPont7+NuiGz5ZrboU98E3Xbv1dH2MCMM2xo9BLNK WPxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KlxshnYO; 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 t37si18784088pgl.46.2021.10.04.09.52.25; Mon, 04 Oct 2021 09:52:42 -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=KlxshnYO; 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 S238437AbhJDNk1 (ORCPT + 99 others); Mon, 4 Oct 2021 09:40:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:51850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238475AbhJDNif (ORCPT ); Mon, 4 Oct 2021 09:38:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CC7663250; Mon, 4 Oct 2021 13:17:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353453; bh=+C11mEzkqjtrmwWudTr03u0W/xZCZCn7y9Qbghxw7qY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlxshnYOpojoaMQZKBMXuHVSb0XocBEzVMwaWFcDCJOTSCA2sQCQ8e4JQ7YT/GgjW jYM2mHz9SL4H5XhOfhFzUOkah+lTCVFj3n72DWW3lTS5vJ8KmakmWBHzFDRYLCF/WV /412b95xlUY0RhhpHq3xeTlQ6GDANtuUQxKa1vGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Pavel Machek (CIP)" , Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 101/172] net: enetc: fix the incorrect clearing of IF_MODE bits Date: Mon, 4 Oct 2021 14:52:31 +0200 Message-Id: <20211004125048.245955940@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@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: Vladimir Oltean [ Upstream commit 325fd36ae76a6d089983b2d2eccb41237d35b221 ] The enetc phylink .mac_config handler intends to clear the IFMODE field (bits 1:0) of the PM0_IF_MODE register, but incorrectly clears all the other fields instead. For normal operation, the bug was inconsequential, due to the fact that we write the PM0_IF_MODE register in two stages, first in phylink .mac_config (which incorrectly cleared out a bunch of stuff), then we update the speed and duplex to the correct values in phylink .mac_link_up. Judging by the code (not tested), it looks like maybe loopback mode was broken, since this is one of the settings in PM0_IF_MODE which is incorrectly cleared. Fixes: c76a97218dcb ("net: enetc: force the RGMII speed and duplex instead of operating in inband mode") Reported-by: Pavel Machek (CIP) Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index c84f6c226743..cf00709caea4 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -541,8 +541,7 @@ static void enetc_mac_config(struct enetc_hw *hw, phy_interface_t phy_mode) if (phy_interface_mode_is_rgmii(phy_mode)) { val = enetc_port_rd(hw, ENETC_PM0_IF_MODE); - val &= ~ENETC_PM0_IFM_EN_AUTO; - val &= ENETC_PM0_IFM_IFMODE_MASK; + val &= ~(ENETC_PM0_IFM_EN_AUTO | ENETC_PM0_IFM_IFMODE_MASK); val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG; enetc_port_wr(hw, ENETC_PM0_IF_MODE, val); } -- 2.33.0