Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3398683rwr; Sat, 22 Apr 2023 04:50:14 -0700 (PDT) X-Google-Smtp-Source: AKy350ZcxRlmv9t00j0mLb+V1QJ0Xnzh9JTPhxEaNlboijjhbAZ1cCZziXSMyxebPd9tRmC9by5x X-Received: by 2002:a05:6a20:3d20:b0:f2:15f7:a7f8 with SMTP id y32-20020a056a203d2000b000f215f7a7f8mr9673264pzi.2.1682164213793; Sat, 22 Apr 2023 04:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682164213; cv=none; d=google.com; s=arc-20160816; b=Y2o2Log3ZZi56pegohqT4CvOdO6wY2DZjAKzBDbM/jwz5Ao3JvH+BKEUw22MuXOIFS NhRF1jSJVulZhhYmWvCAVhVfy40TanAu3SinpEOswNgPcjnU+WYlM0OZBffL+o/Q2mz7 k5NjXFsMUbqczdL/BB12MJyLZZHT53Y3P45djUfPA7kwA69bMuwOJ75fi7YtCUsTy/CW BL4yxpScj9lkCi9GOniSuBwpTbimX2heOMLRntIZcCkuF6dveRXr1yRFm5CSFUBA+fwH KA7FrgFwe/8Xra2AAr/w/q3iPhX1Tkn41bdtBzRtSMIV4kvZPzKlXWuNy8ITSz9sDPDi TOnA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 25-20020a630a19000000b00524da647e20si1584786pgk.458.2023.04.22.04.50.01; Sat, 22 Apr 2023 04:50:13 -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 S229815AbjDVLtS (ORCPT + 99 others); Sat, 22 Apr 2023 07:49:18 -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-Type: text/plain; charset=us-ascii 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 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; } -- 2.40.0