From patchwork Wed Aug 7 14:43:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13756385 X-Patchwork-Delegate: kuba@kernel.org Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE2D78062A; Wed, 7 Aug 2024 14:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.194.8.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041855; cv=none; b=C712p5S31Ctr6lwRAov5qyw1uhHGtcAtC9Z9Lj8iGtEDSkLZ0D2BmSzltz2D/nTLm266cVNc1SBNtRb8pkfIfgfxo3a4HU0EqfjfO6wB30IsbzyYtewj01ZS9o7xVWpD+Kjfw5Z2p93HaNkQ2zSNpbFSSPy10UkziIRdl6EkHpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041855; c=relaxed/simple; bh=EbD1cR10CZ/+8fL1VP7OEMT1fxBxG9Q/NQrr1StPAnk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nqmaos4x/rySbp5QsLWmHY2lv8Nwb3u/afMzZr12qO9qQaytF5mPynefAg4Vufvo1S39g1UP5D8UII3Nr13+BvFIW2eZrTppmxsExyaLx5qCQd0i/ZR1/tV8CqAXd+Mb69Ps0Ha8F5YkQC7VqFCFKSy9L3M6E5xRjzYFU3dIBO0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it; spf=pass smtp.mailfrom=dolcini.it; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b=GpfR773M; arc=none smtp.client-ip=217.194.8.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dolcini.it Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b="GpfR773M" 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 EDA4721B1D; Wed, 7 Aug 2024 16:44:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723041843; bh=xPYVC5iG1MnJHMcqugnI21KD6zEFTKaI7seB9Msq1jE=; h=From:To:Subject; b=GpfR773ML9Orbta3d1xzpP3eLd6XjDT6MhW682g4Yg50shuSf33Ofky5Ue3obd69F wiMRuQPrmytWoJqkeBaUWSR8fXCwZ8qJvW67ElvqiXkAD197h719MpkrWT8ZsEdmHj M3GIOoaY0dMpKyNlwx7YJqXZdvla5k+klBpJwos6ivZRg010qhh7PfaXBDbFe5vl4X hVXhuHb3AgVc9M1kzk/QDzf2TRo7WPE8fAwuOWpWS7JywxALz9sh0RbI8zKHbgNgIe Fasb4rxycaZFOrR6+r9MGYFrdra2LSkfrSyEoGk4FMf/nHZcb5LQXPyVH6eujVS5/N gV567EqI2dnJg== From: Francesco Dolcini To: Wei Fang , Shenwei Wang , Clark Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran Cc: Francesco Dolcini , imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/4] net: fec: refactor PPS channel configuration Date: Wed, 7 Aug 2024 16:43:47 +0200 Message-Id: <20240807144349.297342-3-francesco@dolcini.it> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240807144349.297342-1-francesco@dolcini.it> References: <20240807144349.297342-1-francesco@dolcini.it> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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 --- 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 e32f6724f568..6f0f8bf61752 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 @@ -530,8 +529,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); @@ -542,10 +542,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);