From patchwork Fri Oct 4 15:24:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13822578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A07B8CF8847 for ; Fri, 4 Oct 2024 15:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=03fZTgCgiBxE0qFrCKKkCpSY6xFhbJQG1m+p4KlRZDE=; b=tJRxGIz7Dtq/E6bJ8z99WZOXlo azyvR3sM8zLAq2ZCuf1ylOzXFAbUNJNvjrmhZsfnTewVBetcVlp5ko7rhY9vvZ98TsQGfwIp+ayyf ORSKAb2W3Oga8/Vp/Bz7qxeVzp34LKJnGahdLPicuEwF5JN/1giRcwKq8X5tBSsdcnxc+Rnepy6y+ g5a+Zq9lxXB6xjpJT3v8b08ST9m5V01FcCeVfTjfP5J8zmJQ7tIJFOdTDtkqWyBkAr3bmBnTno9lF NrgQ6aODxOHlfIgBjBio6+faiueDTi62amURdqulcJ4CXBGdqoZipkqy8KSLjqhmlx+Tb/VTSTbM2 2YQwOtzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swkEH-0000000CzhW-3zpE; Fri, 04 Oct 2024 15:28:29 +0000 Received: from mail11.truemail.it ([217.194.8.81]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swkAX-0000000CyjQ-3dtX for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2024 15:24:40 +0000 Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 99D4D20C07; Fri, 4 Oct 2024 17:24:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1728055471; bh=03fZTgCgiBxE0qFrCKKkCpSY6xFhbJQG1m+p4KlRZDE=; h=From:To:Subject; b=niFojYRVbuXDsI/dLNQTvTw1is2QMQvMkRZzSZmZjNHUdJddP0jp5yeiw56WSEaEW QTbYyENZvgb0ifvrJkgTLYks7x29FLIzUr/zRyYMlnlJRERQJR8eYvZHa+TAKpEHOu wQpI4e2qHk5wGM30CDwNWsQ2jnC5aAD3YAAM3wBsvkviao1nQpqtgFpLoMrjARH2jE 5a4HNohl6zchbT2512rjymV8MQz12kl66hjFMmsKmcayk22GZ8S/IiELP7x71+WCb7 hTt1XfZV4OIylDO+S0HFHqU9cnD92j1KQyvCIB4LzLg1sqHIbrBgDygFUQ1GMdy1Nd 31BFlCsBNulfQ== From: Francesco Dolcini To: Wei Fang , Shenwei Wang , Clark Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Richard Cochran , Linux Team Cc: Francesco Dolcini , imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Frank Li Subject: [PATCH net-next v4 2/3] net: fec: refactor PPS channel configuration Date: Fri, 4 Oct 2024 17:24:18 +0200 Message-Id: <20241004152419.79465-3-francesco@dolcini.it> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241004152419.79465-1-francesco@dolcini.it> References: <20241004152419.79465-1-francesco@dolcini.it> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_082438_096733_D1A049F5 X-CRM114-Status: GOOD ( 10.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Francesco Dolcini Preparation patch to allow for PPS channel configuration, no functional change intended. Signed-off-by: Francesco Dolcini Reviewed-by: Frank Li Reviewed-by: Csókás, Bence --- v4: no changes v3: no changes v2: add Reviewed-by --- drivers/net/ethernet/freescale/fec_ptp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 4cffda363a14..ce7aa2c38c7f 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -84,8 +84,7 @@ #define FEC_CC_MULT (1 << 31) #define FEC_COUNTER_PERIOD (1 << 31) #define PPS_OUPUT_RELOAD_PERIOD NSEC_PER_SEC -#define FEC_CHANNLE_0 0 -#define DEFAULT_PPS_CHANNEL FEC_CHANNLE_0 +#define DEFAULT_PPS_CHANNEL 0 #define FEC_PTP_MAX_NSEC_PERIOD 4000000000ULL #define FEC_PTP_MAX_NSEC_COUNTER 0x80000000ULL @@ -524,8 +523,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp, unsigned long flags; int ret = 0; + fep->pps_channel = DEFAULT_PPS_CHANNEL; + if (rq->type == PTP_CLK_REQ_PPS) { - fep->pps_channel = DEFAULT_PPS_CHANNEL; fep->reload_period = PPS_OUPUT_RELOAD_PERIOD; ret = fec_ptp_enable_pps(fep, on); @@ -536,10 +536,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp, if (rq->perout.flags) return -EOPNOTSUPP; - if (rq->perout.index != DEFAULT_PPS_CHANNEL) + if (rq->perout.index != fep->pps_channel) return -EOPNOTSUPP; - fep->pps_channel = DEFAULT_PPS_CHANNEL; period.tv_sec = rq->perout.period.sec; period.tv_nsec = rq->perout.period.nsec; period_ns = timespec64_to_ns(&period);