Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp909046lqm; Wed, 1 May 2024 22:05:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWrfwegS6d9fjehVVGNX3BrdDjsmvDhOALZrdJ/iviAHkNMzdYyrz1bDuKpluYvewJDXo5MZ0ok60iWrZTD6H7MhJIbtRx7zlgjopmEeg== X-Google-Smtp-Source: AGHT+IFkk5M1bJMsI5W9iuqGp30XUoMy0sDBRIJ9NiXGsqaRwM18xJyR0581hhCK68mhzgqX70gm X-Received: by 2002:a50:9993:0:b0:56b:cfef:b2de with SMTP id m19-20020a509993000000b0056bcfefb2demr561084edb.26.1714626300536; Wed, 01 May 2024 22:05:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714626300; cv=pass; d=google.com; s=arc-20160816; b=a6NqEiCzYkhhf1c5rqwl+Vy8RmHIbAhK7NwT3SYTkJkcgq6O38ZLzPLz26Da6gwMw0 JtlrZIHc77svh2Pv65j4eRN7JxwnDKc2CibnS6nnNkgI8OFKWOhPZYEFM3bc5asBn9Hv HfkVENNhXL5h+jMMSaaoAwOGE/03BUncMLmi/jNeTsrpi9jYHNAy952d1JICepACn2UP xaElDWhPs8+GcBU861R19kG14mX6QF0rxIVb6nB8gCdr3pyMQ9ivFUjsQG8X8Ga/GM2d xjlGbkIxNUdrc2US+yz9NVm+E0WStPowoQVMEjrvoIkVHO5kYiZx+TjwMmtcS0DrwfdI U77Q== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=q1q0ChFrxMtycDBR7imxS5phhw6yNdlyBio2eXRhtpU=; fh=TfeXpqzE7EABEm9xuWWx8YKKA2vwgt8yb+Hr5Rh4pJA=; b=agGL8ho50R8PMHlDXhEquf6t3fu0jzJA+7T40Ki4bJUvepXmZlolyF1Wp3F3kwieYs Q00VgNZvVEWSORrzgvC89t48Qfiq5ZU9P9Few4CKVMw2vmdCW2Z/LM4GAIZk4I6lmCB7 pvU3MGHWU0/QgSpBI0Rf1R6wCN1o2Mg6NNsF8OLNNlJKroGZQhYev5/TS9AFtjb/8LY8 OEA6zOpiTe2Hz7SShrVEvkF8k2nuAyy2Nr5PWQzLWQygutmOs6RZbWWda91osMQgWu3n YSCC045GLtcvrkDbdAqtxn7PtG66K2mndPc4BSco8Qeh/6YSNwtKIsVpZaeXYvp1jkVu 45GA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=AP7KFdSq; 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-165973-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165973-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r12-20020aa7da0c000000b005727dc5799esi99552eds.435.2024.05.01.22.05.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 22:05:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165973-linux.lists.archive=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=AP7KFdSq; 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-165973-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165973-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT 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 400831F2230F for ; Thu, 2 May 2024 05:05:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5400B200A0; Thu, 2 May 2024 05:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="AP7KFdSq" 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 64D8029A0; Thu, 2 May 2024 05:04:48 +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=1714626290; cv=none; b=fK3CTIrQt7aQGkjDkO/RnIWJF+bIr+YAEGB/pTKkHlFavlYQXBsuBj771NkefrS35NaHXNmvHe4Bpc/EYEXU0KMtjf2lwLiD8v/vEmJkDmuhItX/+UIbd413pJ+jCvBG+b+FuDQdndovhObmGdyFJRZnc5QsEXwxVBhb+m6AJ98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714626290; c=relaxed/simple; bh=T0bJ9f3B82LY+xAMn+qJU/gURZEvWNZXvg8QNzKqKbo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=ayP4I8RDFhOmrFXiBJRwdqw3rXFTeE3CupaG5gE4DE/+F9Yj8yiNDudXJORUL403BfV0vWkNQsK2XK5aFW1b/5Ev/Z0TgYchNgFPNX83NQRrlu2fysT/Y5nDhH/S+WwjDymfx69AaBrRbZ9cCEToEq+lqXcBtc76GVv0ypKyI5E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject 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=AP7KFdSq; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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=1714626288; x=1746162288; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=T0bJ9f3B82LY+xAMn+qJU/gURZEvWNZXvg8QNzKqKbo=; b=AP7KFdSqUM1pfZnGc6vGltehxhn7381aY3Y91BAvFJ3m6Z0d8lKZ8Ar5 koZDzbd2ugSvQ1KQbokINeifmWwkiIzqDoTFAhYrVUuNnAy3iV9g/VpFa eqmxmA3fiVujHT+DjTJenIV86ti/m05qwq7Q9hLdCoTm92YQxFpM8F/s/ 7B19x/XRJhJVnnxZPPceXfIBbC1/poDT9ybQZyd6MAbc07kk6QbF3n84G arBW/xGitP8vRt6FaUSotY7WJHfVRmSQeSGSeioGpudjyrBwLIPLhg0Xj mHjF1m6bynIP4ID5xa4q9shC0bofIaX/JRnWyywkiZpLgl/RVdGCY789K g==; X-CSE-ConnectionGUID: xcYhx9FVQj+dINQhEIwqNA== X-CSE-MsgGUID: RbhUzTQ2TaCsK+d9AS+NDQ== X-IronPort-AV: E=Sophos;i="6.07,247,1708412400"; d="scan'208";a="190689575" 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; 01 May 2024 22:04:41 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 1 May 2024 22:04:17 -0700 Received: from che-ld-unglab06.microchip.com (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; Wed, 1 May 2024 22:04:14 -0700 From: Rengarajan S To: , , , , , , , , CC: Subject: [PATCH net-next v1] net: microchip: lan743x: Reduce PTP timeout on HW failure Date: Thu, 2 May 2024 10:33:00 +0530 Message-ID: <20240502050300.38689-1-rengarajan.s@microchip.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain The PTP_CMD_CTL is a self clearing register which controls the PTP clock values. In the current implementation driver waits for a duration of 20 sec in case of HW failure to clear the PTP_CMD_CTL register bit. This timeout of 20 sec is very long to recognize a HW failure, as it is typically cleared in one clock(<16ns). Hence reducing the timeout to 1 sec would be sufficient to conclude if there is any HW failure observed. The usleep_range will sleep somewhere between 1 msec to 20 msec for each iteration. By setting the PTP_CMD_CTL_TIMEOUT_CNT to 50 the max timeout is extended to 1 sec. Signed-off-by: Rengarajan S --- drivers/net/ethernet/microchip/lan743x_ptp.c | 2 +- drivers/net/ethernet/microchip/lan743x_ptp.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.c b/drivers/net/ethernet/microchip/lan743x_ptp.c index 2801f08bf1c9..f8e840fd62cd 100644 --- a/drivers/net/ethernet/microchip/lan743x_ptp.c +++ b/drivers/net/ethernet/microchip/lan743x_ptp.c @@ -58,7 +58,7 @@ int lan743x_gpio_init(struct lan743x_adapter *adapter) static void lan743x_ptp_wait_till_cmd_done(struct lan743x_adapter *adapter, u32 bit_mask) { - int timeout = 1000; + int timeout = PTP_CMD_CTL_TIMEOUT_CNT; u32 data = 0; while (timeout && diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.h b/drivers/net/ethernet/microchip/lan743x_ptp.h index e26d4eff7133..0d29914cd460 100644 --- a/drivers/net/ethernet/microchip/lan743x_ptp.h +++ b/drivers/net/ethernet/microchip/lan743x_ptp.h @@ -21,6 +21,7 @@ #define LAN743X_PTP_N_EXTTS 4 #define LAN743X_PTP_N_PPS 0 #define PCI11X1X_PTP_IO_MAX_CHANNELS 8 +#define PTP_CMD_CTL_TIMEOUT_CNT 50 struct lan743x_adapter; -- 2.25.1