From patchwork Wed Aug 7 14:43:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13756386 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 805878121F for ; Wed, 7 Aug 2024 14:44:11 +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=1723041853; cv=none; b=DWy05lIv8IsuW+r/en/FpThwwihHFMkoHoYW3Zpmm9725GF6xrtvrVy76XaJP5FzU+poyT30PC3o81izl2TsCHcuMkjZOA4PN0BHIX7N9BJ3Xq/F9JhYpIyF9qOQv4cBsX5gh5VQ4fJ9ld6UwmdUeTY9Z97OeaSXcfpXoGhRnM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041853; c=relaxed/simple; bh=y/jffoFIybGv4O9jKBf4bavvf0HlaLqCKtoOa6vrEj4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l6diIWFTrdKji+NaQwNijxD94OKcyTMOjvQH9HliEr23YCmXfE6jAWfWzbmsQTbOubu9ri7AF9FXftCmrDSi2fTBzMpo6Qiqh81UxhnYyGLyiUjtZvskhZzaVZi3AXHRkmTgsOlb6BIOOE2jvlpS8BR9Swpn/SDIqhAsZoXCNGI= 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=J7auRFE4; 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="J7auRFE4" 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 8F0B721B19; Wed, 7 Aug 2024 16:44:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723041844; bh=sKOb31r/3Cf+dBRphbkBxUG2Eb1AmfV4cp8ruJ72OgM=; h=From:To:Subject; b=J7auRFE4BpY4chPpWRiWdRzVsT9BK6XF2c97xjtEatuLUlyDQ5FaegGsiGE2UfnM/ AfWfQxKHakLlq5bFKvdijs7BVtBlAXZYxVMPbxdlSqZfLZZKQajReXH4HiQW+8+rml nU9lxAyxkiioUrxa6/Qc0HjegOBtb0ZlVRx+Mnl+Wb0S8nn6wakGQmB9izL8DQt3WX 6BcffeQsAE8622Ur/uvyWUmUnOGl/3DhRluKz4sD3N0zHeEc5betIx2HwPl/UMiO4F MHBTETgU3C2+9zlbaMclie+keM54znSdUhfewuZVYgTrnu/vGQKI5ARJ47M9Z3gUc4 hQDvN6N8mTo9Q== 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 3/4] net: fec: make PPS channel configurable Date: Wed, 7 Aug 2024 16:43:48 +0200 Message-Id: <20240807144349.297342-4-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: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Francesco Dolcini Depending on the SoC where the FEC is integrated into the PPS channel might be routed to different timer instances. Make this configurable from the devicetree. When the related DT property is not present fallback to the previous default and use channel 0. Signed-off-by: Francesco Dolcini Reviewed-by: Frank Li Tested-by: rafael.beims@toradex.com --- drivers/net/ethernet/freescale/fec_ptp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 6f0f8bf61752..8e17fd0c8e6d 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -529,8 +529,6 @@ 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->reload_period = PPS_OUPUT_RELOAD_PERIOD; @@ -712,12 +710,16 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) { struct net_device *ndev = platform_get_drvdata(pdev); struct fec_enet_private *fep = netdev_priv(ndev); + struct device_node *np = fep->pdev->dev.of_node; int irq; int ret; fep->ptp_caps.owner = THIS_MODULE; strscpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name)); + fep->pps_channel = DEFAULT_PPS_CHANNEL; + of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel); + fep->ptp_caps.max_adj = 250000000; fep->ptp_caps.n_alarm = 0; fep->ptp_caps.n_ext_ts = 0;