From patchwork Fri Aug 9 09:48:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13758654 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 31126194158 for ; Fri, 9 Aug 2024 09:48:12 +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=1723196894; cv=none; b=j9hb29NGKltcGk58O6y42QdurqiJ2lbuEWKIqLeXiSx5r7YKg6tSRSQfE6JistGGLRazxej2aFDVR7dTnIBv5M388O1IVqTBp5qJh87KDPGheXyvyF6TVCK6KXtRQ+4u3BTHYcQxkm9fkvGw8/F5P0HZjce35HUt9e5zA8tLhJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723196894; c=relaxed/simple; bh=j1fPwNUdFm4ZwGODxCf24cMNTls1UHVQHeJoZyw2dBY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eufJD86KzE8uRcmgL3qJKLLpLw0nfFsgQhnX4eP7YpRxV7NM79s/oNyN1i2BVXHe8qBYsfcRtYWwmp41dmDkcmvGh25T+Oplvbkorw4aglgI+iqd+3x8oT8cKf20S5B+xu0CiQmUmvs2QH6+FLixl23FItykNTfFKPCNTz9nKk0= 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=ubkSfA+9; 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="ubkSfA+9" 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 001222225F; Fri, 9 Aug 2024 11:48:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723196890; bh=NonHWu5HSDCWO4NMXJI0bjKdUhTbHXVbdDUGqCdqges=; h=From:To:Subject; b=ubkSfA+9B3bPnlMd7xsls+/Q2QP+H/L6LkzvjtnNPi7uU7csnTRNpQ71F80D5J5lN KxNa95UBvK9eOzbPz2EUWw4siqX4bapvlXmgR5R7tv3bAMTgZ3tOw8WaoxVY0+vlCU 6L7JqELwmAJ06p6SiS69hd8UQjMgBS4ycKd8X4hPErE6K8y2obKZ3Ztxy/MO3oMAAz /uJWUNuccxzqYGcr0NVWE5FYyq2QD0CvpI0T5wQdeRDUvTfdCjS+GrhUMKtdO2P7yo SfCTQMazFF4tWV26Ec6etHwDdKxwYFWj7p0yLDO7k95fo9kfx5Mwi6lpm/MiQeaN34 xru0tqtoEpkjg== 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, Frank Li Subject: [PATCH net-next v3 2/3] net: fec: refactor PPS channel configuration Date: Fri, 9 Aug 2024 11:48:03 +0200 Message-Id: <20240809094804.391441-3-francesco@dolcini.it> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240809094804.391441-1-francesco@dolcini.it> References: <20240809094804.391441-1-francesco@dolcini.it> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Francesco Dolcini Preparation patch to allow for PPS channel configuration, no functional change intended. Signed-off-by: Francesco Dolcini Reviewed-by: Frank Li --- v3: added net-next subject prefix 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 2e4f3e1782a2..25f988b9c7cf 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);