From patchwork Thu Feb 29 19:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 208503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp642273dyb; Thu, 29 Feb 2024 11:53:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU0NNehrY5lqRw4/bkVBFfqi8BCMI1+RFX7BsqyarLJnED4fukKt0lM+GojXJ8ZmszebesBTP5MevWzHZWb8MIzNLXWww== X-Google-Smtp-Source: AGHT+IHZwUCMAl8/7zSaa2D9pPTaL3N+1XcLhN+u09NEqBlEUT00LyhEs/LCzSqKIo697uFZ9vJv X-Received: by 2002:a37:e20c:0:b0:787:ec14:877f with SMTP id g12-20020a37e20c000000b00787ec14877fmr3429050qki.34.1709236424784; Thu, 29 Feb 2024 11:53:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709236424; cv=pass; d=google.com; s=arc-20160816; b=z7ZTc6Pd3ShMpDMKpmewotIsMw57kZT47KUelJO9UJQIAd8MdbMKRqyBSaCSVhH6jz wkwJQPn1zu5MEAHb75PvTDkXlab9swCBNTgZq0liPL1qw9iEs2SkgZ8etQ+z0lS+MFUE oRxwLnwq4J9aOpeJ9H6t3qikoELko7nFtdN6ARQDsWEFmlakLTCLyo/VYXQaQCrxxAoB CDGVHJZlxEoEF0LisKSate69F9RPQob6+M3kanZgANeHbP5BB3AAGnzjAwJBFBV3OOd5 POEmuM2uYYse83NXt8jLKR8aG5llzxA0/NEuIAW0hi14cPZOWfUPrhv2TdAExb2C2EOL Wm4w== 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=Phc/414BY7fmUwpnuHXv9QOVMfsXjGtvVlOgbklvjto=; fh=FpR3mLPdqQBO82L2zYItx4P35UDSZWGyoRAIuPUC/TA=; b=GKXZ0EXGbhtMVBFFwPgSJzgXTK7YnsiSI9U6/YyWlWvC85SmIGno59j27YwTWI/LfU Kj+54tEOt9trd7muRs0GPRQMbNhCOj6D0epQQK6vy3mFLdCs8WmjGM2NnLSvIq+6YicL PowgjAJeplRryDUPsxZJfT4MMytF0DFXgICY1kas12yBt5HLX26I5mTL26FyyliWC1NQ 4eJ0TZ65wyKXUh9/bTRoexVvPP9v4U9hV0BAkHCFAf2z73VHqN8kEuzfecYYELKHGDZc OQwPWpfuMOfyod/3EykKgZ7ROw7cMZFiFleJCQ2kwSiFYzspsfhvB0p+yX7hZ1RnaeTF IGpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=rOLcLMbC; 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-87386-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87386-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 i4-20020ae9ee04000000b00787778ed49esi1915388qkg.745.2024.02.29.11.53.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:53:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87386-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=rOLcLMbC; 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-87386-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87386-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 8FD0C1C2298E for ; Thu, 29 Feb 2024 19:53:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BCD713F42C; Thu, 29 Feb 2024 19:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="rOLcLMbC" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 7D13C13C9F7; Thu, 29 Feb 2024 19:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709236388; cv=none; b=kTVzi4Xiqi75V3LnHIPnnPW7ytFY90q164Cguce8For0orvMKviVIjLlWBQT8Fpzc/lVJvtpYuCQ3PpXPpWhoY9Y3Z3cIpbNmw7mNiEQv3NITAi0TfAUSv/Ck67pxS/GUdZaz7sdPvdvpINQCsjUNT/aAQcCBPX+j5ySENIp7bU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709236388; c=relaxed/simple; bh=gmYPlJjIF0Hbvmzz48jcajCXOb7Cc/tg1xpCPkEClkE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fFhGzkAutTXYiavy/YQWPL03hgcl/vlEsHJQaa1iffpLagXplLBT2zRi539LeOtko8QwOErm9On2wS7myB+YA8rVxmdX8M+23ql+R0SYtMT5AERBLEWOu+EinRSQEfYmmDkOQPgJYWtpBCS/Wfgqs6c7iqRXtGe4Ju1i29ydrQ8= 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=rOLcLMbC; arc=none smtp.client-ip=68.232.154.123 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=1709236386; x=1740772386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gmYPlJjIF0Hbvmzz48jcajCXOb7Cc/tg1xpCPkEClkE=; b=rOLcLMbCAyfFte8NE+e0TgGVNjNk7iKCeCHCTwPFHKdv1RnqUouBtNng OhbqooJYbFe76NY+o41rTtJomBeFcH3yDSVB/1SxbGUlEUdG7o+nD0M5p Qjduh5KFOvVCvIhhNI+rVrNraR6uo5/d3Wglxhs8Uepfa+VTaMOOEO2MB ZaIR63e1Aq3jv3eEss1fU9lQjXevVmfw0TXUBInFfBD2fHW57MRuk2hkh 0PVU3XTPSOs41FPJ8QMdZqwzVqPLYumTEKBiiED+L+eiGCHSNBr4oxKEV DEe2K+1dHEkTkjSWYHR80c3myutabCQBuVbT3Ifb1qd+/xpRlLFVwx8Zy Q==; X-CSE-ConnectionGUID: lxx6YzUCRQKZ1uyD65VsbA== X-CSE-MsgGUID: CRFUDg9/QKWC5e255Mix+g== X-IronPort-AV: E=Sophos;i="6.06,194,1705388400"; d="scan'208";a="184305290" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Feb 2024 12:53:05 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 29 Feb 2024 12:52:40 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 29 Feb 2024 12:52:38 -0700 From: Horatiu Vultur To: , , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net-next v2 1/2] net: phy: micrel: lan8814 led errata Date: Thu, 29 Feb 2024 20:52:19 +0100 Message-ID: <20240229195220.2673049-2-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229195220.2673049-1-horatiu.vultur@microchip.com> References: <20240229195220.2673049-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: 1792264293488474748 X-GMAIL-MSGID: 1792264293488474748 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 Reviewed-by: Wojciech Drewek --- 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 Thu Feb 29 19:52:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 208504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp642368dyb; Thu, 29 Feb 2024 11:53:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWrf5K7c9ZW3JWyqolZTOeY6HUZElGhWrPGr/iYUSetpBzD2HduD3Sig3+b+Oe9xvt7X2AwgpuIOUFHh42p3OetriqVLA== X-Google-Smtp-Source: AGHT+IGKtnkHV4jJB5wBWbCHLuWqWJtRiEJj5J0hd+V4f//lwwzXBQeIWm2k32o0mie4bMdwauno X-Received: by 2002:a17:90a:6d01:b0:299:1cce:f3c3 with SMTP id z1-20020a17090a6d0100b002991ccef3c3mr3920087pjj.7.1709236434810; Thu, 29 Feb 2024 11:53:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709236434; cv=pass; d=google.com; s=arc-20160816; b=nBpZgLeNa0MaATEEgZvckrcPjdekIbcPTnr0HkwaGbTsaHM+wyGJdL51D3XjTIdoHm XZQ9XNE7cZqOfez2VR9NwcRQE0juJzNTEPVjP97CQ5HYx0tbjQz9+qC8U5bkKGQ4q+v2 RDK3lHbU+5wGDYzJufEsVCbBQdRLCQyTEmCpskmYbdEeF0yGDe9xTMp+uXQwPHXQ419T 3eeyF9ZrLlKg+MlQJfk4JPTc8+kYfoJaGBcbP15UwUgtHUh5sINz8kCd84saOl5ZlWdS ZZShxmwM4JI4Wande7bDyBHs/dhU4emx15soeeAl3H+EDz2TWom7dVROdk9pKwmewG/B PRiA== 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=L/LIBrhlMXW0TzZbk25bw4ZVsfo3eNBq3LM2ZbGgCEI=; fh=FpR3mLPdqQBO82L2zYItx4P35UDSZWGyoRAIuPUC/TA=; b=Tw25J2vdbjkhw5vbz66oUhVoASAllJTebpJD7zOL7WjoxG3sgQX26XQAp8TYPAx1Jg EVwCWqVnetVShK0chVne1gmfjHKaWEBy6udl21RA9Dn1HqrYnRzmD9kEsePdqRrAgjh/ ucj/TW3VeZrsXV8jd941E+fyUpvKAKGq1A9NVMKLcSjYp+EWoCCSiffhgJKep5J7pYuu knMAOjqwtVXcLRuwW1qZq9spYGVEstFmYCPfHIpyjEIeuzeHCFYgJSgc1J3LGynIWIUq Tprz3Xu94NByGX+sCvSZaIq92Ld8dqV+DB1svGpuk/mWeI3YA9f9lwMeLGvXjszusnj0 XveA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=w4v0zCMO; 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-87387-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87387-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 sh14-20020a17090b524e00b00299b3588831si2207634pjb.58.2024.02.29.11.53.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:53:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87387-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=w4v0zCMO; 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-87387-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87387-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 97E43286EC9 for ; Thu, 29 Feb 2024 19:53:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1339144023; Thu, 29 Feb 2024 19:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="w4v0zCMO" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 9682E13D2ED; Thu, 29 Feb 2024 19:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709236390; cv=none; b=p7lWibFepr4gQ4vYg/uarjpfolJvx+UJ5a6uVyuxq/G0cGberXIbIYh0mqSpvNVuL4zDMYYnu2skROqI9zJxvoubI2gwBGE7+q+75Xcd6/BDQl0NL+mKEqLFWvfTRC/VcESfd70dOnnfTwpocu3Ed+3nsHInn4cdOmaMvwf1IOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709236390; c=relaxed/simple; bh=e3ssywAqf1JTE2bsPBxD0CbekMQX8/goeW7QMUsDhkU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ha5tMPI+ncXNeCx+h4RhvLxCE7s6NYtMde3AX60K574C4+aYyjDjQ746b57uVGECfWR2xIyR9Q/2r1RSt03z2QB5zDHWDa21h102YnOk0Cp5DKY64nRl5kaZFqDKxgUIparPbbEHO/cJyTZrubSQ54g4pIsR5CSVHSqG9aVg3g0= 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=w4v0zCMO; arc=none smtp.client-ip=68.232.154.123 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=1709236388; x=1740772388; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e3ssywAqf1JTE2bsPBxD0CbekMQX8/goeW7QMUsDhkU=; b=w4v0zCMOnJKa9FzMVB119PA2YVqejUOXD3fdes9X9unKdL2LqJF27VEd /lHqhofMfBZ+0n0CL8lB+2sxQZ8NRCppaom4lF219ZjW5/0GjO//0htJB qLRCCUicBG85wcGPUjhvW4oojHO+TModfcLBIJQwTYmoImcRG5SQfc8nB 9H2D01Lath1Cw67PmAlZ2zbCNAMLcfSGD7p7MzK3fdbVfRthT/LfVVzQ9 yPUYt4dsFknyyi/PUd9n704mAp7QXyZqiL06d7A6j9lWjZZyh+eSBHbRC 2O7qGU+dKB2GFqcLsxfmO5+6i8OSpHvJMTXVy9WWhhR5qhYhnqyOhUm80 A==; X-CSE-ConnectionGUID: lxx6YzUCRQKZ1uyD65VsbA== X-CSE-MsgGUID: 03tnWxpGSbiXi9OrHFSHMw== X-IronPort-AV: E=Sophos;i="6.06,194,1705388400"; d="scan'208";a="184305291" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Feb 2024 12:53:05 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 29 Feb 2024 12:52:43 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 29 Feb 2024 12:52:40 -0700 From: Horatiu Vultur To: , , , , , , , CC: , , , Horatiu Vultur Subject: [PATCH net-next v2 2/2] net: phy: micrel: lan8814 cable improvement errata Date: Thu, 29 Feb 2024 20:52:20 +0100 Message-ID: <20240229195220.2673049-3-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229195220.2673049-1-horatiu.vultur@microchip.com> References: <20240229195220.2673049-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: 1792264303599051390 X-GMAIL-MSGID: 1792264303599051390 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 Reviewed-by: Wojciech Drewek --- 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..788fdd54fd22d 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; }