Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2569422lqp; Mon, 25 Mar 2024 03:00:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgROTombB/mjW4Xda+i6VIawMQQAxJihaqlK1ie0kJ77/WkJ/Fs9qL/eljj8Q6LomaYx5LXxXcRUMj0LwJa+qKSinodPGeUGeVDkGhuw== X-Google-Smtp-Source: AGHT+IGxWQkXdKQaSK6g1jUwXOynaynZBcsTpusL3hyNnFzromhq5FmoG3EvhUj3i+gbp8GPMqbt X-Received: by 2002:a05:6808:1141:b0:3c3:9e0e:ac9a with SMTP id u1-20020a056808114100b003c39e0eac9amr8924268oiu.17.1711360850900; Mon, 25 Mar 2024 03:00:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711360850; cv=pass; d=google.com; s=arc-20160816; b=k1Ofmq6oSgocSD1/HZuCA31Mh7/iaLHb5mFCLiVUqfSjUV1jloZVpjmQdTwDPQ3zNc 5uWP0QBwKCGMQykKKOK9F5lQZ3uIA9m28Z9G0OUDHQqaK3PRGlRArpko4CVzC/xErZ8O GBjnRysTa1fSVS1uDKITOJpQCt4KdBPkk/FfR/PXOagRaHp3IsIl26QR1/ADxrcSXCkY /poHlxbZNc7cl/dhkFUjMuMgEVkNLP3I0piKv8lYKLqRsDZ/wYgQdWS1XiiNbos7Eb/B Gx9oVyUG4wvsHgNI8X5m1XNaONuiFRWgjIBJwF1gWTWl8Sqci6Zuebynm5hRsSWK9q6E 9f9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DZZiZUbNvjpjUhEnpRneUGuCy9da3IfWIftuSHlbXq4=; fh=6M64huhjFzD4hJO9ybDhSpQD2WWPq27/S24PpKpgjUw=; b=kIUWKoLPrPDUuSkAOl85ldFrCcPiI1n9zNHdAcIlagknMb5TtNs3K3elgUStF2C36y knEGxDDY1DXRUVgBeAAyX3ZzWumzQleSZ/xSmZOmr1KAJBJqhpu9wRAtDdz/ZBq0jOTo PLMiT/l7j88Rjy/jWlcRA/CcgUKgOFZaUtKU1726MgiVFPFJY9WDKq9iqyCQDH3JjGQq L/6Jr4YcyKFoRDj8C+dk7Gz3k8cMGKst59LrPqvBX3oSpju/MCi4J4PWgjn7OWqq8RWT YennG3KjgCwFgumKiLvsM6gqOhBOI33EBNg1eXCgBYZWecf0imU4I29XKsqfofN/jtZk 99hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JMzuknSK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 18-20020ac85712000000b00431508e27e5si2585391qtw.705.2024.03.25.03.00.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:00:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JMzuknSK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115992-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 86FFB1C32175 for ; Mon, 25 Mar 2024 10:00:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 454E539A0CD; Mon, 25 Mar 2024 03:05:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JMzuknSK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF833238F1C; Sun, 24 Mar 2024 23:18:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322330; cv=none; b=NnIJx5u7S8ofqDt3YZ28Zzj++WLpR5USdBGN7z+o7ptMpAUg9iH9yFvcwpMCWhy/tuOSqIn59h2WvFvQ87uVnUeCEDXtU/RTy9FrCeY1cgt85mmq7jqmOeIHuJDQffJDYY5meXDsm15P+YUpEOU0UaYeI1HgrVxrux7vBgr04kw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322330; c=relaxed/simple; bh=ZFgXoB+8n6Zrm64r3QBen7eSSIdqIg53Ge4PVdKtACA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RBjSFSlG1BTHRhffnut/ShjalukJgKhM1jJSFMKM8TEUeDQukeEEFTECuyKfMoF4k/21aDVQDydqY1sJw+9SgLL4siVAtW2m++2lXW9WC5qHepl34szFianVWp/sfkxBvT0rlg63KzrYGvbkWFS7aPsg7zneh3H94EUypasRTLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JMzuknSK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECD40C433A6; Sun, 24 Mar 2024 23:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322330; bh=ZFgXoB+8n6Zrm64r3QBen7eSSIdqIg53Ge4PVdKtACA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JMzuknSKL+j+E6IpgSkaI8DOeNL/++6eu1Hpng/NDWKbENKALeBxCHDqlDF9RIlu8 dZmdRX12O5kkAxW5R7ooAYYHNav0LOdl+5KedkV2jx7i3cqaPFM10umkOeJLC+Orjb STuqUIdjWewR2xe6kndM+sKoUf8Ff6B14A0pOx69+7v7W/e1eCV0zFKVFm9zwAkgIh vUlaNlhwnqgHu8YT4AMfk6y4LjX2y+7JAtpORNrQpxM75j7As6AJKvAYkRyt+maxUo /C+QQWqins5j+EtXryksxZ6wPxJUuRyntu6UXUsAalYQI4/Luim77oiY7e+4YfkLp2 aSQ7BYF84go/w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Golle , Mason-cw Chang , "David S . Miller" , Sasha Levin Subject: [PATCH 6.1 413/451] net: mediatek: mtk_eth_soc: clear MAC_MCR_FORCE_LINK only when MAC is up Date: Sun, 24 Mar 2024 19:11:29 -0400 Message-ID: <20240324231207.1351418-414-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Daniel Golle [ Upstream commit f1b85ef15a99f06ed48871ce933d591127d2dcc0 ] Clearing bit MAC_MCR_FORCE_LINK which forces the link down too early can result in MAC ending up in a broken/blocked state. Fix this by handling this bit in the .mac_link_up and .mac_link_down calls instead of in .mac_finish. Fixes: b8fc9f30821e ("net: ethernet: mediatek: Add basic PHYLINK support") Suggested-by: Mason-cw Chang Signed-off-by: Daniel Golle Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 17e6ac4445afc..fecf3dd22dfaa 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -561,8 +561,7 @@ static int mtk_mac_finish(struct phylink_config *config, unsigned int mode, mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); mcr_new = mcr_cur; mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE | - MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK | - MAC_MCR_RX_FIFO_CLR_DIS; + MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_RX_FIFO_CLR_DIS; /* Only update control register when needed! */ if (mcr_new != mcr_cur) @@ -610,7 +609,7 @@ static void mtk_mac_link_down(struct phylink_config *config, unsigned int mode, phylink_config); u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); - mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN); + mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK); mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } @@ -649,7 +648,7 @@ static void mtk_mac_link_up(struct phylink_config *config, if (rx_pause) mcr |= MAC_MCR_FORCE_RX_FC; - mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN; + mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK; mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } -- 2.43.0