From patchwork Fri Aug 9 09:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13758585 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 50EAA190047; Fri, 9 Aug 2024 09:18:52 +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=1723195136; cv=none; b=cEanAKXT+1RgiQN2/WfBCV7FcsmWxAUpjT19eG0oinBhZ14bvY+fRRyEzHYR7KMsxfGS8o/SJPNaRhU7GrNMmb01z8lM6fP717tZjXaLOKQvtmITjmlU3adtanUbc8q7dJwwIw+vZMHT2d3fAbFLBrGvAgF7RGEy0z3GGsZxiaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195136; c=relaxed/simple; bh=VqHU0VsOI9CjUOixVRHu+UzVLCWlfQ+f5ptq2gPCu68=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZxOm5nz4HKZojvLbO51nEzC0pdFXD2o562WSG3xdbu43iFoGM6V7N9Cp0pctDeG1wcjv6jMguA0otzvCOfDLHehHh7XjO5D0fYHjwpo7TjykcpvJ0Y/2DJr4Pq4qJZmXSjNqGmcll2V6U/iRuO32vZ0DkJ1EpPfjcn2C35PFwiA= 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=YjcqWJJV; 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="YjcqWJJV" 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 E3A1F22256; Fri, 9 Aug 2024 11:18:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723195130; bh=9oKfdjQrtqrz8jcoWQ7rWOQgPGtJwLhkARzik2qT8Ug=; h=From:To:Subject; b=YjcqWJJVPYsyAyTcjBsFhpdGVgrgDjKFVFBP21JZsLtQBNZ95RpGpVOQyTB4yhSYx YX7P8ZGCXtG/rcNZb2yi7VV0NolEGE0mArS23xKFrkBxVlFQ8ckKm+A7bLRFK0KOGb kYcoAgNP6Imx+ze9WCsoIzPtypMKwBzW5ANDq3aGyGcC/az6IQOpb9UeVIoROhbi1p 2E4nfZMwN+vkpBW59ThRMbOcYhFyyezlUsBYl+yNufTphCw4JCGf2/+8LpTUrXyK1A qf1RrD/OKPsL1s3zdI1Vp62TeyDGTRhyehDevmrF9p2M4YminazH3W+gp3ToaNmDMQ +eeE+GbOB82MQ== 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 v2 1/3] dt-bindings: net: fec: add pps channel property Date: Fri, 9 Aug 2024 11:18:42 +0200 Message-Id: <20240809091844.387824-2-francesco@dolcini.it> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240809091844.387824-1-francesco@dolcini.it> References: <20240809091844.387824-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 --- v2: no changes --- 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 Fri Aug 9 09:18:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13758584 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 A9F6B19148D; Fri, 9 Aug 2024 09:18:53 +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=1723195135; cv=none; b=eA0h9KUYKXxXioLQxgPiX/LHFDMvCdq60ViXFMpGvssAdpeBSDESzNQr9t7Mo9QZlZ+oByGlaEVsgrWzLXN/+JGoPkXkFc4lb1t35Bw5+loEIv+fYzw9pmxqaNRiuQbNghzIla1CiFr9+OdzBTgZP0Y2iWDN7wCAFFyZxVOFWTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195135; c=relaxed/simple; bh=3bEW4BNL0Bvl0ZyI1YXSrraFhvqdFCLvdIc9738R+FI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o9gkxwSZX4O8pqZ7fKCnYaWKlRjlz00smB1cRYr1iRoTB2O52RIAF0orNaRCjj9D5GgCdN709O2feOjtiOqkvsYHtgHUVQZXs7ZEkd88H+J2UObLXHp6eyop3Fstlp2y1qGKmCTWQWqDTktgDbQMCu05FG9TAiAeTKv2LUJ2vxI= 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=mlF3Gsf8; 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="mlF3Gsf8" 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 D02952225B; Fri, 9 Aug 2024 11:18:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723195131; bh=bxJPyjYC85DqIcev1XSx6qROZDSV6+5DPIhde6Jh3SU=; h=From:To:Subject; b=mlF3Gsf8f2Omraxk1cn1YDGvwpLT4IcOVqR6cFTSJtzuRHNr3+shzqfMJz+EIg1ju gBsDvtnoqekQto54VYN/kyDkSQthoS8jYumIbY9x8u19XO4abzMlGgzlqiIDEqzk1Y p0aYb+J1+uFwJ40hTKRODy+MT5ywHN5GCSabGQUPszFyh9On/6vOwyFh4SGZ67/+g0 JOAeWDcfjAsv9ObSuotuo0V6qfDPFJtl/heuY1KvWDrzPeHAsSpayoge90Smv1jpkg N8XYRKXhsLy+LJmdm+Jhmeijrth8fdQNXugodFEOaMB5m2tJSWILxcaIfy49lju4K1 ZbHwY1hAA7XpA== 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 v2 2/3] net: fec: refactor PPS channel configuration Date: Fri, 9 Aug 2024 11:18:43 +0200 Message-Id: <20240809091844.387824-3-francesco@dolcini.it> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240809091844.387824-1-francesco@dolcini.it> References: <20240809091844.387824-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 --- 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); From patchwork Fri Aug 9 09:18:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13758583 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 C8E18191494; Fri, 9 Aug 2024 09:18:53 +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=1723195135; cv=none; b=LJePbAdw/5jjp+xrJbcMap1bFF+aoTO5rXj1aPCHLhHn3/wA2saGDkHpchr7NLGMEldbxKemnu1uDfB7WnLfigRBNruPwPaHVbVBtWnJhpU24LmFUG3G8OHPB5Cjj4X4SrbqbWKXvy0xfCM5qmS+HzV1pA+OTDaPGpVcjPjt2TM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195135; c=relaxed/simple; bh=QM5RqrqcktqXeIDfRBP175DXMqiPVEAu+7zAxCxcFnk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TK8fjf71Vc8Pwp8VYTQB9+RirMAcCwcypus4Y8OSCg5OSAIZ6XslSkM0aOVDTErnjH6dDcEldioqG9WXdpzqVsctyshSkBz5QdRbQHJZ2MCRUEyUMEgTsNMljchvge7zsTEXeO1nVsnYJ1FCAjV/Y+Dhl6L6J9bnMYXCUlbpntI= 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=S5vGPXQg; 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="S5vGPXQg" 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 8AB5E2225F; Fri, 9 Aug 2024 11:18:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723195132; bh=/l2VIPtGJZdoH2vVzcshpCeh2OG0Hg9867gp1xRmQ5w=; h=From:To:Subject; b=S5vGPXQgRtjy8WhmdLXPZF2mVZEi6QOqGFONWI/RSjxDQTFzbo/VIHJlfgEm2eLaV Mh8jUviJBWt2yYNzZDMS7RskV63dOqeamt4kof1+GcHwMbNtE23k2X8wJNlQGelsEW nzrS2vRZy2AQqrN21DsdBgfEetgTLIAr7TGlyuqgXX1VaUtCf6ZT9y5YBrMjUl3mnz FfGhZ46Hn3VDbLlUwoqeNN59NiHTTBJRGpjFOn9yJ9y9AFHs/AnR/mGyWf9nO5WMnS jz6zbj0nFCreDnXyR0uonQGZKU+EGyrYwfCtUSs41n/cz7zJgZ94wgHDSoc1UgFrh5 rBqYv5VcraVpg== 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 , Rafael Beims Subject: [PATCH v2 3/3] net: fec: make PPS channel configurable Date: Fri, 9 Aug 2024 11:18:44 +0200 Message-Id: <20240809091844.387824-4-francesco@dolcini.it> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240809091844.387824-1-francesco@dolcini.it> References: <20240809091844.387824-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. Reviewed-by: Frank Li Tested-by: Rafael Beims Signed-off-by: Francesco Dolcini --- v2: add Reviewed|Tested-by --- 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 25f988b9c7cf..2e05083cbf29 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;