From patchwork Mon Mar 4 09:15:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 209441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1305078dyc; Mon, 4 Mar 2024 01:17:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWC74bFIPCjKCForFGJjAnF6r6RlJOMwprP5LMj2OXjysBJyTSEqE9ZtWPuDkNJ8p965A0P226nhxSSZfBg4QFwZtLQyw== X-Google-Smtp-Source: AGHT+IEfopCCJ1U3MrDXnP7BMmHKDbA2+KrH+9zEJFM17XIjqRTJ8zY5jal319RhB2LYxW90GxNE X-Received: by 2002:aa7:d9d9:0:b0:567:6d76:89c with SMTP id v25-20020aa7d9d9000000b005676d76089cmr141256eds.29.1709543843514; Mon, 04 Mar 2024 01:17:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709543843; cv=pass; d=google.com; s=arc-20160816; b=GfnqDujlO6nl5cnKxLQJ67erIZSxcjKPeqKXKTVjNUsZmeVCkMuAryBFSagb8r/XK7 ftfeO5gSCzUNKjHoS2wD+svtRR2JCNlqD3VyiT0Z2pUipYxr9mHKpiyHbwdXKC9Gaf7N x63ybjaMgpscvmwr7BgMnxP3No3VpBBGUyzsLphcRSCTpfqQdNWnM87HAy4Vw6P7WhFC aduDa9wA7ojQOlrFL/zfNr1J5UYw2WCmqrDyjakKS7gUX9cDsLBjcW9d6bNOS8/KOwUr Y23GSv9Zx51oQn3eNNqgK/+JpA0Tzi3+hTZMv5lGvvUWYsLxD2Kyx/MD6vdVY0UpiJr5 bGew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Fqo3OSYEXGWEgsUg/OjL9TnvqGinmOeY2363mbEkLDY=; fh=9W0gpJZfC9XsOr9+pK2lni369hmb1w6p2KEhjzj/GF0=; b=TZpNQQ7vmqwQbk31KX6vNAZukhIRIgUAZclnfhHbdgFKa3KZ2ao2TXmfTq5f+YX3fL auxR/DGD66BkBFRTwj6xhr/Yf4PNv1hwq4OjToBPa97S0Ttb+PrvigKDBJpd3F8E/u7K v0cZpbRKp6L3S6WuwiKzmicNcPNAvkqc8mz27mZPxooO8LiGFnc4nqgTRataCxCio8TG 2Hftx2UdWCTR58biATspYAGD8mzWjBT4FBJtpUBjjgfwRDEg9YwbxXP+XqKlFPLUL0ev HHSFaHpAOGBodJ2hkHsMvSUXe//jPd3jtEoEBjZv2TmHOPH7GTWSvQ4KSF/x4V0HaK8m i9bA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=AIZiYfau; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-90287-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90287-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m22-20020a50ef16000000b00564574222c1si3887382eds.678.2024.03.04.01.17.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:17:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90287-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=AIZiYfau; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-90287-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90287-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 19E4F1F220B7 for ; Mon, 4 Mar 2024 09:17:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2AC1224ED; Mon, 4 Mar 2024 09:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="AIZiYfau" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF2931B801; Mon, 4 Mar 2024 09:16:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543810; cv=none; b=PNwpm/+5pAsFFnQCmPOn+1xQPo7W4TW4ENjokzbv2j0DSqyS3iXbjuC1onz0Z6TC7xdDifn0DjziwPup2pF4r/IkVP0i6e7Zx/TIeQOmtgyuzQd8GZEYXQ3Jo2Jlbd7BCQseYFx3iYmhvhiJEHU6sWUZGMrzkWWnlV8cWmWnbh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543810; c=relaxed/simple; bh=BkrF617xwkwNY1RZs7y/Blv4nDks9Xbe6MUsFO6cYPw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ky8R3lh4/0fXkzE595pBY40t2JOHEwbcdEWYHpiAwLNGI5d1jlf6caMy7OuIjxweMLyoi8LIv0Grz15XBpDcYAb785bjZxNZ4IZhkwJrNV0TzUq3e1j7nD5/SxgULtJGTHFrbGsxWcJ+EB8gMhag8Lib5Ey8okGjWci8OhdBTDs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=AIZiYfau; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1709543809; x=1741079809; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BkrF617xwkwNY1RZs7y/Blv4nDks9Xbe6MUsFO6cYPw=; b=AIZiYfauVX+i0n5mql7KF4nf8zPog2AD+XlhJPzhmBpbzzNmpUbEWE/w 2+228BvgWFG9QzUgMwIWeUptqPSg6n705E3OAi2A+MIGYrF5yo0JMgkyZ wyylXXOn9Wa+ZCfkZfD20m1A5N4Yn93iMWu3S6i7uf0vOFhnjXV1dct0C 42WxE8epnC6oz7rnzsOig+KsU3xaUZbMc6U8FyrGpb9FL631p85vcmHcZ xF2CaNLnIXwhTVV6v4vj6LUXPbGgS1eI2Nr8LegY9iFO2WLLfBRPMo6fB cFKwTbvp7JXMD7MNQYw4wSly/7F/qhh7v+4q4IpP1xz5VPLzocLyOrIhP g==; X-CSE-ConnectionGUID: UAxa/GSoQIW4jsMaPoMz9g== X-CSE-MsgGUID: wI874TKgQ2+tNzKPW9CC6g== X-IronPort-AV: E=Sophos;i="6.06,203,1705388400"; d="scan'208";a="247914611" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Mar 2024 02:16:47 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 4 Mar 2024 02:16:25 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Mon, 4 Mar 2024 02:16:22 -0700 From: Horatiu Vultur To: , , , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net-next v3 1/2] net: phy: micrel: lan8814 led errata Date: Mon, 4 Mar 2024 10:15:47 +0100 Message-ID: <20240304091548.1386022-2-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240304091548.1386022-1-horatiu.vultur@microchip.com> References: <20240304091548.1386022-1-horatiu.vultur@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792586645213511029 X-GMAIL-MSGID: 1792586645213511029 Lan8814 phy led behavior is not correct. It was noticed that the led still remains ON when the cable is unplugged while there was traffic passing at that time. The fix consists in clearing bit 10 of register 0x38, in this way the led behaviour is correct and gets OFF when there is no link. Reviewed-by: Wojciech Drewek Signed-off-by: Horatiu Vultur Reviewed-by: Andrew Lunn --- drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 9b69735819896..88cc03982bb78 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -114,6 +114,9 @@ #define LAN8814_INTR_CTRL_REG_POLARITY BIT(1) #define LAN8814_INTR_CTRL_REG_INTR_ENABLE BIT(0) +#define LAN8814_EEE_STATE 0x38 +#define LAN8814_EEE_STATE_MASK2P5P BIT(10) + /* Represents 1ppm adjustment in 2^32 format with * each nsec contains 4 clock cycles. * The value is calculated as following: (1/1000000)/((2^-32)/4) @@ -3288,6 +3291,19 @@ static int lan8814_release_coma_mode(struct phy_device *phydev) return 0; } +static void lan8814_clear_2psp_bit(struct phy_device *phydev) +{ + u16 val; + + /* It was noticed that when traffic is passing through the PHY and the + * cable is removed then the LED was still one even though there is no + * link + */ + val = lanphy_read_page_reg(phydev, 2, LAN8814_EEE_STATE); + val &= ~LAN8814_EEE_STATE_MASK2P5P; + lanphy_write_page_reg(phydev, 2, LAN8814_EEE_STATE, val); +} + static int lan8814_probe(struct phy_device *phydev) { const struct kszphy_type *type = phydev->drv->driver_data; @@ -3324,6 +3340,9 @@ static int lan8814_probe(struct phy_device *phydev) lan8814_ptp_init(phydev); + /* Errata workarounds */ + lan8814_clear_2psp_bit(phydev); + return 0; } From patchwork Mon Mar 4 09:15:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 209442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1305193dyc; Mon, 4 Mar 2024 01:17:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVHgEkwMR3YZ16UAF8VGMJy9mEaNugZYTjEPT6A3bX8jvefVmLe2t+EHviy+i9s05rScGZqbD5Gw7v7CQo99PkXUFC4ag== X-Google-Smtp-Source: AGHT+IEPEFl1jd569Y0U+nFD4WlV9ec550b8pMoTGDL9oe/k3qeN1IJbMlMBTTrU6hLQ0DHEtpUQ X-Received: by 2002:ac8:7d0c:0:b0:42e:f6ca:d2ab with SMTP id g12-20020ac87d0c000000b0042ef6cad2abmr791159qtb.13.1709543861235; Mon, 04 Mar 2024 01:17:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709543861; cv=pass; d=google.com; s=arc-20160816; b=TFVqGkK9inO8CQcF7DeDhRTyiL+XQGz98Yo90dMXpx5J3MfCAt+dblk6fSDN5HMqZX j76BvrioN/TO7UbAQaWQQU03Jg3SBW3wNlBCBbzz/iwERU/RExi4WMV7v0TkN0W9kOo8 nYP2zcxTe61VH/FfKEc8b2C/d7yjfs3kwxzPeaHrkpsDgSSoskbQywG2vxwWpBnOYFXx 0dxA8/V1P4Zcofedb7dztlXQ7uWxsrqn+Bx6hCmVF+VSaO3BFACcwkln3NY8HRO2/Wao cZMOaE9QSROaTAUi9FPhhn5xZlaVzfirnJw3WjzPaixwOVIEhWp/MkgP7oSSG8ICZKrN 9dEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8hIzCJo0jgwtpBgczsQl7y/6gNQb7t+gIChGh6+0P8o=; fh=9W0gpJZfC9XsOr9+pK2lni369hmb1w6p2KEhjzj/GF0=; b=vczBNwLXjkIYE11iV/XuJMjqqUmCkNzouttXXY51RJTXRuuojWC9s7rRjc8jU5vGEp 3fCcQs7q67KkorhhYSohsuyVCnDSGjxXpb5xdtOrbK32S4ue4IJt3mRKt20guROV0w0N l0BO85fgYCQ/vCCgGRu8Dpx0G8Jg0GwSFEZDDJFf8Wca4EOwVh0ncv7FkMpIF6aFTcLo jZHRIKIudq9F6G/wF8dRX5zMbPjwz8Zs6TTduDycSF9jZcmesC1npT08uHGpkZff6ni8 E+8LSEWNC2zpHlCU9XHA1TnackeiZeoFav1u3lO6Ztj0wXOLiwca9S4ytm0SrabLq7IU JayA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=QvkwNkGu; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-90289-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90289-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s21-20020ac85cd5000000b0042eee469474si2369681qta.109.2024.03.04.01.17.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:17:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90289-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=QvkwNkGu; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-90289-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90289-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C986C1C2119C for ; Mon, 4 Mar 2024 09:17:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B272422636; Mon, 4 Mar 2024 09:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="QvkwNkGu" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6498C1B97C; Mon, 4 Mar 2024 09:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543812; cv=none; b=TJKsLvpQRUUxbHMqonRZcZeOymCETSONn9AGNtBvccYl7HgI/m1mrsyVy4Pb9sf68TvarZdgcbIQRC66a4SjmxpXIIMGXlP9uiNOVEZ+mwSW8T+WBOEr4Lm1fx58ERlcnqmVtUtvBTMkzkre6pFiWTjrRZaypudk7mIt9Opt4w0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543812; c=relaxed/simple; bh=zseSRa6wXr7QVJKhGnqeZU4nSAnBMOPbW06T7r7hqZw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qas0n5fo4IK9YC7KM/BZn4yMfVeDpMm8LzbwKkzbAPL0Yl8C3BYj9786iL8C78aAO+tEAHAN2Nw8G/97QsEjJikQM//+2Zo3B70m9nZZ+KWAzen3JoaryVfAAuHZEdyBQVvkdBwNR2W+wCx07y/UPtUVovmcgWUqqGmQBMz75fs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=QvkwNkGu; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1709543811; x=1741079811; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zseSRa6wXr7QVJKhGnqeZU4nSAnBMOPbW06T7r7hqZw=; b=QvkwNkGuRbKij7tWpMWBRrJK5PW52YJua5frFAg5xXHMXvES0O9yqo7d PKSLtEo0P+F/1rBRsmNy9+9zlKaXshoLb8ScoHEJ7j3ZLYq6dF4sqKJUM J9EswjXS0dYr5xaoNp5OuJ5rRHbf0HLTLR2j6SalXcLpk2N+OHhjIMTbA ST44RSIjlsEilyaHUunBfWwBH+KZ0p/pxSgmPhFWTB4bC2o5PFFkpWuwU XSfVd1JPymYniATXurTFuJgcj88G5+55h2YCyDiEr090AO3svsEgK1kR2 aOMPN3Esf0ms+I/1DOUzoJjWNJICqOIAz9hL1qCUQ5BAHHBy8AfDQbkHf w==; X-CSE-ConnectionGUID: 7oblNlVzTXGpgkVkuiMXRA== X-CSE-MsgGUID: ViKNQmJISyi7R0WCPHQlsA== X-IronPort-AV: E=Sophos;i="6.06,203,1705388400"; d="scan'208";a="247914620" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Mar 2024 02:16:48 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 4 Mar 2024 02:16:28 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Mon, 4 Mar 2024 02:16:25 -0700 From: Horatiu Vultur To: , , , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net-next v3 2/2] net: phy: micrel: lan8814 cable improvement errata Date: Mon, 4 Mar 2024 10:15:48 +0100 Message-ID: <20240304091548.1386022-3-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240304091548.1386022-1-horatiu.vultur@microchip.com> References: <20240304091548.1386022-1-horatiu.vultur@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792586663786659508 X-GMAIL-MSGID: 1792586663786659508 When the length of the cable is more than 100m and the lan8814 is configured to run in 1000Base-T Slave then the register of the device needs to be optimized. Workaround this by setting the measure time to a value of 0xb. This value can be set regardless of the configuration. This issue is described in 'LAN8814 Silicon Errata and Data Sheet Clarification' and according to that, this will not be corrected in a future silicon revision. Reviewed-by: Wojciech Drewek Signed-off-by: Horatiu Vultur Reviewed-by: Andrew Lunn Acked-by: Arun Ramadoss --- drivers/net/phy/micrel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 88cc03982bb78..8b8634600c519 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -117,6 +117,10 @@ #define LAN8814_EEE_STATE 0x38 #define LAN8814_EEE_STATE_MASK2P5P BIT(10) +#define LAN8814_PD_CONTROLS 0x9d +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK GENMASK(3, 0) +#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL 0xb + /* Represents 1ppm adjustment in 2^32 format with * each nsec contains 4 clock cycles. * The value is calculated as following: (1/1000000)/((2^-32)/4) @@ -3304,6 +3308,20 @@ static void lan8814_clear_2psp_bit(struct phy_device *phydev) lanphy_write_page_reg(phydev, 2, LAN8814_EEE_STATE, val); } +static void lan8814_update_meas_time(struct phy_device *phydev) +{ + u16 val; + + /* By setting the measure time to a value of 0xb this will allow cables + * longer than 100m to be used. This configuration can be used + * regardless of the mode of operation of the PHY + */ + val = lanphy_read_page_reg(phydev, 1, LAN8814_PD_CONTROLS); + val &= ~LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK; + val |= LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL; + lanphy_write_page_reg(phydev, 1, LAN8814_PD_CONTROLS, val); +} + static int lan8814_probe(struct phy_device *phydev) { const struct kszphy_type *type = phydev->drv->driver_data; @@ -3342,6 +3360,7 @@ static int lan8814_probe(struct phy_device *phydev) /* Errata workarounds */ lan8814_clear_2psp_bit(phydev); + lan8814_update_meas_time(phydev); return 0; }