From patchwork Wed Feb 28 06:28:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 207675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3167908dyb; Tue, 27 Feb 2024 22:31:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVa9TmhKoCsXSaKn4+lwmTiqGKsdGCxz0CwGA+0CKVRUK1sf2kJL8w6IQeHGis/sy8ijgEC9oMCyGaVzZAXupuAntmAlw== X-Google-Smtp-Source: AGHT+IGePGyHY3tbG4WsQJg2dfuYmsNLAGHoIwn6ZJvZbGOhA49jBl/b22eN12Ijmw8I298YYTY/ X-Received: by 2002:a05:6a00:2316:b0:6e4:8313:171b with SMTP id h22-20020a056a00231600b006e48313171bmr17975337pfh.23.1709101912328; Tue, 27 Feb 2024 22:31:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709101912; cv=pass; d=google.com; s=arc-20160816; b=jZ0JqwYh/v3sOiRAZ3x7xpoJbGXOgxw3ZRTVu++HaUR24i7QDCgQIkSvyM9SDscEge tXlgwTw3LKk30xcT5gqJSvK6BF5s1EkzgJDG+BMDl50r0vlPT3gyeO8vIuh7wbXk+dWG K4tU1ed3qGfaDu8IBQUpdVQaW7mF2y6gjxYSVPRznFhEOa1nPxaDE0DK+tu+cWTqkKwN u3m6LsPQcTu6HgCPhyVJ7vrCkrhTGgq/SGyXyDpwjzGY075p+F6Jo1M6tvUsA22KGAas JbMsDYjo1S2xHU5VFchLg4+4o7QJtl3ludIxQ/Oy+VNj35vv8jTTVuGPYQjzur4ztoKe xvCw== 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=dIt/c+Tbfm/gyXtw+O2SKLGzkLfNhGRxoWu0DBW/8io=; fh=4QsgaxB/D4vgvZDOyD4hOqL7/0PF6ZqevOrk8yprrqs=; b=t8xBR3bvVjJLJptGL7XeynUmsZQOeK3XvFWXgBC3hG+HqrajDl7S47OlkL4RUHoj6O 52V09HAVAQPY1BAkro4EY0l72h0si6DiSPV/BKvL2oqLHmmtL4rV6mQUIbcTX+UXYVUK qwCxl47opxnCQub4i1IajgsIsLaz17sWkJp5bIfsA0wfuKANYtrEGwOMcCPdXy2TFCaI Q9UmNXgx47XJspw5/TNsdYY+FFnFjSFqT93PNd2XMtuD5oxizMiMKDTjY/BhIUSQzRYu aNllYTHps5wpSSxgBnwLxyn9MIUlP7PZf/eDsaAziiYGYne1hNczGE4CZNYjGoGc2Qqq 6SiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=XY3v6iB3; 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-84561-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84561-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v7-20020aa799c7000000b006e568580af7si339160pfi.111.2024.02.27.22.31.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 22:31:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84561-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=XY3v6iB3; 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-84561-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84561-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C6982289670 for ; Wed, 28 Feb 2024 06:31:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC36523749; Wed, 28 Feb 2024 06:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="XY3v6iB3" 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 E76D21E501; Wed, 28 Feb 2024 06:30:35 +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=1709101838; cv=none; b=gwyGag/1KCEapp7mwXiT8nIcVylW1P/E+WVwrpssfM+Pc3maKnFS9ia19Rm9vJgEHnQf9MOBy2HhD5/JsQMFSTkJQS6ClB280bBpzipKHCo+rATMzd+ODsY4Gpsxq324oq7yF71Lkvg0gK23YbJ5h5HOA6A+gs2vfFCXCmGta/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709101838; c=relaxed/simple; bh=5zgtvBb7ybGOTydt2Y9kLwJt/b4q5aA+RidLp5++cRE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KdRguY0WBiceU7pVyOKGKvmTVNQUsizagCVAEzIotmFc3AizIYGBW73VqVSRfPkEP9n5Qf/GHzX3pXwwNqmn3tOy4EEq5+Kgcste+/wd8KKz+ngJfFqKh/X/a3A7cVHkWL7KjVi0aABVZbGufa2O0n6Yyvb3HYGF5uBTvhPE4N4= 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=XY3v6iB3; 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=1709101837; x=1740637837; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5zgtvBb7ybGOTydt2Y9kLwJt/b4q5aA+RidLp5++cRE=; b=XY3v6iB3THpVPlwDcG2WiRyYL8JhtEhSa8CEx8MVpATCxtdjQbJ9uk/5 g4QqtiqIsT6PGOnR9uj/TiaNnPFA4H+ZkGU9Y6AGaCNxSEcae5A6ocA/H A8h5LIgazX/tDZ8lh+u4Yg1Cl1aytrrfAtJfAs5PS20ktFKwJT21oQPS8 yOIJR/CkOb6Bh9VQdqIz09cAdegYM6nH+CJE1YEpzemQ3Iu7sZaGwWiI3 WvX4vl5K09KbujUuI+cX1cuOX3vh4TQobLcu79E4pftDxa1pkBa/zU0dx d7lYs6KtOxKXYtM0S8WdGc+a6Eoc56V+eTP8zidUv2Tbly9n9fzekT0kE g==; X-CSE-ConnectionGUID: WwtfXDcGT3ekg/b+aiH4Eg== X-CSE-MsgGUID: vk/89F6YQJOYQKdIPkjbaA== X-IronPort-AV: E=Sophos;i="6.06,190,1705388400"; d="scan'208";a="247685634" 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; 27 Feb 2024 23:30:35 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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; Tue, 27 Feb 2024 23:30:06 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 27 Feb 2024 23:30:04 -0700 From: Horatiu Vultur To: , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net-next 1/2] net: phy: micrel: lan8814 led errata Date: Wed, 28 Feb 2024 07:28:12 +0100 Message-ID: <20240228062813.1007138-2-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228062813.1007138-1-horatiu.vultur@microchip.com> References: <20240228062813.1007138-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: 1792123247032452369 X-GMAIL-MSGID: 1792123247032452369 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. Signed-off-by: Horatiu Vultur --- drivers/net/phy/micrel.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 9b69735819896..5a0cc89eaebdd 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_errata_fixes(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; @@ -3323,6 +3339,7 @@ static int lan8814_probe(struct phy_device *phydev) } lan8814_ptp_init(phydev); + lan8814_errata_fixes(phydev); return 0; } From patchwork Wed Feb 28 06:28:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 207674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3167695dyb; Tue, 27 Feb 2024 22:31:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHIT/5Wpqbc2+kFH5z7YH+0UmbQsi1+JZvwg7iLWGjBz5+wnrFvdi+omYjkJM+qmhBBekbcgPR1mmORdmKV0C/J8bi1A== X-Google-Smtp-Source: AGHT+IFxZZEwa14z+DUoeXwjupGWi7dmqrRynz5juSD5mdlsT+rBuMzgM3O3zXC/WOhrHpYiEF9o X-Received: by 2002:a17:906:7749:b0:a43:c5d5:7b55 with SMTP id o9-20020a170906774900b00a43c5d57b55mr2091769ejn.57.1709101880504; Tue, 27 Feb 2024 22:31:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709101880; cv=pass; d=google.com; s=arc-20160816; b=XDYYwqq5TCu1iJL/ZKuao7Hh/GscdlMy/D5hDyRuOKEKBO6LILYeR5xDttTQpiHKg/ XTzfm/vW0utq300e/99QyUO2P6nbaL7znm/1dCsvQVaC/k5Bn3kLXaR1etg/unJxEp35 hQ0mtnJgPje62AdcrRKlu2cqUYj3kLY15R1r2mL0CCNpkc8y1Nfhzq5Sa6OiH+MIKkVJ g7dSrj891zkwzPaUZ/fmpOXlb14aYyY3guJveMlrplSMmhJUTKD/aMdZ7JM/3cirRzG9 2XSVoQHnd4Fn7Dk0mMOvp6Y6P/Jk196WQG25lkbn0vvPxHxrbg+r+mFR8lMOwEey6BM9 gIkg== 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=ugrCPL69A6il2mXgHKtPQY++kliIAbyWEevsy6+zb7E=; fh=4QsgaxB/D4vgvZDOyD4hOqL7/0PF6ZqevOrk8yprrqs=; b=CMTUy89tknSUJiG3LLKRy/Ck51T3+tC5tLH2Eu5KTKxKQCmh7mZNUMIb6vcND6oicQ s+eH+myDgOaSBtHfGfrX7yePOqtQizR21+8Sel83oNXYraGpcnt6a8EabHd7RI6ypTdu g4WRpl/dnWHhDZO8QOrhf4vgZmUFFUse6lnCbbvJri+AXeLXo0RMTho6vXFKZWaeMS+a Sf1CG1y5WQxyOn2XLTcuaER+58RJZSpJ3Ok2puX5NIBRn5hPKohMVFsf7yxI4gCgC5/C w6TMWxWGEKyqIKdzBNlbMy9k6v11IAR6EfOsSJ8Ai0IEL9lasVekz+A0V/R3UzV+E6cD Kkow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=bUbpqgpy; 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-84562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84562-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 16-20020a170906309000b00a3fc1f18be9si1480940ejv.550.2024.02.27.22.31.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 22:31:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84562-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=bUbpqgpy; 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-84562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84562-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 2203D1F25D32 for ; Wed, 28 Feb 2024 06:31:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E39312421C; Wed, 28 Feb 2024 06:30:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="bUbpqgpy" 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 3A8781EB27; Wed, 28 Feb 2024 06:30:38 +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=1709101840; cv=none; b=H9fHu5lX+jdq8eIcsUhIuzUc0z6n7l0ec76ntrSXFtG2rELVXfRyQiVbbi0W//HSVx9sdwRyDYfjMNvQHIuixD2XLdXf1MhmBsBZW01RofrEcFKrzw7c9+gpoxqYy6xVPqjRXKghP8PhKbsgxa7zRcxAAkaZrW6Y2Ax6s5woPWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709101840; c=relaxed/simple; bh=yykHRE1Z1DG58ITzYPSAjX+1Z8DC7NCPRqkZBbJG4/A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LTF/IIaA1c9ii7rfwpE/7sy/TewLfqhqY7Kvv/B8n9L4+hiOHKN57LhAWoeeGEuQLEXeFFycUFCamQ5zmQJjc4pn7QczFhJVodJ0gxt0sqv0GQ9cCbTzeKpT+DsuT37nhJZQDFxGw6Oqrp/7tdmUtYMwemJ42mc1kgY3thZSNaw= 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=bUbpqgpy; 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=1709101839; x=1740637839; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yykHRE1Z1DG58ITzYPSAjX+1Z8DC7NCPRqkZBbJG4/A=; b=bUbpqgpySHTZ2jutG5hDq1C+u24QmsS5+Vxr7WYV14bRWV8DnQWd+/il i6ymwhWew07Ra/yj4uQjj6b1VDFferyrR7iRb7c9pL/2kbJzQrQ1B5zsC vZD8hmT/hCtqH1srsMYXTX+5HC7/FFLfHJ1J7J04/m2Lv+2QVyC6BIeBb w/HjHlBF3JuhRyWu9IAwPhbfi7UgyoNC1AhysGwxeDqFTCyam5T9PtLwT 8NWWCFaDD6KrszfrMhWF++huQ2SNLSn5NLf4xhzFgK/CqRckBWym/1L8X 3sd8TMLejkkCClUVEUoCMpnDZXVet7gltCIri/Yv2VE2Kg6xt3B6vKVfs A==; X-CSE-ConnectionGUID: WwtfXDcGT3ekg/b+aiH4Eg== X-CSE-MsgGUID: jGD6Xd8wRRq4FYvG5xft5w== X-IronPort-AV: E=Sophos;i="6.06,190,1705388400"; d="scan'208";a="247685635" 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; 27 Feb 2024 23:30:36 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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; Tue, 27 Feb 2024 23:30:08 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 27 Feb 2024 23:30:06 -0700 From: Horatiu Vultur To: , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net-next 2/2] net: phy: micrel: lan8814 cable improvement errata Date: Wed, 28 Feb 2024 07:28:13 +0100 Message-ID: <20240228062813.1007138-3-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228062813.1007138-1-horatiu.vultur@microchip.com> References: <20240228062813.1007138-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: 1792123213337685648 X-GMAIL-MSGID: 1792123213337685648 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. Signed-off-by: Horatiu Vultur --- drivers/net/phy/micrel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 5a0cc89eaebdd..1e3b0436e161e 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) @@ -3302,6 +3306,12 @@ static void lan8814_errata_fixes(struct phy_device *phydev) 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); + + /* Improve cable reach beyond 100m */ + 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)