Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3024091pxb; Mon, 18 Oct 2021 06:49:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYrJ3abDDhe+EdCK9gh2dTJdfUp49Oa85UTnKN2meDrp6Uj9cFGmt/+MmvqPRPCq4cNRdO X-Received: by 2002:a17:90a:4306:: with SMTP id q6mr33914164pjg.17.1634564969112; Mon, 18 Oct 2021 06:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564969; cv=none; d=google.com; s=arc-20160816; b=GHHTC8MrRFpXfDTR+foAYiKR4VpHYyFBpPhon+VpP+RI7nNOuOjGm4RTg5jK1h2aQ8 z5z+3a0HH8q9K9Ekgmz8r786pq+IIOB3dUoz/YLTDG6ABbmywdaahCSF7GWHeq0CZ9Bd tNGscyV52y1rZBNZx2ZDJKQscRoI5dW3T4k73nFPc0g1iHyjWzKoMIErolDtm/bWZ7KD TD/0xnRRz11Izpf7K49EyrU0ggFt0QO4HkaMTxd1RLAsn0+ZdhVuYXFI1+AxI8XksHHR koWzEUeCNjg243fCK49Y4Zf5IDkcfSKW2Y/sTF+KFH4pnLSslxrcv+NHA/trQMUXU2k+ R+oA== 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=9ZLybITrIkCM4VZEkKtcEne/KiR7WCRghpciKVu2h/Y=; b=YmQV0I7O4muFBUM2lnGxJq5N7fn1aTFVZT88Y6u8MEXw9taJYWt4gMuzG3zSj5mn28 XCzUCISDZFkgRepei26LewsXKxN5bfaLzTksWUK3scrtYyJ3sxU8T+B67Y0NtMCly0az Y4SuBniha1R8plHwctUGEx2Ueg035L9SszRCN4vk09DABcVtelpGJ88o7+8bzxnDg5n7 /uAeZc4u3qGw7qwv1c2DDh/nOsiICRMLNBE8jPGjnhVU2wd+3SlZs0HxdyupLBkzeXtC etlRPZ+OBnEYZzHfZVjt43TDn272UpwtSTWJWYLwcdZw7YlFnIMjI9Btbsnv9x+OkOQt VZOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TWSLJxL8; 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 x22si20218564pgj.320.2021.10.18.06.49.10; Mon, 18 Oct 2021 06:49:29 -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=TWSLJxL8; 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 S232656AbhJRNts (ORCPT + 99 others); Mon, 18 Oct 2021 09:49:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:50006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233721AbhJRNrz (ORCPT ); Mon, 18 Oct 2021 09:47:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 30AD961362; Mon, 18 Oct 2021 13:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564201; bh=yLn3k5DtQT0PdlV2+BI5NbqHLvBYEVN2RQCrVWRpfyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWSLJxL8xgyqoiBdSGHqet9LK2Fnw3HUkmSot1WLSkc4t0XrAkiUkvmB9LioYvmFS 93k7KCppBFK0DodON1muXMOrzg2suL9h98DNoyo2/nUSnTqWbHQ1wrY96E5WmExj9W NqONTN59EU4CFVulR7BTuZGJ6Y3iIbz+vzArUXvo= 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.10 103/103] net: dsa: mv88e6xxx: dont use PHY_DETECT on internal PHYs Date: Mon, 18 Oct 2021 15:25:19 +0200 Message-Id: <20211018132338.204807441@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132334.702559133@linuxfoundation.org> References: <20211018132334.702559133@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 @@ -726,7 +726,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_set_link) err = ops->port_set_link(chip, port, LINK_FORCED_DOWN); mv88e6xxx_reg_unlock(chip); @@ -749,7 +753,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