From patchwork Fri Aug 9 09:48:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13758653 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 7D62219E7CF for ; Fri, 9 Aug 2024 09:48: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=1723196893; cv=none; b=X8THjpQVjXFScicg0UrzghaFPA1Q+vw6pRy7WCD4KFUPRuD+w8mQQ3xRho4RJjX5bOjLFTobr/yt5sCUqj1xXAD8eaX+uOrMsl92kzNlyfI304wvpIcxqyXyvRgRCn2MBkf2trlfkZHVazawkeLrgy42H1e/ZiKGJMrd+jjDxDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723196893; c=relaxed/simple; bh=Mj5q6Ht7ONsEOZwQLKFqH9Xko3VJLFvaLqH9flrU40Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fttfzh/op5p7cVEj3XCNgAydlYFGXY3M6n4BVzWuXAvxSAnESVvAN6ViMwiAVrEh7DSMtl6UZBcfdPd08KhkmCTyVOpOxbFJjG1s/fHqEZ/cd8NWNPR+xBNCUdLo7gOeNIeSnnWJXJF1Th94fLvphoxgCjSmopxF6bnxzJURmTE= 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=dshUde9K; 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="dshUde9K" 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 2A5AA22256; 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=1723196889; bh=wLgmakV2uu/fLVMKr1LfemMNcltofndRm6TxgbbFq54=; h=From:To:Subject; b=dshUde9K8Kam8eADtB2Av8RW6blSQaC/hs5vmkeU4D8Wn4pB/LxelgstlbLklNJgE H1faKHcjz12m4wKTyBTObO0yxFEatdH9piOpRC5w7yi7mzIH38dfZsBlz1x3l5YxKU fugg/PI7Bw1A+6TIhyKgHNorO6OYcdEQb9eSZcncRMlcnFDjqWYMVr5FWFcZ8+ZCSx k8Ao21yoJuH+nyVE6tAoBRsFAnlxxOESm10Ulu6rxoK25aH+xdN49LcYm6RC15mkLu JI6ztXn01eaJSth2Y8M/q6tRKFrSYzu5JvvvSGMCYTR+gxKdidFDZ6UpYpRu16/ryg osAJZAr60dD4Q== 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 net-next v3 1/3] dt-bindings: net: fec: add pps channel property Date: Fri, 9 Aug 2024 11:48:02 +0200 Message-Id: <20240809094804.391441-2-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 Add fsl,pps-channel property to specify to which timer instance the PPS channel is connected to. Signed-off-by: Francesco Dolcini --- v3: added net-next subject prefix 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: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); From patchwork Fri Aug 9 09:48:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13758655 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 D4DE819E7F8 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=1723196895; cv=none; b=DC7rl06KLR+ykDdXmS7v7wHVTlEI3JvyaHJsML3/Zr18K8rEEIQjWAhSr1e8JYbgYDkeHezN4xcq7X/63pyrkEo+rmKpGg3u/ekh63eAKRzpCx5oTnoJTIuFbPaW1A4J1RDUPacr2YKzlMHSeiWVylABDHTdkwKaAgDnlNqiXao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723196895; c=relaxed/simple; bh=JfrSTDupAEFNzJ0NTGgYxinFFwD+sj0VT9HNe7eYu8Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gK05QRwtsrLec8G7/gMoGZSUZZyBuuoRWCzfq8L4ZnsJ97AYdnhHtUnGPMsNVm2ZWTM13+OsUF+DWPWujDmlfdpD/qpauXbDbUIBFHRxUqQ4ZFrZYcRRLrSyoj9IroND4ECyrZGQ7x/JUFKLQBHXT5siiTmwy2dJsRFYfu8SMCk= 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=bJiwDo2g; 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="bJiwDo2g" 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 AD3E822295; Fri, 9 Aug 2024 11:48:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1723196891; bh=EUM89Z92ylZOhefElMUwK8siDmQ2624apyQbZLSedCM=; h=From:To:Subject; b=bJiwDo2gIv83wOVzcz+S1rzJiPKEUefi0EoEDJ133lkgcwlHWlauDehQNc6TKy95q cLUjJ2y9QnLOxIbEPxno5fjQPaK3ggciUr7Oao6PtzqklcI3WOMbFH7J1oCc0LvqF9 +anlp4PRUXfcBLsPjKVY/fb7Cl5tvKkSFAjM71lhTEQ8RCiCUrg9QcbjFNJM558wiC kZWpgrEJYS+CUXQaQRbnlEN/v2DUhuS6N2kwnvPO0OK52ABKOSMyZ5b0PTqC0Hevn/ B6NyHD1UjjJI1f0/HwOMj//273XxrWlYIC+NKQl8FovT9qF5fPQoaivXNrsJajOMlc Hd4k8FDCFxGVA== 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 net-next v3 3/3] net: fec: make PPS channel configurable Date: Fri, 9 Aug 2024 11:48:04 +0200 Message-Id: <20240809094804.391441-4-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 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 --- v3: added net-next subject prefix 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;