From patchwork Wed Aug 7 14:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13756382 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 EE2518060A; 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=1723041854; cv=none; b=nL3wWGTaT5/h8rPcbZgeDe5D3/AEmlwoeGKrYg9bbxo2YK/o/O3jC0vvMJPr4zI2n6nTBLltI06LBtRx6FHMNb69AigOiYBze1hwKelwLIyuD2isHOs0gse0EsfkoThJq8Q0cTnO11b8bnpMS3um95p6pimn3b1e0tso7eImlPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041854; c=relaxed/simple; bh=NZcmwPI9cW0n0CJkJL/ps67EW4H3d9nTVit6EgK2L4k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YaXI2PzPyQplfgwf7w6AuSeRpiQJFCLFuCNZSDw9eyA+aMT5Tn7MolITSzVMVdSywn8q9B/1k4vmzpZrIuVGhWoRL2mylO/jyp5Yh2/xrrVUE7ccrSD/XnWvIySkP0obhUSPG1L+setURXoe1gptVjcj7n3qzc1dXTWH4mkcMjE= 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=Vi9R8B3U; 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="Vi9R8B3U" 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 27A0821B05; 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=1723041842; bh=JzKokxW+QzlgsiYj68z1A8RZdfcJ1yv1U8asgBKtrxc=; h=From:To:Subject; b=Vi9R8B3UbF8LbSEA4ufwpoQyScIxMzdPlmTwar17ha2PUQREoBM5e4/0PVvMQLPVK bt4U3IbmtK2jYp8lTfM1i985uQNrXOFntKLh5MR5eVRPuSkS7YKC1wR04qWQGnbHse mkxmuctH1eWc74tZ0uBkv+LCYTLX37Tk5mUXVph2jOkDHkOsPAQNGcxb4jKplhzRoy mSYkA/4NCg91+5H8/MAnlA6SVjzDgzfsVZzpXwb0s3qwOGhrDJvfJkFUS/YqG+FwIV NIVMh9FHrhFtUDic7XIKeejgzPvP6IWkWYuPo4uBHiT551mctaxxcOBaU5LBW8kUbc cTpFJCEwV0ovg== 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 , Linux Team Cc: Francesco Dolcini , imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] dt-bindings: net: fec: add pps channel property Date: Wed, 7 Aug 2024 16:43:46 +0200 Message-Id: <20240807144349.297342-2-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 Add fsl,pps-channel property to specify to which timer instance the PPS channel is connected to. Signed-off-by: Francesco Dolcini --- Documentation/devicetree/bindings/net/fsl,fec.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/net/fsl,fec.yaml b/Documentation/devicetree/bindings/net/fsl,fec.yaml index 5536c06139ca..24e863fdbdab 100644 --- a/Documentation/devicetree/bindings/net/fsl,fec.yaml +++ b/Documentation/devicetree/bindings/net/fsl,fec.yaml @@ -183,6 +183,13 @@ properties: description: Register bits of stop mode control, the format is <&gpr req_gpr req_bit>. + fsl,pps-channel: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 0 + description: + Specifies to which timer instance the PPS signal is routed. + enum: [0, 1, 2, 3] + mdio: $ref: mdio.yaml# unevaluatedProperties: false 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); 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: 13756383 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 55F6A80BEC; 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=1723041854; cv=none; b=s1T2vn98RGtbJ312+1wsnVEZTPqcDv52POPTI92cf00JS+xu7HPXhuh7flZg5R0FGPqZlLGJAubmGRvU4FhDlPcF6ZA8xAm3RTj6tt3yvnyUzutycPDlXivZQ2nQHw+HpqRpvEhSKs7LXDMX6rn+3XeHdufC9WMXjp6n9KKxVZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041854; c=relaxed/simple; bh=y/jffoFIybGv4O9jKBf4bavvf0HlaLqCKtoOa6vrEj4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RneAFAy6jy0RUBubcdDEC1RwEofTixMhPdb8mIKbllYTLKW63YsMn/ljnsLVv0aHqhp6vheTNA/CgZCOjC3HBQgyoel+kkTOJ2Di6Ac0At5/KJJFx2/NspmjP/XUVGGwDD2ncGHa3ib8jGbxkDOBW/SeJH6j7+C1eRnvSWf2Kmw= 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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;