From patchwork Wed Aug 7 08:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q3PDs2vDoXMgQmVuY2U=?= X-Patchwork-Id: 13755967 Received: from fw2.prolan.hu (fw2.prolan.hu [193.68.50.107]) (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 74C0F1C9DCF for ; Wed, 7 Aug 2024 08:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.68.50.107 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723019390; cv=none; b=BKwd3tUYl2BNjauY3YAuFojQo77ds2R1DSiXlMnm7Qyzd9M6JBu7ptso2RgqaQjyP7EhlLQp5MvXgo6/EboFnz6j8snHGqQ4QJCsGuaHhs8THhdoAZ/fDqm0l5Zb5vJZ96FRSSPi5JyH+e1SRLl1t9pHgSA8lY8M3TIuIuhgPlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723019390; c=relaxed/simple; bh=OnapAem2E91EqGGMAh397ud0U7heFVYvLvbFISX8OlM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=eW0o/W8TupuH6bKqlDD/XFSycwfBh7QMPEPD0uYkKbo/HW/x80BW6iShDoyO/4/Um0AitSygsJW6IcO9ZG8MxDLbe2P3C5JUrYSlMTEz3KsmVIG3vopqNpt1c804pIyMfiKJY6xpH2EVgjjKBzy8be/QsWxkE7r+/TxJ6sT1hkM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prolan.hu; spf=pass smtp.mailfrom=prolan.hu; dkim=pass (4096-bit key) header.d=prolan.hu header.i=@prolan.hu header.b=uX/Go35j; arc=none smtp.client-ip=193.68.50.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prolan.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=prolan.hu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=prolan.hu header.i=@prolan.hu header.b="uX/Go35j" Received: from proxmox-mailgw.intranet.prolan.hu (localhost.localdomain [127.0.0.1]) by proxmox-mailgw.intranet.prolan.hu (Proxmox) with ESMTP id D9631A050F; Wed, 7 Aug 2024 10:29:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prolan.hu; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:message-id:mime-version:reply-to:subject:subject:to :to; s=mail; bh=Hg5GSTMLl38WzLZ42vBN3FPT2wlT/tDURwfZyb8EsxM=; b= uX/Go35jJLVi8M3I+eRiMjuuU4AQ62Fo8BAu2mA0r1i8GZJ9GyBpJpq5DD0rZWM6 eTwatiBDY4gQpe/RGKJgD/LVm3g2UuCj2mH4/cTvCBLNxoEIzFLm+GDI1eiYcAPa KutoNa7C216JHgA4ggZqsp5S6kdZNMaxf1RBxzAq6BvTgbVMfWL1pt2fnPweG6+r fR8wI5/QmOHv8zhGFCCeNnnsg8jfadFYYpzSLqOgeall9AaoHT51e9RZNZo3aHMC zXOoVQLD5xcFou/aM1p0+dkB1lcbazsWU3Fw8V9+PEf83E3Qk6/49net0uJdSdZs /lD5GTmiWNQIfif+4uNH8AHn2FJDhlUpKrC6OUA0Ak1qiuqgnOyfPZmrlSiPRI2n +5ovph72+t3PMaZzizIYcM8qFNFFMgIErAAzi/FmTjEI7pRkCjEN9iwjYnos+aWQ JQUf3jMCG2ZTt9cZa9QFYUpwoWxbPnLW5MI7nBWyxEEFRp4mJqaUEMKYE/3FoHwR eBwpUJOXSxB4ROyN2xttY5TrU8qIo3TenHFcOJDRcVlT0SpMBR3jqM98CAJzNfIl 6/YUFFdnzZgEmtG6XOA8MSfNoACd3TrQj+tIBs+F9ahr9f9G5f4xp2mvLHFV31DT BBAf8WSv/j12zSqXFuHOKLJfh2IkrGBBFxwL8lzLIu4= From: =?utf-8?b?Q3PDs2vDoXMsIEJlbmNl?= To: =?utf-8?b?Q3PDs2vDoXMgQmVuY2U=?= , "Jakub Kicinski" , , , CC: Frank Li , Wei Fang , Shenwei Wang , Clark Wang , "David S. Miller" , Eric Dumazet , Paolo Abeni , Richard Cochran Subject: [PATCH resubmit net 1/2] net: fec: Forward-declare `fec_ptp_read()` Date: Wed, 7 Aug 2024 10:29:17 +0200 Message-ID: <20240807082918.2558282-1-csokas.bence@prolan.hu> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ESET-AS: R=OK;S=0;OP=CALC;TIME=1723019386;VERSION=7975;MC=2323596704;ID=189166;TRN=0;CRV=0;IPC=;SP=0;SIPS=0;PI=3;F=0 X-ESET-Antispam: OK X-EsetResult: clean, is OK X-EsetId: 37303A29ACD94854617461 This function is used in `fec_ptp_enable_pps()` through struct cyclecounter read(). Forward declarations make it clearer, what's happening. Fixes: 61d5e2a251fb ("fec: Fix timer capture timing in `fec_ptp_enable_pps()`") Suggested-by: Frank Li Link: https://lore.kernel.org/netdev/20240805144754.2384663-1-csokas.bence@prolan.hu/T/#ma6c21ad264016c24612048b1483769eaff8cdf20 Signed-off-by: Csókás, Bence Reviewed-by: Frank Li --- drivers/net/ethernet/freescale/fec_ptp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index e32f6724f568..fdbf61069a05 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -90,6 +90,8 @@ #define FEC_PTP_MAX_NSEC_PERIOD 4000000000ULL #define FEC_PTP_MAX_NSEC_COUNTER 0x80000000ULL +static u64 fec_ptp_read(const struct cyclecounter *cc); + /** * fec_ptp_enable_pps * @fep: the fec_enet_private structure handle @@ -136,7 +138,7 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable) * NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds * to current timer would be next second. */ - tempval = fep->cc.read(&fep->cc); + tempval = fec_ptp_read(&fep->cc); /* Convert the ptp local counter to 1588 timestamp */ ns = timecounter_cyc2time(&fep->tc, tempval); ts = ns_to_timespec64(ns); From patchwork Wed Aug 7 08:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q3PDs2vDoXMgQmVuY2U=?= X-Patchwork-Id: 13755968 Received: from fw2.prolan.hu (fw2.prolan.hu [193.68.50.107]) (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 A7A1A1C9DDC for ; Wed, 7 Aug 2024 08:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.68.50.107 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723019403; cv=none; b=IPtqf5l6stD/9bSp3S1iM4BvSRiic5VMKOSTijiEs3tx1iX0sy9AaKC++8fW3qbBfOnSF5z51klhYiob7LNsoryvBNR1yKtJ9MHdWNnt3wUhVToKQ7Q9FfdB5rKmbpwD8DCo2wBovHCcKa3P1xs58pzGTStOAdt48yUr54oMtno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723019403; c=relaxed/simple; bh=pfjwYai1kDEFlMTRwq1zDwxzrf113UCZwO0Y3kDOyc4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=farmwUVOdP0rjYbzSsBCH3VicbQJ4EnMF/ZzuI7P/ESwbHCJjZBxZ/h9masZyzurIZUwmMOTZMEWBPcv5o1nXOYx9zY4iinBqh2rN8lShIsvladlGmN9TljjrgMJCtPvqod5xC7fGFqgZllqpn0DMDQ9B8KO2tG/LUslMxkk2Cg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prolan.hu; spf=pass smtp.mailfrom=prolan.hu; dkim=pass (4096-bit key) header.d=prolan.hu header.i=@prolan.hu header.b=M2yY2/3w; arc=none smtp.client-ip=193.68.50.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=prolan.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=prolan.hu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=prolan.hu header.i=@prolan.hu header.b="M2yY2/3w" Received: from proxmox-mailgw.intranet.prolan.hu (localhost.localdomain [127.0.0.1]) by proxmox-mailgw.intranet.prolan.hu (Proxmox) with ESMTP id 30E31A050F; Wed, 7 Aug 2024 10:30:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prolan.hu; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mail; bh=Ba0CST7W2CinJDo4EiMn 4wDfsciaCg1eeQIJj73GLgM=; b=M2yY2/3w6JEsqO7f48Y3Ks4T3Jlfm4dCLv19 YNx6dkipbwulcnrC1MOBskP27lNBIGaQsdIUilhAQjYDzEfJ+Cos8d5dAj1xt0O9 E9S8knLX13wOXoosVOzhKSuxjqDf4fFIkpTlnw7UjM6jQe7Nn69PbmK5GMSXYeVt PyO0mikWaKdSumY/yPP9Aua1zndVfByVbLMoUugIwfKuPI/7DZRBrTKTjmB/roKt mj0ADJ+RKQ93Gz81//L5UhNqgvI9ioJVJCZb5GAvUVL2lLr/eg/y6Fe6FT3dgiTX opC3P9/6225x2PWMsTtCFzMC9j8/oR/yUBXA0eUI8Xhy8rPl47m5EOmL0AZo4CXV 0tWIkJxtGT+X3vZ7PUrW1S930UXgjACPxB/KsAjpFFnHmUEExEbweNj6fAAcGnh4 6fYggHzDxf86OKeOn61+q6isdx5hL7SR/BcPAMl/Rd5M3nvsEPG50VrhS6QGAPnz kln+a/f/8kZwy/Bhhb8zi4PYlafCe32nnk0eNNzX3H10xnLaclR3s/EKENYjpqKz Tf9+1Ytt2jlvX0HZtCx8B4/MooCbeby0P1g0qbKARNm3UFwiXouGG5A1131BEVyV izgXwoq7dsBJJ9uwbKNmadAoUCVRwosCmEfMsILUOr7uL5TfjGT8fDXOksujGOxH D7gCUAo= From: =?utf-8?b?Q3PDs2vDoXMsIEJlbmNl?= To: , , CC: =?utf-8?b?Q3PDs2vDoXMsIEJlbmNl?= , Wei Fang , Shenwei Wang , Clark Wang , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni , Richard Cochran Subject: [PATCH resubmit net 2/2] net: fec: Remove duplicated code Date: Wed, 7 Aug 2024 10:29:19 +0200 Message-ID: <20240807082918.2558282-2-csokas.bence@prolan.hu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807082918.2558282-1-csokas.bence@prolan.hu> References: <20240807082918.2558282-1-csokas.bence@prolan.hu> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ESET-AS: R=OK;S=0;OP=CALC;TIME=1723019399;VERSION=7975;MC=3677061131;ID=189168;TRN=0;CRV=0;IPC=;SP=0;SIPS=0;PI=3;F=0 X-ESET-Antispam: OK X-EsetResult: clean, is OK X-EsetId: 37303A29ACD94854617461 `fec_ptp_pps_perout()` reimplements logic already in `fec_ptp_read()`. Replace with function call. Signed-off-by: Csókás, Bence Reviewed-by: Frank Li --- drivers/net/ethernet/freescale/fec_ptp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index fdbf61069a05..91b0804142e4 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -213,13 +213,7 @@ static int fec_ptp_pps_perout(struct fec_enet_private *fep) timecounter_read(&fep->tc); /* Get the current ptp hardware time counter */ - temp_val = readl(fep->hwp + FEC_ATIME_CTRL); - temp_val |= FEC_T_CTRL_CAPTURE; - writel(temp_val, fep->hwp + FEC_ATIME_CTRL); - if (fep->quirks & FEC_QUIRK_BUG_CAPTURE) - udelay(1); - - ptp_hc = readl(fep->hwp + FEC_ATIME); + ptp_hc = fec_ptp_read(&fep->cc); /* Convert the ptp local counter to 1588 timestamp */ curr_time = timecounter_cyc2time(&fep->tc, ptp_hc);