Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7241681rwr; Wed, 10 May 2023 06:00:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RguDFA5RPlmUyAK0EGnjbarIa77cQ7rpCEdytPcXUF7j9erqqgAeG/zh4YL0L2n0pcCmP X-Received: by 2002:a17:903:120c:b0:1a6:d15f:3ce1 with SMTP id l12-20020a170903120c00b001a6d15f3ce1mr21576890plh.34.1683723639460; Wed, 10 May 2023 06:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683723639; cv=none; d=google.com; s=arc-20160816; b=Sgr285BGLtSjpKwERq9DrFX7DseYtSwSLf/gs0BJDevvmwUO1AV/HmVhjbcIZ/tdh3 ISyt+yZHamgoyCVfQKyPY5woCcb/UmVUECxHgbfgKMSJ5WSiFecxXZPviSlrtPI7H5vN VKuwt92C5VBJlHv+FFE+TKdJ/YitJVaITUyDCJ+rgzTmRv1/i2aEKRVHzPIOSkdOE6iW kjk7//D7rOW/Zegp0H2za2GrAohPCYMA+cxWAHD92naN6Dq4wWITvZ4PKKdSncFEWcFt EcsyUujvlTDd/rix/MuCmEgmsqahwG6eOTvW9E87gpU6qheduObcCYIrS4notI9YSK8l xx1A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=2RMALsxCD9vv+3SY36ICjcgswL3/hso7mKW8Q7aCQGc=; b=TQ4kD30IRlJLTG/yn0QF8mF4LWeBXc3+HuIJuSThJZ7EJMFYSt9gfvqr/fzl9LGlc7 gGelA9fNZlrMAQs26U6FTDmaeuhYgUOCQlry0vd6zUxzuCSmULKUJBhZlyJZquzBq4AT 6PgUAovxSfUZniWqZtnvfm1yErNkg8IZYYPMWRXyLFIMpfrJ7/xHFLcjhEpWrqPqa1Te qV+95yr7A5EQz5kjvygpMHdQLnGyVwMVdpGv5it703Qsbf0djmKdYMi9XHCU19BxGIeK c+SqXQlSPKASqcs85ZYDiY1lIbpNfNfHdBMtGHdRNIqMjduT8YvPA9xwpFV7lDSs/rss QVlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wYnla6Au; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a170902b68c00b001ac8835b86dsi3953187pls.38.2023.05.10.05.59.55; Wed, 10 May 2023 06:00:38 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wYnla6Au; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236713AbjEJMwH (ORCPT + 99 others); Wed, 10 May 2023 08:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbjEJMwF (ORCPT ); Wed, 10 May 2023 08:52:05 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCB66188; Wed, 10 May 2023 05:52:02 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34ACpiLG001859; Wed, 10 May 2023 07:51:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1683723104; bh=2RMALsxCD9vv+3SY36ICjcgswL3/hso7mKW8Q7aCQGc=; h=From:To:CC:Subject:Date; b=wYnla6Aub9v10PjLTXMjAyLHh6nnvjLp+/E5NrlJ3UROaQvFAomSvSLguhpzkIuGy g94ahy8crx9heecSoCAS9Do4fMHrHxe2rw0SLfpHlz8/W/gcCi4aAMGLd5aA3thiN7 Ny+sGPhHYNbYn5iTgS7fty4pnSVQueTLex8Yl0jw= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34ACpiZx022718 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 May 2023 07:51:44 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 10 May 2023 07:51:44 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 07:51:44 -0500 Received: from uda0492258.dhcp.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34ACpeZY006649; Wed, 10 May 2023 07:51:41 -0500 From: Siddharth Vadapalli To: , , , , , , CC: , , , , Subject: [PATCH net v3] net: phy: dp83867: add w/a for packet errors seen with short cables Date: Wed, 10 May 2023 18:21:39 +0530 Message-ID: <20230510125139.646222-1-s-vadapalli@ti.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 From: Grygorii Strashko Introduce the W/A for packet errors seen with short cables (<1m) between two DP83867 PHYs. The W/A recommended by DM requires FFE Equalizer Configuration tuning by writing value 0x0E81 to DSP_FFE_CFG register (0x012C), surrounded by hard and soft resets as follows: write_reg(0x001F, 0x8000); //hard reset write_reg(DSP_FFE_CFG, 0x0E81); write_reg(0x001F, 0x4000); //soft reset Since DP83867 PHY DM says "Changing this register to 0x0E81, will not affect Long Cable performance.", enable the W/A by default. Fixes: 2a10154abcb7 ("net: phy: dp83867: Add TI dp83867 phy") Signed-off-by: Grygorii Strashko Signed-off-by: Siddharth Vadapalli --- V2 patch at: https://lore.kernel.org/r/20230509052124.611875-1-s-vadapalli@ti.com/ Changes since v2 patch: - Add comment describing the short cable w/a register configuration. V1 patch at: https://lore.kernel.org/r/20230508070019.356548-1-s-vadapalli@ti.com Changes since v1 patch: - Wrap the line invoking phy_write_mmd(), limiting it to 80 characters. - Replace 0X0E81 with 0x0e81 in the call to phy_write_mmd(). - Replace 0X012C with 0x012c in the new define for DP83867_DSP_FFE_CFG. RFC patch at: https://lore.kernel.org/r/20230425054429.3956535-2-s-vadapalli@ti.com/ Changes since RFC patch: - Change patch subject to PATCH net. - Add Fixes tag. - Check return value of phy_write_mmd(). drivers/net/phy/dp83867.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index d75f526a20a4..76f5a2402fb0 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -44,6 +44,7 @@ #define DP83867_STRAP_STS1 0x006E #define DP83867_STRAP_STS2 0x006f #define DP83867_RGMIIDCTL 0x0086 +#define DP83867_DSP_FFE_CFG 0x012c #define DP83867_RXFCFG 0x0134 #define DP83867_RXFPMD1 0x0136 #define DP83867_RXFPMD2 0x0137 @@ -941,8 +942,27 @@ static int dp83867_phy_reset(struct phy_device *phydev) usleep_range(10, 20); - return phy_modify(phydev, MII_DP83867_PHYCTRL, + err = phy_modify(phydev, MII_DP83867_PHYCTRL, DP83867_PHYCR_FORCE_LINK_GOOD, 0); + if (err < 0) + return err; + + /* Configure the DSP Feedforward Equalizer Configuration register to + * improve short cable (< 1 meter) performance. This will not affect + * long cable performance. + */ + err = phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_DSP_FFE_CFG, + 0x0e81); + if (err < 0) + return err; + + err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART); + if (err < 0) + return err; + + usleep_range(10, 20); + + return 0; } static void dp83867_link_change_notify(struct phy_device *phydev) -- 2.25.1