Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3037716pxb; Mon, 18 Oct 2021 07:05:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziG8UTBNtuRuvY9KuWOQmgax/4SbXnh4ctplb3vDqEAIHhzHGw3PMTMoSTrzZmttd+61wm X-Received: by 2002:a17:90b:3851:: with SMTP id nl17mr33354342pjb.12.1634565911990; Mon, 18 Oct 2021 07:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565911; cv=none; d=google.com; s=arc-20160816; b=yUWng/kCvCARcMakogVyK994ojzj/ZUSOW5J5r5sJb48g1YJraWSTBv77m1cDTBmkD HIyqJGRs2mr7NegUg61PXDADevMZ9Fz9jtJbbM2jwhbE71AElIvmcpMqQGtY3VWMkgwb 4zrZnuIXffrQv4wmfNbxrxdKlqgjhVCt0GPk91nbbcGx3ybozYJkejAzV634e+uzXmZ+ UiUO2EsF0js6OHAOBD0xbS78KIKInGigu+Iq9KDBggHsmZ7PhDKRWTd3HbO3c+yr+2s9 SGErHDBe4i5qvWs/L785dqukfB4bnugl3fzqReMZnlTghcqwJM1iJnQKkqdQjEBfzJNf HJAA== 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=BcqcRgXZTWkGXcZ02GRnJS8SFWT1BcGBcQ1cdS8aj48=; b=Bvyr6WLDKWgEowE1GSRE27ZkKeCKXKttAg5NY1vxdulRz2EKNAhGJ9ilqng+JQSf9u 3b6iVa0rXbeGe29pawpfHej2V3WTgZNxjBEo/NPOO/wlv1gpCUredWQ49KnNwJvYZ8Ei KAQ5csAwDGXdHU+g8Rb1Ie57bN0ngJ0r0f54v123tA8nerhh8o1rxsbZdNzWqjhKisl+ mswHbCbjGA8WPILsgTXTYwyaE6y8U0gMfVvaIpboY5Ed0sSiwqQ++FgbsNmKVBpk62In abqHJg9KhypXJoVzS25bjZvWbmeFTD2a2WRiBD4LT3CAIutdViY9+EYIESgkGhAGUNM6 Oo5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V1LcwwQd; 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 b14si24074145pfm.188.2021.10.18.07.04.57; Mon, 18 Oct 2021 07:05:11 -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=V1LcwwQd; 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 S234218AbhJROFl (ORCPT + 99 others); Mon, 18 Oct 2021 10:05:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234130AbhJROB4 (ORCPT ); Mon, 18 Oct 2021 10:01:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9D59161A7D; Mon, 18 Oct 2021 13:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564576; bh=IbQGeoLWsxcDZCrfIL+MGeMYAnCWVmunxa6PYbLY0w4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1LcwwQdQ4LcUjPZSox//o29dXBZrpA8ofBQAqFSvq3ho3wVi/KDj/JufYHv6Xvyx 7OpIy+ZfSHkncv7TucFMRdXyVyG1O5xPgLdKTp6FKbN27QHlQFLwQmRATfs4XC2hvf jxuK9SlKyrNsQfojx5RDl3e00o8sQSh/w8IXsUyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maarten Zanders , Maxime Chevallier , Maarten Zanders , "David S. Miller" Subject: [PATCH 5.14 109/151] net: dsa: mv88e6xxx: dont use PHY_DETECT on internal PHYs Date: Mon, 18 Oct 2021 15:24:48 +0200 Message-Id: <20211018132344.218209451@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@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: Maarten Zanders commit 4a3e0aeddf091f00974b02627c157843ce382a24 upstream. mv88e6xxx_port_ppu_updates() interpretes data in the PORT_STS register incorrectly for internal ports (ie no PPU). In these cases, the PHY_DETECT bit indicates link status. This results in forcing the MAC state whenever the PHY link goes down which is not intended. As a side effect, LED's configured to show link status stay lit even though the physical link is down. Add a check in mac_link_down and mac_link_up to see if it concerns an external port and only then, look at PPU status. Fixes: 5d5b231da7ac (net: dsa: mv88e6xxx: use PHY_DETECT in mac_link_up/mac_link_down) Reported-by: Maarten Zanders Reviewed-by: Maxime Chevallier Signed-off-by: Maarten Zanders Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/mv88e6xxx/chip.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -749,7 +749,11 @@ static void mv88e6xxx_mac_link_down(stru ops = chip->info->ops; mv88e6xxx_reg_lock(chip); - if ((!mv88e6xxx_port_ppu_updates(chip, port) || + /* Internal PHYs propagate their configuration directly to the MAC. + * External PHYs depend on whether the PPU is enabled for this port. + */ + if (((!mv88e6xxx_phy_is_internal(ds, port) && + !mv88e6xxx_port_ppu_updates(chip, port)) || mode == MLO_AN_FIXED) && ops->port_sync_link) err = ops->port_sync_link(chip, port, mode, false); mv88e6xxx_reg_unlock(chip); @@ -772,7 +776,12 @@ static void mv88e6xxx_mac_link_up(struct ops = chip->info->ops; mv88e6xxx_reg_lock(chip); - if (!mv88e6xxx_port_ppu_updates(chip, port) || mode == MLO_AN_FIXED) { + /* Internal PHYs propagate their configuration directly to the MAC. + * External PHYs depend on whether the PPU is enabled for this port. + */ + if ((!mv88e6xxx_phy_is_internal(ds, port) && + !mv88e6xxx_port_ppu_updates(chip, port)) || + mode == MLO_AN_FIXED) { /* FIXME: for an automedia port, should we force the link * down here - what if the link comes up due to "other" media * while we're bringing the port up, how is the exclusivity