From patchwork Sat Apr 22 11:48:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 86590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1653273vqo; Sat, 22 Apr 2023 04:55:25 -0700 (PDT) X-Google-Smtp-Source: AKy350YUelq9Z2KghyaGJYLeQvtvvDs5GHvilz5ls2egA6yxttJ2ZpvsJye1Z1LR161HYeMGmkKP X-Received: by 2002:a17:903:284:b0:1a6:be37:22c3 with SMTP id j4-20020a170903028400b001a6be3722c3mr7319262plr.67.1682164524660; Sat, 22 Apr 2023 04:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682164524; cv=none; d=google.com; s=arc-20160816; b=Ec2kv0QxUxgsXLWKTTDvWNfrhpjhDkD/yE+7U91ZivoqmHu2/fefwh7PL8MooZori5 RD55zNCMgV6/q2hA0hd53ls/ggQBSl12Q9/bsQg7vYt6mpGcE6iezozRtiyz0XTMOYgq HM+UqZsekuLKCcG1VE6UxhMY6doXhE9DpBWETgHMxUHnKrcgLZvw85i3G63dqWa8ankW rBNadaNBx7g/QqAi+aFXaK/I6rTSI9NtoZLM4Q1YpocE1gMgEUDHAe8j2hA7St+iatrn yFvOgtAMQ38DqsqgjXdfFMurYND5bCHMe7oElVQFDYLwb8ZsIeA4Q1V8Xy/6TFD/Zzz6 jikA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=U0OP4cxmvRIRQloik5rVQaaqL3GdttPr84OkqgTdvVQ=; b=IsQYWjpMr6whbyCBDmH5Hv9mJil12rI9aOcENTbxFd1vAa92PBIGIjWdf0KyIBgJLI QCqZL7Cpj/yqFzBdXnx9D1KSlkBeU9n5SsjHKCiSafWgJ8qPLD+27YuEF8wbt9HDyiDX iPrCokRP5Tr008VAm1iPCNbFFmDZo+PubqHpnGUqi8eYjzxxCA47Hu0McT22ePtnz2HN lT26IxBaEzbNxZ/wtR9wIPZr//KnBzz8beQd6hbT18mdz+/OzOv8MvJ1S50oq6EEhOI+ SXay9wUE8d3S23IrqlgXs66h0C2L68tI4/CSRQ9Ru84wgVYh34lCQXmzzFCdU1JpQPIx 5rww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a170902d4d100b0019a96849d6dsi7273391plg.605.2023.04.22.04.55.11; Sat, 22 Apr 2023 04:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbjDVLtT (ORCPT + 99 others); Sat, 22 Apr 2023 07:49:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbjDVLtJ (ORCPT ); Sat, 22 Apr 2023 07:49:09 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4912826AF; Sat, 22 Apr 2023 04:48:54 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1pqBjY-00085G-2M; Sat, 22 Apr 2023 13:48:52 +0200 Date: Sat, 22 Apr 2023 12:48:48 +0100 From: Daniel Golle To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Chen Minqiang , Chukun Pan , Yevhen Kolomeiko , Alexander Couzens Subject: [RFC PATCH net-next 4/8] net: phy: realtek: disable SGMII in-band AN for 2.5G PHYs Message-ID: <87f666009413e8c6edac1ba30533b8f97a4fee76.1682163424.git.daniel@makrotopia.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763877348997190903?= X-GMAIL-MSGID: =?utf-8?q?1763877348997190903?= MAC drivers don't use SGMII in-band autonegotiation unless told to do so in device tree using 'managed = "in-band-status"'. When using MDIO to access a PHY, in-band-status is unneeded as we have link-status via MDIO. Switch off SGMII in-band autonegotiation using magic values. Reported-by: Chen Minqiang Reported-by: Chukun Pan Reported-by: Yevhen Kolomeiko Tested-by: Yevhen Kolomeiko Signed-off-by: Daniel Golle --- drivers/net/phy/realtek.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 9b477dd17fa56..f97b5e49fae58 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -883,6 +883,7 @@ static irqreturn_t rtl9000a_handle_interrupt(struct phy_device *phydev) static int rtl8221b_config_init(struct phy_device *phydev) { u16 option_mode; + int val; switch (phydev->interface) { case PHY_INTERFACE_MODE_2500BASEX: @@ -919,6 +920,13 @@ static int rtl8221b_config_init(struct phy_device *phydev) break; } + /* Disable SGMII AN */ + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7588, 0x2); + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7589, 0x71d0); + phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, 0x3); + phy_read_mmd_poll_timeout(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, + val, !(val & BIT(0)), 500, 100000, false); + return 0; }